[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198

commit-queue at webkit.org commit-queue at webkit.org
Sun Feb 20 22:46:40 UTC 2011


The following commit has been merged in the webkit-1.3 branch:
commit 74421310221ab41b906f23eb7d906e1fb649a591
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Jan 11 12:46:06 2011 +0000

    2011-01-11  Noel Gordon  <noel.gordon at gmail.com>
    
            Reviewed by James Robinson.
    
            [chromium] canvas.toDataURL("image/jpeg") should composite onto black.
            https://bugs.webkit.org/show_bug.cgi?id=51237
    
            canvas/philip/tests/toDataURL.jpeg.alpha.html only fails on chromium-mac
            now, tracked by bug http://webkit.org/b/40147.
    
            * platform/chromium/test_expectations.txt: win & linux pass.
    2011-01-11  Noel Gordon  <noel.gordon at gmail.com>
    
             Reviewed by James Robinson.
    
             [chromium] canvas.toDataURL("image/jpeg") should composite onto black.
             https://bugs.webkit.org/show_bug.cgi?id=51237
    
             The Canvas specification requires that the canvas image is composited using
             the Porter-Duff operator source-over onto a black background; the resultant
             image should be JPEG encoded and returned as a dataURL.  To composite image
             A and background B, for any Porter-Duff operator, produce pixels I with
    
                I = c(A)F(A) + c(B)F(B)
    
             where, F(X) is the fraction [0.0-1.0] contributed to the composite by image
             X, and c(X) are the premultiplied RGB color components of image X.  Note by
             definition, c(B) = 0 since the background is black, so I = c(A)F(A).  Since
             F(A) = 1 in Porter-Duff operator source-over, the composited pixels satisfy
             I = c(A).  Hence, to conform to the Canvas spec, pass the premultiplied RGB
             color components of the canvas image to the JPEG encoder.
    
             Covered by canvas/philip/tests/toDataURL.jpeg.alpha.html
    
             * platform/image-encoders/skia/JPEGImageEncoder.cpp:
             (WebCore::preMultipliedBGRAtoRGB): Use Porter-Duff source-over black.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@75488 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index c1d138e..76ee353 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,15 @@
+2011-01-11  Noel Gordon  <noel.gordon at gmail.com>
+
+        Reviewed by James Robinson.
+
+        [chromium] canvas.toDataURL("image/jpeg") should composite onto black.
+        https://bugs.webkit.org/show_bug.cgi?id=51237
+
+        canvas/philip/tests/toDataURL.jpeg.alpha.html only fails on chromium-mac
+        now, tracked by bug http://webkit.org/b/40147.
+
+        * platform/chromium/test_expectations.txt: win & linux pass.
+
 2011-01-11  Anton Muhin  <antonm at chromium.org>
 
         Unreviewed Chromium test expectations update.
diff --git a/LayoutTests/platform/chromium/test_expectations.txt b/LayoutTests/platform/chromium/test_expectations.txt
index 07b6355..ec7b367 100644
--- a/LayoutTests/platform/chromium/test_expectations.txt
+++ b/LayoutTests/platform/chromium/test_expectations.txt
@@ -2054,7 +2054,7 @@ BUGWK45991 : canvas/philip/tests/2d.pattern.image.broken.html = TEXT
 BUGWK45991 : canvas/philip/tests/2d.text.draw.baseline.ideographic.html = TEXT
 BUGWK48579 : canvas/philip/tests/type.prototype.html = TEXT
 BUGWK50797 : canvas/philip/tests/2d.fillStyle.parse.invalid.rgba-6.html = TEXT
-BUGWK40147 : canvas/philip/tests/toDataURL.jpeg.alpha.html = TEXT
+BUGWK40147 MAC : canvas/philip/tests/toDataURL.jpeg.alpha.html = TEXT
 BUGCR61824 : canvas/philip/tests/2d.pattern.image.string.html = TEXT
 
 // Update canvas/philip in WK r71481
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 4f4d5e9..8dbc76d 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,29 @@
+2011-01-11  Noel Gordon  <noel.gordon at gmail.com>
+
+         Reviewed by James Robinson.
+
+         [chromium] canvas.toDataURL("image/jpeg") should composite onto black.
+         https://bugs.webkit.org/show_bug.cgi?id=51237
+
+         The Canvas specification requires that the canvas image is composited using
+         the Porter-Duff operator source-over onto a black background; the resultant
+         image should be JPEG encoded and returned as a dataURL.  To composite image
+         A and background B, for any Porter-Duff operator, produce pixels I with
+
+            I = c(A)F(A) + c(B)F(B)
+
+         where, F(X) is the fraction [0.0-1.0] contributed to the composite by image
+         X, and c(X) are the premultiplied RGB color components of image X.  Note by
+         definition, c(B) = 0 since the background is black, so I = c(A)F(A).  Since
+         F(A) = 1 in Porter-Duff operator source-over, the composited pixels satisfy
+         I = c(A).  Hence, to conform to the Canvas spec, pass the premultiplied RGB
+         color components of the canvas image to the JPEG encoder.
+
+         Covered by canvas/philip/tests/toDataURL.jpeg.alpha.html
+
+         * platform/image-encoders/skia/JPEGImageEncoder.cpp:
+         (WebCore::preMultipliedBGRAtoRGB): Use Porter-Duff source-over black.
+
 2011-01-11  François Sausset  <sausset at gmail.com>
 
         Reviewed by Eric Seidel.
diff --git a/Source/WebCore/platform/image-encoders/skia/JPEGImageEncoder.cpp b/Source/WebCore/platform/image-encoders/skia/JPEGImageEncoder.cpp
index b675ab5..be3c92a 100644
--- a/Source/WebCore/platform/image-encoders/skia/JPEGImageEncoder.cpp
+++ b/Source/WebCore/platform/image-encoders/skia/JPEGImageEncoder.cpp
@@ -79,23 +79,12 @@ static void handleError(j_common_ptr common)
     longjmp(*jumpBufferPtr, -1);
 }
 
-// FIXME: is alpha unpremultiplication correct, or should the alpha channel
-// be ignored? See bug http://webkit.org/b/40147.
-void preMultipliedBGRAtoRGB(const SkPMColor* input, unsigned int pixels, unsigned char* output)
+static void preMultipliedBGRAtoRGB(const SkPMColor* input, unsigned int pixels, unsigned char* output)
 {
-    static const SkUnPreMultiply::Scale* scale = SkUnPreMultiply::GetScaleTable();
-
     for (; pixels-- > 0; ++input) {
-        const unsigned alpha = SkGetPackedA32(*input);
-        if ((alpha != 0) && (alpha != 255)) {
-            *output++ = SkUnPreMultiply::ApplyScale(scale[alpha], SkGetPackedR32(*input));
-            *output++ = SkUnPreMultiply::ApplyScale(scale[alpha], SkGetPackedG32(*input));
-            *output++ = SkUnPreMultiply::ApplyScale(scale[alpha], SkGetPackedB32(*input));
-        } else {
-            *output++ = SkGetPackedR32(*input);
-            *output++ = SkGetPackedG32(*input);
-            *output++ = SkGetPackedB32(*input);
-        }
+        *output++ = SkGetPackedR32(*input);
+        *output++ = SkGetPackedG32(*input);
+        *output++ = SkGetPackedB32(*input);
     }
 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list