Title: [126023] trunk
Revision
126023
Author
[email protected]
Date
2012-08-20 06:24:50 -0700 (Mon, 20 Aug 2012)

Log Message

The 2d.imageData.object.round canvas test is failing
https://bugs.webkit.org/show_bug.cgi?id=40272

Patch by Dominik Röttsches <[email protected]> on 2012-08-20
Reviewed by Kenneth Rohde Christiansen.

Source/WTF:

According to the Uint8ClampedArray spec (http://www.khronos.org/registry/typedarray/specs/latest/#7.1)
which references WebIDL's clamping rules, with implications defined in http://www.w3.org/TR/WebIDL/#es-octet
we need to round to nearest integer, and to the even one if exactly halfway in between.
As a solution: applying C99's lrint which, in default rounding mode, does that.

The updated version of test 2d.imageData.object.round.html test passes now.

* wtf/MathExtras.h:
(lrint): Assembly based implementation for MSVC under X86, otherwise falling back to casting.
* wtf/Uint8ClampedArray.h:
(WTF::Uint8ClampedArray::set): lrint instead of simple rounding.

LayoutTests:

Fixing expectations for the imageData rounding test, unskipping the tests on all ports.

* canvas/philip/tests/2d.imageData.object.round.html: Fixing expected results according to "round to even in halfway case".
* fast/canvas/canvas-ImageData-behaviour-expected.txt: Fixing expected results according to "round to even in halfway case".
* fast/canvas/canvas-ImageData-behaviour.js: Fixing expected results according to "round to even in halfway case".
* platform/chromium/TestExpectations: Updating bug id for 2d.imageData.object.round.html and for wrap case, adding SVG case for rebaselining.
* platform/efl/Skipped: 2d.imageData.object.round.html
* platform/efl/TestExpectations: Moving 2d.imageData.object.wrap.html case here with new bug id.
* platform/gtk/TestExpectations: Unskippng 2d.imageData.object.round.html, updating bug id for wrap case.
* platform/mac/Skipped: Unskipping 2d.imageData.object.round.html.
* platform/qt/Skipped: Unskipping 2d.imageData.object.round.html.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (126022 => 126023)


--- trunk/LayoutTests/ChangeLog	2012-08-20 12:45:19 UTC (rev 126022)
+++ trunk/LayoutTests/ChangeLog	2012-08-20 13:24:50 UTC (rev 126023)
@@ -1,3 +1,22 @@
+2012-08-20  Dominik Röttsches  <[email protected]>
+
+        The 2d.imageData.object.round canvas test is failing
+        https://bugs.webkit.org/show_bug.cgi?id=40272
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        Fixing expectations for the imageData rounding test, unskipping the tests on all ports.
+
+        * canvas/philip/tests/2d.imageData.object.round.html: Fixing expected results according to "round to even in halfway case".
+        * fast/canvas/canvas-ImageData-behaviour-expected.txt: Fixing expected results according to "round to even in halfway case".
+        * fast/canvas/canvas-ImageData-behaviour.js: Fixing expected results according to "round to even in halfway case".
+        * platform/chromium/TestExpectations: Updating bug id for 2d.imageData.object.round.html and for wrap case, adding SVG case for rebaselining.
+        * platform/efl/Skipped: 2d.imageData.object.round.html
+        * platform/efl/TestExpectations: Moving 2d.imageData.object.wrap.html case here with new bug id.
+        * platform/gtk/TestExpectations: Unskippng 2d.imageData.object.round.html, updating bug id for wrap case.
+        * platform/mac/Skipped: Unskipping 2d.imageData.object.round.html.
+        * platform/qt/Skipped: Unskipping 2d.imageData.object.round.html.
+
 2012-08-20  Christophe Dumez  <[email protected]>
 
         [EFL] Update flaky tests to make the bots green

Modified: trunk/LayoutTests/canvas/philip/tests/2d.imageData.object.round.html (126022 => 126023)


--- trunk/LayoutTests/canvas/philip/tests/2d.imageData.object.round.html	2012-08-20 12:45:19 UTC (rev 126022)
+++ trunk/LayoutTests/canvas/philip/tests/2d.imageData.object.round.html	2012-08-20 13:24:50 UTC (rev 126023)
@@ -18,7 +18,7 @@
 imgdata.data[0] = 0.5;
 _assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0");
 imgdata.data[0] = 0.501;
-_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0");
+_assertSame(imgdata.data[0], 1, "imgdata.data[\""+(0)+"\"]", "1");
 imgdata.data[0] = 1.499;
 _assertSame(imgdata.data[0], 1, "imgdata.data[\""+(0)+"\"]", "1");
 imgdata.data[0] = 1.5;
@@ -32,15 +32,15 @@
 imgdata.data[0] = 252.5;
 _assertSame(imgdata.data[0], 252, "imgdata.data[\""+(0)+"\"]", "252");
 imgdata.data[0] = 253.5;
-_assertSame(imgdata.data[0], 253, "imgdata.data[\""+(0)+"\"]", "253");
+_assertSame(imgdata.data[0], 254, "imgdata.data[\""+(0)+"\"]", "254");
 imgdata.data[0] = 254.5;
 _assertSame(imgdata.data[0], 254, "imgdata.data[\""+(0)+"\"]", "254");
 imgdata.data[0] = 256.5;
-_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0");
+_assertSame(imgdata.data[0], 255, "imgdata.data[\""+(0)+"\"]", "255");
 imgdata.data[0] = -0.5;
 _assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0");
 imgdata.data[0] = -1.5;
-_assertSame(imgdata.data[0], 255, "imgdata.data[\""+(0)+"\"]", "255");
+_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0");
 
 
 });

