Changeset 75341 in webkit


Ignore:
Timestamp:
Jan 8, 2011 6:35:18 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2011-01-08 Helder Correia <helder@sencha.com>

Reviewed by Simon Fraser.

Shadow is not drawn when filling a path with a gradient
https://bugs.webkit.org/show_bug.cgi?id=51982

This happens in CG and is related to bug 51869, this time to be fixed
in GraphicsContext::fillPath(const Path& path). We need to draw the
gradient clipped to the path on a CGLayer first, and then draw the
layer on the GraphicsContext.

  • fast/canvas/canvas-fillPath-gradient-shadow-expected.txt: Added.
  • fast/canvas/canvas-fillPath-gradient-shadow.html: Added.
  • fast/canvas/script-tests/canvas-fillPath-gradient-shadow.js: Added.
  • platform/chromium/test_expectations.txt: Skipping new test since it fails.
  • platform/qt/Skipped: Ditto.

2011-01-08 Helder Correia <helder@sencha.com>

Reviewed by Simon Fraser.

Shadow is not drawn when filling a path with a gradient
https://bugs.webkit.org/show_bug.cgi?id=51982

This happens in CG and is related to bug 51869, this time to be fixed
in GraphicsContext::fillPath(const Path& path). We need to draw the
gradient clipped to the path on a CGLayer first, and then draw the
layer on the GraphicsContext.

Test: fast/canvas/canvas-fillPath-gradient-shadow.html

  • platform/graphics/cg/GraphicsContextCG.cpp: (WebCore::GraphicsContext::fillPath):
Location:
trunk
Files:
3 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r75338 r75341  
     12011-01-08  Helder Correia  <helder@sencha.com>
     2
     3        Reviewed by Simon Fraser.
     4
     5        Shadow is not drawn when filling a path with a gradient
     6        https://bugs.webkit.org/show_bug.cgi?id=51982
     7
     8        This happens in CG and is related to bug 51869, this time to be fixed
     9        in GraphicsContext::fillPath(const Path& path). We need to draw the
     10        gradient clipped to the path on a CGLayer first, and then draw the
     11        layer on the GraphicsContext.
     12
     13        * fast/canvas/canvas-fillPath-gradient-shadow-expected.txt: Added.
     14        * fast/canvas/canvas-fillPath-gradient-shadow.html: Added.
     15        * fast/canvas/script-tests/canvas-fillPath-gradient-shadow.js: Added.
     16        * platform/chromium/test_expectations.txt: Skipping new test since it fails.
     17        * platform/qt/Skipped: Ditto.
     18
    1192011-01-08  Tony Gentilcore  <tonyg@chromium.org>
    220
  • trunk/LayoutTests/platform/chromium/test_expectations.txt

    r75322 r75341  
    13271327BUGCR23477 MAC : fast/canvas/fill-stroke-clip-reset-path.html = IMAGE
    13281328BUGCR23477 MAC : fast/dynamic/containing-block-change.html = IMAGE
     1329BUGWK51982 : fast/canvas/canvas-fillPath-gradient-shadow.html = FAIL
    13291330
    13301331// Unexpected gray
  • trunk/LayoutTests/platform/qt/Skipped

    r75189 r75341  
    23682368fast/block/positioning/absolute-in-inline-rtl-4.html
    23692369fast/canvas/canvas-gradient-addStop-error.html
     2370fast/canvas/canvas-fillPath-gradient-shadow.html
    23702371fast/css/zoom-body-scroll.html
    23712372fast/dom/Element/getBoundingClientRect.html
  • trunk/Source/WebCore/ChangeLog

    r75339 r75341  
     12011-01-08  Helder Correia  <helder@sencha.com>
     2
     3        Reviewed by Simon Fraser.
     4
     5        Shadow is not drawn when filling a path with a gradient
     6        https://bugs.webkit.org/show_bug.cgi?id=51982
     7
     8        This happens in CG and is related to bug 51869, this time to be fixed
     9        in GraphicsContext::fillPath(const Path& path). We need to draw the
     10        gradient clipped to the path on a CGLayer first, and then draw the
     11        layer on the GraphicsContext.
     12
     13        Test: fast/canvas/canvas-fillPath-gradient-shadow.html
     14
     15        * platform/graphics/cg/GraphicsContextCG.cpp:
     16        (WebCore::GraphicsContext::fillPath):
     17
    1182011-01-08  Benjamin Poulain  <benjamin.poulain@nokia.com>
    219
  • trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp

    r75163 r75341  
    547547    CGContextRef context = platformContext();
    548548
     549    if (m_state.fillGradient) {
     550        if (hasShadow()) {
     551            FloatRect rect = path.boundingRect();
     552            CGLayerRef layer = CGLayerCreateWithContext(context, CGSizeMake(rect.width(), rect.height()), 0);
     553            CGContextRef layerContext = CGLayerGetContext(layer);
     554
     555            CGContextTranslateCTM(layerContext, -rect.x(), -rect.y());
     556            CGContextConcatCTM(layerContext, m_state.fillGradient->gradientSpaceTransform());
     557            CGContextBeginPath(layerContext);
     558            CGContextAddPath(layerContext, path.platformPath());
     559
     560            if (fillRule() == RULE_EVENODD)
     561                CGContextEOClip(layerContext);
     562            else
     563                CGContextClip(layerContext);
     564
     565            m_state.fillGradient->paint(layerContext);
     566            CGContextDrawLayerAtPoint(context, CGPointMake(rect.left(), rect.top()), layer);
     567            CGLayerRelease(layer);
     568        } else {
     569            CGContextSaveGState(context);
     570            CGContextConcatCTM(context, m_state.fillGradient->gradientSpaceTransform());
     571
     572            CGContextBeginPath(context);
     573            CGContextAddPath(context, path.platformPath());
     574
     575            if (fillRule() == RULE_EVENODD)
     576                CGContextEOClip(context);
     577            else
     578                CGContextClip(context);
     579
     580            m_state.fillGradient->paint(this);
     581            CGContextRestoreGState(context);
     582        }
     583
     584        return;
     585    }
     586
    549587    CGContextBeginPath(context);
    550588    CGContextAddPath(context, path.platformPath());
    551 
    552     if (m_state.fillGradient) {
    553         CGContextSaveGState(context);
    554         if (fillRule() == RULE_EVENODD)
    555             CGContextEOClip(context);
    556         else
    557             CGContextClip(context);
    558         CGContextConcatCTM(context, m_state.fillGradient->gradientSpaceTransform());
    559         m_state.fillGradient->paint(this);
    560         CGContextRestoreGState(context);
    561         return;
    562     }
    563589
    564590    if (m_state.fillPattern)
Note: See TracChangeset for help on using the changeset viewer.