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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/canvas/canvas-blending-helpers.js

Issue 2673883002: Use testharness.js instead of js-test.js in LayoutTests/fast/canvas tests. (Closed)
Patch Set: Addressing comments Created 3 years, 10 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
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/canvas/canvas-blending-gradient-over-pattern-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 var blendModes = ["source-over", "multiply", "screen", "overlay", "darken", "lig hten", "color-dodge", "color-burn", 1 var blendModes = ["source-over", "multiply", "screen", "overlay", "darken", "lig hten", "color-dodge", "color-burn",
2 "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"]; 2 "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"];
3 3
4 // Helper functions for separate blend mode 4 // Helper functions for separate blend mode
5 5
6 var separateBlendmodes = ["normal", "multiply", "screen", "overlay", 6 var separateBlendmodes = ["normal", "multiply", "screen", "overlay",
7 "darken", "lighten", "colorDodge","colorBurn", 7 "darken", "lighten", "colorDodge","colorBurn",
8 "hardLight", "softLight", "difference", "exclusion"]; 8 "hardLight", "softLight", "difference", "exclusion"];
9 9
10 var separateBlendFunctions = { 10 var separateBlendFunctions = {
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 function separateBlendColors(backdrop, source, blendModeIndex) { 293 function separateBlendColors(backdrop, source, blendModeIndex) {
294 return applyBlendMode(backdrop, source, separateBlendFunctions[separateBlend modes[blendModeIndex]]); 294 return applyBlendMode(backdrop, source, separateBlendFunctions[separateBlend modes[blendModeIndex]]);
295 } 295 }
296 296
297 function nonSeparateBlendColors(backdrop, source, blendModeIndex) { 297 function nonSeparateBlendColors(backdrop, source, blendModeIndex) {
298 var expectedColor = nonSeparateBlendFunctions[nonSeparateBlendModes[blendMod eIndex]](backdrop, source); 298 var expectedColor = nonSeparateBlendFunctions[nonSeparateBlendModes[blendMod eIndex]](backdrop, source);
299 for (var i = 0; i < 3; ++i) 299 for (var i = 0; i < 3; ++i)
300 expectedColor[i] = source[3] * (1 - backdrop[3]) * source[i] + source[3] * backdrop[3] * expectedColor[i] + (1 - source[3]) * backdrop[3] * backdrop[i]; 300 expectedColor[i] = source[3] * (1 - backdrop[3]) * source[i] + source[3] * backdrop[3] * expectedColor[i] + (1 - source[3]) * backdrop[3] * backdrop[i];
301 return [Math.round(255 * expectedColor[0]), Math.round(255 * expectedColor[1 ]), Math.round(255 * expectedColor[2]), 255]; 301 return [Math.round(255 * expectedColor[0]), Math.round(255 * expectedColor[1 ]), Math.round(255 * expectedColor[2]), 255];
302 } 302 }
303
304 function checkBlendModeResult(i, context, sigma) {
305 var actualColor = context.getImageData(0, 0, 1, 1).data;
306 var expectedColor = blendColors([129 / 255, 1, 129 / 255, 1], [1, 129 / 255, 129 / 255, 1], i);
307 assert_approx_equals(actualColor[0], expectedColor[0], sigma);
308 assert_approx_equals(actualColor[1], expectedColor[1], sigma);
309 assert_approx_equals(actualColor[2], expectedColor[2], sigma);
310 assert_approx_equals(actualColor[3], expectedColor[3], sigma);
311 }
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/canvas/canvas-blending-gradient-over-pattern-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698