Title: [142123] trunk/Source/WebCore
Revision
142123
Author
[email protected]
Date
2013-02-07 07:53:50 -0800 (Thu, 07 Feb 2013)

Log Message

GraphicsContext::drawImageBuffer is inefficient
https://bugs.webkit.org/show_bug.cgi?id=104367

Reviewed by Dirk Schulze.

This patch converts all of the drawImage and drawImageBuffer
convenience methods (those that take parameters of various types) to
invoke the implementing method (that takes FloatRect src and dest)
directly, rather than through the next-most-convenient method as was
done previously. This will knock some layers off the stack compared
to the existing code, and may remove one or two constructor invocations.
This may be slightly more efficient, and also makes debugging simpler.

Also removes the unused drawImage method that takes and IntRect source
area and IntRect destination. It is not invoked anywhere in a standard
WebKit checkout.

No new tests. No change in functionality, just refactoring.

* platform/graphics/GraphicsContext.cpp:
(WebCore::GraphicsContext::drawImage): Modify all the convenience versions to call
the implementing version directly.
(WebCore::GraphicsContext::drawImageBuffer): Modify all the convenience versions
to call the implementing version directly.
* platform/graphics/GraphicsContext.h:
(GraphicsContext): Remove IntRect, IntRect version of drawImage.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (142122 => 142123)


--- trunk/Source/WebCore/ChangeLog	2013-02-07 15:46:58 UTC (rev 142122)
+++ trunk/Source/WebCore/ChangeLog	2013-02-07 15:53:50 UTC (rev 142123)
@@ -1,3 +1,32 @@
+2013-02-07  Stephen Chenney  <[email protected]>
+
+        GraphicsContext::drawImageBuffer is inefficient
+        https://bugs.webkit.org/show_bug.cgi?id=104367
+
+        Reviewed by Dirk Schulze.
+
+        This patch converts all of the drawImage and drawImageBuffer
+        convenience methods (those that take parameters of various types) to
+        invoke the implementing method (that takes FloatRect src and dest)
+        directly, rather than through the next-most-convenient method as was
+        done previously. This will knock some layers off the stack compared
+        to the existing code, and may remove one or two constructor invocations.
+        This may be slightly more efficient, and also makes debugging simpler.
+
+        Also removes the unused drawImage method that takes and IntRect source
+        area and IntRect destination. It is not invoked anywhere in a standard
+        WebKit checkout.
+
+        No new tests. No change in functionality, just refactoring.
+
+        * platform/graphics/GraphicsContext.cpp:
+        (WebCore::GraphicsContext::drawImage): Modify all the convenience versions to call
+        the implementing version directly.
+        (WebCore::GraphicsContext::drawImageBuffer): Modify all the convenience versions
+        to call the implementing version directly.
+        * platform/graphics/GraphicsContext.h:
+        (GraphicsContext): Remove IntRect, IntRect version of drawImage.
+
 2013-02-07  Kent Tamura  <[email protected]>
 
         Conversion from localized numbers to HTML numbers should accept not only localized numbers but also HTML numbers

Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp (142122 => 142123)


--- trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp	2013-02-07 15:46:58 UTC (rev 142122)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp	2013-02-07 15:53:50 UTC (rev 142123)
@@ -450,29 +450,24 @@
 {
     if (!image)
         return;
-    drawImage(image, styleColorSpace, p, IntRect(IntPoint(), image->size()), op, shouldRespectImageOrientation);
+    drawImage(image, styleColorSpace, FloatRect(IntRect(p, image->size())), FloatRect(FloatPoint(), FloatSize(image->size())), op, shouldRespectImageOrientation);
 }
 
 void GraphicsContext::drawImage(Image* image, ColorSpace styleColorSpace, const IntRect& r, CompositeOperator op, RespectImageOrientationEnum shouldRespectImageOrientation, bool useLowQualityScale)
 {
     if (!image)
         return;
-    drawImage(image, styleColorSpace, r, IntRect(IntPoint(), image->size()), op, shouldRespectImageOrientation, useLowQualityScale);
+    drawImage(image, styleColorSpace, FloatRect(r), FloatRect(FloatPoint(), FloatSize(image->size())), op, shouldRespectImageOrientation, useLowQualityScale);
 }
 
 void GraphicsContext::drawImage(Image* image, ColorSpace styleColorSpace, const IntPoint& dest, const IntRect& srcRect, CompositeOperator op, RespectImageOrientationEnum shouldRespectImageOrientation)
 {
-    drawImage(image, styleColorSpace, IntRect(dest, srcRect.size()), srcRect, op, shouldRespectImageOrientation);
+    drawImage(image, styleColorSpace, FloatRect(IntRect(dest, srcRect.size())), FloatRect(srcRect), op, shouldRespectImageOrientation);
 }
 
