[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

senorblanco at chromium.org senorblanco at chromium.org
Wed Dec 22 15:42:33 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit c17049c075d639c1d5e0380cdad6846abcfe93f0
Author: senorblanco at chromium.org <senorblanco at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Nov 10 20:16:00 2010 +0000

    2010-11-10  Stephen White  <senorblanco at chromium.org>
    
            Reviewed by James Robinson.
    
            Fix canvas.putImageData(canvas.getImageData(...)) to be lossless.
            https://bugs.webkit.org/show_bug.cgi?id=49330
    
            These cycles should be lossless for valid colours.  A similar fix went
            into the CG port at r32878.
    
            Covered by canvas/philip/tests/2d.imageData.put.unchanged.html.
    
            * platform/graphics/skia/ImageBufferSkia.cpp:
            (WebCore::mulDiv255Ceil):
            A helper function to do (a + b + 254) / 255 without a divide.
            (WebCore::putImageData):
            Use the above helper to round up when premultiplying alpha.
    2010-11-10  Stephen White  <senorblanco at chromium.org>
    
            Reviewed by James Robinson.
    
            Mark 2d.imageData.put.unchanged.html as passing on Win/Linux.
            https://bugs.webkit.org/show_bug.cgi?id=49330
    
            * platform/chromium/test_expectations.txt:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71760 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 757046d..240268d 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,12 @@
+2010-11-10  Stephen White  <senorblanco at chromium.org>
+
+        Reviewed by James Robinson.
+
+        Mark 2d.imageData.put.unchanged.html as passing on Win/Linux.
+        https://bugs.webkit.org/show_bug.cgi?id=49330
+
+        * platform/chromium/test_expectations.txt:
+
 2010-11-10  Mihai Parparita  <mihaip at chromium.org>
 
         Unreviewed Chromium Mac rebaselines.
diff --git a/LayoutTests/platform/chromium/test_expectations.txt b/LayoutTests/platform/chromium/test_expectations.txt
index 5a98044..392bb9c 100644
--- a/LayoutTests/platform/chromium/test_expectations.txt
+++ b/LayoutTests/platform/chromium/test_expectations.txt
@@ -2402,7 +2402,6 @@ BUGWK45991 LINUX WIN : canvas/philip/tests/2d.gradient.radial.cone.shape2.html =
 BUGWK45991 LINUX WIN : canvas/philip/tests/2d.gradient.radial.outside3.html = TEXT
 BUGWK45991 LINUX WIN : canvas/philip/tests/2d.gradient.radial.touch1.html = TEXT
 BUGWK45991 LINUX WIN : canvas/philip/tests/2d.gradient.radial.touch3.html = TEXT
-BUGWK45991 LINUX WIN : canvas/philip/tests/2d.imageData.put.unchanged.html = TEXT
 BUGWK45991 LINUX WIN : canvas/philip/tests/2d.line.width.basic.html = TEXT
 BUGWK45991 LINUX WIN : canvas/philip/tests/2d.line.width.transformed.html = TEXT
 BUGWK45991 LINUX WIN : canvas/philip/tests/2d.path.arc.angle.3.html = TEXT
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 413e6c8..4cca714 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,21 @@
+2010-11-10  Stephen White  <senorblanco at chromium.org>
+
+        Reviewed by James Robinson.
+
+        Fix canvas.putImageData(canvas.getImageData(...)) to be lossless.
+        https://bugs.webkit.org/show_bug.cgi?id=49330
+
+        These cycles should be lossless for valid colours.  A similar fix went
+        into the CG port at r32878.
+
+        Covered by canvas/philip/tests/2d.imageData.put.unchanged.html.
+
+        * platform/graphics/skia/ImageBufferSkia.cpp:
+        (WebCore::mulDiv255Ceil):
+        A helper function to do (a + b + 254) / 255 without a divide.
+        (WebCore::putImageData):
+        Use the above helper to round up when premultiplying alpha.
+
 2010-11-10  Csaba Osztrogonác  <ossy at webkit.org>
 
         Reviewed by David Hyatt.
diff --git a/WebCore/platform/graphics/skia/ImageBufferSkia.cpp b/WebCore/platform/graphics/skia/ImageBufferSkia.cpp
index 143d667..f7cc5a6 100644
--- a/WebCore/platform/graphics/skia/ImageBufferSkia.cpp
+++ b/WebCore/platform/graphics/skia/ImageBufferSkia.cpp
@@ -238,6 +238,14 @@ PassRefPtr<ImageData> ImageBuffer::getPremultipliedImageData(const IntRect& rect
     return getImageData<Premultiplied>(rect, *context()->platformContext()->bitmap(), m_size);
 }
 
+// This function does the equivalent of (a * b + 254) / 255, without an integer divide.
+// Valid for a, b in the range [0..255].
+unsigned mulDiv255Ceil(unsigned a, unsigned b)
+{
+    unsigned value = a * b + 255;
+    return (value + (value >> 8)) >> 8;
+}
+
 template <Multiply multiplied>
 void putImageData(ImageData*& source, const IntRect& sourceRect, const IntPoint& destPoint, 
                   const SkBitmap& bitmap, const IntSize& size)
@@ -279,10 +287,13 @@ void putImageData(ImageData*& source, const IntRect& sourceRect, const IntPoint&
         uint32_t* destRow = bitmap.getAddr32(destX, destY + y);
         for (int x = 0; x < numColumns; ++x) {
             const unsigned char* srcPixel = &srcRow[x * 4];
-            if (multiplied == Unmultiplied)
-                destRow[x] = SkPreMultiplyARGB(srcPixel[3], srcPixel[0],
-                                               srcPixel[1], srcPixel[2]);
-            else
+            if (multiplied == Unmultiplied) {
+                unsigned char alpha = srcPixel[3];
+                unsigned char r = mulDiv255Ceil(srcPixel[0], alpha);
+                unsigned char g = mulDiv255Ceil(srcPixel[1], alpha);
+                unsigned char b = mulDiv255Ceil(srcPixel[2], alpha);
+                destRow[x] = SkPackARGB32(alpha, r, g, b);
+            } else
                 destRow[x] = SkPackARGB32(srcPixel[3], srcPixel[0],
                                           srcPixel[1], srcPixel[2]);
         }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list