Changeset 75833 in webkit


Ignore:
Timestamp:
Jan 14, 2011 3:46:58 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2011-01-14 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-14 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

    r75828 r75833  
     12011-01-14  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-14  Mihai Parparita  <mihaip@chromium.org>
    220
  • trunk/LayoutTests/platform/chromium/test_expectations.txt

    r75802 r75833  
    12981298BUGCR23477 MAC : fast/canvas/fill-stroke-clip-reset-path.html = IMAGE
    12991299BUGCR23477 MAC : fast/dynamic/containing-block-change.html = IMAGE
     1300BUGWK51982 LINUX WIN : fast/canvas/canvas-fillPath-gradient-shadow.html = FAIL
    13001301
    13011302// Unexpected gray
  • trunk/LayoutTests/platform/qt/Skipped

    r75771 r75833  
    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

    r75832 r75833  
     12011-01-14  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-14  Simon Fraser  <simon.fraser@apple.com>
    219
  • trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp

    r75393 r75833  
    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            CGContextBeginPath(layerContext);
     557            CGContextAddPath(layerContext, path.platformPath());
     558            CGContextConcatCTM(layerContext, m_state.fillGradient->gradientSpaceTransform());
     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            CGContextBeginPath(context);
     570            CGContextAddPath(context, path.platformPath());
     571            CGContextSaveGState(context);
     572            CGContextConcatCTM(context, m_state.fillGradient->gradientSpaceTransform());
     573
     574            if (fillRule() == RULE_EVENODD)
     575                CGContextEOClip(context);
     576            else
     577                CGContextClip(context);
     578
     579            m_state.fillGradient->paint(this);
     580            CGContextRestoreGState(context);
     581        }
     582
     583        return;
     584    }
     585
    549586    CGContextBeginPath(context);
    550587    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     }
    563588
    564589    if (m_state.fillPattern)
Note: See TracChangeset for help on using the changeset viewer.