Modified: trunk/LayoutTests/fast/canvas/canvas-ImageData-behaviour-expected.txt (126022 => 126023)


--- trunk/LayoutTests/fast/canvas/canvas-ImageData-behaviour-expected.txt	2012-08-20 12:45:19 UTC (rev 126022)
+++ trunk/LayoutTests/fast/canvas/canvas-ImageData-behaviour-expected.txt	2012-08-20 13:24:50 UTC (rev 126023)
@@ -35,7 +35,7 @@
 PASS imageData.data[0] = -5, imageData.data[0] is 0
 PASS imageData.data[0] = -0.5, imageData.data[0] is 0
 PASS imageData.data[0] = 0, imageData.data[0] is 0
-PASS imageData.data[0] = 0.5, imageData.data[0] is 1
+PASS imageData.data[0] = 0.5, imageData.data[0] is 0
 PASS imageData.data[0] = 5, imageData.data[0] is 5
 PASS imageData.data[0] = 5.4, imageData.data[0] is 5
 PASS imageData.data[0] = 255, imageData.data[0] is 255

Modified: trunk/LayoutTests/fast/canvas/canvas-ImageData-behaviour.js (126022 => 126023)


--- trunk/LayoutTests/fast/canvas/canvas-ImageData-behaviour.js	2012-08-20 12:45:19 UTC (rev 126022)
+++ trunk/LayoutTests/fast/canvas/canvas-ImageData-behaviour.js	2012-08-20 13:24:50 UTC (rev 126023)
@@ -14,7 +14,7 @@
                   5.4, 255, 256, null, undefined];
 var testResults = [0, 1, 0, 0, 0,
                    0, 1, 2, 255, 0,
-                   0, 0, 0, 1, 5,
+                   0, 0, 0, 0, 5,
                    5, 255, 255, 0, 0];
 for (var i = 0; i < testValues.length; i++) {
     shouldBe("imageData.data[0] = "+testValues[i]+", imageData.data[0]", ""+testResults[i]);

Modified: trunk/LayoutTests/platform/chromium/TestExpectations (126022 => 126023)


--- trunk/LayoutTests/platform/chromium/TestExpectations	2012-08-20 12:45:19 UTC (rev 126022)
+++ trunk/LayoutTests/platform/chromium/TestExpectations	2012-08-20 13:24:50 UTC (rev 126023)
@@ -1872,11 +1872,14 @@
 BUGWK39212 : platform/chromium/virtual/gpu/canvas/philip/tests/2d.imageData.create2.type.html = TEXT
 BUGWK39212 : platform/chromium/virtual/gpu/canvas/philip/tests/2d.imageData.get.type.html = TEXT
 
-BUGWK40272 : canvas/philip/tests/2d.imageData.object.round.html = TEXT
-BUGWK40272 : canvas/philip/tests/2d.imageData.object.wrap.html = TEXT
-BUGWK40272 : platform/chromium/virtual/gpu/canvas/philip/tests/2d.imageData.object.round.html = TEXT
-BUGWK40272 : platform/chromium/virtual/gpu/canvas/philip/tests/2d.imageData.object.wrap.html = TEXT
+BUGWK94246 : canvas/philip/tests/2d.imageData.object.round.html = TEXT
+BUGWK94246 : platform/chromium/virtual/gpu/canvas/philip/tests/2d.imageData.object.round.html = TEXT
+BUGWK94246 : fast/canvas/canvas-ImageData-behaviour.html = TEXT
+BUGWK94246 : platform/chromium/virtual/gpu/fast/canvas/canvas-ImageData-behaviour.html = TEXT
 
+BUGWK94089 : canvas/philip/tests/2d.imageData.object.wrap.html = TEXT
+BUGWK94089 : platform/chromium/virtual/gpu/canvas/philip/tests/2d.imageData.object.wrap.html = TEXT
+
 BUGWK45991 : canvas/philip/tests/2d.pattern.image.broken.html = TEXT
 BUGWK45991 : platform/chromium/virtual/gpu/canvas/philip/tests/2d.pattern.image.broken.html = TEXT
 BUGWK45991 LINUX WIN : canvas/philip/tests/2d.text.draw.baseline.ideographic.html = TEXT
@@ -3506,3 +3509,6 @@
 BUGWK94256 DEBUG : fast/block/inline-children-root-linebox-crash.html = PASS CRASH
 
 BUGWK94261 DEBUG : http/tests/inspector/indexeddb/resources-panel.html = PASS CRASH TIMEOUT
+
+// Needs a rebaseline.
+BUGWK40272 : svg/css/circle-in-mask-with-shadow.svg = IMAGE

Modified: trunk/LayoutTests/platform/efl/Skipped (126022 => 126023)


--- trunk/LayoutTests/platform/efl/Skipped	2012-08-20 12:45:19 UTC (rev 126022)
+++ trunk/LayoutTests/platform/efl/Skipped	2012-08-20 13:24:50 UTC (rev 126023)
@@ -335,14 +335,6 @@
 sputnik/Unicode/Unicode_510/S7.6_A5.3_T1.html
 sputnik/Unicode/Unicode_510/S7.6_A5.3_T2.html
 
-# Tests failing with other ports too.
-# https://bugs.webkit.org/show_bug.cgi?id=40272
-canvas/philip/tests/2d.imageData.object.round.html
-canvas/philip/tests/2d.imageData.object.wrap.html
-
-# These tests are failing for us, but not for Mac. This likely
-# indicates platform specific problems (via GTK+).
-
 # A testcase for this failure is already in cairo tree, but has not yet been fixed.
 # Cairo commit http://cgit.freedesktop.org/cairo/commit/?id=4d4056872db94573183473610ad1d81d5439fdc6
 # https://bugs.webkit.org/show_bug.cgi?id=54471

Modified: trunk/LayoutTests/platform/efl/TestExpectations (126022 => 126023)


--- trunk/LayoutTests/platform/efl/TestExpectations	2012-08-20 12:45:19 UTC (rev 126022)
+++ trunk/LayoutTests/platform/efl/TestExpectations	2012-08-20 13:24:50 UTC (rev 126023)
@@ -911,3 +911,5 @@
 
 // Slider thumb can not be displayed without parent slider.
 BUGWK94334 : fast/forms/range/thumbslider-no-parent-slider.html = MISSING
+
+BUGWK94089 : canvas/philip/tests/2d.imageData.object.wrap.html = TEXT

Modified: trunk/LayoutTests/platform/gtk/TestExpectations (126022 => 126023)


--- trunk/LayoutTests/platform/gtk/TestExpectations	2012-08-20 12:45:19 UTC (rev 126022)
+++ trunk/LayoutTests/platform/gtk/TestExpectations	2012-08-20 13:24:50 UTC (rev 126023)
@@ -1016,8 +1016,7 @@
 // DRT does not obey testRunner.addURLToRedirect()
 BUGWKGTK : http/tests/loading/cross-origin-XHR-willLoadRequest.html = TEXT
 
-BUGWK40272 : canvas/philip/tests/2d.imageData.object.round.html = TEXT
-BUGWK40272 : canvas/philip/tests/2d.imageData.object.wrap.html = TEXT
+BUGWK94089 : canvas/philip/tests/2d.imageData.object.wrap.html = TEXT
 
 // See also https://bugs.webkit.org/show_bug.cgi?id=54926
 BUGWK53707 : http/tests/security/xss-DENIED-xsl-document-redirect.xml = TEXT

Modified: trunk/LayoutTests/platform/mac/Skipped (126022 => 126023)


--- trunk/LayoutTests/platform/mac/Skipped	2012-08-20 12:45:19 UTC (rev 126022)
+++ trunk/LayoutTests/platform/mac/Skipped	2012-08-20 13:24:50 UTC (rev 126023)
@@ -167,7 +167,6 @@
 # drawing model being different than the spec's current model. There is a current
 # effort out to change the spec to the webkit canvas model.
 canvas/philip/tests/2d.composite.operation.darker.html
-canvas/philip/tests/2d.imageData.object.round.html
 canvas/philip/tests/2d.imageData.object.wrap.html
 
 # This canvas test is skipped because it is out of date with respect to

Modified: trunk/LayoutTests/platform/qt/Skipped (126022 => 126023)


--- trunk/LayoutTests/platform/qt/Skipped	2012-08-20 12:45:19 UTC (rev 126022)
+++ trunk/LayoutTests/platform/qt/Skipped	2012-08-20 13:24:50 UTC (rev 126023)
@@ -2097,7 +2097,6 @@
 canvas/philip/tests/2d.imageData.create1.type.html
 canvas/philip/tests/2d.imageData.create2.type.html
 canvas/philip/tests/2d.imageData.get.type.html
-canvas/philip/tests/2d.imageData.object.round.html
 canvas/philip/tests/2d.imageData.object.wrap.html
 canvas/philip/tests/2d.imageData.put.unchanged.html
 canvas/philip/tests/2d.line.cap.open.html

Modified: trunk/Source/WTF/ChangeLog (126022 => 126023)


--- trunk/Source/WTF/ChangeLog	2012-08-20 12:45:19 UTC (rev 126022)
+++ trunk/Source/WTF/ChangeLog	2012-08-20 13:24:50 UTC (rev 126023)
@@ -1,3 +1,22 @@
+2012-08-20  Dominik Röttsches  <[email protected]>
+
+        The 2d.imageData.object.round canvas test is failing
+        https://bugs.webkit.org/show_bug.cgi?id=40272
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        According to the Uint8ClampedArray spec (http://www.khronos.org/registry/typedarray/specs/latest/#7.1)
+        which references WebIDL's clamping rules, with implications defined in http://www.w3.org/TR/WebIDL/#es-octet
+        we need to round to nearest integer, and to the even one if exactly halfway in between.
+        As a solution: applying C99's lrint which, in default rounding mode, does that.
+
+        The updated version of test 2d.imageData.object.round.html test passes now.
+
+        * wtf/MathExtras.h:
+        (lrint): Assembly based implementation for MSVC under X86, otherwise falling back to casting.
+        * wtf/Uint8ClampedArray.h:
+        (WTF::Uint8ClampedArray::set): lrint instead of simple rounding.
+
 2012-08-17  Michael Saboff  <[email protected]>
 
         Add ability to create AtomicString using LChar* buffer and length

Modified: trunk/Source/WTF/wtf/MathExtras.h (126022 => 126023)


--- trunk/Source/WTF/wtf/MathExtras.h	2012-08-20 12:45:19 UTC (rev 126022)
+++ trunk/Source/WTF/wtf/MathExtras.h	2012-08-20 13:24:50 UTC (rev 126023)
@@ -202,6 +202,22 @@
 #define fmod(x, y) wtf_fmod(x, y)
 #define pow(x, y) wtf_pow(x, y)
 
+// MSVC's math functions do not bring lrint.
+inline long int lrint(double flt)
+{
+    int intgr;
+#if CPU(X86)
+    __asm {
+        fld flt
+        fistp intgr
+    };
+#else
+#pragma message("Falling back to casting for lrint(), causes rounding inaccuracy in halfway case.")
+    intgr = static_cast<int>flt;
+#endif
+    return intgr;
+}
+
 #endif // COMPILER(MSVC)
 
 inline double deg2rad(double d)  { return d * piDouble / 180.0; }

Modified: trunk/Source/WTF/wtf/Uint8ClampedArray.h (126022 => 126023)


--- trunk/Source/WTF/wtf/Uint8ClampedArray.h	2012-08-20 12:45:19 UTC (rev 126022)
+++ trunk/Source/WTF/wtf/Uint8ClampedArray.h	2012-08-20 13:24:50 UTC (rev 126023)
@@ -28,7 +28,12 @@
 #ifndef Uint8ClampedArray_h
 #define Uint8ClampedArray_h
 
+#include <wtf/Platform.h>
+
 #include <wtf/Uint8Array.h>
+#if COMPILER(MSVC)
+#include <wtf/MathExtras.h>
+#endif
 
 namespace WTF {
 
@@ -100,7 +105,7 @@
         value = 0;
     else if (value > 255)
         value = 255;
-    data()[index] = static_cast<unsigned char>(value + 0.5);
+    data()[index] = static_cast<unsigned char>(lrint(value));
 }
 
 Uint8ClampedArray::Uint8ClampedArray(PassRefPtr<ArrayBuffer> buffer, unsigned byteOffset, unsigned length)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to