diff options
author | jackhou@chromium.org <jackhou@chromium.org> | 2014-12-18 03:53:29 +0000 |
---|---|---|
committer | jackhou@chromium.org <jackhou@chromium.org> | 2014-12-18 03:53:29 +0000 |
commit | a85874ebe58ab86e2413043f6e37e9f55c049c31 (patch) | |
tree | e3d150dad8cbe1c0237dab639f81b3145fd31fa6 /third_party/WebKit/LayoutTests/fast/canvas/pixelated-resize.html | |
parent | 1084b30571ede9c32b2d47c5b42a262724a517fa (diff) | |
download | chromium_src-a85874ebe58ab86e2413043f6e37e9f55c049c31.zip chromium_src-a85874ebe58ab86e2413043f6e37e9f55c049c31.tar.gz chromium_src-a85874ebe58ab86e2413043f6e37e9f55c049c31.tar.bz2 |
Implement image-rendering:pixelated for accelerated 2D canvases.
This CL depends on a CC side change here:
https://codereview.chromium.org/558083002/
BUG=134040, 424025, 317991
Review URL: https://codereview.chromium.org/562583002
git-svn-id: svn://svn.chromium.org/blink/trunk@187428 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Diffstat (limited to 'third_party/WebKit/LayoutTests/fast/canvas/pixelated-resize.html')
-rw-r--r-- | third_party/WebKit/LayoutTests/fast/canvas/pixelated-resize.html | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/pixelated-resize.html b/third_party/WebKit/LayoutTests/fast/canvas/pixelated-resize.html new file mode 100644 index 0000000..723a0d5 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/canvas/pixelated-resize.html @@ -0,0 +1,37 @@ +<!DOCTYPE html> +<style> + img { + display: none; + } + canvas { + width: 100px; + height: 100px; + image-rendering: pixelated; + } +</style> +<body> + <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAAAFElEQVQIHWP4z8DwHwyBNJDN8B8AQNEG+t5Ik2kAAAAASUVORK5CYII="> + <!-- Test that resizing a pixelated canvas works. --> + <!-- The canvas should be upscaled without blurring. --> + <canvas width="4" height="4"></canvas> +</body> +<script> + // Ignore the render tree. + if (window.testRunner) + window.testRunner.dumpAsTextWithPixelResults(); + + function drawToCanvas(canvas) { + var ctx = canvas.getContext("2d") + ctx.drawImage(document.getElementsByTagName("img")[0], 1, 1); + } + + function draw() { + var canvas = document.getElementsByTagName("canvas")[0]; + drawToCanvas(canvas); + // Resize so that the image buffer is reset. + canvas.width = 5; + canvas.style.width = "201px"; + drawToCanvas(canvas); + } + window.onload = draw; +</script> |