OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 <!-- DO NOT EDIT! This test has been generated by tools/gentest.py. --> | |
3 <title>OffscreenCanvas test: 2d.imageData.put.dirty.rect2</title> | |
4 <script src="/resources/testharness.js"></script> | |
5 <script src="/resources/testharnessreport.js"></script> | |
6 <script src="/common/canvas-tests.js"></script> | |
7 | |
8 <h1>2d.imageData.put.dirty.rect2</h1> | |
9 <p class="desc">putImageData() only modifies areas inside the dirty rectangle, u
sing x and y</p> | |
10 | |
11 | |
12 <script> | |
13 var t = async_test("putImageData() only modifies areas inside the dirty rectangl
e, using x and y"); | |
14 t.step(function() { | |
15 | |
16 var offscreenCanvas = new OffscreenCanvas(100, 50); | |
17 var ctx = offscreenCanvas.getContext('2d'); | |
18 | |
19 ctx.fillStyle = '#f00'; | |
20 ctx.fillRect(0, 0, 100, 50) | |
21 ctx.fillStyle = '#0f0'; | |
22 ctx.fillRect(60, 30, 20, 20) | |
23 var imgdata = ctx.getImageData(0, 0, 100, 50); | |
24 ctx.fillStyle = '#0f0'; | |
25 ctx.fillRect(0, 0, 100, 50) | |
26 ctx.fillStyle = '#f00'; | |
27 ctx.fillRect(40, 20, 20, 20) | |
28 ctx.putImageData(imgdata, -20, -10, 60, 30, 20, 20); | |
29 _assertPixelApprox(offscreenCanvas, 50,25, 0,255,0,255, "50,25", "0,255,0,255",
2); | |
30 _assertPixelApprox(offscreenCanvas, 35,25, 0,255,0,255, "35,25", "0,255,0,255",
2); | |
31 _assertPixelApprox(offscreenCanvas, 65,25, 0,255,0,255, "65,25", "0,255,0,255",
2); | |
32 _assertPixelApprox(offscreenCanvas, 50,15, 0,255,0,255, "50,15", "0,255,0,255",
2); | |
33 _assertPixelApprox(offscreenCanvas, 50,45, 0,255,0,255, "50,45", "0,255,0,255",
2); | |
34 | |
35 t.done(); | |
36 | |
37 }); | |
38 </script> | |
OLD | NEW |