Title: [91870] trunk/Source/WebCore
- Revision
- 91870
- Author
- [email protected]
- Date
- 2011-07-27 14:50:57 -0700 (Wed, 27 Jul 2011)
Log Message
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):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (91869 => 91870)
--- trunk/Source/WebCore/ChangeLog 2011-07-27 21:44:49 UTC (rev 91869)
+++ trunk/Source/WebCore/ChangeLog 2011-07-27 21:50:57 UTC (rev 91870)
@@ -1,3 +1,18 @@
+2011-07-27 Stephen White <[email protected]>
+
+ 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):
+
2011-07-25 Mihai Parparita <[email protected]>
[Chromium] Add better WebKit API for chrome.tabs.insertCSS extension API
Modified: trunk/Source/WebCore/html/HTMLCanvasElement.cpp (91869 => 91870)
--- trunk/Source/WebCore/html/HTMLCanvasElement.cpp 2011-07-27 21:44:49 UTC (rev 91869)
+++ trunk/Source/WebCore/html/HTMLCanvasElement.cpp 2011-07-27 21:50:57 UTC (rev 91870)
@@ -281,7 +281,7 @@
return;
if (m_context) {
- if (!m_context->paintsIntoCanvasBuffer())
+ if (!m_context->paintsIntoCanvasBuffer() && !document()->printing())
return;
m_context->paintRenderingResultsToCanvas();
}
Modified: trunk/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp (91869 => 91870)
--- trunk/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp 2011-07-27 21:44:49 UTC (rev 91869)
+++ trunk/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp 2011-07-27 21:50:57 UTC (rev 91870)
@@ -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