Changeset 87174 in webkit


Ignore:
Timestamp:
May 24, 2011 11:24:56 AM (13 years ago)
Author:
commit-queue@webkit.org
Message:

2011-05-24 Mike Reed <reed@google.com>

Reviewed by Kenneth Russell.

skia: fix stroking of zero-height rectangles
https://bugs.webkit.org/show_bug.cgi?id=61284

Tests: canvas/philip/tests/2d.line.miter.lineedge.html

canvas/philip/tests/2d.strokeRect.zero.4.html

  • platform/graphics/skia/GraphicsContextSkia.cpp: (WebCore::GraphicsContext::strokeRect):
Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/platform/chromium/test_expectations.txt

    r87164 r87174  
    10111011// Misc. render failures
    10121012BUGCR81718 WIN LINUX GPU : compositing/tiling/huge-layer-img.html = CRASH
    1013 BUGCR80593 WIN LINUX GPU : canvas/philip/tests/2d.strokeRect.zero.4.html = TEXT
    10141013BUGCR79741 WIN LINUX GPU : fast/canvas/canvasDrawingIntoSelf.html = IMAGE
    10151014BUGCR79741 WIN LINUX GPU : fast/canvas/drawImage.html = IMAGE
    10161015BUGCR81601 WIN LINUX GPU : fast/repaint/canvas-putImageData.html = IMAGE+TEXT
    1017 BUGCR81600 WIN LINUX GPU : canvas/philip/tests/2d.line.miter.lineedge.html = TEXT
    10181016BUGCR81606 WIN LINUX GPU : fast/canvas/drawImage-with-globalAlpha.html = IMAGE
    10191017
  • trunk/Source/WebCore/ChangeLog

    r87173 r87174  
     12011-05-24  Mike Reed  <reed@google.com>
     2
     3        Reviewed by Kenneth Russell.
     4
     5        skia: fix stroking of zero-height rectangles
     6        https://bugs.webkit.org/show_bug.cgi?id=61284
     7
     8        Tests: canvas/philip/tests/2d.line.miter.lineedge.html
     9               canvas/philip/tests/2d.strokeRect.zero.4.html
     10
     11        * platform/graphics/skia/GraphicsContextSkia.cpp:
     12        (WebCore::GraphicsContext::strokeRect):
     13
    1142011-05-24  Zan Dobersek  <zandobersek@gmail.com> and Philippe Normand  <pnormand@igalia.com>
    215
  • trunk/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp

    r87099 r87174  
    12311231    platformContext()->setupPaintForStroking(&paint, 0, 0);
    12321232    paint.setStrokeWidth(WebCoreFloatToSkScalar(lineWidth));
    1233     platformContext()->canvas()->drawRect(rect, paint);
     1233    // strokerect has special rules for CSS when the rect is degenerate:
     1234    // if width==0 && height==0, do nothing
     1235    // if width==0 || height==0, then just draw line for the other dimension
     1236    SkRect r(rect);
     1237    bool validW = r.width() > 0;
     1238    bool validH = r.height() > 0;
     1239    SkCanvas* canvas = platformContext()->canvas();
     1240    if (validW && validH)
     1241        canvas->drawRect(r, paint);
     1242    else if (validW || validH) {
     1243        // we are expected to respect the lineJoin, so we can't just call
     1244        // drawLine -- we have to create a path that doubles back on itself.
     1245        SkPath path;
     1246        path.moveTo(r.fLeft, r.fTop);
     1247        path.lineTo(r.fRight, r.fBottom);
     1248        path.close();
     1249        canvas->drawPath(path, paint);
     1250    }
    12341251}
    12351252
Note: See TracChangeset for help on using the changeset viewer.