diff options
author | Allan Sandfeld Jensen <allan.jensen@digia.com> | 2013-03-14 14:01:52 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-03-18 15:50:55 +0100 |
commit | 3774b52275c59d74571b0e1f87950dcfc257d408 (patch) | |
tree | c87848b7f7c8206554c7a1437c3da77cabffd00f /Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp | |
parent | fa9f68ec24fee49e30d22d0d911853de15a86624 (diff) |
[Qt] Enable tiled shadow blur for inset box shadows
https://bugs.webkit.org/show_bug.cgi?id=111736
Reviewed by Noam Rosenthal.
Paint inset box-shadows using the optimized tiled shadow blur, instead of
applying shadow blur to the entire painted rect.
This optimizes the default CSS on common pastebin sites.
Tested by existing tests.
* platform/graphics/GraphicsContext.cpp:
* platform/graphics/ShadowBlur.cpp:
(WebCore::ShadowBlur::drawInsetShadowWithTiling):
Must set fill color before calling clearShadow, as that might clear m_color.
(WebCore::ShadowBlur::drawLayerPieces):
Ditto.
* platform/graphics/qt/GraphicsContextQt.cpp:
(WebCore::GraphicsContext::fillPath):
(WebCore::GraphicsContext::fillRectWithRoundedHole):
Change-Id: Idc563ff997f8150ef9553d8fe3d164e488f16e9f
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@145366 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
Diffstat (limited to 'Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp')
-rw-r--r-- | Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp b/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp index e91c2d287..ec992d648 100644 --- a/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp +++ b/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp @@ -791,6 +791,37 @@ void GraphicsContext::fillRoundedRect(const IntRect& rect, const IntSize& topLef p->fillPath(path.platformPath(), QColor(color)); } +void GraphicsContext::fillRectWithRoundedHole(const IntRect& rect, const RoundedRect& roundedHoleRect, const Color& color, ColorSpace colorSpace) +{ + if (paintingDisabled() || !color.isValid()) + return; + + Path path; + path.addRect(rect); + if (!roundedHoleRect.radii().isZero()) + path.addRoundedRect(roundedHoleRect); + else + path.addRect(roundedHoleRect.rect()); + + QPainterPath platformPath = path.platformPath(); + platformPath.setFillRule(Qt::OddEvenFill); + + QPainter* p = m_data->p(); + if (hasShadow()) { + ShadowBlur* shadow = shadowBlur(); + if (shadow->mustUseShadowBlur(this)) + shadow->drawInsetShadow(this, rect, roundedHoleRect.rect(), roundedHoleRect.radii()); + else { + const QPointF shadowOffset(m_state.shadowOffset.width(), m_state.shadowOffset.height()); + p->translate(shadowOffset); + p->fillPath(platformPath, QColor(m_state.shadowColor)); + p->translate(-shadowOffset); + } + } + + p->fillPath(platformPath, QColor(color)); +} + bool GraphicsContext::isInTransparencyLayer() const { return m_data->layerCount; |