[webkit-changes] [WebKit/WebKit] 9d5ce3: Render background-clip effects with a transparency...
Simon Fraser
noreply at github.com
Tue Sep 3 22:36:47 PDT 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 9d5ce39e6de489a2292584160d51ef49789d3f00
https://github.com/WebKit/WebKit/commit/9d5ce39e6de489a2292584160d51ef49789d3f00
Author: Simon Fraser <simon.fraser at apple.com>
Date: 2024-09-03 (Tue, 03 Sep 2024)
Changed paths:
A LayoutTests/fast/backgrounds/background-clip-border-area-alpha-expected.html
A LayoutTests/fast/backgrounds/background-clip-border-area-alpha.html
A LayoutTests/fast/backgrounds/background-clip-text-alpha-expected.html
A LayoutTests/fast/backgrounds/background-clip-text-alpha.html
M Source/WebCore/rendering/BackgroundPainter.cpp
M Source/WebCore/rendering/RenderBoxModelObject.cpp
M Source/WebCore/rendering/RenderBoxModelObject.h
Log Message:
-----------
Render background-clip effects with a transparency layer instead of a buffer
https://bugs.webkit.org/show_bug.cgi?id=279070
rdar://135205084
Reviewed by Matt Woodrow.
`BackgroundPainter::paintFillLayer()` currently uses an ImageBuffer and `CompositeOperator::DestinationIn`
to render the masking-based background-clip modes (`text` and `border-area`). Making an ImageBuffer is expensive;
it's more efficient to do this with transparency layers.
Factor common code into a `setupMaskingBackgroundClip()` lambda, which takes a callback for drawing the
masking content. Previously the code used a transparency layer and an ImageBuffer; now we use two
transparency layers. First we start a transparency layer, and render the masking content. Then we set
the composited operator to SourceIn, and start a second layer which will contain the pixels to be masked.
Two TransparencyLayerScopes ensure we close the layers in the correct order.
Added a test to ensure we didn't break rendering with alpha.
* LayoutTests/fast/backgrounds/background-clip-border-area-alpha-expected.html: Added.
* LayoutTests/fast/backgrounds/background-clip-border-area-alpha.html: Added.
* LayoutTests/fast/backgrounds/background-clip-text-alpha-expected.html: Added.
* LayoutTests/fast/backgrounds/background-clip-text-alpha.html: Added.
* Source/WebCore/rendering/BackgroundPainter.cpp:
(WebCore::BackgroundPainter::paintFillLayer const):
* Source/WebCore/rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::paintMaskForTextFillBox): This can just take a GraphicsContxet now.
* Source/WebCore/rendering/RenderBoxModelObject.h:
Canonical link: https://commits.webkit.org/283135@main
To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications
More information about the webkit-changes
mailing list