Title: [213437] trunk/Source/WebCore
Revision
213437
Author
aes...@apple.com
Date
2017-03-05 12:31:06 -0800 (Sun, 05 Mar 2017)

Log Message

Add support for canvas.toBlob
https://bugs.webkit.org/show_bug.cgi?id=148878

Reviewed by Tim Horton.

Address additional review feedback received after r213412 landed.

* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::toBlob): Passed null to the blob callback if blob conversion
fails for any reason.
* platform/graphics/cg/ImageBufferCG.cpp:
(WebCore::cgImage): Removed an unnecessary local variable.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (213436 => 213437)


--- trunk/Source/WebCore/ChangeLog	2017-03-05 20:14:02 UTC (rev 213436)
+++ trunk/Source/WebCore/ChangeLog	2017-03-05 20:31:06 UTC (rev 213437)
@@ -238,6 +238,21 @@
 
         Add support for canvas.toBlob
         https://bugs.webkit.org/show_bug.cgi?id=148878
+
+        Reviewed by Tim Horton.
+
+        Address additional review feedback received after r213412 landed.
+
+        * html/HTMLCanvasElement.cpp:
+        (WebCore::HTMLCanvasElement::toBlob): Passed null to the blob callback if blob conversion
+        fails for any reason.
+        * platform/graphics/cg/ImageBufferCG.cpp:
+        (WebCore::cgImage): Removed an unnecessary local variable.
+
+2017-03-03  Andy Estes  <aes...@apple.com>
+
+        Add support for canvas.toBlob
+        https://bugs.webkit.org/show_bug.cgi?id=148878
         <rdar://problem/22590406>
 
         Reviewed by Tim Horton.

Modified: trunk/Source/WebCore/html/HTMLCanvasElement.cpp (213436 => 213437)


--- trunk/Source/WebCore/html/HTMLCanvasElement.cpp	2017-03-05 20:14:02 UTC (rev 213436)
+++ trunk/Source/WebCore/html/HTMLCanvasElement.cpp	2017-03-05 20:31:06 UTC (rev 213437)
@@ -504,8 +504,11 @@
 
 #if USE(CG)
     if (auto imageData = getImageData()) {
+        RefPtr<Blob> blob;
         Vector<uint8_t> blobData = data(*imageData, encodingMIMEType, quality);
-        callback->scheduleCallback(context, Blob::create(WTFMove(blobData), encodingMIMEType));
+        if (!blobData.isEmpty())
+            blob = Blob::create(WTFMove(blobData), encodingMIMEType);
+        callback->scheduleCallback(context, WTFMove(blob));
         return { };
     }
 #endif
@@ -512,8 +515,11 @@
 
     makeRenderingResultsAvailable();
 
+    RefPtr<Blob> blob;
     Vector<uint8_t> blobData = buffer()->toData(encodingMIMEType, quality);
-    callback->scheduleCallback(context, Blob::create(WTFMove(blobData), encodingMIMEType));
+    if (!blobData.isEmpty())
+        blob = Blob::create(WTFMove(blobData), encodingMIMEType);
+    callback->scheduleCallback(context, WTFMove(blob));
     return { };
 }
 

Modified: trunk/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp (213436 => 213437)


--- trunk/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp	2017-03-05 20:14:02 UTC (rev 213436)
+++ trunk/Source/WebCore/platform/graphics/cg/ImageBufferCG.cpp	2017-03-05 20:31:06 UTC (rev 213437)
@@ -610,8 +610,7 @@
     if (!dataProvider)
         return nullptr;
 
-    auto image = adoptCF(CGImageCreate(source.width(), source.height(), 8, 32, 4 * source.width(), sRGBColorSpaceRef(), kCGBitmapByteOrderDefault | dataAlphaInfo, dataProvider.get(), 0, false, kCGRenderingIntentDefault));
-    return image;
+    return adoptCF(CGImageCreate(source.width(), source.height(), 8, 32, 4 * source.width(), sRGBColorSpaceRef(), kCGBitmapByteOrderDefault | dataAlphaInfo, dataProvider.get(), 0, false, kCGRenderingIntentDefault));
 }
 
 String dataURL(const ImageData& source, const String& mimeType, std::optional<double> quality)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to