Title: [87174] trunk
- Revision
- 87174
- Author
- [email protected]
- Date
- 2011-05-24 11:24:56 -0700 (Tue, 24 May 2011)
Log Message
2011-05-24 Mike Reed <[email protected]>
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):
Modified Paths
Diff
Modified: trunk/LayoutTests/platform/chromium/test_expectations.txt (87173 => 87174)
--- trunk/LayoutTests/platform/chromium/test_expectations.txt 2011-05-24 18:16:51 UTC (rev 87173)
+++ trunk/LayoutTests/platform/chromium/test_expectations.txt 2011-05-24 18:24:56 UTC (rev 87174)
@@ -1010,11 +1010,9 @@
// Misc. render failures
BUGCR81718 WIN LINUX GPU : compositing/tiling/huge-layer-img.html = CRASH
-BUGCR80593 WIN LINUX GPU : canvas/philip/tests/2d.strokeRect.zero.4.html = TEXT
BUGCR79741 WIN LINUX GPU : fast/canvas/canvasDrawingIntoSelf.html = IMAGE
BUGCR79741 WIN LINUX GPU : fast/canvas/drawImage.html = IMAGE
BUGCR81601 WIN LINUX GPU : fast/repaint/canvas-putImageData.html = IMAGE+TEXT
-BUGCR81600 WIN LINUX GPU : canvas/philip/tests/2d.line.miter.lineedge.html = TEXT
BUGCR81606 WIN LINUX GPU : fast/canvas/drawImage-with-globalAlpha.html = IMAGE
// fillRect failures
Modified: trunk/Source/WebCore/ChangeLog (87173 => 87174)
--- trunk/Source/WebCore/ChangeLog 2011-05-24 18:16:51 UTC (rev 87173)
+++ trunk/Source/WebCore/ChangeLog 2011-05-24 18:24:56 UTC (rev 87174)
@@ -1,3 +1,16 @@
+2011-05-24 Mike Reed <[email protected]>
+
+ 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):
+
2011-05-24 Zan Dobersek <[email protected]> and Philippe Normand <[email protected]>
Reviewed by Kenneth Russell.
Modified: trunk/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp (87173 => 87174)
--- trunk/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp 2011-05-24 18:16:51 UTC (rev 87173)
+++ trunk/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp 2011-05-24 18:24:56 UTC (rev 87174)
@@ -1230,7 +1230,24 @@
SkPaint paint;
platformContext()->setupPaintForStroking(&paint, 0, 0);
paint.setStrokeWidth(WebCoreFloatToSkScalar(lineWidth));
- platformContext()->canvas()->drawRect(rect, paint);
+ // strokerect has special rules for CSS when the rect is degenerate:
+ // if width==0 && height==0, do nothing
+ // if width==0 || height==0, then just draw line for the other dimension
+ SkRect r(rect);
+ bool validW = r.width() > 0;
+ bool validH = r.height() > 0;
+ SkCanvas* canvas = platformContext()->canvas();
+ if (validW && validH)
+ canvas->drawRect(r, paint);
+ else if (validW || validH) {
+ // we are expected to respect the lineJoin, so we can't just call
+ // drawLine -- we have to create a path that doubles back on itself.
+ SkPath path;
+ path.moveTo(r.fLeft, r.fTop);
+ path.lineTo(r.fRight, r.fBottom);
+ path.close();
+ canvas->drawPath(path, paint);
+ }
}
void GraphicsContext::rotate(float angleInRadians)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes