Title: [288602] trunk/Source
Revision
288602
Author
timothy_hor...@apple.com
Date
2022-01-25 20:12:24 -0800 (Tue, 25 Jan 2022)

Log Message

Shadows are flattened to bitmaps in CGDisplayListImageBufferBackend
https://bugs.webkit.org/show_bug.cgi?id=235617

Reviewed by Wenson Hsieh.

Source/WebCore:

* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContextCG::fillRect):
(WebCore::GraphicsContextCG::fillRoundedRectImpl):
(WebCore::GraphicsContextCG::fillRectWithRoundedHole):
(WebCore::GraphicsContextCG::canUseShadowBlur const):
* platform/graphics/cg/GraphicsContextCG.h:
Factor out `canUseShadowBlur` so that GraphicsContextCG subclasses can
request that we not use WebCore's custom shadow implementation.

Source/WebKit:

* Shared/RemoteLayerTree/CGDisplayListImageBufferBackend.cpp:
Disable ShadowBlur for CGDisplayListImageBufferBackend, allowing it to
be recorded as a "shadow" display list item instead of a series of bitmaps.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (288601 => 288602)


--- trunk/Source/WebCore/ChangeLog	2022-01-26 03:14:33 UTC (rev 288601)
+++ trunk/Source/WebCore/ChangeLog	2022-01-26 04:12:24 UTC (rev 288602)
@@ -1,3 +1,19 @@
+2022-01-25  Tim Horton  <timothy_hor...@apple.com>
+
+        Shadows are flattened to bitmaps in CGDisplayListImageBufferBackend
+        https://bugs.webkit.org/show_bug.cgi?id=235617
+
+        Reviewed by Wenson Hsieh.
+
+        * platform/graphics/cg/GraphicsContextCG.cpp:
+        (WebCore::GraphicsContextCG::fillRect):
+        (WebCore::GraphicsContextCG::fillRoundedRectImpl):
+        (WebCore::GraphicsContextCG::fillRectWithRoundedHole):
+        (WebCore::GraphicsContextCG::canUseShadowBlur const):
+        * platform/graphics/cg/GraphicsContextCG.h:
+        Factor out `canUseShadowBlur` so that GraphicsContextCG subclasses can
+        request that we not use WebCore's custom shadow implementation.
+
 2022-01-25  Adrian Perez de Castro  <ape...@igalia.com>
 
         Fix non-unified build by adding missing headers to JSKeyframeEffectCustom.cpp

Modified: trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp (288601 => 288602)


--- trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp	2022-01-26 03:14:33 UTC (rev 288601)
+++ trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp	2022-01-26 04:12:24 UTC (rev 288602)
@@ -811,7 +811,7 @@
     if (m_state.fillPattern)
         applyFillPattern();
 
-    bool drawOwnShadow = (renderingMode() == RenderingMode::Unaccelerated) && hasBlurredShadow() && !m_state.shadowsIgnoreTransforms;
+    bool drawOwnShadow = canUseShadowBlur();
     CGContextStateSaver stateSaver(context, drawOwnShadow);
     if (drawOwnShadow) {
         // Turn off CG shadows.
@@ -832,7 +832,7 @@
     if (oldFillColor != color)
         setCGFillColor(context, color);
 
-    bool drawOwnShadow = (renderingMode() == RenderingMode::Unaccelerated) && hasBlurredShadow() && !m_state.shadowsIgnoreTransforms;
+    bool drawOwnShadow = canUseShadowBlur();
     CGContextStateSaver stateSaver(context, drawOwnShadow);
     if (drawOwnShadow) {
         // Turn off CG shadows.
@@ -859,7 +859,7 @@
     if (oldFillColor != color)
         setCGFillColor(context, color);
 
-    bool drawOwnShadow = (renderingMode() == RenderingMode::Unaccelerated) && hasBlurredShadow() && !m_state.shadowsIgnoreTransforms;
+    bool drawOwnShadow = canUseShadowBlur();
     CGContextStateSaver stateSaver(context, drawOwnShadow);
     if (drawOwnShadow) {
         // Turn off CG shadows.
@@ -908,7 +908,7 @@
     setFillColor(color);
 
     // fillRectWithRoundedHole() assumes that the edges of rect are clipped out, so we only care about shadows cast around inside the hole.
-    bool drawOwnShadow = (renderingMode() == RenderingMode::Unaccelerated) && hasBlurredShadow() && !m_state.shadowsIgnoreTransforms;
+    bool drawOwnShadow = canUseShadowBlur();
     CGContextStateSaver stateSaver(context, drawOwnShadow);
     if (drawOwnShadow) {
         // Turn off CG shadows.
@@ -1472,6 +1472,11 @@
     CGPDFContextAddDestinationAtPoint(context, name.createCFString().get(), transformedPoint);
 }
 
+bool GraphicsContextCG::canUseShadowBlur() const
+{
+    return (renderingMode() == RenderingMode::Unaccelerated) && hasBlurredShadow() && !m_state.shadowsIgnoreTransforms;
 }
 
+}
+
 #endif

Modified: trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.h (288601 => 288602)


--- trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.h	2022-01-26 03:14:33 UTC (rev 288601)
+++ trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.h	2022-01-26 04:12:24 UTC (rev 288602)
@@ -169,6 +169,8 @@
 
     void didUpdateState(const GraphicsContextState&, GraphicsContextState::StateChangeFlags) final;
 
+    virtual bool canUseShadowBlur() const;
+
 #if OS(WINDOWS)
     GraphicsContextPlatformPrivate* deprecatedPrivateContext() const final;
 #endif

Modified: trunk/Source/WebKit/ChangeLog (288601 => 288602)


--- trunk/Source/WebKit/ChangeLog	2022-01-26 03:14:33 UTC (rev 288601)
+++ trunk/Source/WebKit/ChangeLog	2022-01-26 04:12:24 UTC (rev 288602)
@@ -1,3 +1,14 @@
+2022-01-25  Tim Horton  <timothy_hor...@apple.com>
+
+        Shadows are flattened to bitmaps in CGDisplayListImageBufferBackend
+        https://bugs.webkit.org/show_bug.cgi?id=235617
+
+        Reviewed by Wenson Hsieh.
+
+        * Shared/RemoteLayerTree/CGDisplayListImageBufferBackend.cpp:
+        Disable ShadowBlur for CGDisplayListImageBufferBackend, allowing it to
+        be recorded as a "shadow" display list item instead of a series of bitmaps.
+
 2022-01-25  Michael Saboff  <msab...@apple.com>
 
         Install build failure when using SYSTEM_CONTENT_PATH

Modified: trunk/Source/WebKit/Shared/RemoteLayerTree/CGDisplayListImageBufferBackend.cpp (288601 => 288602)


--- trunk/Source/WebKit/Shared/RemoteLayerTree/CGDisplayListImageBufferBackend.cpp	2022-01-26 03:14:33 UTC (rev 288601)
+++ trunk/Source/WebKit/Shared/RemoteLayerTree/CGDisplayListImageBufferBackend.cpp	2022-01-26 04:12:24 UTC (rev 288602)
@@ -55,6 +55,8 @@
         return m_scaleTransform * GraphicsContextCG::getCTM(includeDeviceScale);
     }
 
+    bool canUseShadowBlur() const final { return false; }
+
 private:
     WebCore::AffineTransform m_scaleTransform;
     WebCore::AffineTransform m_inverseScaleTransform;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to