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

Unified Diff: third_party/WebKit/LayoutTests/fast/canvas/imagebitmap/transferFromImageBitmap-drawImage.html

Issue 2267653005: Resolving drawImage issue with canvases that contain bitmap images (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Resolving the conflict with DCHECK on canvas type. Created 4 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 | third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/fast/canvas/imagebitmap/transferFromImageBitmap-drawImage.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/imagebitmap/transferFromImageBitmap-drawImage.html b/third_party/WebKit/LayoutTests/fast/canvas/imagebitmap/transferFromImageBitmap-drawImage.html
new file mode 100644
index 0000000000000000000000000000000000000000..925ba43815a859f3138f6058a1b874e5dcbc1a94
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/canvas/imagebitmap/transferFromImageBitmap-drawImage.html
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script>
+
+function testCanvas_0f0(ctx) {
+ var colorData = ctx.getImageData(50, 50, 1, 1).data;
+ assert_equals(colorData[0], 0);
+ assert_equals(colorData[1], 255);
+ assert_equals(colorData[2], 0);
+ assert_equals(colorData[3], 255);
+}
+
+function testDrawCanvasWithImageBitamp(image) {
+ var dstCanvas = document.createElement('canvas');
+ dstCanvas.width = dstCanvas.height = 100;
+ var dstCtx = dstCanvas.getContext('bitmaprenderer');
+ dstCtx.transferFromImageBitmap(image);
+
+ var myCanvas = document.createElement('canvas');
+ myCanvas.width = myCanvas.height = 100;
+ var myCtx = myCanvas.getContext('2d');
+ myCtx.drawImage(dstCanvas, 10, 10);
+ testCanvas_0f0(myCtx);
+}
+
+promise_test(function() {
+ var canvas = document.createElement('canvas');
+ canvas.width = canvas.height = 100;
+ var ctx = canvas.getContext('2d');
+ ctx.fillStyle = '#0f0';
+ ctx.fillRect(0, 0, 100, 100);
+ testCanvas_0f0(ctx);
+
+ return createImageBitmap(canvas).then(testDrawCanvasWithImageBitamp);
+}, 'testDrawCanvasWithImageBitamp should not return any error');
+
+</script>
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698