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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-drawImage-video-with-options.html

Issue 1609763002: Implement ImageBitmap options premultiplyAlpha (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 unified diff | Download patch
OLDNEW
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../../resources/js-test.js"></script> 4 <script src="../../resources/js-test.js"></script>
5 </head> 5 </head>
6 <body> 6 <body>
7 <script> 7 <script>
8 8
9 description("Ensure correct behavior of drawImage with ImageBitmaps from video e lements."); 9 description("Ensure correct behavior of drawImage with ImageBitmaps from video e lements.");
10 window.jsTestIsAsync = true; 10 window.jsTestIsAsync = true;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 canvas.setAttribute("width", "500"); 50 canvas.setAttribute("width", "500");
51 canvas.setAttribute("height", "500"); 51 canvas.setAttribute("height", "500");
52 var ctx = canvas.getContext("2d"); 52 var ctx = canvas.getContext("2d");
53 53
54 video = document.createElement("video"); 54 video = document.createElement("video");
55 video.addEventListener("canplaythrough", videoLoaded, false); 55 video.addEventListener("canplaythrough", videoLoaded, false);
56 video.src = "../../compositing/resources/video.ogv"; 56 video.src = "../../compositing/resources/video.ogv";
57 57
58 function videoLoaded() { 58 function videoLoaded() {
59 var imageBitmaps = {}; 59 var imageBitmaps = {};
60 var p1 = createImageBitmap(video).then(function (image) { imageBitmaps.noCro p = image }); 60 var p1 = createImageBitmap(video, {'premultiplyAlpha' : false}).then(functio n (image) { imageBitmaps.noCrop = image });
61 var p2 = createImageBitmap(video, 0, 0, 100, 100).then(function (image) { i mageBitmaps.crop = image }); 61 var p2 = createImageBitmap(video, 0, 0, 100, 100, {'premultiplyAlpha' : fal se}).then(function (image) { imageBitmaps.crop = image });
62 var p3 = createImageBitmap(video, 50, 50, 100, 100).then(function (image) { imageBitmaps.cropRight = image }); 62 var p3 = createImageBitmap(video, 50, 50, 100, 100, {'premultiplyAlpha' : f alse}).then(function (image) { imageBitmaps.cropRight = image });
63 var p4 = createImageBitmap(video, 100, 100, 100, 100).then(function (image) { imageBitmaps.cropCenter = image }); 63 var p4 = createImageBitmap(video, 100, 100, 100, 100, {'premultiplyAlpha' : false}).then(function (image) { imageBitmaps.cropCenter = image });
64 var p5 = createImageBitmap(video, -100, -100, 600, 600).then(function (image ) { imageBitmaps.overCrop = image }); 64 var p5 = createImageBitmap(video, -100, -100, 600, 600, {'premultiplyAlpha' : false}).then(function (image) { imageBitmaps.overCrop = image });
65 var p6 = createImageBitmap(video, 100, 100, 500, 500).then(function (image) { imageBitmaps.overCropRight = image }); 65 var p6 = createImageBitmap(video, 100, 100, 500, 500, {'premultiplyAlpha' : false}).then(function (image) { imageBitmaps.overCropRight = image });
66 var p7 = createImageBitmap(video, 100, 100, -100, -100).then(function (image ) { imageBitmaps.negativeCrop = image }); 66 var p7 = createImageBitmap(video, 100, 100, -100, -100, {'premultiplyAlpha' : false}).then(function (image) { imageBitmaps.negativeCrop = image });
67 var p8 = createImageBitmap(video, -300, -300, 300, 300).then(function (image ) { imageBitmaps.empty = image }); 67 var p8 = createImageBitmap(video, -300, -300, 300, 300, {'premultiplyAlpha' : false}).then(function (image) { imageBitmaps.empty = image });
68 var p9 = createImageBitmap(video, 400, 300, 300, 300).then(function (image) { imageBitmaps.emptyTwo = image }); 68 var p9 = createImageBitmap(video, 400, 300, 300, 300, {'premultiplyAlpha' : false}).then(function (image) { imageBitmaps.emptyTwo = image });
69 69
70 Promise.all([p1, p2, p3, p4, p5, p6, p7, p8, p9]).then(function() { 70 Promise.all([p1, p2, p3, p4, p5, p6, p7, p8, p9]).then(function() {
71 checkNoCrop(imageBitmaps.noCrop); 71 checkNoCrop(imageBitmaps.noCrop);
72 checkCrop(imageBitmaps.crop); 72 checkCrop(imageBitmaps.crop);
73 checkCrop(imageBitmaps.cropRight); 73 checkCrop(imageBitmaps.cropRight);
74 checkCrop(imageBitmaps.cropCenter); 74 checkCrop(imageBitmaps.cropCenter);
75 checkOverCrop(imageBitmaps.overCrop); 75 checkOverCrop(imageBitmaps.overCrop);
76 checkOverCropRight(imageBitmaps.overCropRight); 76 checkOverCropRight(imageBitmaps.overCropRight);
77 checkCrop(imageBitmaps.negativeCrop); 77 checkCrop(imageBitmaps.negativeCrop);
78 checkEmpty(imageBitmaps.empty); 78 checkEmpty(imageBitmaps.empty);
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 ctx.drawImage(imageBitmap, 0, 0); 203 ctx.drawImage(imageBitmap, 0, 0);
204 shouldBeClear(10, 10); 204 shouldBeClear(10, 10);
205 shouldBeClear(90, 90); 205 shouldBeClear(90, 90);
206 shouldBeClear(110, 110); 206 shouldBeClear(110, 110);
207 shouldBeClear(210, 210); 207 shouldBeClear(210, 210);
208 } 208 }
209 209
210 </script> 210 </script>
211 </body> 211 </body>
212 </html> 212 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698