Title: [139967] trunk/Source/WebCore
Revision
139967
Author
[email protected]
Date
2013-01-16 23:23:17 -0800 (Wed, 16 Jan 2013)

Log Message

Update GraphicsContext to support winding rule in clip operator for Core Graphics
https://bugs.webkit.org/show_bug.cgi?id=106871

Patch by Rik Cabanier <[email protected]> on 2013-01-16
Reviewed by Dirk Schulze.

Changed the interface to GraphicsContext so it's possible to pass the winding
rule to canvasClip() and clip().

No new tests, no change in functionality.

* WebCore.exp.in: Change signature of canvasClip function.
* platform/graphics/GraphicsContext.h: Change canvasClip and clip signature with default winding rule.
* platform/graphics/cairo/GraphicsContextCairo.cpp: Update interface with new signature so it still compiles.
(WebCore::GraphicsContext::clip):
(WebCore::GraphicsContext::canvasClip):
* platform/graphics/cg/GraphicsContextCG.cpp: Update interface with new signature and implement winding rules.
(WebCore::GraphicsContext::clip):
(WebCore::GraphicsContext::canvasClip):
* platform/graphics/openvg/GraphicsContextOpenVG.cpp: Update interface with new signature so it still compiles.
(WebCore::GraphicsContext::clip):
(WebCore::GraphicsContext::canvasClip):
* platform/graphics/qt/GraphicsContextQt.cpp: Update interface with new signature so it still compiles.
(WebCore::GraphicsContext::clip):
(WebCore::GraphicsContext::canvasClip):
* platform/graphics/skia/GraphicsContextSkia.cpp: Update interface with new signature so it still compiles.
(WebCore::GraphicsContext::clip):
(WebCore::GraphicsContext::canvasClip):
* platform/graphics/wince/GraphicsContextWinCE.cpp: Update interface with new signature so it still compiles.
(WebCore::GraphicsContext::clip):
(WebCore::GraphicsContext::canvasClip):
* platform/graphics/wx/GraphicsContextWx.cpp: Update interface with new signature so it still compiles.
(WebCore::GraphicsContext::clip):
(WebCore::GraphicsContext::canvasClip):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (139966 => 139967)


--- trunk/Source/WebCore/ChangeLog	2013-01-17 07:20:23 UTC (rev 139966)
+++ trunk/Source/WebCore/ChangeLog	2013-01-17 07:23:17 UTC (rev 139967)
@@ -1,3 +1,39 @@
+2013-01-16  Rik Cabanier  <[email protected]>
+
+        Update GraphicsContext to support winding rule in clip operator for Core Graphics
+        https://bugs.webkit.org/show_bug.cgi?id=106871
+
+        Reviewed by Dirk Schulze.
+
+        Changed the interface to GraphicsContext so it's possible to pass the winding
+        rule to canvasClip() and clip().
+
+        No new tests, no change in functionality.
+
+        * WebCore.exp.in: Change signature of canvasClip function.
+        * platform/graphics/GraphicsContext.h: Change canvasClip and clip signature with default winding rule.
+        * platform/graphics/cairo/GraphicsContextCairo.cpp: Update interface with new signature so it still compiles.
+        (WebCore::GraphicsContext::clip):
+        (WebCore::GraphicsContext::canvasClip):
+        * platform/graphics/cg/GraphicsContextCG.cpp: Update interface with new signature and implement winding rules.
+        (WebCore::GraphicsContext::clip):
+        (WebCore::GraphicsContext::canvasClip):
+        * platform/graphics/openvg/GraphicsContextOpenVG.cpp: Update interface with new signature so it still compiles.
+        (WebCore::GraphicsContext::clip):
+        (WebCore::GraphicsContext::canvasClip):
+        * platform/graphics/qt/GraphicsContextQt.cpp: Update interface with new signature so it still compiles.
+        (WebCore::GraphicsContext::clip):
+        (WebCore::GraphicsContext::canvasClip):
+        * platform/graphics/skia/GraphicsContextSkia.cpp: Update interface with new signature so it still compiles.
+        (WebCore::GraphicsContext::clip):
+        (WebCore::GraphicsContext::canvasClip):
+        * platform/graphics/wince/GraphicsContextWinCE.cpp: Update interface with new signature so it still compiles.
+        (WebCore::GraphicsContext::clip):
+        (WebCore::GraphicsContext::canvasClip):
+        * platform/graphics/wx/GraphicsContextWx.cpp: Update interface with new signature so it still compiles.
+        (WebCore::GraphicsContext::clip):
+        (WebCore::GraphicsContext::canvasClip):
+
 2013-01-16  Hajime Morrita  <[email protected]>
 
         NoEventDispatchAssertion in ContainerNode::removeChildren is too strict

