Changeset 145810 in webkit


Ignore:
Timestamp:
Mar 14, 2013 7:04:32 AM (11 years ago)
Author:
allan.jensen@digia.com
Message:

[Qt] Add support for tiled shadow blur
https://bugs.webkit.org/show_bug.cgi?id=90082

Reviewed by Noam Rosenthal.

Use the optimized ShadowBlur::drawRectShadow as long as we do not
have a rotating transform. Such a transform would go through the
slow path in ShadowBlur anyway, and would end up using a transformed
TransparencyLayer with an alphaMap which causes scaling artifacts
for us.

Tested by fast/canvas/canvas-scale-fillRect-shadow.html
and fast/canvas/canvas-transforms-fillRect-shadow.html

  • platform/graphics/ShadowBlur.cpp:

(WebCore::ShadowBlur::drawInsetShadowWithTiling):

Handle scaling transforms when shadows ignore transforms.

(WebCore::ShadowBlur::drawRectShadowWithTiling):

Ditto.

  • platform/graphics/qt/GraphicsContextQt.cpp:

(WebCore::GraphicsContext::fillRect):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r145809 r145810  
     12013-03-14  Allan Sandfeld Jensen  <allan.jensen@digia.com>
     2
     3        [Qt] Add support for tiled shadow blur
     4        https://bugs.webkit.org/show_bug.cgi?id=90082
     5
     6        Reviewed by Noam Rosenthal.
     7
     8        Use the optimized ShadowBlur::drawRectShadow as long as we do not
     9        have a rotating transform. Such a transform would go through the
     10        slow path in ShadowBlur anyway, and would end up using a transformed
     11        TransparencyLayer with an alphaMap which causes scaling artifacts
     12        for us.
     13
     14        Tested by fast/canvas/canvas-scale-fillRect-shadow.html
     15        and fast/canvas/canvas-transforms-fillRect-shadow.html
     16
     17        * platform/graphics/ShadowBlur.cpp:
     18        (WebCore::ShadowBlur::drawInsetShadowWithTiling):
     19            Handle scaling transforms when shadows ignore transforms.
     20        (WebCore::ShadowBlur::drawRectShadowWithTiling):
     21            Ditto.
     22        * platform/graphics/qt/GraphicsContextQt.cpp:
     23        (WebCore::GraphicsContext::fillRect):
     24
    1252013-03-12  Andrey Kosyakov  <caseq@chromium.org>
    226
  • trunk/Source/WebCore/platform/graphics/ShadowBlur.cpp

    r145366 r145810  
    680680        blurAndColorShadowBuffer(templateSize);
    681681    }
     682    FloatSize offset = m_offset;
     683    if (shadowsIgnoreTransforms()) {
     684        AffineTransform transform = graphicsContext->getCTM();
     685        offset.scale(1 / transform.xScale(), 1 / transform.yScale());
     686    }
    682687
    683688    FloatRect boundingRect = rect;
    684     boundingRect.move(m_offset);
     689    boundingRect.move(offset);
    685690
    686691    FloatRect destHoleRect = holeRect;
    687     destHoleRect.move(m_offset);
     692    destHoleRect.move(offset);
    688693    FloatRect destHoleBounds = destHoleRect;
    689694    destHoleBounds.inflateX(edgeSize.width());
     
    737742        blurAndColorShadowBuffer(templateSize);
    738743    }
     744    FloatSize offset = m_offset;
     745    if (shadowsIgnoreTransforms()) {
     746        AffineTransform transform = graphicsContext->getCTM();
     747        offset.scale(1 / transform.xScale(), 1 / transform.yScale());
     748    }
    739749
    740750    FloatRect shadowBounds = shadowedRect;
    741     shadowBounds.move(m_offset.width(), m_offset.height());
     751    shadowBounds.move(offset);
    742752    shadowBounds.inflateX(edgeSize.width());
    743753    shadowBounds.inflateY(edgeSize.height());
  • trunk/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp

    r145366 r145810  
    803803        if (hasShadow()) {
    804804            if (shadow->mustUseShadowBlur(this)) {
    805                 GraphicsContext* shadowContext = shadow->beginShadowLayer(this, normalizedRect);
    806                 if (shadowContext) {
    807                     QPainter* shadowPainter = shadowContext->platformContext();
    808                     shadowPainter->fillRect(normalizedRect, p->brush());
    809                     shadow->endShadowLayer(this);
    810                 }
     805                // drawRectShadowWithTiling does not work with rotations, and the fallback of
     806                // drawing though clipToImageBuffer() produces scaling artifacts for us.
     807                if (!getCTM().preservesAxisAlignment()) {
     808                    GraphicsContext* shadowContext = shadow->beginShadowLayer(this, normalizedRect);
     809                    if (shadowContext) {
     810                        QPainter* shadowPainter = shadowContext->platformContext();
     811                        shadowPainter->fillRect(normalizedRect, p->brush());
     812                        shadow->endShadowLayer(this);
     813                    }
     814                } else
     815                    shadow->drawRectShadow(this, rect, RoundedRect::Radii());
    811816            } else {
    812817                // Solid rectangle fill with no blur shadow or transformations applied can be done
Note: See TracChangeset for help on using the changeset viewer.