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

Unified Diff: third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-transferToImageBitmap-state-persistency.html

Issue 1995733005: Fix 2D canvas state persistency after OffscreenCanvas.transferToImageBitmap (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix test Created 4 years, 7 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/LayoutTests/fast/canvas/OffscreenCanvas-transferToImageBitmap-state-persistency-expected.txt » ('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-transferToImageBitmap-state-persistency.html
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-transferToImageBitmap-state-persistency.html b/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-transferToImageBitmap-state-persistency.html
new file mode 100644
index 0000000000000000000000000000000000000000..186646c1af469bac34dc47945923e374aa59ec00
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-transferToImageBitmap-state-persistency.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<script src="../../resources/js-test.js"></script>
+<script>
+var aCanvas = new OffscreenCanvas(50, 50);
+var ctx = aCanvas.getContext('2d');
+
+ctx.rect(0, 0, 25, 50);
+ctx.clip();
+ctx.translate(20, 20);
+// Verify backing is reset through transferToImageBitmap()
+ctx.fillStyle = '#0f0';
+var firstImage = aCanvas.transferToImageBitmap();
+// trasnform should be preserved
+ctx.fillRect(0, 0, 10, 10);
+var secondImage = aCanvas.transferToImageBitmap();
+
+var testCanvas = document.createElement('canvas');
+var testCtx = testCanvas.getContext('2d');
+testCtx.drawImage(secondImage, 0, 0);
+// Verify that transform was carried over.
+var imgData = testCtx.getImageData(23, 25, 1, 1).data;
+shouldBe("imgData[0]", "0");
+shouldBe("imgData[1]", "255");
+shouldBe("imgData[2]", "0");
+shouldBe("imgData[3]", "255");
+// Verify that clip was carried over.
+var imgData = testCtx.getImageData(27, 25, 1, 1).data;
+shouldBe("imgData[0]", "0");
+shouldBe("imgData[1]", "0");
+shouldBe("imgData[2]", "0");
+shouldBe("imgData[3]", "0");
+</script>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-transferToImageBitmap-state-persistency-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698