Changeset 126023 in webkit


Ignore:
Timestamp:
Aug 20, 2012 6:24:50 AM (12 years ago)
Author:
commit-queue@webkit.org
Message:

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

Patch by Dominik Röttsches <dominik.rottsches@intel.com> 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.
Location:
trunk
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r126020 r126023  
     12012-08-20  Dominik Röttsches  <dominik.rottsches@intel.com>
     2
     3        The 2d.imageData.object.round canvas test is failing
     4        https://bugs.webkit.org/show_bug.cgi?id=40272
     5
     6        Reviewed by Kenneth Rohde Christiansen.
     7
     8        Fixing expectations for the imageData rounding test, unskipping the tests on all ports.
     9
     10        * canvas/philip/tests/2d.imageData.object.round.html: Fixing expected results according to "round to even in halfway case".
     11        * fast/canvas/canvas-ImageData-behaviour-expected.txt: Fixing expected results according to "round to even in halfway case".
     12        * fast/canvas/canvas-ImageData-behaviour.js: Fixing expected results according to "round to even in halfway case".
     13        * platform/chromium/TestExpectations: Updating bug id for 2d.imageData.object.round.html and for wrap case, adding SVG case for rebaselining.
     14        * platform/efl/Skipped: 2d.imageData.object.round.html
     15        * platform/efl/TestExpectations: Moving 2d.imageData.object.wrap.html case here with new bug id.
     16        * platform/gtk/TestExpectations: Unskippng 2d.imageData.object.round.html, updating bug id for wrap case.
     17        * platform/mac/Skipped: Unskipping 2d.imageData.object.round.html.
     18        * platform/qt/Skipped: Unskipping 2d.imageData.object.round.html.
     19
    1202012-08-20  Christophe Dumez  <christophe.dumez@intel.com>
    221
  • trunk/LayoutTests/canvas/philip/tests/2d.imageData.object.round.html

    r79501 r126023  
    1919_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0");
    2020imgdata.data[0] = 0.501;
    21 _assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0");
     21_assertSame(imgdata.data[0], 1, "imgdata.data[\""+(0)+"\"]", "1");
    2222imgdata.data[0] = 1.499;
    2323_assertSame(imgdata.data[0], 1, "imgdata.data[\""+(0)+"\"]", "1");
     
    3333_assertSame(imgdata.data[0], 252, "imgdata.data[\""+(0)+"\"]", "252");
    3434imgdata.data[0] = 253.5;
    35 _assertSame(imgdata.data[0], 253, "imgdata.data[\""+(0)+"\"]", "253");
     35_assertSame(imgdata.data[0], 254, "imgdata.data[\""+(0)+"\"]", "254");
    3636imgdata.data[0] = 254.5;
    3737_assertSame(imgdata.data[0], 254, "imgdata.data[\""+(0)+"\"]", "254");
    3838imgdata.data[0] = 256.5;
    39 _assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0");
     39_assertSame(imgdata.data[0], 255, "imgdata.data[\""+(0)+"\"]", "255");
    4040imgdata.data[0] = -0.5;
    4141_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0");
    4242imgdata.data[0] = -1.5;
    43 _assertSame(imgdata.data[0], 255, "imgdata.data[\""+(0)+"\"]", "255");
     43_assertSame(imgdata.data[0], 0, "imgdata.data[\""+(0)+"\"]", "0");
    4444
    4545
  • trunk/LayoutTests/fast/canvas/canvas-ImageData-behaviour-expected.txt

    r79501 r126023  
    3636PASS imageData.data[0] = -0.5, imageData.data[0] is 0
    3737PASS imageData.data[0] = 0, imageData.data[0] is 0
    38 PASS imageData.data[0] = 0.5, imageData.data[0] is 1
     38PASS imageData.data[0] = 0.5, imageData.data[0] is 0
    3939PASS imageData.data[0] = 5, imageData.data[0] is 5
    4040PASS imageData.data[0] = 5.4, imageData.data[0] is 5
  • trunk/LayoutTests/fast/canvas/canvas-ImageData-behaviour.js

    r98407 r126023  
    1515var testResults = [0, 1, 0, 0, 0,
    1616                   0, 1, 2, 255, 0,
    17                    0, 0, 0, 1, 5,
     17                   0, 0, 0, 0, 5,
    1818                   5, 255, 255, 0, 0];
    1919for (var i = 0; i < testValues.length; i++) {
  • trunk/LayoutTests/platform/chromium/TestExpectations

    r126007 r126023  
    18731873BUGWK39212 : platform/chromium/virtual/gpu/canvas/philip/tests/2d.imageData.get.type.html = TEXT
    18741874
    1875 BUGWK40272 : canvas/philip/tests/2d.imageData.object.round.html = TEXT
    1876 BUGWK40272 : canvas/philip/tests/2d.imageData.object.wrap.html = TEXT
    1877 BUGWK40272 : platform/chromium/virtual/gpu/canvas/philip/tests/2d.imageData.object.round.html = TEXT
    1878 BUGWK40272 : platform/chromium/virtual/gpu/canvas/philip/tests/2d.imageData.object.wrap.html = TEXT
     1875BUGWK94246 : canvas/philip/tests/2d.imageData.object.round.html = TEXT
     1876BUGWK94246 : platform/chromium/virtual/gpu/canvas/philip/tests/2d.imageData.object.round.html = TEXT
     1877BUGWK94246 : fast/canvas/canvas-ImageData-behaviour.html = TEXT
     1878BUGWK94246 : platform/chromium/virtual/gpu/fast/canvas/canvas-ImageData-behaviour.html = TEXT
     1879
     1880BUGWK94089 : canvas/philip/tests/2d.imageData.object.wrap.html = TEXT
     1881BUGWK94089 : platform/chromium/virtual/gpu/canvas/philip/tests/2d.imageData.object.wrap.html = TEXT
    18791882
    18801883BUGWK45991 : canvas/philip/tests/2d.pattern.image.broken.html = TEXT
     
    35073510
    35083511BUGWK94261 DEBUG : http/tests/inspector/indexeddb/resources-panel.html = PASS CRASH TIMEOUT
     3512
     3513// Needs a rebaseline.
     3514BUGWK40272 : svg/css/circle-in-mask-with-shadow.svg = IMAGE
  • trunk/LayoutTests/platform/efl/Skipped

    r125663 r126023  
    335335sputnik/Unicode/Unicode_510/S7.6_A5.3_T1.html
    336336sputnik/Unicode/Unicode_510/S7.6_A5.3_T2.html
    337 
    338 # Tests failing with other ports too.
    339 # https://bugs.webkit.org/show_bug.cgi?id=40272
    340 canvas/philip/tests/2d.imageData.object.round.html
    341 canvas/philip/tests/2d.imageData.object.wrap.html
    342 
    343 # These tests are failing for us, but not for Mac. This likely
    344 # indicates platform specific problems (via GTK+).
    345337
    346338# A testcase for this failure is already in cairo tree, but has not yet been fixed.
  • trunk/LayoutTests/platform/efl/TestExpectations

    r126020 r126023  
    912912// Slider thumb can not be displayed without parent slider.
    913913BUGWK94334 : fast/forms/range/thumbslider-no-parent-slider.html = MISSING
     914
     915BUGWK94089 : canvas/philip/tests/2d.imageData.object.wrap.html = TEXT
  • trunk/LayoutTests/platform/gtk/TestExpectations

    r126014 r126023  
    10171017BUGWKGTK : http/tests/loading/cross-origin-XHR-willLoadRequest.html = TEXT
    10181018
    1019 BUGWK40272 : canvas/philip/tests/2d.imageData.object.round.html = TEXT
    1020 BUGWK40272 : canvas/philip/tests/2d.imageData.object.wrap.html = TEXT
     1019BUGWK94089 : canvas/philip/tests/2d.imageData.object.wrap.html = TEXT
    10211020
    10221021// See also https://bugs.webkit.org/show_bug.cgi?id=54926
  • trunk/LayoutTests/platform/mac/Skipped

    r125794 r126023  
    168168# effort out to change the spec to the webkit canvas model.
    169169canvas/philip/tests/2d.composite.operation.darker.html
    170 canvas/philip/tests/2d.imageData.object.round.html
    171170canvas/philip/tests/2d.imageData.object.wrap.html
    172171
  • trunk/LayoutTests/platform/qt/Skipped

    r125794 r126023  
    20982098canvas/philip/tests/2d.imageData.create2.type.html
    20992099canvas/philip/tests/2d.imageData.get.type.html
    2100 canvas/philip/tests/2d.imageData.object.round.html
    21012100canvas/philip/tests/2d.imageData.object.wrap.html
    21022101canvas/philip/tests/2d.imageData.put.unchanged.html
  • trunk/Source/WTF/ChangeLog

    r125958 r126023  
     12012-08-20  Dominik Röttsches  <dominik.rottsches@intel.com>
     2
     3        The 2d.imageData.object.round canvas test is failing
     4        https://bugs.webkit.org/show_bug.cgi?id=40272
     5
     6        Reviewed by Kenneth Rohde Christiansen.
     7
     8        According to the Uint8ClampedArray spec (http://www.khronos.org/registry/typedarray/specs/latest/#7.1)
     9        which references WebIDL's clamping rules, with implications defined in http://www.w3.org/TR/WebIDL/#es-octet
     10        we need to round to nearest integer, and to the even one if exactly halfway in between.
     11        As a solution: applying C99's lrint which, in default rounding mode, does that.
     12
     13        The updated version of test 2d.imageData.object.round.html test passes now.
     14
     15        * wtf/MathExtras.h:
     16        (lrint): Assembly based implementation for MSVC under X86, otherwise falling back to casting.
     17        * wtf/Uint8ClampedArray.h:
     18        (WTF::Uint8ClampedArray::set): lrint instead of simple rounding.
     19
    1202012-08-17  Michael Saboff  <msaboff@apple.com>
    221
  • trunk/Source/WTF/wtf/MathExtras.h

    r123175 r126023  
    203203#define pow(x, y) wtf_pow(x, y)
    204204
     205// MSVC's math functions do not bring lrint.
     206inline long int lrint(double flt)
     207{
     208    int intgr;
     209#if CPU(X86)
     210    __asm {
     211        fld flt
     212        fistp intgr
     213    };
     214#else
     215#pragma message("Falling back to casting for lrint(), causes rounding inaccuracy in halfway case.")
     216    intgr = static_cast<int>flt;
     217#endif
     218    return intgr;
     219}
     220
    205221#endif // COMPILER(MSVC)
    206222
  • trunk/Source/WTF/wtf/Uint8ClampedArray.h

    r123935 r126023  
    2929#define Uint8ClampedArray_h
    3030
     31#include <wtf/Platform.h>
     32
    3133#include <wtf/Uint8Array.h>
     34#if COMPILER(MSVC)
     35#include <wtf/MathExtras.h>
     36#endif
    3237
    3338namespace WTF {
     
    101106    else if (value > 255)
    102107        value = 255;
    103     data()[index] = static_cast<unsigned char>(value + 0.5);
     108    data()[index] = static_cast<unsigned char>(lrint(value));
    104109}
    105110
Note: See TracChangeset for help on using the changeset viewer.