Title: [92388] trunk/Source/WebCore
Revision
92388
Author
[email protected]
Date
2011-08-04 11:00:41 -0700 (Thu, 04 Aug 2011)

Log Message

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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (92387 => 92388)


--- trunk/Source/WebCore/ChangeLog	2011-08-04 17:52:20 UTC (rev 92387)
+++ trunk/Source/WebCore/ChangeLog	2011-08-04 18:00:41 UTC (rev 92388)
@@ -1,3 +1,16 @@
+2011-08-04  Stephen White  <[email protected]>
+
+        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):
+
 2011-08-01  Brian Weinstein  <[email protected]>
 
         WebKit2: Web Inspector always starts in undocked mode

Modified: trunk/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp (92387 => 92388)


--- trunk/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp	2011-08-04 17:52:20 UTC (rev 92387)
+++ trunk/Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp	2011-08-04 18:00:41 UTC (rev 92388)
@@ -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