Changeset 39080 in webkit


Ignore:
Timestamp:
Dec 7, 2008 1:23:17 AM (15 years ago)
Author:
krit@webkit.org
Message:

2008-12-07 Dirk Schulze <krit@webkit.org>

Reviewed by Oliver Hunt.

WebCore:

Add gradient and pattern support for strokeRect on canvas/Cg.

Canvas strokeRect() doesn't support gradients
https://bugs.webkit.org/show_bug.cgi?id=19790

Test: fast/canvas/canvas-strokeRect.html

  • platform/graphics/cg/GraphicsContextCG.cpp: (WebCore::GraphicsContext::strokeRect):

LayoutTests:

Tests strokeRect with patterns and gradients.

  • fast/canvas/canvas-strokeRect-expected.txt: Added.
  • fast/canvas/canvas-strokeRect.html: Added.
  • fast/canvas/resources/canvas-strokeRect.js: Added.
Location:
trunk
Files:
3 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r39079 r39080  
     12008-12-07  Dirk Schulze  <krit@webkit.org>
     2
     3        Reviewed by Oliver Hunt.
     4
     5        Tests strokeRect with patterns and gradients.
     6
     7        * fast/canvas/canvas-strokeRect-expected.txt: Added.
     8        * fast/canvas/canvas-strokeRect.html: Added.
     9        * fast/canvas/resources/canvas-strokeRect.js: Added.
     10
    1112008-12-06  Dirk Schulze  <krit@webkit.org>
    212
  • trunk/WebCore/ChangeLog

    r39079 r39080  
     12008-12-07  Dirk Schulze  <krit@webkit.org>
     2
     3        Reviewed by Oliver Hunt.
     4
     5        Add gradient and pattern support for strokeRect on canvas/Cg.
     6
     7        Canvas strokeRect() doesn't support gradients
     8        https://bugs.webkit.org/show_bug.cgi?id=19790
     9
     10        Test: fast/canvas/canvas-strokeRect.html
     11
     12        * platform/graphics/cg/GraphicsContextCG.cpp:
     13        (WebCore::GraphicsContext::strokeRect):
     14
    1152008-12-06  Dirk Schulze  <krit@webkit.org>
    216
  • trunk/WebCore/platform/graphics/cg/GraphicsContextCG.cpp

    r38405 r39080  
    763763    if (paintingDisabled())
    764764        return;
    765     CGContextStrokeRectWithWidth(platformContext(), r, lineWidth);
     765
     766    CGContextRef context = platformContext();
     767    switch (m_common->state.strokeColorSpace) {
     768    case SolidColorSpace:
     769        if (strokeColor().alpha())
     770            CGContextStrokeRectWithWidth(context, r, lineWidth);
     771        break;
     772    case PatternColorSpace:
     773        applyStrokePattern(this, m_common->state.strokePattern.get());
     774        CGContextStrokeRectWithWidth(context, r, lineWidth);
     775        break;
     776    case GradientColorSpace:
     777        CGContextSaveGState(context);
     778        setStrokeThickness(lineWidth);
     779        CGContextAddRect(context, r);
     780        CGContextReplacePathWithStrokedPath(context);
     781        CGContextClip(context);
     782        CGContextDrawShading(context, m_common->state.strokeGradient->platformGradient());
     783        CGContextRestoreGState(context);
     784        break;
     785    }
    766786}
    767787
Note: See TracChangeset for help on using the changeset viewer.