From 8b06471693b58479fceaf8070bc315b7523e88b7 Mon Sep 17 00:00:00 2001 From: "timothy_horton@apple.com" Date: Sun, 31 Aug 2014 22:03:50 +0000 Subject: [PATCH] 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. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@173149 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Source/WebCore/ChangeLog | 26 +++++++++++++++++ .../platform/graphics/GraphicsContext.cpp | 2 -- .../platform/graphics/GraphicsContext.h | 3 -- .../graphics/cairo/GraphicsContextCairo.cpp | 2 +- .../graphics/cg/GraphicsContextCG.cpp | 29 ++----------------- 5 files changed, 29 insertions(+), 33 deletions(-) diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index b910f34466f0..e7a51c527daf 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,29 @@ +2014-08-31 Tim Horton + + 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 Fix a harmless mismerge in BitmapImage::destroyDecodedDataIfNecessary diff --git a/Source/WebCore/platform/graphics/GraphicsContext.cpp b/Source/WebCore/platform/graphics/GraphicsContext.cpp index 0468397b2867..6eb1216428c6 100644 --- a/Source/WebCore/platform/graphics/GraphicsContext.cpp +++ b/Source/WebCore/platform/graphics/GraphicsContext.cpp @@ -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) { diff --git a/Source/WebCore/platform/graphics/GraphicsContext.h b/Source/WebCore/platform/graphics/GraphicsContext.h index af5a05b98aa0..e3292c279c8b 100644 --- a/Source/WebCore/platform/graphics/GraphicsContext.h +++ b/Source/WebCore/platform/graphics/GraphicsContext.h @@ -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&); diff --git a/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp b/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp index db73c030c171..cbf1822cd0b5 100644 --- a/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp +++ b/Source/WebCore/platform/graphics/cairo/GraphicsContextCairo.cpp @@ -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; diff --git a/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp b/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp index b0a05d599c8c..7a2fa24c851d 100644 --- a/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp +++ b/Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp @@ -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); -- 2.36.0