Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(292)

Unified Diff: Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp

Issue 7582010: Merge 92388 - Set graphics context current before canvas.toDataURL(). (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/835/
Patch Set: Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp
===================================================================
--- Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp (revision 92481)
+++ Source/WebCore/platform/graphics/skia/ImageBufferSkia.cpp (working copy)
@@ -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)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698