[webkit-changes] [WebKit/WebKit] d132cc: PathSegments cannot be used with anything else tha...

Kimmo Kinnunen noreply at github.com
Tue Nov 28 04:52:40 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d132cc11f0bf78cb0752568e1eb5d707c50ace5a
      https://github.com/WebKit/WebKit/commit/d132cc11f0bf78cb0752568e1eb5d707c50ace5a
  Author: Kimmo Kinnunen <kkinnunen at apple.com>
  Date:   2023-11-28 (Tue, 28 Nov 2023)

  Changed paths:
    M Source/WebCore/platform/graphics/Path.cpp
    M Source/WebCore/platform/graphics/PathImpl.cpp
    M Source/WebCore/platform/graphics/PathImpl.h
    M Source/WebCore/platform/graphics/PathSegment.cpp
    M Source/WebCore/platform/graphics/PathSegment.h
    M Source/WebCore/platform/graphics/PathSegmentData.cpp
    M Source/WebCore/platform/graphics/PathSegmentData.h
    M Source/WebCore/platform/graphics/PathStream.cpp
    M Source/WebCore/platform/graphics/PathStream.h
    M Source/WebCore/platform/graphics/cairo/PathCairo.cpp
    M Source/WebCore/platform/graphics/cairo/PathCairo.h
    M Source/WebCore/platform/graphics/cg/PathCG.cpp
    M Source/WebCore/platform/graphics/cg/PathCG.h

  Log Message:
  -----------
  PathSegments cannot be used with anything else than PathImpl
https://bugs.webkit.org/show_bug.cgi?id=265247
rdar://118717060

Reviewed by Said Abou-Hallawa.

PathImpl and PathSegment were coupled:
PathImpl::appendSegment would call into PathSegment::addToImpl
PathSegment::addToImpl would call into PathImpl

This would be more complex than needed and also limit the PathSegments
to be only used with PathImpl.

Instead:
  - PathSegment is the data that is being held -- no actions toward any
    class that does actual work on the data.
  - PathImpl knows how to use the path segment types: PathImpl::add()
    for each path segment type.
  - PathImpl knows how to use the PathSegment variant:
    PathImpl::addSegment() for the PathSegment, doing generic add() over
    the variants.
  - Make each member function for adding segments PathImpl::add(). This
    way generic algorithms over the variants are consistent to write.
  - The PathImpl::add() parameters are by-value to avoid introducing
    indirection, the arguments are always used.

Construct PathCG, PathCairo from PathStream without applySegments, as
the PathStream segment list can be just iterated.

This works towards being able to play back a PathSegment list to a
CGContext.

* Source/WebCore/platform/graphics/PathImpl.cpp:
(WebCore::PathImpl::appendSegment): Deleted.
* Source/WebCore/platform/graphics/PathImpl.h:
(WebCore::addPathSegment):
* Source/WebCore/platform/graphics/PathSegment.cpp:
(WebCore::PathSegment::addToImpl const): Deleted.
* Source/WebCore/platform/graphics/PathSegment.h:
(WebCore::PathSegment::addTo const):
* Source/WebCore/platform/graphics/PathSegmentData.cpp:
(WebCore::PathMoveTo::addToImpl const): Deleted.
(WebCore::PathLineTo::addToImpl const): Deleted.
(WebCore::PathQuadCurveTo::addToImpl const): Deleted.
(WebCore::PathBezierCurveTo::addToImpl const): Deleted.
(WebCore::PathArcTo::addToImpl const): Deleted.
(WebCore::PathArc::addToImpl const): Deleted.
(WebCore::PathEllipse::addToImpl const): Deleted.
(WebCore::PathEllipseInRect::addToImpl const): Deleted.
(WebCore::PathRect::addToImpl const): Deleted.
(WebCore::PathRoundedRect::addToImpl const): Deleted.
(WebCore::PathDataLine::addToImpl const): Deleted.
(WebCore::PathDataQuadCurve::addToImpl const): Deleted.
(WebCore::PathDataBezierCurve::addToImpl const): Deleted.
(WebCore::PathDataArc::addToImpl const): Deleted.
(WebCore::PathCloseSubpath::addToImpl const): Deleted.
* Source/WebCore/platform/graphics/PathSegmentData.h:
* Source/WebCore/platform/graphics/cairo/PathCairo.cpp:
(WebCore::PathCairo::create):
* Source/WebCore/platform/graphics/cg/PathCG.cpp:
(WebCore::PathCG::create):

Canonical link: https://commits.webkit.org/271199@main




More information about the webkit-changes mailing list