Modified: trunk/Source/WebCore/WebCore.exp.in (139966 => 139967)


--- trunk/Source/WebCore/WebCore.exp.in	2013-01-17 07:20:23 UTC (rev 139966)
+++ trunk/Source/WebCore/WebCore.exp.in	2013-01-17 07:23:17 UTC (rev 139967)
@@ -400,7 +400,7 @@
 __ZN7WebCore15GraphicsContext22applyDeviceScaleFactorEf
 __ZN7WebCore15GraphicsContext22beginTransparencyLayerEf
 __ZN7WebCore15GraphicsContext28setImageInterpolationQualityENS_20InterpolationQualityE
-__ZN7WebCore15GraphicsContext4clipERKNS_4PathE
+__ZN7WebCore15GraphicsContext4clipERKNS_4PathENS_8WindRuleE
 __ZN7WebCore15GraphicsContext4clipERKNS_7IntRectE
 __ZN7WebCore15GraphicsContext4clipERKNS_9FloatRectE
 __ZN7WebCore15GraphicsContext4saveEv

Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext.h (139966 => 139967)


--- trunk/Source/WebCore/platform/graphics/GraphicsContext.h	2013-01-17 07:20:23 UTC (rev 139966)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext.h	2013-01-17 07:23:17 UTC (rev 139967)
@@ -408,12 +408,12 @@
         void setCompositeOperation(CompositeOperator, BlendMode = BlendModeNormal);
         CompositeOperator compositeOperation() const;
 
-        void clip(const Path&);
+        void clip(const Path&, WindRule = RULE_EVENODD);
 
         // This clip function is used only by <canvas> code. It allows
         // implementations to handle clipping on the canvas differently since
         // the discipline is different.
-        void canvasClip(const Path&);
+        void canvasClip(const Path&, WindRule = RULE_EVENODD);
         void clipOut(const Path&);
 
         void scale(const FloatSize&);

Modified: trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp (139966 => 139967)


--- trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp	2013-01-17 07:20:23 UTC (rev 139966)
+++ trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp	2013-01-17 07:23:17 UTC (rev 139967)
@@ -997,7 +997,8 @@
     cairo_set_operator(platformContext()->cr(), cairo_op);
 }
 
-void GraphicsContext::clip(const Path& path)
+// FIXME: don't ignore the winding rule. https://bugs.webkit.org/show_bug.cgi?id=107065
+void GraphicsContext::clip(const Path& path, WindRule)
 {
     if (paintingDisabled())
         return;
@@ -1015,9 +1016,9 @@
     m_data->clip(path);
 }
 
-void GraphicsContext::canvasClip(const Path& path)
+void GraphicsContext::canvasClip(const Path& path, WindRule fillRule)
 {
-    clip(path);
+    clip(path, fillRule);
 }
 
 void GraphicsContext::clipOut(const Path& path)

Modified: trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp (139966 => 139967)


--- trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp	2013-01-17 07:20:23 UTC (rev 139966)
+++ trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp	2013-01-17 07:23:17 UTC (rev 139967)
@@ -1317,7 +1317,7 @@
     }
 }
 
-void GraphicsContext::clip(const Path& path)
+void GraphicsContext::clip(const Path& path, WindRule fillRule)
 {
     if (paintingDisabled())
         return;
@@ -1331,14 +1331,17 @@
     else {
         CGContextBeginPath(context);
         CGContextAddPath(context, path.platformPath());
-        CGContextClip(context);
+        if (fillRule == RULE_EVENODD)
+            CGContextClip(context);
+        else
+            CGContextEOClip(context);
     }
     m_data->clip(path);
 }
 
-void GraphicsContext::canvasClip(const Path& path)
+void GraphicsContext::canvasClip(const Path& path, WindRule fillRule)
 {
-    clip(path);
+    clip(path, fillRule);
 }
 
 void GraphicsContext::clipOut(const Path& path)

Modified: trunk/Source/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp (139966 => 139967)


--- trunk/Source/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp	2013-01-17 07:20:23 UTC (rev 139966)
+++ trunk/Source/WebCore/platform/graphics/openvg/GraphicsContextOpenVG.cpp	2013-01-17 07:23:17 UTC (rev 139967)
@@ -379,7 +379,8 @@
     m_data->setCompositeOperation(op);
 }
 
