Skip to content

Instantly share code, notes, and snippets.

@annulen
Last active March 5, 2020 18:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save annulen/884b116d229f04b4e7db8fa6d018e865 to your computer and use it in GitHub Desktop.
Save annulen/884b116d229f04b4e7db8fa6d018e865 to your computer and use it in GitHub Desktop.
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