Changeset 127001 in webkit


Ignore:
Timestamp:
Aug 29, 2012 8:33:07 AM (12 years ago)
Author:
dominik.rottsches@intel.com
Message:

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

Reviewed by Benjamin Poulain.

Source/WTF:

Updating previous patch to address Benjamin's comments.
#ifdef in Uint8ClampedArray removed, fallback implementation for MSVC on non-X86 added.

  • wtf/MathExtras.h:

(lrint): Fallback implementation for non-X86 & MSVC case.

  • wtf/Uint8ClampedArray.h: Removed #ifdef.

Tools:

Updating patch to address Benjamin's review comments.
Adding a WTF test to test lrint implementation.

  • TestWebKitAPI/CMakeLists.txt: Added MathExtras.cpp test file.
  • TestWebKitAPI/GNUmakefile.am: Added MathExtras.cpp test file.
  • TestWebKitAPI/TestWebKitAPI.gypi: Added MathExtras.cpp test file.
  • TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: Added MathExtras.cpp test file.
  • TestWebKitAPI/Tests/WTF/MathExtras.cpp: Added this test file containing a test for lrint().

(TestWebKitAPI):
(TestWebKitAPI::TEST):

  • TestWebKitAPI/win/TestWebKitAPI.vcproj: Added MathExtras.cpp test file.
