Last active
March 5, 2020 18:48
-
-
Save annulen/884b116d229f04b4e7db8fa6d018e865 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp | |
index 423e5ca6da8..5872ffce9f5 100644 | |
--- a/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp | |
+++ b/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp | |
@@ -641,21 +641,27 @@ void GraphicsContext::fillPath(const Path& path) | |
if (hasShadow()) { | |
if (mustUseShadowBlur() || m_state.fillPattern || m_state.fillGradient) | |
{ | |
- ShadowBlur shadow(m_state); | |
- GraphicsContext* shadowContext = shadow.beginShadowLayer(*this, platformPath.controlPointRect()); | |
- if (shadowContext) { | |
- QPainter* shadowPainter = shadowContext->platformContext(); | |
- if (m_state.fillPattern) { | |
- shadowPainter->fillPath(platformPath, QBrush(m_state.fillPattern->createPlatformPattern())); | |
- } else if (m_state.fillGradient) { | |
- QBrush brush(*m_state.fillGradient->platformGradient()); | |
- brush.setTransform(m_state.fillGradient->gradientSpaceTransform()); | |
- shadowPainter->fillPath(platformPath, brush); | |
- } else { | |
- shadowPainter->fillPath(platformPath, p->brush()); | |
- } | |
- shadow.endShadowLayer(*this); | |
- } | |
+ const auto& state = m_state; | |
+ const auto& oldBrush = p->brush(); | |
+ ShadowBlur shadow(state); | |
+ shadow.drawShadowLayer(getCTM(), clipBounds(), platformPath.controlPointRect(), | |
+ [&state, &platformPath, oldBrush](GraphicsContext& shadowContext) | |
+ { | |
+ QPainter* shadowPainter = shadowContext.platformContext(); | |
+ if (state.fillPattern) { | |
+ shadowPainter->fillPath(platformPath, QBrush(state.fillPattern->createPlatformPattern())); | |
+ } else if (state.fillGradient) { | |
+ QBrush brush(*state.fillGradient->platformGradient()); | |
+ brush.setTransform(state.fillGradient->gradientSpaceTransform()); | |
+ shadowPainter->fillPath(platformPath, brush); | |
+ } else { | |
+ shadowPainter->fillPath(platformPath, oldBrush); | |
+ } | |
+ }, | |
+ [this](ImageBuffer& layerImage, const FloatPoint& layerOrigin, const FloatSize& layerSize) | |
+ { | |
+ drawImageBuffer(layerImage, FloatRect(roundedIntPoint(layerOrigin), layerSize), FloatRect(FloatPoint(), layerSize), compositeOperation()); | |
+ }); | |
} else { | |
QPointF offset(m_state.shadowOffset.width(), m_state.shadowOffset.height()); | |
p->translate(offset); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment