Title: [106095] trunk/Source/WebCore
Revision
106095
Author
mdela...@apple.com
Date
2012-01-26 23:23:22 -0800 (Thu, 26 Jan 2012)

Log Message

ImageBuffer::draw should deep copy if drawing to an accelerated context
https://bugs.webkit.org/show_bug.cgi?id=77185

Reviewed by Simon Fraser.

No new tests since any test for this issue would be flaky at best.

* platform/graphics/cg/ImageBufferCG.cpp: Deep copy when drawing ourself into
    an accelerated context for both draw and drawPattern.
(WebCore::ImageBuffer::draw):
(WebCore::ImageBuffer::drawPattern):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (106094 => 106095)


--- trunk/Source/WebCore/ChangeLog	2012-01-27 07:19:13 UTC (rev 106094)
+++ trunk/Source/WebCore/ChangeLog	2012-01-27 07:23:22 UTC (rev 106095)
@@ -1,3 +1,17 @@
+2012-01-26  Matthew Delaney  <mdela...@apple.com>
+
+        ImageBuffer::draw should deep copy if drawing to an accelerated context
+        https://bugs.webkit.org/show_bug.cgi?id=77185
+
+        Reviewed by Simon Fraser.
+
+        No new tests since any test for this issue would be flaky at best.
+
+        * platform/graphics/cg/ImageBufferCG.cpp: Deep copy when drawing ourself into
+            an accelerated context for both draw and drawPattern.
+        (WebCore::ImageBuffer::draw):
+        (WebCore::ImageBuffer::drawPattern):
+
 2012-01-26  Kevin Ollivier  <kev...@theolliviers.com>
 
         [wx] Unreviewed. Build fixes.

Modified: trunk/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp (106094 => 106095)


--- trunk/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp	2012-01-27 07:19:13 UTC (rev 106094)
+++ trunk/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp	2012-01-27 07:23:22 UTC (rev 106095)
@@ -241,7 +241,7 @@
     ColorSpace colorSpace = (destContext == m_context) ? ColorSpaceDeviceRGB : styleColorSpace;
 
     RetainPtr<CGImageRef> image;
-    if (destContext == m_context)
+    if (destContext == m_context || destContext->isAcceleratedContext())
         image.adoptCF(copyNativeImage(CopyBackingStore)); // Drawing into our own buffer, need to deep copy.
     else
         image.adoptCF(copyNativeImage(DontCopyBackingStore));
@@ -249,19 +249,19 @@
     destContext->drawNativeImage(image.get(), m_size, colorSpace, destRect, srcRect, op);
 }
 
-void ImageBuffer::drawPattern(GraphicsContext* context, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator op, const FloatRect& destRect)
+void ImageBuffer::drawPattern(GraphicsContext* destContext, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, ColorSpace styleColorSpace, CompositeOperator op, const FloatRect& destRect)
 {
     if (!m_context->isAcceleratedContext()) {
-        if (context == m_context) {
+        if (destContext == m_context || destContext->isAcceleratedContext()) {
             RefPtr<Image> copy = copyImage(CopyBackingStore); // Drawing into our own buffer, need to deep copy.
-            copy->drawPattern(context, srcRect, patternTransform, phase, styleColorSpace, op, destRect);
+            copy->drawPattern(destContext, srcRect, patternTransform, phase, styleColorSpace, op, destRect);
         } else {
             RefPtr<Image> imageForRendering = copyImage(DontCopyBackingStore);
-            imageForRendering->drawPattern(context, srcRect, patternTransform, phase, styleColorSpace, op, destRect);
+            imageForRendering->drawPattern(destContext, srcRect, patternTransform, phase, styleColorSpace, op, destRect);
         }
     } else {
         RefPtr<Image> copy = copyImage(CopyBackingStore);
-        copy->drawPattern(context, srcRect, patternTransform, phase, styleColorSpace, op, destRect);
+        copy->drawPattern(destContext, srcRect, patternTransform, phase, styleColorSpace, op, destRect);
     }
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to