Title: [122598] trunk/Source/WebCore
Revision
122598
Author
[email protected]
Date
2012-07-13 10:19:28 -0700 (Fri, 13 Jul 2012)

Log Message

Remove down-casting to BitmapImage in GraphicsContext::drawImage.
https://bugs.webkit.org/show_bug.cgi?id=90755

Patch by Huang Dongsung <[email protected]> on 2012-07-13
Reviewed by Simon Fraser.

Add a BitmapImage draw method which takes RespectImageOrientationEnum enum as
the last argument for CG. Then we can remove the conditional down-casting in
GraphicsContext::drawImage.

This change is needed for parallel image decoders. Because parallel image
decoders use a Bitmap image wrapper class which extends Image (not Bitmap), the
down-casting above causes the loss of RespectImageOrientationEnum which must be
passed to BitmapImage.

No new tests, no behavior change.

* platform/graphics/BitmapImage.cpp:
* platform/graphics/BitmapImage.h:
* platform/graphics/GraphicsContext.cpp:
(WebCore::GraphicsContext::drawImage):
* platform/graphics/Image.cpp:
(WebCore::Image::draw):
(WebCore):
* platform/graphics/Image.h:
(Image):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (122597 => 122598)


--- trunk/Source/WebCore/ChangeLog	2012-07-13 17:09:03 UTC (rev 122597)
+++ trunk/Source/WebCore/ChangeLog	2012-07-13 17:19:28 UTC (rev 122598)
@@ -1,3 +1,31 @@
+2012-07-13  Huang Dongsung  <[email protected]>
+
+        Remove down-casting to BitmapImage in GraphicsContext::drawImage.
+        https://bugs.webkit.org/show_bug.cgi?id=90755
+
+        Reviewed by Simon Fraser.
+
+        Add a BitmapImage draw method which takes RespectImageOrientationEnum enum as
+        the last argument for CG. Then we can remove the conditional down-casting in
+        GraphicsContext::drawImage.
+
+        This change is needed for parallel image decoders. Because parallel image
+        decoders use a Bitmap image wrapper class which extends Image (not Bitmap), the
+        down-casting above causes the loss of RespectImageOrientationEnum which must be
+        passed to BitmapImage.
+
+        No new tests, no behavior change.
+
+        * platform/graphics/BitmapImage.cpp:
+        * platform/graphics/BitmapImage.h:
+        * platform/graphics/GraphicsContext.cpp:
+        (WebCore::GraphicsContext::drawImage):
+        * platform/graphics/Image.cpp:
+        (WebCore::Image::draw):
+        (WebCore):
+        * platform/graphics/Image.h:
+        (Image):
+
 2012-07-13  Lauro Neto  <[email protected]>
 
         Fix QtWebKit build with OpenGLES after GC3D/E3D refactor

Modified: trunk/Source/WebCore/platform/graphics/BitmapImage.cpp (122597 => 122598)


--- trunk/Source/WebCore/platform/graphics/BitmapImage.cpp	2012-07-13 17:09:03 UTC (rev 122597)
+++ trunk/Source/WebCore/platform/graphics/BitmapImage.cpp	2012-07-13 17:19:28 UTC (rev 122598)
@@ -563,11 +563,4 @@
     return m_solidColor;
 }
 
-#if !USE(CG)
-void BitmapImage::draw(GraphicsContext* ctx, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator op, RespectImageOrientationEnum)
-{
-    draw(ctx, dstRect, srcRect, styleColorSpace, op);
 }
-#endif
-
-}

Modified: trunk/Source/WebCore/platform/graphics/BitmapImage.h (122597 => 122598)


--- trunk/Source/WebCore/platform/graphics/BitmapImage.h	2012-07-13 17:09:03 UTC (rev 122597)
+++ trunk/Source/WebCore/platform/graphics/BitmapImage.h	2012-07-13 17:19:28 UTC (rev 122598)
@@ -199,7 +199,9 @@
     virtual void drawFrameMatchingSourceSize(GraphicsContext*, const FloatRect& dstRect, const IntSize& srcSize, ColorSpace styleColorSpace, CompositeOperator);
 #endif
     virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator);
-    void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator, RespectImageOrientationEnum);
+#if USE(CG)
+    virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator, RespectImageOrientationEnum);
+#endif
 
 #if (OS(WINCE) && !PLATFORM(QT))
     virtual void drawPattern(GraphicsContext*, const FloatRect& srcRect, const AffineTransform& patternTransform,

Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp (122597 => 122598)


--- trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp	2012-07-13 17:09:03 UTC (rev 122597)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext.cpp	2012-07-13 17:19:28 UTC (rev 122598)
@@ -490,10 +490,7 @@
 #endif
     }
 
-    if (image->isBitmapImage())
-        static_cast<BitmapImage*>(image)->draw(this, FloatRect(dest.location(), FloatSize(tw, th)), FloatRect(src.location(), FloatSize(tsw, tsh)), styleColorSpace, op, shouldRespectImageOrientation);
-    else
-        image->draw(this, FloatRect(dest.location(), FloatSize(tw, th)), FloatRect(src.location(), FloatSize(tsw, tsh)), styleColorSpace, op);
+    image->draw(this, FloatRect(dest.location(), FloatSize(tw, th)), FloatRect(src.location(), FloatSize(tsw, tsh)), styleColorSpace, op, shouldRespectImageOrientation);
 
     if (useLowQualityScale)
         setImageInterpolationQuality(previousInterpolationQuality);

Modified: trunk/Source/WebCore/platform/graphics/Image.cpp (122597 => 122598)


--- trunk/Source/WebCore/platform/graphics/Image.cpp	2012-07-13 17:09:03 UTC (rev 122597)
+++ trunk/Source/WebCore/platform/graphics/Image.cpp	2012-07-13 17:19:28 UTC (rev 122598)
@@ -89,6 +89,11 @@
     ctxt->setCompositeOperation(previousOperator);
 }
 
+void Image::draw(GraphicsContext* ctx, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator op, RespectImageOrientationEnum)
+{
+    draw(ctx, dstRect, srcRect, styleColorSpace, op);
+}
+
 void Image::drawTiled(GraphicsContext* ctxt, const FloatRect& destRect, const FloatPoint& srcPoint, const FloatSize& scaledTileSize, ColorSpace styleColorSpace, CompositeOperator op)
 {    
     if (mayFillWithSolidColor()) {

Modified: trunk/Source/WebCore/platform/graphics/Image.h (122597 => 122598)


--- trunk/Source/WebCore/platform/graphics/Image.h	2012-07-13 17:09:03 UTC (rev 122597)
+++ trunk/Source/WebCore/platform/graphics/Image.h	2012-07-13 17:19:28 UTC (rev 122598)
@@ -181,6 +181,7 @@
     virtual void drawFrameMatchingSourceSize(GraphicsContext*, const FloatRect& dstRect, const IntSize& srcSize, ColorSpace styleColorSpace, CompositeOperator) { }
 #endif
     virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator) = 0;
+    virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, ColorSpace styleColorSpace, CompositeOperator, RespectImageOrientationEnum);
     void drawTiled(GraphicsContext*, const FloatRect& dstRect, const FloatPoint& srcPoint, const FloatSize& tileSize, ColorSpace styleColorSpace, CompositeOperator);
     void drawTiled(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, const FloatSize& tileScaleFactor, TileRule hRule, TileRule vRule, ColorSpace styleColorSpace, CompositeOperator);
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to