[webkit-changes] [WebKit/WebKit] bc5272: Path::transform() should not trigger creation of a...

Cameron McCormack noreply at github.com
Mon Aug 7 19:13:09 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: bc527208a62ff94103079beae9e5e582134d9b49
      https://github.com/WebKit/WebKit/commit/bc527208a62ff94103079beae9e5e582134d9b49
  Author: Cameron McCormack <heycam at apple.com>
  Date:   2023-08-07 (Mon, 07 Aug 2023)

  Changed paths:
    M LayoutTests/platform/glib/TestExpectations
    M Source/WebCore/platform/graphics/Path.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:
  -----------
  Path::transform() should not trigger creation of a platform path
https://bugs.webkit.org/show_bug.cgi?id=258759
rdar://problem/111934640

Reviewed by Simon Fraser.

Many paths consist only of Move/Line/Quadratic/Cubic/Close segments, which are
all simple to apply an AffineTransform to. Transform single segment and PathStream
based paths in place when Path::transform() is called, to avoid the overhead of
generating a CGPath. If other segment types are in the path, continue to convert
to a platform path first.

Some WPT (path + transform) tests fail on GTK ports because the tests are fragile
to floating point calculations. The tests rotate the context by 90 degree and scale
it by 283 then they stroke a line to cover the whole canvas by the stroke color.
If we scale by 282, the last row in the canvas will not be stroked even without
this patch. On GKT port and with this patch, the last row is stroked but it is
anti-aliased with the background.

* LayoutTests/platform/glib/TestExpectations:
* Source/WebCore/platform/graphics/Path.cpp:
(WebCore::Path::transform):
* Source/WebCore/platform/graphics/PathImpl.h:
* Source/WebCore/platform/graphics/PathSegment.cpp:
(WebCore::PathSegment::canTransform const):
(WebCore::PathSegment::transform):
* Source/WebCore/platform/graphics/PathSegment.h:
* Source/WebCore/platform/graphics/PathSegmentData.cpp:
(WebCore::PathMoveTo::transform):
(WebCore::PathLineTo::transform):
(WebCore::PathQuadCurveTo::transform):
(WebCore::PathBezierCurveTo::transform):
(WebCore::PathDataLine::transform):
(WebCore::PathDataQuadCurve::transform):
(WebCore::PathDataBezierCurve::transform):
(WebCore::PathCloseSubpath::transform):
* Source/WebCore/platform/graphics/PathSegmentData.h:
* Source/WebCore/platform/graphics/PathStream.cpp:
(WebCore::PathStream::transform):
* Source/WebCore/platform/graphics/PathStream.h:
* Source/WebCore/platform/graphics/cairo/PathCairo.cpp:
(WebCore::PathCairo::transform):
* Source/WebCore/platform/graphics/cairo/PathCairo.h:
* Source/WebCore/platform/graphics/cg/PathCG.cpp:
(WebCore::PathCG::transform):
* Source/WebCore/platform/graphics/cg/PathCG.h:

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




More information about the webkit-changes mailing list