Title: [87099] trunk/Source/WebCore
Revision
87099
Author
[email protected]
Date
2011-05-23 14:50:03 -0700 (Mon, 23 May 2011)

Log Message

2011-05-23  Mike Reed  <[email protected]>

        Reviewed by James Robinson.

        Skia: Need to implement GraphicsContext::clipConvexPolygon()
        https://bugs.webkit.org/show_bug.cgi?id=41311

        No new tests.

        * platform/graphics/skia/GraphicsContextSkia.cpp:
        (WebCore::setPathFromConvexPoints):
        (WebCore::GraphicsContext::drawConvexPolygon):
        (WebCore::GraphicsContext::clipConvexPolygon):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (87098 => 87099)


--- trunk/Source/WebCore/ChangeLog	2011-05-23 21:29:18 UTC (rev 87098)
+++ trunk/Source/WebCore/ChangeLog	2011-05-23 21:50:03 UTC (rev 87099)
@@ -1,3 +1,17 @@
+2011-05-23  Mike Reed  <[email protected]>
+
+        Reviewed by James Robinson.
+
+        Skia: Need to implement GraphicsContext::clipConvexPolygon()
+        https://bugs.webkit.org/show_bug.cgi?id=41311
+
+        No new tests. 
+
+        * platform/graphics/skia/GraphicsContextSkia.cpp:
+        (WebCore::setPathFromConvexPoints):
+        (WebCore::GraphicsContext::drawConvexPolygon):
+        (WebCore::GraphicsContext::clipConvexPolygon):
+
 2011-05-23  James Simonsen  <[email protected]>
 
         Reviewed by Adam Barth.

Modified: trunk/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp (87098 => 87099)


--- trunk/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp	2011-05-23 21:29:18 UTC (rev 87098)
+++ trunk/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp	2011-05-23 21:50:03 UTC (rev 87099)
@@ -449,6 +449,18 @@
     platformContext()->canvas()->setMatrix(affine);
 }
 
+static void setPathFromConvexPoints(SkPath* path, size_t numPoints, const FloatPoint* points)
+{
+    path->incReserve(numPoints);
+    path->moveTo(WebCoreFloatToSkScalar(points[0].x()),
+                 WebCoreFloatToSkScalar(points[0].y()));
+    for (size_t i = 1; i < numPoints; ++i) {
+        path->lineTo(WebCoreFloatToSkScalar(points[i].x()),
+                     WebCoreFloatToSkScalar(points[i].y()));
+    }
+    path->setIsConvex(true);
+}
+
 void GraphicsContext::drawConvexPolygon(size_t numPoints,
                                         const FloatPoint* points,
                                         bool shouldAntialias)
@@ -462,15 +474,8 @@
     platformContext()->prepareForSoftwareDraw();
 
     SkPath path;
+    setPathFromConvexPoints(&path, numPoints, points);
 
-    path.incReserve(numPoints);
-    path.moveTo(WebCoreFloatToSkScalar(points[0].x()),
-                WebCoreFloatToSkScalar(points[0].y()));
-    for (size_t i = 1; i < numPoints; i++) {
-        path.lineTo(WebCoreFloatToSkScalar(points[i].x()),
-                    WebCoreFloatToSkScalar(points[i].y()));
-    }
-
     if (!isPathSkiaSafe(getCTM(), path))
         return;
 
@@ -493,7 +498,9 @@
     if (numPoints <= 1)
         return;
 
-    // FIXME: IMPLEMENT!!
+    SkPath path;
+    setPathFromConvexPoints(&path, numPoints, points);
+    platformContext()->canvas()->clipPath(path);
 }
 
 // This method is only used to draw the little circles used in lists.
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to