Title: [92296] branches/chromium/835/Source/WebCore
Revision
92296
Author
[email protected]
Date
2011-08-03 11:38:40 -0700 (Wed, 03 Aug 2011)

Log Message

Merge 91870 - Fix for printing with accelerated <canvas>
https://bugs.webkit.org/show_bug.cgi?id=62406

Reviewed by James Robinson.

The platform-independent side of this should be covered by existing
tests.  Printing itself in Chrome has few tests, sadly.  :(

* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::paint):
* platform/graphics/skia/ImageBufferSkia.cpp:
(WebCore::ImageBuffer::draw):


[email protected]
Review URL: http://codereview.chromium.org/7564022

Modified Paths

Diff

Modified: branches/chromium/835/Source/WebCore/html/HTMLCanvasElement.cpp (92295 => 92296)


--- branches/chromium/835/Source/WebCore/html/HTMLCanvasElement.cpp	2011-08-03 18:38:26 UTC (rev 92295)
+++ branches/chromium/835/Source/WebCore/html/HTMLCanvasElement.cpp	2011-08-03 18:38:40 UTC (rev 92296)
@@ -281,7 +281,7 @@
         return;
     
     if (m_context) {
-        if (!m_context->paintsIntoCanvasBuffer())
+        if (!m_context->paintsIntoCanvasBuffer() && !document()->printing())
             return;
         m_context->paintRenderingResultsToCanvas();
     }

Modified: branches/chromium/835/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp (92295 => 92296)


--- branches/chromium/835/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp	2011-08-03 18:38:26 UTC (rev 92295)
+++ branches/chromium/835/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp	2011-08-03 18:38:40 UTC (rev 92296)
@@ -112,8 +112,12 @@
 void ImageBuffer::draw(GraphicsContext* context, ColorSpace styleColorSpace, const FloatRect& destRect, const FloatRect& srcRect,
                        CompositeOperator op, bool useLowQualityScale)
 {
+    m_context->platformContext()->makeGrContextCurrent();
+    SkDevice* srcDevice = m_context->platformContext()->canvas()->getDevice();
+    SkBitmap bitmap = srcDevice->accessBitmap(false);
+    SkAutoLockPixels bitmapLock(bitmap);
     context->platformContext()->makeGrContextCurrent();
-    RefPtr<Image> image = BitmapImageSingleFrameSkia::create(*m_data.m_platformContext.bitmap(), context == m_context);
+    RefPtr<Image> image = BitmapImageSingleFrameSkia::create(bitmap, context == m_context);
     context->drawImage(image.get(), styleColorSpace, destRect, srcRect, op, useLowQualityScale);
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to