Title: [135411] trunk/Source/WebCore
Revision
135411
Author
[email protected]
Date
2012-11-21 09:28:05 -0800 (Wed, 21 Nov 2012)

Log Message

Avoid creating degenerate cubics at corners of rounded rects.
https://bugs.webkit.org/show_bug.cgi?id=102945

Patch by Tom Hudson <[email protected]> on 2012-11-21
Reviewed by Stephen White.

Covered by existing layout tests.

* platform/graphics/Path.cpp:
(Path::addBeziersForRoundedRect):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (135410 => 135411)


--- trunk/Source/WebCore/ChangeLog	2012-11-21 17:18:00 UTC (rev 135410)
+++ trunk/Source/WebCore/ChangeLog	2012-11-21 17:28:05 UTC (rev 135411)
@@ -1,3 +1,15 @@
+2012-11-21  Tom Hudson  <[email protected]>
+
+        Avoid creating degenerate cubics at corners of rounded rects.
+        https://bugs.webkit.org/show_bug.cgi?id=102945
+
+        Reviewed by Stephen White.
+
+        Covered by existing layout tests.
+
+        * platform/graphics/Path.cpp:
+        (Path::addBeziersForRoundedRect):
+
 2012-11-21  Eric Carlson  <[email protected]>
 
         In-band text tracks infrastructure

Modified: trunk/Source/WebCore/platform/graphics/Path.cpp (135410 => 135411)


--- trunk/Source/WebCore/platform/graphics/Path.cpp	2012-11-21 17:18:00 UTC (rev 135410)
+++ trunk/Source/WebCore/platform/graphics/Path.cpp	2012-11-21 17:28:05 UTC (rev 135411)
@@ -165,21 +165,25 @@
     moveTo(FloatPoint(rect.x() + topLeftRadius.width(), rect.y()));
 
     addLineTo(FloatPoint(rect.maxX() - topRightRadius.width(), rect.y()));
-    addBezierCurveTo(FloatPoint(rect.maxX() - topRightRadius.width() * gCircleControlPoint, rect.y()),
-                     FloatPoint(rect.maxX(), rect.y() + topRightRadius.height() * gCircleControlPoint),
-                     FloatPoint(rect.maxX(), rect.y() + topRightRadius.height()));
+    if (topRightRadius.width() > 0 || topRightRadius.height() > 0)
+        addBezierCurveTo(FloatPoint(rect.maxX() - topRightRadius.width() * gCircleControlPoint, rect.y()),
+            FloatPoint(rect.maxX(), rect.y() + topRightRadius.height() * gCircleControlPoint),
+            FloatPoint(rect.maxX(), rect.y() + topRightRadius.height()));
     addLineTo(FloatPoint(rect.maxX(), rect.maxY() - bottomRightRadius.height()));
-    addBezierCurveTo(FloatPoint(rect.maxX(), rect.maxY() - bottomRightRadius.height() * gCircleControlPoint),
-                     FloatPoint(rect.maxX() - bottomRightRadius.width() * gCircleControlPoint, rect.maxY()),
-                     FloatPoint(rect.maxX() - bottomRightRadius.width(), rect.maxY()));
+    if (bottomRightRadius.width() > 0 || bottomRightRadius.height() > 0)
+        addBezierCurveTo(FloatPoint(rect.maxX(), rect.maxY() - bottomRightRadius.height() * gCircleControlPoint),
+            FloatPoint(rect.maxX() - bottomRightRadius.width() * gCircleControlPoint, rect.maxY()),
+            FloatPoint(rect.maxX() - bottomRightRadius.width(), rect.maxY()));
     addLineTo(FloatPoint(rect.x() + bottomLeftRadius.width(), rect.maxY()));
-    addBezierCurveTo(FloatPoint(rect.x() + bottomLeftRadius.width() * gCircleControlPoint, rect.maxY()),
-                     FloatPoint(rect.x(), rect.maxY() - bottomLeftRadius.height() * gCircleControlPoint),
-                     FloatPoint(rect.x(), rect.maxY() - bottomLeftRadius.height()));
+    if (bottomLeftRadius.width() > 0 || bottomLeftRadius.height() > 0)
+        addBezierCurveTo(FloatPoint(rect.x() + bottomLeftRadius.width() * gCircleControlPoint, rect.maxY()),
+            FloatPoint(rect.x(), rect.maxY() - bottomLeftRadius.height() * gCircleControlPoint),
+            FloatPoint(rect.x(), rect.maxY() - bottomLeftRadius.height()));
     addLineTo(FloatPoint(rect.x(), rect.y() + topLeftRadius.height()));
-    addBezierCurveTo(FloatPoint(rect.x(), rect.y() + topLeftRadius.height() * gCircleControlPoint),
-                     FloatPoint(rect.x() + topLeftRadius.width() * gCircleControlPoint, rect.y()),
-                     FloatPoint(rect.x() + topLeftRadius.width(), rect.y()));
+    if (topLeftRadius.width() > 0 || topLeftRadius.height() > 0)
+        addBezierCurveTo(FloatPoint(rect.x(), rect.y() + topLeftRadius.height() * gCircleControlPoint),
+            FloatPoint(rect.x() + topLeftRadius.width() * gCircleControlPoint, rect.y()),
+            FloatPoint(rect.x() + topLeftRadius.width(), rect.y()));
 
     closeSubpath();
 }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to