Title: [173149] trunk/Source/WebCore
Revision
173149
Author
[email protected]
Date
2014-08-31 15:03:50 -0700 (Sun, 31 Aug 2014)

Log Message

Remove duplicate implementation of drawEllipse and some related PLATFORM(IOS) ifdefs
https://bugs.webkit.org/show_bug.cgi?id=136413

Reviewed by Dan Bernstein.

No new tests, just cleanup.

* platform/graphics/GraphicsContext.cpp:
(WebCore::GraphicsContext::drawRaisedEllipse):
There's nothing iOS specific about this function.

* platform/graphics/GraphicsContext.h:
* platform/graphics/cairo/GraphicsContextCairo.cpp:
(WebCore::GraphicsContext::drawEllipse):
* platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContext::drawEllipse):
Un-ifdef drawRaisedEllipse; delete the reimplementation of drawEllipse that takes
a FloatRect and make the normal one take a FloatRect instead.

(WebCore::GraphicsContext::platformInit):
Make sure that the CGContext's line width starts out in sync with GraphicsContext's.
By default, CGContext has a line width of 1 and GraphicsContext 0, so they could previously
have been out of sync until someone set the width explicitly.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (173148 => 173149)


--- trunk/Source/WebCore/ChangeLog	2014-08-31 22:02:47 UTC (rev 173148)
+++ trunk/Source/WebCore/ChangeLog	2014-08-31 22:03:50 UTC (rev 173149)
@@ -1,5 +1,31 @@
 2014-08-31  Tim Horton  <[email protected]>
 
+        Remove duplicate implementation of drawEllipse and some related PLATFORM(IOS) ifdefs
+        https://bugs.webkit.org/show_bug.cgi?id=136413
+
+        Reviewed by Dan Bernstein.
+
+        No new tests, just cleanup.
+
+        * platform/graphics/GraphicsContext.cpp:
+        (WebCore::GraphicsContext::drawRaisedEllipse):
+        There's nothing iOS specific about this function.
+
+        * platform/graphics/GraphicsContext.h:
+        * platform/graphics/cairo/GraphicsContextCairo.cpp:
+        (WebCore::GraphicsContext::drawEllipse):
+        * platform/graphics/cg/GraphicsContextCG.cpp:
+        (WebCore::GraphicsContext::drawEllipse):
+        Un-ifdef drawRaisedEllipse; delete the reimplementation of drawEllipse that takes
+        a FloatRect and make the normal one take a FloatRect instead.
+
+        (WebCore::GraphicsContext::platformInit):
+        Make sure that the CGContext's line width starts out in sync with GraphicsContext's.
+        By default, CGContext has a line width of 1 and GraphicsContext 0, so they could previously
+        have been out of sync until someone set the width explicitly.
+
+2014-08-31  Tim Horton  <[email protected]>
+
         Fix a harmless mismerge in BitmapImage::destroyDecodedDataIfNecessary
         https://bugs.webkit.org/show_bug.cgi?id=136412
 

Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp (173148 => 173149)


--- trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp	2014-08-31 22:02:47 UTC (rev 173148)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp	2014-08-31 22:03:50 UTC (rev 173149)
@@ -148,7 +148,6 @@
     restorePlatformState();
 }
 
-#if PLATFORM(IOS)
 void GraphicsContext::drawRaisedEllipse(const FloatRect& rect, const Color& ellipseColor, ColorSpace ellipseColorSpace, const Color& shadowColor, ColorSpace shadowColorSpace)
 {
     if (paintingDisabled())
@@ -168,7 +167,6 @@
 
     restore();
 }
-#endif
 
 void GraphicsContext::setStrokeThickness(float thickness)
 {

Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext.h (173148 => 173149)


--- trunk/Source/WebCore/platform/graphics/GraphicsContext.h	2014-08-31 22:02:47 UTC (rev 173148)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext.h	2014-08-31 22:03:50 UTC (rev 173149)
@@ -309,11 +309,8 @@
         void drawJoinedLines(CGPoint points[], unsigned count, bool antialias, CGLineCap = kCGLineCapButt);
 #endif
 
-        void drawEllipse(const IntRect&);
-#if PLATFORM(IOS)
         void drawEllipse(const FloatRect&);
         void drawRaisedEllipse(const FloatRect&, const Color& ellipseColor, ColorSpace ellipseColorSpace, const Color& shadowColor, ColorSpace shadowColorSpace);
-#endif
         void drawConvexPolygon(size_t numPoints, const FloatPoint*, bool shouldAntialias = false);
 
         WEBCORE_EXPORT void fillPath(const Path&);

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


--- trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp	2014-08-31 22:02:47 UTC (rev 173148)
+++ trunk/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp	2014-08-31 22:03:50 UTC (rev 173149)
@@ -344,7 +344,7 @@
 }
 
 // This method is only used to draw the little circles used in lists.
-void GraphicsContext::drawEllipse(const IntRect& rect)
+void GraphicsContext::drawEllipse(const FloatRect& rect)
 {
     if (paintingDisabled())
         return;

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


--- trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp	2014-08-31 22:02:47 UTC (rev 173148)
+++ trunk/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp	2014-08-31 22:03:50 UTC (rev 173149)
@@ -134,6 +134,7 @@
         // Make sure the context starts in sync with our state.
         setPlatformFillColor(fillColor(), fillColorSpace());
         setPlatformStrokeColor(strokeColor(), strokeColorSpace());
+        setPlatformStrokeThickness(strokeThickness());
 #if PLATFORM(IOS)
         }
 #endif
@@ -456,8 +457,7 @@
 }
 #endif
 
-// This method is only used to draw the little circles used in lists.
-void GraphicsContext::drawEllipse(const IntRect& rect)
+void GraphicsContext::drawEllipse(const FloatRect& rect)
 {
     if (paintingDisabled())
         return;
@@ -467,31 +467,6 @@
     drawPath(path);
 }
 
-#if PLATFORM(IOS)
-void GraphicsContext::drawEllipse(const FloatRect& rect)
-{
-    if (paintingDisabled())
-        return;
-
-    CGContextRef context(platformContext());
-
-    CGContextSaveGState(context);
-
-    setCGFillColor(context, fillColor(), fillColorSpace());
-    setCGStrokeColor(context, strokeColor(), strokeColorSpace());
-
-    CGContextSetLineWidth(context, strokeThickness());
-    
-    CGContextBeginPath(context);
-    CGContextAddEllipseInRect(context, rect);
-
-    CGContextFillPath(context);
-    CGContextStrokePath(context);
-    
-    CGContextRestoreGState(context);
-}
-#endif
-
 static void addConvexPolygonToPath(Path& path, size_t numberOfPoints, const FloatPoint* points)
 {
     ASSERT(numberOfPoints > 0);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to