-void GraphicsContext::clip(const Path& path)
+// FIXME: don't ignore the winding rule. https://bugs.webkit.org/show_bug.cgi?id=107064
+void GraphicsContext::clip(const Path& path, WindRule)
 {
     if (paintingDisabled())
         return;
@@ -387,9 +388,9 @@
     m_data->clipPath(path, PainterOpenVG::IntersectClip, m_state.fillRule);
 }
 
-void GraphicsContext::canvasClip(const Path& path)
+void GraphicsContext::canvasClip(const Path& path, WindRule fillRule)
 {
-    clip(path);
+    clip(path, fillRule);
 }
 
 void GraphicsContext::clipOut(const Path& path)

Modified: trunk/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp (139966 => 139967)


--- trunk/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp	2013-01-17 07:20:23 UTC (rev 139966)
+++ trunk/Source/WebCore/platform/graphics/qt/GraphicsContextQt.cpp	2013-01-17 07:23:17 UTC (rev 139967)
@@ -1251,7 +1251,8 @@
     m_data->p()->setCompositionMode(toQtCompositionMode(op));
 }
 
-void GraphicsContext::clip(const Path& path)
+// FIXME: don't ignore the winding rule. https://bugs.webkit.org/show_bug.cgi?id=106873
+void GraphicsContext::clip(const Path& path, WindRule)
 {
     if (paintingDisabled())
         return;
@@ -1261,9 +1262,9 @@
     m_data->p()->setClipPath(clipPath, Qt::IntersectClip);
 }
 
-void GraphicsContext::canvasClip(const Path& path)
+void GraphicsContext::canvasClip(const Path& path, WindRule fillRule)
 {
-    clip(path);
+    clip(path, fillRule);
 }
 
 void GraphicsContext::clipOut(const Path& path)

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


--- trunk/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp	2013-01-17 07:20:23 UTC (rev 139966)
+++ trunk/Source/WebCore/platform/graphics/skia/GraphicsContextSkia.cpp	2013-01-17 07:23:17 UTC (rev 139967)
@@ -314,7 +314,8 @@
     platformContext()->clipRect(rect);
 }
 
-void GraphicsContext::clip(const Path& path)
+// FIXME: don't ignore the winding rule. https://bugs.webkit.org/show_bug.cgi?id=106872
+void GraphicsContext::clip(const Path& path, WindRule)
 {
     if (paintingDisabled() || path.isEmpty())
         return;
@@ -337,7 +338,8 @@
     platformContext()->clipRRect(r, PlatformContextSkia::AntiAliased);
 }
 
-void GraphicsContext::canvasClip(const Path& path)
+// FIXME: don't ignore the winding rule. https://bugs.webkit.org/show_bug.cgi?id=106872
+void GraphicsContext::canvasClip(const Path& path, WindRule)
 {
     if (paintingDisabled())
         return;

Modified: trunk/Source/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp (139966 => 139967)


--- trunk/Source/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp	2013-01-17 07:20:23 UTC (rev 139966)
+++ trunk/Source/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp	2013-01-17 07:23:17 UTC (rev 139967)
@@ -1192,14 +1192,14 @@
     notImplemented();
 }
 
-void GraphicsContext::clip(const Path& path)
+void GraphicsContext::clip(const Path& path, WindRule)
 {
     notImplemented();
 }
 
-void GraphicsContext::canvasClip(const Path& path)
+void GraphicsContext::canvasClip(const Path& path, WindRule fillRule)
 {
-    clip(path);
+    clip(path, fillRule);
 }
 
 void GraphicsContext::clipOut(const Path&)

Modified: trunk/Source/WebCore/platform/graphics/wx/GraphicsContextWx.cpp (139966 => 139967)


--- trunk/Source/WebCore/platform/graphics/wx/GraphicsContextWx.cpp	2013-01-17 07:20:23 UTC (rev 139966)
+++ trunk/Source/WebCore/platform/graphics/wx/GraphicsContextWx.cpp	2013-01-17 07:23:17 UTC (rev 139967)
@@ -466,7 +466,8 @@
     m_data->context->DrawLine(origin.x(), origin.y(), origin.x() + width, origin.y());
 }
 
-void GraphicsContext::clip(const Path& path) 
+// FIXME: don't ignore the winding rule.
+void GraphicsContext::clip(const Path& path, WindRule) 
 { 
     if (paintingDisabled())
         return;
@@ -479,9 +480,9 @@
         clipPath(path, RULE_NONZERO);
 }
 
-void GraphicsContext::canvasClip(const Path& path)
+void GraphicsContext::canvasClip(const Path& path, WindRule fillRule)
 {
-    clip(path);
+    clip(path, fillRule);
 }
 
 AffineTransform GraphicsContext::getCTM(IncludeDeviceScale) const
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to