| OLD | NEW |
| 1 description("This test ensures that putImageData works correctly, the end result
should be a 100x100px green square."); | 1 description("This test ensures that putImageData works correctly, the end result
should be a 100x100px green square."); |
| 2 | 2 |
| 3 function fillRect(imageData, x, y, width, height, r, g, b, a) | 3 function fillRect(imageData, x, y, width, height, r, g, b, a) |
| 4 { | 4 { |
| 5 var bytesPerRow = imageData.width * 4; | 5 var bytesPerRow = imageData.width * 4; |
| 6 var data =imageData.data; | 6 var data =imageData.data; |
| 7 for (var i = 0; i < height; i++) { | 7 for (var i = 0; i < height; i++) { |
| 8 var rowOrigin = (y+i) * bytesPerRow; | 8 var rowOrigin = (y+i) * bytesPerRow; |
| 9 rowOrigin += x * 4; | 9 rowOrigin += x * 4; |
| 10 for (var j = 0; j < width; j++) { | 10 for (var j = 0; j < width; j++) { |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 shouldThrow("context.putImageData(buffer, 0, 0, Infinity, 0, 0, 0)"); | 213 shouldThrow("context.putImageData(buffer, 0, 0, Infinity, 0, 0, 0)"); |
| 214 shouldThrow("context.putImageData(buffer, 0, 0, 0, Infinity, 0, 0)"); | 214 shouldThrow("context.putImageData(buffer, 0, 0, 0, Infinity, 0, 0)"); |
| 215 shouldThrow("context.putImageData(buffer, 0, 0, 0, 0, Infinity, 0)"); | 215 shouldThrow("context.putImageData(buffer, 0, 0, 0, 0, Infinity, 0)"); |
| 216 shouldThrow("context.putImageData(buffer, 0, 0, 0, 0, 0, Infinity)"); | 216 shouldThrow("context.putImageData(buffer, 0, 0, 0, 0, 0, Infinity)"); |
| 217 shouldThrow("context.putImageData(buffer, undefined, 0, 0, 0, 0, 0)"); | 217 shouldThrow("context.putImageData(buffer, undefined, 0, 0, 0, 0, 0)"); |
| 218 shouldThrow("context.putImageData(buffer, 0, undefined, 0, 0, 0, 0)"); | 218 shouldThrow("context.putImageData(buffer, 0, undefined, 0, 0, 0, 0)"); |
| 219 shouldThrow("context.putImageData(buffer, 0, 0, undefined, 0, 0, 0)"); | 219 shouldThrow("context.putImageData(buffer, 0, 0, undefined, 0, 0, 0)"); |
| 220 shouldThrow("context.putImageData(buffer, 0, 0, 0, undefined, 0, 0)"); | 220 shouldThrow("context.putImageData(buffer, 0, 0, 0, undefined, 0, 0)"); |
| 221 shouldThrow("context.putImageData(buffer, 0, 0, 0, 0, undefined, 0)"); | 221 shouldThrow("context.putImageData(buffer, 0, 0, 0, 0, undefined, 0)"); |
| 222 shouldThrow("context.putImageData(buffer, 0, 0, 0, 0, 0, undefined)"); | 222 shouldThrow("context.putImageData(buffer, 0, 0, 0, 0, 0, undefined)"); |
| 223 shouldThrow("context.putImageData(null, 0, 0, 0, 0, 0, 0)"); |
| 224 shouldThrow("context.putImageData(undefined, 0, 0, 0, 0, 0, 0)"); |
| 223 | 225 |
| 224 // Ensure we don't mess up bounds clipping checks | 226 // Ensure we don't mess up bounds clipping checks |
| 225 var rectcanvas = document.createElement("canvas"); | 227 var rectcanvas = document.createElement("canvas"); |
| 226 rectcanvas.width = 20; | 228 rectcanvas.width = 20; |
| 227 rectcanvas.height = 10; | 229 rectcanvas.height = 10; |
| 228 var rectbuffer = rectcanvas.getContext("2d"); | 230 var rectbuffer = rectcanvas.getContext("2d"); |
| 229 rectbuffer.putImageData(smallbuffer, 10, 0); | 231 rectbuffer.putImageData(smallbuffer, 10, 0); |
| 230 | 232 |
| 231 var rectcanvas = document.createElement("canvas"); | 233 var rectcanvas = document.createElement("canvas"); |
| 232 rectcanvas.width = 10; | 234 rectcanvas.width = 10; |
| 233 rectcanvas.height = 20; | 235 rectcanvas.height = 20; |
| 234 var rectbuffer = rectcanvas.getContext("2d"); | 236 var rectbuffer = rectcanvas.getContext("2d"); |
| 235 rectbuffer.putImageData(smallbuffer, 0, 10); | 237 rectbuffer.putImageData(smallbuffer, 0, 10); |
| OLD | NEW |