Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 47195378027dfc79782682ef15e877bb87cb96b9
https://github.com/WebKit/WebKit/commit/47195378027dfc79782682ef15e877bb87cb96b9
Author: Simon Fraser <[email protected]>
Date: 2025-05-13 (Tue, 13 May 2025)
Changed paths:
M LayoutTests/TestExpectations
A LayoutTests/fast/canvas/gradient-into-p3-canvas-expected.txt
A LayoutTests/fast/canvas/gradient-into-p3-canvas.html
M LayoutTests/platform/mac/TestExpectations
M Source/WebCore/platform/graphics/Gradient.h
M Source/WebCore/platform/graphics/cg/ColorCG.cpp
M Source/WebCore/platform/graphics/cg/GradientCG.cpp
M Source/WebCore/platform/graphics/cg/GradientRendererCG.cpp
M Source/WebCore/platform/graphics/cg/GradientRendererCG.h
Log Message:
-----------
Cache gradients with the destination colorspace
https://bugs.webkit.org/show_bug.cgi?id=292808
rdar://151043882
Reviewed by Sam Weinig.
When a gradient is painted by the underlying frameworks, its colors (usually
sRGB) are converted
to the display colorspace, which has some cost. Gradients are usually fairly
long-lived and painted
many times, so we can avoid that repeated colorspace conversion by having the
gradient store colors
in the destination colorspace.
The test fails on iOS because of rdar://151188818.
* LayoutTests/TestExpectations:
* LayoutTests/platform/mac/TestExpectations:
* LayoutTests/fast/canvas/gradient-into-p3-canvas-expected.txt: Added.
* LayoutTests/fast/canvas/gradient-into-p3-canvas.html: Added. Tests the change
in `platformConvertColorComponents()`.
* Source/WebCore/platform/graphics/Gradient.h: Pass an optional
DestinationColorSpace to paint().
* Source/WebCore/platform/graphics/cg/ColorCG.cpp:
(WebCore::platformConvertColorComponents): We need to copy over the alpha,
which is the fourth component.
* Source/WebCore/platform/graphics/cg/GradientCG.cpp:
(WebCore::Gradient::paint): The cached platform gradient can be reused if its
colorspace matches the
destination colorspace.
* Source/WebCore/platform/graphics/cg/GradientRendererCG.cpp:
(WebCore::GradientRendererCG::GradientRendererCG):
(WebCore::GradientRendererCG::colorSpace const):
(WebCore::GradientRendererCG::pickStrategy const):
(WebCore::GradientRendererCG::makeGradient const): Convert the colors to the
destination colorspace.
* Source/WebCore/platform/graphics/cg/GradientRendererCG.h:
Canonical link: https://commits.webkit.org/294844@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