Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: cca3917b8294d93936438c5ad7969111c02321fa
https://github.com/WebKit/WebKit/commit/cca3917b8294d93936438c5ad7969111c02321fa
Author: Simon Fraser <[email protected]>
Date: 2025-04-15 (Tue, 15 Apr 2025)
Changed paths:
M Source/WebCore/platform/graphics/FloatRect.cpp
M Source/WebCore/platform/graphics/FloatRect.h
M Source/WebCore/platform/graphics/GeometryUtilities.h
M Source/WebCore/platform/graphics/PathSegmentData.cpp
Log Message:
-----------
Optimize Path::fastBoundingRect()
https://bugs.webkit.org/show_bug.cgi?id=291552
rdar://149258802
Reviewed by Cameron McCormack.
Calling `boundingRect.extend()` for every point does extra work, because it
recomputes the
rect's origin and size every time. Instead, compute the min/max for all the
points, and then
update the rect once. We can save another min/max comparison by adding a
two-argument version
of FloatRect::extend() which assumes that the points are ordered.
I tested `FloatRect::extend(std::initializer_list<FloatRect>)` but this was a
little slower.
In cases where the `extend()` arguments are rect corners, we can just use
`uniteEvenIfEmpty()`.
* Source/WebCore/platform/graphics/FloatRect.cpp:
(WebCore::FloatRect::extend):
* Source/WebCore/platform/graphics/FloatRect.h:
* Source/WebCore/platform/graphics/GeometryUtilities.h:
(WebCore::min3):
(WebCore::max3):
* Source/WebCore/platform/graphics/PathSegmentData.cpp:
(WebCore::extendRect):
(WebCore::PathQuadCurveTo::extendFastBoundingRect const):
(WebCore::PathQuadCurveTo::extendBoundingRect const):
(WebCore::PathBezierCurveTo::extendFastBoundingRect const):
(WebCore::PathBezierCurveTo::extendBoundingRect const):
(WebCore::PathArcTo::extendFastBoundingRect const):
(WebCore::PathArcTo::extendBoundingRect const):
(WebCore::PathArc::extendFastBoundingRect const):
(WebCore::PathArc::extendBoundingRect const):
(WebCore::PathEllipse::extendFastBoundingRect const):
(WebCore::PathEllipseInRect::extendBoundingRect const):
(WebCore::PathRect::extendBoundingRect const):
(WebCore::PathRoundedRect::extendBoundingRect const):
(WebCore::PathContinuousRoundedRect::extendBoundingRect const):
(WebCore::PathDataQuadCurve::extendFastBoundingRect const):
(WebCore::PathDataQuadCurve::extendBoundingRect const):
(WebCore::PathDataBezierCurve::extendFastBoundingRect const):
(WebCore::PathDataBezierCurve::extendBoundingRect const):
(WebCore::PathDataArc::extendFastBoundingRect const):
(WebCore::PathDataArc::extendBoundingRect const):
Canonical link: https://commits.webkit.org/293710@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes