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

Unified Diff: third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-2d-drawImage-no-context.html

Issue 2550443002: Fix a minor issue in OffscreenCanvas.drawImage (Closed)
Patch Set: address comments Created 4 years 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/offscreencanvas/OffscreenCanvas.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/OffscreenCanvas-2d-drawImage-no-context.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-2d-drawImage-no-context.html b/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-2d-drawImage-no-context.html
new file mode 100644
index 0000000000000000000000000000000000000000..e44e9b3c37d21994b47f6408d37fb7ca582e4aa4
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-2d-drawImage-no-context.html
@@ -0,0 +1,22 @@
+<!DOCTYPE HTML>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script>
+test(function() {
+ var offscreenCanvas = new OffscreenCanvas(100, 50);
+ var ctx = offscreenCanvas.getContext('2d');
+ ctx.fillStyle = "#0f0";
+ ctx.fillRect(0, 0, 100, 50);
+ // The default globalCompositeOperation is source-over, that that will
+ // draw nothing in the next drawImage call. So we have to change it to copy
+ // so that it will actually draw transparent black in the next drawImage
+ // call.
+ ctx.globalCompositeOperation = 'copy';
+
+ var offscreenCanvas2 = new OffscreenCanvas(100, 50);
+ ctx.drawImage(offscreenCanvas2, 0, 0);
+
+ var clr = ctx.getImageData(50, 25, 1, 1).data;
+ assert_array_equals(clr, [0, 0, 0, 0]);
+}, 'Use OffscreenCanvas without a context as ImageSource should draw transparent black');
+</script>
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/offscreencanvas/OffscreenCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698