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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/canvas/canvas-createImageBitmap-resize.html

Issue 2845193002: Refactor ImageBitmap constructor from ImageData to be color managed
Patch Set: local commit - all working except unpremultiply Created 3 years, 6 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> 1 <!DOCTYPE HTML>
2 <script src="../../resources/testharness.js"></script> 2 <script src="../../resources/testharness.js"></script>
3 <script src="../../resources/testharnessreport.js"></script> 3 <script src="../../resources/testharnessreport.js"></script>
4 <script> 4 <script>
5 function checkNoCrop(imageBitmap) 5 function checkNoCrop(imageBitmap)
6 { 6 {
7 var canvas = document.createElement("canvas"); 7 var canvas = document.createElement("canvas");
8 canvas.width = 50; 8 canvas.width = 50;
9 canvas.height = 50; 9 canvas.height = 50;
10 var ctx = canvas.getContext("2d"); 10 var ctx = canvas.getContext("2d");
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 testCtx.fillRect(0, 0, 10, 10); 106 testCtx.fillRect(0, 0, 10, 10);
107 testCtx.fillStyle = "rgb(0, 255, 0)"; 107 testCtx.fillStyle = "rgb(0, 255, 0)";
108 testCtx.fillRect(10, 0, 10, 10); 108 testCtx.fillRect(10, 0, 10, 10);
109 testCtx.fillStyle = "rgb(0, 0, 255)"; 109 testCtx.fillStyle = "rgb(0, 0, 255)";
110 testCtx.fillRect(0, 10, 10, 10); 110 testCtx.fillRect(0, 10, 10, 10);
111 testCtx.fillStyle = "rgb(0, 0, 0)"; 111 testCtx.fillStyle = "rgb(0, 0, 0)";
112 testCtx.fillRect(10, 10, 10, 10); 112 testCtx.fillRect(10, 10, 10, 10);
113 return testCanvas; 113 return testCanvas;
114 } 114 }
115 115
116 // Blob
117 promise_test(function() {
118 return new Promise((resolve, reject) => {
119 var xhr = new XMLHttpRequest();
120 xhr.open("GET", 'resources/pattern.png');
121 xhr.responseType = 'blob';
122 xhr.send();
123 xhr.onload = function() {
124 resolve(xhr.response);
125 };
126 }).then(testImageBitmap);
127 }, 'createImageBitmap from a Blob with resize option.');
128
129 // HTMLCanvasElement
130 promise_test(function() {
131 var testCanvas = initializeTestCanvas();
132 return testImageBitmap(testCanvas);
133 }, 'createImageBitmap from a HTMLCanvasElement with resize option.');
134
135 // HTMLImageElement
136 promise_test(function() {
137 return new Promise((resolve, reject) => {
138 var image = new Image();
139 image.onload = function() {
140 resolve(image);
141 }
142 image.src = 'resources/pattern.png'
143 }).then(testImageBitmap);
144 }, 'createImageBitmap from a HTMLImageElement with resize option.');
145
146 // ImageBitmap
147 promise_test(function() {
148 var testCanvas = initializeTestCanvas();
149 return createImageBitmap(testCanvas).then(testImageBitmap);
150 }, 'createImageBitmap from an ImageBitmap with resize option.');
151
152 // ImageData 116 // ImageData
153 promise_test(function() { 117 promise_test(function() {
154 var canvas = initializeTestCanvas(); 118 var canvas = initializeTestCanvas();
155 var ctx = canvas.getContext("2d"); 119 var ctx = canvas.getContext("2d");
156 var data = ctx.getImageData(0, 0, 20, 20); 120 var data = ctx.getImageData(0, 0, 20, 20);
157 return testImageBitmap(data); 121 return testImageBitmap(data);
158 }, 'createImageBitmap from an ImageData with resize option.'); 122 }, 'createImageBitmap from an ImageData with resize option.');
159 </script> 123 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698