diff --git a/offscreen-canvas/filter/offscreencanvas.filter.html b/offscreen-canvas/filter/offscreencanvas.filter.html new file mode 100644 index 000000000000000..25691983f1e1027 --- /dev/null +++ b/offscreen-canvas/filter/offscreencanvas.filter.html @@ -0,0 +1,27 @@ + + + + diff --git a/offscreen-canvas/filter/offscreencanvas.filter.js b/offscreen-canvas/filter/offscreencanvas.filter.js new file mode 100644 index 000000000000000..cb2e2458030f53d --- /dev/null +++ b/offscreen-canvas/filter/offscreencanvas.filter.js @@ -0,0 +1,48 @@ +var getRegularContextForFilter = function(filter, pattern) { + var c = document.createElement("canvas"); + c.width = c.height = 80; + var ctx = c.getContext('2d'); + ctx.filter = filter; + ctx.drawImage(pattern, 5, 5); + ctx.drawImage(pattern, 25, 25); + ctx.drawImage(pattern, 45, 45); + return ctx; +}; + +var matchImageDataResults = function(offscreenImage, regularImage, filter) { + assert_array_equals(offscreenImage, regularImage, + "The image data generated by filter " + + filter + + " should be the same for both OffscreenCanvas and regular canvas"); +}; + +var createPatternCanvas = function() { + var patternCanvas = document.createElement('canvas'); + patternCanvas.width = 20; + patternCanvas.height = 20; + var patternCtx = patternCanvas.getContext('2d'); + patternCtx.fillStyle = '#A00'; + patternCtx.fillRect(0, 0, 10, 10); + patternCtx.fillStyle = '#0A0'; + patternCtx.fillRect(10, 0, 10, 10); + patternCtx.fillStyle = '#00A'; + patternCtx.fillRect(0, 10, 10, 10); + patternCtx.fillStyle = "#AA0"; + patternCtx.fillRect(10, 10, 10, 10); + return patternCanvas; +}; + +var filters = [ "none" , + "blur(10px)" , + "brightness(40%)" , + "contrast(20%)" , + "drop-shadow(0 0 5px green)" , + "grayscale(100%)" , + "invert(100%)" , + "opacity(50%)" , + "saturate(20%)" , + "sepia(100%)" , + "sepia(1) hue-rotate(200deg)", + "url(#url)" ]; + + diff --git a/offscreen-canvas/filter/offscreencanvas.filter.w.html b/offscreen-canvas/filter/offscreencanvas.filter.w.html new file mode 100644 index 000000000000000..d6ed915b5392998 --- /dev/null +++ b/offscreen-canvas/filter/offscreencanvas.filter.w.html @@ -0,0 +1,54 @@ + + + + + diff --git a/offscreen-canvas/the-offscreen-canvas/offscreencanvas.resize.html b/offscreen-canvas/the-offscreen-canvas/offscreencanvas.resize.html new file mode 100644 index 000000000000000..2906f8069b3b170 --- /dev/null +++ b/offscreen-canvas/the-offscreen-canvas/offscreencanvas.resize.html @@ -0,0 +1,217 @@ + +Test resizing an OffscreenCanvas with a 2d context + + + + +