Title: [154316] trunk
- Revision
- 154316
- Author
- [email protected]
- Date
- 2013-08-19 23:48:42 -0700 (Mon, 19 Aug 2013)
Log Message
[Cairo] Canvas putImageData is not working as expected
https://bugs.webkit.org/show_bug.cgi?id=119992
Patch by Hurnjoo Lee <[email protected]> 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.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (154315 => 154316)
--- trunk/LayoutTests/ChangeLog 2013-08-20 06:35:44 UTC (rev 154315)
+++ trunk/LayoutTests/ChangeLog 2013-08-20 06:48:42 UTC (rev 154316)
@@ -1,3 +1,15 @@
+2013-08-19 Hurnjoo Lee <[email protected]>
+
+ [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 <[email protected]>
<https://webkit.org/b/118754> AX: aria-required.html needs to test @required vs @aria-required mismatch reconciliation
Added: trunk/LayoutTests/fast/canvas/canvas-putImageData-zero-alpha-expected.html (0 => 154316)
--- trunk/LayoutTests/fast/canvas/canvas-putImageData-zero-alpha-expected.html (rev 0)
+++ trunk/LayoutTests/fast/canvas/canvas-putImageData-zero-alpha-expected.html 2013-08-20 06:48:42 UTC (rev 154316)
@@ -0,0 +1,20 @@
+<!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>
Added: trunk/LayoutTests/fast/canvas/canvas-putImageData-zero-alpha.html (0 => 154316)
--- trunk/LayoutTests/fast/canvas/canvas-putImageData-zero-alpha.html (rev 0)
+++ trunk/LayoutTests/fast/canvas/canvas-putImageData-zero-alpha.html 2013-08-20 06:48:42 UTC (rev 154316)
@@ -0,0 +1,43 @@
+<!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>
Modified: trunk/Source/WebCore/ChangeLog (154315 => 154316)
--- trunk/Source/WebCore/ChangeLog 2013-08-20 06:35:44 UTC (rev 154315)
+++ trunk/Source/WebCore/ChangeLog 2013-08-20 06:48:42 UTC (rev 154316)
@@ -1,3 +1,18 @@
+2013-08-19 Hurnjoo Lee <[email protected]>
+
+ [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 <[email protected]>
<https://webkit.org/b/119991> change usage of calculateUTCOffset()/calculateDSTOffset to calculateLocalTimeOffset
Modified: trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp (154315 => 154316)
--- trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp 2013-08-20 06:35:44 UTC (rev 154315)
+++ trunk/Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp 2013-08-20 06:48:42 UTC (rev 154316)
@@ -335,7 +335,7 @@
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;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes