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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/canvas/OffscreenCanvas-2d-globalAlpha.html

Issue 2526693003: Make OffscreenCanvas 2D context support globalAlpha (Closed)
Patch Set: Created 4 years 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
(Empty)
1 <script src="../../resources/testharness.js"></script>
2 <script src="../../resources/testharnessreport.js"></script>
3 <script>
4 test(function() {
5 function assertPixelApprox(ctx, x, y, r, g, b, a, pos, colour, tolerance) {
6 var imgdata = ctx.getImageData(x, y, 1, 1);
7 var diff = Math.max(Math.abs(r-imgdata.data[0]), Math.abs(g-imgdata.data [1]), Math.abs(b-imgdata.data[2]), Math.abs(a-imgdata.data[3]));
8 assert_less_than_equal(diff, tolerance);
9 }
10 var offscreenCanvas = new OffscreenCanvas(100, 100);
11 var ctx = offscreenCanvas.getContext('2d');
12 ctx.fillStyle = '#0f0';
13 ctx.fillRect(0, 0, 100, 100);
14 ctx.globalAlpha = 0.01; // avoid any potential alpha = 0 optimisations.
xlai (Olivia) 2016/11/23 17:26:43 Could you use a more obvious number like 0.2, 0.7
15 ctx.beginPath();
16 ctx.fillStyle = '#f00';
17 ctx.rect(0, 0, 100, 100);
18 ctx.fill();
19 assertPixelApprox(ctx, 50, 25, 2, 253, 0, 255, "50,25", "2,253,0,255", 2);
20 });
21 </script>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/serviceworker/webexposed/global-interface-listing-service-worker-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698