[webkit-changes] [WebKit/WebKit] 40b192: CanvasRenderingContext2D globalAlpha property is i...
Said Abou-Hallawa
noreply at github.com
Fri Aug 30 07:16:12 PDT 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 40b19269f440dbfe44035f50d2b0ccbe6e3fe58d
https://github.com/WebKit/WebKit/commit/40b19269f440dbfe44035f50d2b0ccbe6e3fe58d
Author: Said Abou-Hallawa <said at apple.com>
Date: 2024-08-30 (Fri, 30 Aug 2024)
Changed paths:
A LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/compositing/2d.composite.full.mode.alpha-expected.html
A LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/compositing/2d.composite.full.mode.alpha.html
M Source/WebCore/platform/graphics/BifurcatedGraphicsContext.cpp
M Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp
Log Message:
-----------
CanvasRenderingContext2D globalAlpha property is ignored for some values of globalCompositeOperation
https://bugs.webkit.org/show_bug.cgi?id=278454
rdar://134840885
Reviewed by Simon Fraser.
beginTransparencyLayer(opacity) sets the global alpha to `opacity`. Then it
calls CGContextBeginTransparencyLayer() which sets the global alpha to 1.
Calling CGContextEndTransparencyLayer() restores the global alpha back to
`opacity` before compositing the transparency layer back to the destination
context.
beginTransparencyLayer(CompositeOperator, BlendMode) is called only from canvas.
It passes `opacity` = 1 to beginTransparencyLayer(opacity). This will set the
alpha of both the transparency layer and the destination context to 1. This will
display everything opaque.
The fix is to make beginTransparencyLayer(CompositeOperator, BlendMode) pass
state().alpha() to beginTransparencyLayer(opacity) so the current global alpha
is preserved.
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/compositing/2d.composite.full.mode.alpha-expected.html: Added.
* LayoutTests/imported/w3c/web-platform-tests/html/canvas/element/compositing/2d.composite.full.mode.alpha.html: Added.
* Source/WebCore/platform/graphics/BifurcatedGraphicsContext.cpp:
(WebCore::BifurcatedGraphicsContext::beginTransparencyLayer):
* Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContextCG::beginTransparencyLayer):
Canonical link: https://commits.webkit.org/282965@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