Location:
trunk
Files:
1 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r126926 r127001  
     12012-08-29  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 Benjamin Poulain.
     7
     8        Updating previous patch to address Benjamin's comments.
     9        #ifdef in Uint8ClampedArray removed, fallback implementation for MSVC on non-X86 added.
     10
     11        * wtf/MathExtras.h:
     12        (lrint): Fallback implementation for non-X86 & MSVC case.
     13        * wtf/Uint8ClampedArray.h: Removed #ifdef.
     14
    1152012-08-28  Sheriff Bot  <webkit.review.bot@gmail.com>
    216
  • trunk/Source/WTF/wtf/MathExtras.h

    r126153 r127001  
    206206inline long int lrint(double flt)
    207207{
    208     int intgr;
     208    int64_t intgr;
    209209#if CPU(X86)
    210210    __asm {
     
    213213    };
    214214#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;
     215    ASSERT(isfinite(flt));
     216    double rounded = round(flt);
     217    intgr = static_cast<int64_t>(rounded);
     218    // If the fractional part is exactly 0.5, we need to check whether
     219    // the rounded result is even. If it is not we need to add 1 to
     220    // negative values and subtract one from positive values.
     221    if (fabs(intgr - flt) == 0.5 & intgr)
     222        intgr -= ((intgr >> 62) | 1); // 1 with the sign of result, i.e. -1 or 1.
     223#endif
     224    return static_cast<long int>(intgr);
    219225}
    220226
  • trunk/Source/WTF/wtf/Uint8ClampedArray.h

    r126023 r127001  
    3232
    3333#include <wtf/Uint8Array.h>
    34 #if COMPILER(MSVC)
    3534#include <wtf/MathExtras.h>
    36 #endif
    3735
    3836namespace WTF {
  • trunk/Tools/ChangeLog

    r126997 r127001  
     12012-08-29  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 Benjamin Poulain.
     7
     8        Updating patch to address Benjamin's review comments.
     9        Adding a WTF test to test lrint implementation.
     10
     11        * TestWebKitAPI/CMakeLists.txt: Added MathExtras.cpp test file.
     12        * TestWebKitAPI/GNUmakefile.am: Added MathExtras.cpp test file.
     13        * TestWebKitAPI/TestWebKitAPI.gypi: Added MathExtras.cpp test file.
     14        * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: Added MathExtras.cpp test file.
     15        * TestWebKitAPI/Tests/WTF/MathExtras.cpp: Added this test file containing a test for lrint().
     16        (TestWebKitAPI):
     17        (TestWebKitAPI::TEST):
     18        * TestWebKitAPI/win/TestWebKitAPI.vcproj: Added MathExtras.cpp test file.
     19
    1202012-08-29  Florin Malita  <fmalita@chromium.org>
    221
  • trunk/Tools/TestWebKitAPI/CMakeLists.txt

    r126658 r127001  
    7373    ${TESTWEBKITAPI_DIR}/Tests/WTF/HashMap.cpp
    7474    ${TESTWEBKITAPI_DIR}/Tests/WTF/IntegerToStringConversion.cpp
     75    ${TESTWEBKITAPI_DIR}/Tests/WTF/MathExtras.cpp
    7576    ${TESTWEBKITAPI_DIR}/Tests/WTF/MetaAllocator.cpp
    7677    ${TESTWEBKITAPI_DIR}/Tests/WTF/RedBlackTree.cpp
  • trunk/Tools/TestWebKitAPI/GNUmakefile.am

    r126658 r127001  
    5757        Tools/TestWebKitAPI/Tests/WTF/HashMap.cpp \
    5858        Tools/TestWebKitAPI/Tests/WTF/IntegerToStringConversion.cpp \
     59        Tools/TestWebKitAPI/Tests/WTF/MathExtras.cpp \
    5960        Tools/TestWebKitAPI/Tests/WTF/MediaTime.cpp \
    6061        Tools/TestWebKitAPI/Tests/WTF/RedBlackTree.cpp \
  • trunk/Tools/TestWebKitAPI/TestWebKitAPI.gypi

    r126530 r127001  
    3737            'Tests/WTF/Functional.cpp',
    3838            'Tests/WTF/HashMap.cpp',
     39            'Tests/WTF/MathExtras.cpp',
    3940            'Tests/WTF/MediaTime.cpp',
    4041            'Tests/WTF/RedBlackTree.cpp',
  • trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj

    r126658 r127001  
    9191                A5E2027515B21F6E00C13E14 /* WindowlessWebViewWithMedia.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = A5E2027015B2180600C13E14 /* WindowlessWebViewWithMedia.html */; };
    9292                A7A966DB140ECCC8005EF9B4 /* CheckedArithmeticOperations.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7A966DA140ECCC8005EF9B4 /* CheckedArithmeticOperations.cpp */; };
     93                B4039F9D15E6D8B3007255D6 /* MathExtras.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B4039F9C15E6D8B3007255D6 /* MathExtras.cpp */; };
    9394                B55F11A01516834F00915916 /* AttributedString.mm in Sources */ = {isa = PBXBuildFile; fileRef = B55F119F1516834F00915916 /* AttributedString.mm */; };
    9495                B55F11B71517D03300915916 /* attributedStringCustomFont.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = B55F11B01517A2C400915916 /* attributedStringCustomFont.html */; };
     
    326327                A5E2027215B2181900C13E14 /* WindowlessWebViewWithMedia.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WindowlessWebViewWithMedia.mm; sourceTree = "<group>"; };
    327328                A7A966DA140ECCC8005EF9B4 /* CheckedArithmeticOperations.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CheckedArithmeticOperations.cpp; path = WTF/CheckedArithmeticOperations.cpp; sourceTree = "<group>"; };
     329                B4039F9C15E6D8B3007255D6 /* MathExtras.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MathExtras.cpp; path = WTF/MathExtras.cpp; sourceTree = "<group>"; };
    328330                B55F119F1516834F00915916 /* AttributedString.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AttributedString.mm; sourceTree = "<group>"; };
    329331                B55F11B01517A2C400915916 /* attributedStringCustomFont.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = attributedStringCustomFont.html; sourceTree = "<group>"; };
     
    643645                                0BCD833414857CE400EA2003 /* HashMap.cpp */,
    644646                                26B2DFF815BDE599004F691D /* HashSet.cpp */,
     647                                B4039F9C15E6D8B3007255D6 /* MathExtras.cpp */,
    645648                                14F3B11215E45EAB00210069 /* SaturatedArithmeticOperations.cpp */,
    646649                                266FAFD215E5775200F61D5B /* IntegerToStringConversion.cpp */,
     
    926929                                33DC8911141953A300747EF7 /* LoadCanceledNoServerRedirectCallback.cpp in Sources */,
    927930                                BC131A9B1171316900B69727 /* main.mm in Sources */,
     931                                B4039F9D15E6D8B3007255D6 /* MathExtras.cpp in Sources */,
    928932                                CD5497B415857F0C00B5BC30 /* MediaTime.cpp in Sources */,
    929933                                E1220DA0155B25480013E2FC /* MemoryCacheDisableWithinResourceLoadDelegate.mm in Sources */,
  • trunk/Tools/TestWebKitAPI/win/TestWebKitAPI.vcproj

    r126509 r127001  
    653653                                </File>
    654654                                <File
     655                                        RelativePath="..\Tests\WTF\MathExtras.cpp"
     656                                        >
     657                                </File>
     658                                <File
    655659                                        RelativePath="..\Tests\WTF\MediaTime.cpp"
    656660                                        >
Note: See TracChangeset for help on using the changeset viewer.