-void GraphicsContext::drawImage(Image* image, ColorSpace styleColorSpace, const IntRect& dest, const IntRect& srcRect, CompositeOperator op, RespectImageOrientationEnum shouldRespectImageOrientation, bool useLowQualityScale)
-{
-    drawImage(image, styleColorSpace, FloatRect(dest), srcRect, op, shouldRespectImageOrientation, useLowQualityScale);
-}
-
 void GraphicsContext::drawImage(Image* image, ColorSpace styleColorSpace, const FloatRect& dest, const FloatRect& src, CompositeOperator op, RespectImageOrientationEnum shouldRespectImageOrientation, bool useLowQualityScale)
 {
-    drawImage(image, styleColorSpace, FloatRect(dest), src, op, BlendModeNormal, shouldRespectImageOrientation, useLowQualityScale);
+    drawImage(image, styleColorSpace, dest, src, op, BlendModeNormal, shouldRespectImageOrientation, useLowQualityScale);
 }
 
 void GraphicsContext::drawImage(Image* image, ColorSpace styleColorSpace, const FloatRect& dest)
@@ -543,24 +538,24 @@
 {
     if (!image)
         return;
-    drawImageBuffer(image, styleColorSpace, p, IntRect(IntPoint(), image->logicalSize()), op, blendMode);
+    drawImageBuffer(image, styleColorSpace, FloatRect(IntRect(p, image->logicalSize())), FloatRect(FloatPoint(), FloatSize(image->logicalSize())), op, blendMode);
 }
 
 void GraphicsContext::drawImageBuffer(ImageBuffer* image, ColorSpace styleColorSpace, const IntRect& r, CompositeOperator op, BlendMode blendMode, bool useLowQualityScale)
 {
     if (!image)
         return;
-    drawImageBuffer(image, styleColorSpace, r, IntRect(IntPoint(), image->logicalSize()), op, blendMode, useLowQualityScale);
+    drawImageBuffer(image, styleColorSpace, FloatRect(r), FloatRect(FloatPoint(), FloatSize(image->logicalSize())), op, blendMode, useLowQualityScale);
 }
 
 void GraphicsContext::drawImageBuffer(ImageBuffer* image, ColorSpace styleColorSpace, const IntPoint& dest, const IntRect& srcRect, CompositeOperator op, BlendMode blendMode)
 {
-    drawImageBuffer(image, styleColorSpace, IntRect(dest, srcRect.size()), srcRect, op, blendMode);
+    drawImageBuffer(image, styleColorSpace, FloatRect(IntRect(dest, srcRect.size())), FloatRect(srcRect), op, blendMode);
 }
 
 void GraphicsContext::drawImageBuffer(ImageBuffer* image, ColorSpace styleColorSpace, const IntRect& dest, const IntRect& srcRect, CompositeOperator op, BlendMode blendMode, bool useLowQualityScale)
 {
-    drawImageBuffer(image, styleColorSpace, FloatRect(dest), srcRect, op, blendMode, useLowQualityScale);
+    drawImageBuffer(image, styleColorSpace, FloatRect(dest), FloatRect(srcRect), op, blendMode, useLowQualityScale);
 }
 
 void GraphicsContext::drawImageBuffer(ImageBuffer* image, ColorSpace styleColorSpace, const FloatRect& dest)

Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext.h (142122 => 142123)


--- trunk/Source/WebCore/platform/graphics/GraphicsContext.h	2013-02-07 15:46:58 UTC (rev 142122)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext.h	2013-02-07 15:53:50 UTC (rev 142123)
@@ -321,7 +321,6 @@
         void drawImage(Image*, ColorSpace styleColorSpace, const IntPoint&, CompositeOperator = CompositeSourceOver, RespectImageOrientationEnum = DoNotRespectImageOrientation);
         void drawImage(Image*, ColorSpace styleColorSpace, const IntRect&, CompositeOperator = CompositeSourceOver, RespectImageOrientationEnum = DoNotRespectImageOrientation, bool useLowQualityScale = false);
         void drawImage(Image*, ColorSpace styleColorSpace, const IntPoint& destPoint, const IntRect& srcRect, CompositeOperator = CompositeSourceOver, RespectImageOrientationEnum = DoNotRespectImageOrientation);
-        void drawImage(Image*, ColorSpace styleColorSpace, const IntRect& destRect, const IntRect& srcRect, CompositeOperator = CompositeSourceOver, RespectImageOrientationEnum = DoNotRespectImageOrientation, bool useLowQualityScale = false);
         void drawImage(Image*, ColorSpace styleColorSpace, const FloatRect& destRect);
         void drawImage(Image*, ColorSpace styleColorSpace, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator = CompositeSourceOver, RespectImageOrientationEnum = DoNotRespectImageOrientation, bool useLowQualityScale = false);
         void drawImage(Image*, ColorSpace styleColorSpace, const FloatRect& destRect, const FloatRect& srcRect, CompositeOperator, BlendMode, RespectImageOrientationEnum = DoNotRespectImageOrientation, bool useLowQualityScale = false);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to