2011-04-29 Mike Reed <reed@google.com>
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 29 Apr 2011 16:48:00 +0000 (16:48 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 29 Apr 2011 16:48:00 +0000 (16:48 +0000)
        Reviewed by Ojan Vafai.

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

        This does not (yet) enable HAVE_PATH_BASED_BORDER_RADIUS_DRAWING
        as that shows other issues/question unrelated to clipping.
        https://bugs.webkit.org/show_bug.cgi?id=41311

        No new tests. covered by existing layout tests

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

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@85330 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp

index d1b542210d7be661c579bbcc2131d81a7669e05a..c781d6f6840dc0c8465647c73ada0e24e9ac29df 100644 (file)
@@ -1,3 +1,21 @@
+2011-04-29  Mike Reed  <reed@google.com>
+
+        Reviewed by Ojan Vafai.
+
+        Skia: Need to implement GraphicsContext::clipConvexPolygon()
+        https://bugs.webkit.org/show_bug.cgi?id=41311
+
+        This does not (yet) enable HAVE_PATH_BASED_BORDER_RADIUS_DRAWING
+        as that shows other issues/question unrelated to clipping.
+        https://bugs.webkit.org/show_bug.cgi?id=41311
+
+        No new tests. covered by existing layout tests
+
+        * platform/graphics/skia/GraphicsContextSkia.cpp:
+        (WebCore::setPathFromConvexPoints):
+        (WebCore::GraphicsContext::drawConvexPolygon):
+        (WebCore::GraphicsContext::clipConvexPolygon):
+
 2011-04-29  Mike Lawther  <mikelawther@chromium.org>
 
         Reviewed by Ojan Vafai.
index 8136286fb35e7fb8c1deb875112b2c26eadf2bc0..206af8ca6d58d88c58765438ad98b44907d546ec 100644 (file)
@@ -449,6 +449,18 @@ void GraphicsContext::setCTM(const AffineTransform& affine)
     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,20 +474,14 @@ void GraphicsContext::drawConvexPolygon(size_t numPoints,
     platformContext()->prepareForSoftwareDraw();
 
     SkPath path;
-
-    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()));
-    }
+    setPathFromConvexPoints(&path, numPoints, points);
 
     if (!isPathSkiaSafe(getCTM(), path))
         return;
 
     SkPaint paint;
     platformContext()->setupPaintForFilling(&paint);
+    paint.setAntiAlias(shouldAntialias);
     platformContext()->canvas()->drawPath(path, paint);
 
     if (strokeStyle() != NoStroke) {
@@ -493,7 +499,9 @@ void GraphicsContext::clipConvexPolygon(size_t numPoints, const FloatPoint* poin
     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.