[webkit-changes] [WebKit/WebKit] bb3cac: Restore Path cheap copying (refcount/COW PathStream)
Simon Fraser
noreply at github.com
Thu Jul 6 10:02:07 PDT 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: bb3cac815bdf97893a9a5992109a58467a07df06
https://github.com/WebKit/WebKit/commit/bb3cac815bdf97893a9a5992109a58467a07df06
Author: Simon Fraser <simon.fraser at apple.com>
Date: 2023-07-06 (Thu, 06 Jul 2023)
Changed paths:
M Source/WebCore/platform/graphics/PathStream.cpp
M Source/WebCore/platform/graphics/PathStream.h
Log Message:
-----------
Restore Path cheap copying (refcount/COW PathStream)
https://bugs.webkit.org/show_bug.cgi?id=258758
rdar://111595182
Reviewed by Myles C. Maxfield.
265569 at main undid the "copy on write" behavior of class; assigning a Path would copy
the underlying PathStream.
To fix this, store the Vector<PathSegment> in an internal, thread-safe ref-counted SegmentsData
struct, and have PathStream hold a DataRef to this struct.
All functions that mutate the path segments call `access()` on the DataRef to trigger a copy.
* Source/WebCore/platform/graphics/PathStream.cpp:
(WebCore::PathStream::create):
(WebCore::PathStream::PathStream):
(WebCore::PathStream::clone const):
(WebCore::PathStream::operator== const):
(WebCore::PathStream::lastIfMoveTo const):
(WebCore::PathStream::moveTo):
(WebCore::PathStream::addLineTo):
(WebCore::PathStream::addQuadCurveTo):
(WebCore::PathStream::addBezierCurveTo):
(WebCore::PathStream::addArcTo):
(WebCore::PathStream::addArc):
(WebCore::PathStream::addRect):
(WebCore::PathStream::addEllipse):
(WebCore::PathStream::addEllipseInRect):
(WebCore::PathStream::addRoundedRect):
(WebCore::PathStream::closeSubpath):
(WebCore::PathStream::segments const):
(WebCore::PathStream::applySegments const):
(WebCore::PathStream::applyElements const):
(WebCore::PathStream::singleSegment const):
(WebCore::PathStream::isClosed const):
(WebCore::PathStream::currentPoint const):
(WebCore::PathStream::fastBoundingRect const):
(WebCore::PathStream::boundingRect const):
* Source/WebCore/platform/graphics/PathStream.h:
Canonical link: https://commits.webkit.org/265810@main
More information about the webkit-changes
mailing list