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

Unified Diff: Source/core/html/HTMLCanvasElement.cpp

Issue 1302423004: Support lossy and lossless <canvas>.toDataURL for webp (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Patch for landing. Created 5 years, 3 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 | « LayoutTests/fast/canvas/toDataURL-supportedTypes.html ('k') | Source/platform/MIMETypeRegistry.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLCanvasElement.cpp
diff --git a/Source/core/html/HTMLCanvasElement.cpp b/Source/core/html/HTMLCanvasElement.cpp
index 492c0912d8324e6ebe948f49ab2677f6f9dea79e..235a4d9c1d175cb9e60987a11636150ceb70ff37 100644
--- a/Source/core/html/HTMLCanvasElement.cpp
+++ b/Source/core/html/HTMLCanvasElement.cpp
@@ -564,16 +564,14 @@ void HTMLCanvasElement::toBlob(FileCallback* callback, const String& mimeType, c
}
}
- String encodingMimeType = toEncodingMimeType(mimeType);
-
ImageData* imageData = toImageData(BackBuffer);
ScopedDisposal<ImageData> disposer(imageData);
- // Perform image encoding
Vector<char> encodedImage;
- ImageDataBuffer(imageData->size(), imageData->data()->data()).encodeImage(encodingMimeType, qualityPtr, &encodedImage);
- resultBlob = File::create(encodedImage.data(), encodedImage.size(), encodingMimeType);
+ String encodedMimeType;
+ ImageDataBuffer(imageData->size(), imageData->data()->data()).encodeImage(toEncodingMimeType(mimeType), qualityPtr, &encodedImage, &encodedMimeType);
+ resultBlob = File::create(encodedImage.data(), encodedImage.size(), encodedMimeType);
Platform::current()->mainThread()->postTask(FROM_HERE, bind(&FileCallback::handleEvent, callback, resultBlob));
}
« no previous file with comments | « LayoutTests/fast/canvas/toDataURL-supportedTypes.html ('k') | Source/platform/MIMETypeRegistry.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698