Commit dc967a9c authored by commit-queue@webkit.org's avatar commit-queue@webkit.org
Browse files

[Cairo] Canvas putImageData is not working as expected

https://bugs.webkit.org/show_bug.cgi?id=119992

Patch by Hurnjoo Lee <hurnjoo.lee@samsung.com> on 2013-08-19
Reviewed by Darin Adler.

Source/WebCore:

ImageBufferCairo::putImageArray didn't perform pre-multiply in case of zero alpha value.
If the alpha value is not 255, image data should always be pre-multiplied.

Test: fast/canvas/canvas-putImageData-zero-alpha.html

* platform/graphics/cairo/ImageBufferCairo.cpp:
(WebCore::ImageBuffer::putByteArray):

LayoutTests:

Add a ref test that ensures that putImageData of canvas with zero alpha work correctly.

* fast/canvas/canvas-putImageData-zero-alpha-expected.html: Added.
* fast/canvas/canvas-putImageData-zero-alpha.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154316 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 11174a2c
2013-08-19 Hurnjoo Lee <hurnjoo.lee@samsung.com>
[Cairo] Canvas putImageData is not working as expected
https://bugs.webkit.org/show_bug.cgi?id=119992
Reviewed by Darin Adler.
Add a ref test that ensures that putImageData of canvas with zero alpha work correctly.
* fast/canvas/canvas-putImageData-zero-alpha-expected.html: Added.
* fast/canvas/canvas-putImageData-zero-alpha.html: Added.
2013-08-19 James Craig <james@cookiecrook.com>
 
<https://webkit.org/b/118754> AX: aria-required.html needs to test @required vs @aria-required mismatch reconciliation
<!DOCTYPE html>
<html>
<head>
<style>
body {
background-color:blue;
}
#box {
width:100px;
height:100px;
border:1px solid;
}
</style>
</head>
<body>
<canvas id="box" width="100" height="100">
</canvas>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<style>
body {
background-color:blue;
}
#box {
width:100px;
height:100px;
border:1px solid;
}
</style>
<script>
if (window.testRunner) {
testRunner.dumpAsText(true);
testRunner.waitUntilDone();
}
function doTest()
{
var c = document.getElementById("box");
var ctx = c.getContext("2d");
var imgData = ctx.createImageData(100, 100);
for (var i = 0; i < imgData.data.length ; i += 4) {
imgData.data[i + 0] = 255;
imgData.data[i + 1] = 0;
imgData.data[i + 2] = 0;
imgData.data[i + 3] = 0;
}
ctx.putImageData(imgData, 0, 0);
if (window.testRunner)
testRunner.notifyDone();
}
window.addEventListener('load', doTest, false);
</script>
</head>
<body>
<canvas id="box" width="100" height="100">
</canvas>
</body>
</html>
2013-08-19 Hurnjoo Lee <hurnjoo.lee@samsung.com>
[Cairo] Canvas putImageData is not working as expected
https://bugs.webkit.org/show_bug.cgi?id=119992
Reviewed by Darin Adler.
ImageBufferCairo::putImageArray didn't perform pre-multiply in case of zero alpha value.
If the alpha value is not 255, image data should always be pre-multiplied.
Test: fast/canvas/canvas-putImageData-zero-alpha.html
* platform/graphics/cairo/ImageBufferCairo.cpp:
(WebCore::ImageBuffer::putByteArray):
2013-08-19 Santosh Mahto <santosh.ma@samsung.com>
 
<https://webkit.org/b/119991> change usage of calculateUTCOffset()/calculateDSTOffset to calculateLocalTimeOffset
......@@ -335,7 +335,7 @@ void ImageBuffer::putByteArray(Multiply multiplied, Uint8ClampedArray* source, c
unsigned alpha = srcRows[basex + 3];
if (multiplied == Unmultiplied) {
if (alpha && alpha != 255) {
if (alpha != 255) {
red = (red * alpha + 254) / 255;
green = (green * alpha + 254) / 255;
blue = (blue * alpha + 254) / 255;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment