Remove duplicate implementation of drawEllipse and some related PLATFORM(IOS) ifdefs
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 31 Aug 2014 22:03:50 +0000 (22:03 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 31 Aug 2014 22:03:50 +0000 (22:03 +0000)
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.

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

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/GraphicsContext.cpp
Source/WebCore/platform/graphics/GraphicsContext.h
Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp
Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp

index b910f34..e7a51c5 100644 (file)
@@ -1,5 +1,31 @@
 2014-08-31  Tim Horton  <timothy_horton@apple.com>
 
+        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  <timothy_horton@apple.com>
+
         Fix a harmless mismerge in BitmapImage::destroyDecodedDataIfNecessary
         https://bugs.webkit.org/show_bug.cgi?id=136412
 
index 0468397..6eb1216 100644 (file)
@@ -148,7 +148,6 @@ void GraphicsContext::restore()
     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 @@ void GraphicsContext::drawRaisedEllipse(const FloatRect& rect, const Color& elli
 
     restore();
 }
-#endif
 
 void GraphicsContext::setStrokeThickness(float thickness)
 {
index af5a05b..e3292c2 100644 (file)
@@ -309,11 +309,8 @@ namespace WebCore {
         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&);
index db73c03..cbf1822 100644 (file)
@@ -344,7 +344,7 @@ void GraphicsContext::drawLine(const FloatPoint& point1, const FloatPoint& point
 }
 
 // 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;
index b0a05d5..7a2fa24 100644 (file)
@@ -134,6 +134,7 @@ void GraphicsContext::platformInit(CGContextRef cgContext, bool shouldUseContext
         // 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 @@ void GraphicsContext::drawJoinedLines(CGPoint points[], unsigned count, bool ant
 }
 #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 @@ void GraphicsContext::drawEllipse(const IntRect& rect)
     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);