diff options
author | commit-queue@webkit.org <commit-queue@webkit.org@bbb929c8-8fbe-4397-9dbb-9b2b20218538> | 2012-06-14 18:33:03 +0000 |
---|---|---|
committer | commit-queue@webkit.org <commit-queue@webkit.org@bbb929c8-8fbe-4397-9dbb-9b2b20218538> | 2012-06-14 18:33:03 +0000 |
commit | a4d44d380a46482d9be4212533ce4f9de9ef5304 (patch) | |
tree | 840d8ca88d0eacba2e3f73448d789084d11e658c | |
parent | 343a57a407899396c515d08db24893fbd1e7b461 (diff) | |
download | chromium_src-a4d44d380a46482d9be4212533ce4f9de9ef5304.zip chromium_src-a4d44d380a46482d9be4212533ce4f9de9ef5304.tar.gz chromium_src-a4d44d380a46482d9be4212533ce4f9de9ef5304.tar.bz2 |
[Chromium] webkitImageSmoothingEnabled canvas property does not work on redraw
https://bugs.webkit.org/show_bug.cgi?id=89018
Patch by Justin Novosad <junov@chromium.org> on 2012-06-14
Reviewed by Stephen White.
Source/WebCore:
Test: fast/canvas/canvas-imageSmoothingEnabled-repaint.html
When an accelerated canvas layer prepares its texture for the
compositor, it must send a notification to skia to invalidate texture
proprties that are cached by skia, since the compositor may modify them.
The use case this fixes is when a canvas to canvas copy is performed
with webkitImageSmoothingEnabled=false on the destination canvas.
The backing texture of the source canvas will be set to "nearest"
filtering by skia in order to perform the copy. Then, the compositor
sets filtering back to "linear" when the source canvas is drawn.
Skia is designed to only update GL attributes when required, so errors
occur when the skia-side GL state cache is out of sync.
* platform/graphics/chromium/Canvas2DLayerBridge.cpp:
(WebCore::Canvas2DLayerBridge::prepareTexture):
Source/WebKit/chromium:
Rolling chromium DEPS to 141884
* DEPS:
LayoutTests:
New layout test that verifies that disabling image smoothing on a 2d
canvas continues to work after multiple paint cycles.
* fast/canvas/canvas-imageSmoothingEnabled-repaint-expected.txt: Added.
* fast/canvas/canvas-imageSmoothingEnabled-repaint.html: Added.
* fast/canvas/script-tests/canvas-imageSmoothingEnabled-repaint.js: Added.
(draw):
(testResult):
(TestControllerPaint):
(BrowserPaint):
(onLoadHandler):
git-svn-id: svn://svn.chromium.org/blink/trunk@120344 bbb929c8-8fbe-4397-9dbb-9b2b20218538
8 files changed, 161 insertions, 1 deletions
diff --git a/third_party/WebKit/LayoutTests/ChangeLog b/third_party/WebKit/LayoutTests/ChangeLog index 3389ba5..ccc31b2 100644 --- a/third_party/WebKit/LayoutTests/ChangeLog +++ b/third_party/WebKit/LayoutTests/ChangeLog @@ -1,3 +1,22 @@ +2012-06-14 Justin Novosad <junov@chromium.org> + + [Chromium] webkitImageSmoothingEnabled canvas property does not work on redraw + https://bugs.webkit.org/show_bug.cgi?id=89018 + + Reviewed by Stephen White. + + New layout test that verifies that disabling image smoothing on a 2d + canvas continues to work after multiple paint cycles. + + * fast/canvas/canvas-imageSmoothingEnabled-repaint-expected.txt: Added. + * fast/canvas/canvas-imageSmoothingEnabled-repaint.html: Added. + * fast/canvas/script-tests/canvas-imageSmoothingEnabled-repaint.js: Added. + (draw): + (testResult): + (TestControllerPaint): + (BrowserPaint): + (onLoadHandler): + 2012-06-14 Stephen Chenney <schenney@chromium.org> [svg] SVGResources applied to Text with Incorrect Transformations in non-CG Implementations diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-imageSmoothingEnabled-repaint-expected.txt b/third_party/WebKit/LayoutTests/fast/canvas/canvas-imageSmoothingEnabled-repaint-expected.txt new file mode 100644 index 0000000..092f51c --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-imageSmoothingEnabled-repaint-expected.txt @@ -0,0 +1,16 @@ +Tests that disabling the imageSmoothingEnabled attribute still works after multiple repaints + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +Test that the image is not filtered +PASS left_of_center_pixel.data[0] is 255 +PASS left_of_center_pixel.data[1] is 0 +PASS left_of_center_pixel.data[2] is 0 +PASS right_of_center_pixel.data[0] is 0 +PASS right_of_center_pixel.data[1] is 255 +PASS right_of_center_pixel.data[2] is 0 +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/third_party/WebKit/LayoutTests/fast/canvas/canvas-imageSmoothingEnabled-repaint.html b/third_party/WebKit/LayoutTests/fast/canvas/canvas-imageSmoothingEnabled-repaint.html new file mode 100644 index 0000000..ffc4b20 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/canvas/canvas-imageSmoothingEnabled-repaint.html @@ -0,0 +1,12 @@ +<!DOCTYPE html> +<html> +<head> + <script src="../js/resources/js-test-pre.js"></script> +</head> +<body> + <canvas id="destination" width="300" height="300"></canvas> + <canvas id="source" width="300" height="300"></canvas> + <script src="script-tests/canvas-imageSmoothingEnabled-repaint.js"></script> + <script src="../js/resources/js-test-post.js"></script> +</body> +</html> diff --git a/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-imageSmoothingEnabled-repaint.js b/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-imageSmoothingEnabled-repaint.js new file mode 100644 index 0000000..f8c0833 --- /dev/null +++ b/third_party/WebKit/LayoutTests/fast/canvas/script-tests/canvas-imageSmoothingEnabled-repaint.js @@ -0,0 +1,73 @@ +// This is a regression test for bug https://bugs.webkit.org/show_bug.cgi?id=89018 + +description("Tests that disabling the imageSmoothingEnabled attribute still works after multiple repaints"); +var dstCanvas = document.getElementById("destination"); +var dstCtx = dstCanvas.getContext('2d'); +var srcCanvas = document.getElementById("source"); +var srcCtx = srcCanvas.getContext('2d'); + + +var srcCanvas, srcCtx, dstCanvas, dstCtx; + +function draw() +{ + srcCtx.clearRect(0, 0, 300, 300); + dstCtx.clearRect(0, 0, 300, 300); + srcCtx.fillStyle = "rgb(255, 0, 0)"; + srcCtx.fillRect(0, 0, 1, 1); + srcCtx.fillStyle = "rgb(0, 255, 0)"; + srcCtx.fillRect(1, 0, 1, 1); + dstCtx.webkitImageSmoothingEnabled = false; + dstCtx.drawImage(srcCanvas, 0, 0, 2, 1, 0, 0, 300, 300); +} + +function testResult() { + debug("Test that the image is not filtered"); + left_of_center_pixel = dstCtx.getImageData(149, 150, 1, 1); + shouldBe("left_of_center_pixel.data[0]", "255"); + shouldBe("left_of_center_pixel.data[1]", "0"); + shouldBe("left_of_center_pixel.data[2]", "0"); + right_of_center_pixel = dstCtx.getImageData(150, 150, 1, 1); + shouldBe("right_of_center_pixel.data[0]", "0"); + shouldBe("right_of_center_pixel.data[1]", "255"); + shouldBe("right_of_center_pixel.data[2]", "0"); + finishJSTest(); +} + +// Bug 89018 requires 2 draw iteration in order to manifest itself. +var drawIterations = 2; + +// Unrolled repaint loop for running the test in DumpRenderTree +function TestControllerPaint() { + while (drawIterations > 0) { + draw(); + layoutTestController.display(); + drawIterations = drawIterations - 1; + } + draw(); + testResult(); +} + +// Repaint loop for running the test in the browser +function BrowserPaint(){ + draw(); + if (drawIterations > 0) { + drawIterations = drawIterations - 1; + window.webkitRequestAnimationFrame(BrowserPaint); + } else { + testResult(); + } +} + +function onLoadHandler() +{ + if (window.layoutTestController) { + TestControllerPaint(); + } else { + BrowserPaint(); + } +} + +window.jsTestIsAsync = true; +window.onload = onLoadHandler; + diff --git a/third_party/WebKit/Source/WebCore/ChangeLog b/third_party/WebKit/Source/WebCore/ChangeLog index ba4fbda..bbad940 100644 --- a/third_party/WebKit/Source/WebCore/ChangeLog +++ b/third_party/WebKit/Source/WebCore/ChangeLog @@ -1,3 +1,26 @@ +2012-06-14 Justin Novosad <junov@chromium.org> + + [Chromium] webkitImageSmoothingEnabled canvas property does not work on redraw + https://bugs.webkit.org/show_bug.cgi?id=89018 + + Reviewed by Stephen White. + + Test: fast/canvas/canvas-imageSmoothingEnabled-repaint.html + + When an accelerated canvas layer prepares its texture for the + compositor, it must send a notification to skia to invalidate texture + proprties that are cached by skia, since the compositor may modify them. + The use case this fixes is when a canvas to canvas copy is performed + with webkitImageSmoothingEnabled=false on the destination canvas. + The backing texture of the source canvas will be set to "nearest" + filtering by skia in order to perform the copy. Then, the compositor + sets filtering back to "linear" when the source canvas is drawn. + Skia is designed to only update GL attributes when required, so errors + occur when the skia-side GL state cache is out of sync. + + * platform/graphics/chromium/Canvas2DLayerBridge.cpp: + (WebCore::Canvas2DLayerBridge::prepareTexture): + 2012-06-14 Jon Honeycutt <jhoneycutt@apple.com> Fix some failing tests on Windows by resetting the page scale factor diff --git a/third_party/WebKit/Source/WebCore/platform/graphics/chromium/Canvas2DLayerBridge.cpp b/third_party/WebKit/Source/WebCore/platform/graphics/chromium/Canvas2DLayerBridge.cpp index bb02fe8..0df0b83 100644 --- a/third_party/WebKit/Source/WebCore/platform/graphics/chromium/Canvas2DLayerBridge.cpp +++ b/third_party/WebKit/Source/WebCore/platform/graphics/chromium/Canvas2DLayerBridge.cpp @@ -141,6 +141,12 @@ unsigned Canvas2DLayerBridge::prepareTexture(WebTextureUpdater& updater) return m_frontBufferTexture; } + if (m_canvas) { + // Notify skia that the state of the backing store texture object will be touched by the compositor + GrRenderTarget* renderTarget = reinterpret_cast<GrRenderTarget*>(m_canvas->getDevice()->accessRenderTarget()); + if (renderTarget) + renderTarget->asTexture()->invalidateCachedState(); + } return m_backBufferTexture; } diff --git a/third_party/WebKit/Source/WebKit/chromium/ChangeLog b/third_party/WebKit/Source/WebKit/chromium/ChangeLog index 6cbf683..b8ef591 100644 --- a/third_party/WebKit/Source/WebKit/chromium/ChangeLog +++ b/third_party/WebKit/Source/WebKit/chromium/ChangeLog @@ -1,3 +1,14 @@ +2012-06-14 Justin Novosad <junov@chromium.org> + + [Chromium] webkitImageSmoothingEnabled canvas property does not work on redraw + https://bugs.webkit.org/show_bug.cgi?id=89018 + + Reviewed by Stephen White. + + Rolling chromium DEPS to 141884 + + * DEPS: + 2012-06-14 Alexander Pavlov <apavlov@chromium.org> [Chromium] Unreviewed, build fix for Mac 10.5 diff --git a/third_party/WebKit/Source/WebKit/chromium/DEPS b/third_party/WebKit/Source/WebKit/chromium/DEPS index a39fe0a..dec86d2 100644 --- a/third_party/WebKit/Source/WebKit/chromium/DEPS +++ b/third_party/WebKit/Source/WebKit/chromium/DEPS @@ -32,7 +32,7 @@ vars = { 'chromium_svn': 'http://src.chromium.org/svn/trunk/src', - 'chromium_rev': '141410' + 'chromium_rev': '141884' } deps = { |