Title: [92482] branches/chromium/835/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp
Revision
92482
Author
[email protected]
Date
2011-08-05 09:27:43 -0700 (Fri, 05 Aug 2011)

Log Message

Merge 92388 - Set graphics context current before canvas.toDataURL().
https://bugs.webkit.org/show_bug.cgi?id=65700

Reviewed by James Robinson.

No new tests, unfortunately.  The test infrastucture doesn't seem
to be conducive to writing multiple-context tests.

* platform/graphics/skia/ImageBufferSkia.cpp:
(WebCore::ImageBuffer::toDataURL):


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

Modified Paths

Diff

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


--- branches/chromium/835/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp	2011-08-05 15:40:10 UTC (rev 92481)
+++ branches/chromium/835/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp	2011-08-05 16:27:43 UTC (rev 92482)
@@ -361,20 +361,9 @@
 
 String ImageBuffer::toDataURL(const String& mimeType, const double* quality) const
 {
+    m_context->platformContext()->makeGrContextCurrent();
     SkDevice* device = context()->platformContext()->canvas()->getDevice();
-    SkBitmap bitmap = device->accessBitmap(false);
-
-    // if we can't see the pixels directly, call readPixels() to get a copy.
-    // this could happen if the device is backed by a GPU.
-    bitmap.lockPixels(); // balanced by our destructor, or explicitly if getPixels() fails
-    if (!bitmap.getPixels()) {
-        bitmap.unlockPixels();
-        SkIRect bounds = SkIRect::MakeWH(device->width(), device->height());
-        if (!device->readPixels(bounds, &bitmap))
-            return "data:,";
-    }
-
-    return ImageToDataURL(bitmap, mimeType, quality);
+    return ImageToDataURL(device->accessBitmap(false), mimeType, quality);
 }
 
 String ImageDataToDataURL(const ImageData& source, const String& mimeType, const double* quality)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to