Changeset 75488 in webkit
- Timestamp:
- Jan 11, 2011, 4:46:06 AM (15 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r75484 r75488 1 2011-01-11 Noel Gordon <noel.gordon@gmail.com> 2 3 Reviewed by James Robinson. 4 5 [chromium] canvas.toDataURL("image/jpeg") should composite onto black. 6 https://bugs.webkit.org/show_bug.cgi?id=51237 7 8 canvas/philip/tests/toDataURL.jpeg.alpha.html only fails on chromium-mac 9 now, tracked by bug http://webkit.org/b/40147. 10 11 * platform/chromium/test_expectations.txt: win & linux pass. 12 1 13 2011-01-11 Anton Muhin <antonm@chromium.org> 2 14 -
trunk/LayoutTests/platform/chromium/test_expectations.txt
r75482 r75488 2055 2055 BUGWK48579 : canvas/philip/tests/type.prototype.html = TEXT 2056 2056 BUGWK50797 : canvas/philip/tests/2d.fillStyle.parse.invalid.rgba-6.html = TEXT 2057 BUGWK40147 : canvas/philip/tests/toDataURL.jpeg.alpha.html = TEXT2057 BUGWK40147 MAC : canvas/philip/tests/toDataURL.jpeg.alpha.html = TEXT 2058 2058 BUGCR61824 : canvas/philip/tests/2d.pattern.image.string.html = TEXT 2059 2059 -
trunk/Source/WebCore/ChangeLog
r75487 r75488 1 2011-01-11 Noel Gordon <noel.gordon@gmail.com> 2 3 Reviewed by James Robinson. 4 5 [chromium] canvas.toDataURL("image/jpeg") should composite onto black. 6 https://bugs.webkit.org/show_bug.cgi?id=51237 7 8 The Canvas specification requires that the canvas image is composited using 9 the Porter-Duff operator source-over onto a black background; the resultant 10 image should be JPEG encoded and returned as a dataURL. To composite image 11 A and background B, for any Porter-Duff operator, produce pixels I with 12 13 I = c(A)F(A) + c(B)F(B) 14 15 where, F(X) is the fraction [0.0-1.0] contributed to the composite by image 16 X, and c(X) are the premultiplied RGB color components of image X. Note by 17 definition, c(B) = 0 since the background is black, so I = c(A)F(A). Since 18 F(A) = 1 in Porter-Duff operator source-over, the composited pixels satisfy 19 I = c(A). Hence, to conform to the Canvas spec, pass the premultiplied RGB 20 color components of the canvas image to the JPEG encoder. 21 22 Covered by canvas/philip/tests/toDataURL.jpeg.alpha.html 23 24 * platform/image-encoders/skia/JPEGImageEncoder.cpp: 25 (WebCore::preMultipliedBGRAtoRGB): Use Porter-Duff source-over black. 26 1 27 2011-01-11 François Sausset <sausset@gmail.com> 2 28 -
trunk/Source/WebCore/platform/image-encoders/skia/JPEGImageEncoder.cpp
r74631 r75488 80 80 } 81 81 82 // FIXME: is alpha unpremultiplication correct, or should the alpha channel 83 // be ignored? See bug http://webkit.org/b/40147. 84 void preMultipliedBGRAtoRGB(const SkPMColor* input, unsigned int pixels, unsigned char* output) 82 static void preMultipliedBGRAtoRGB(const SkPMColor* input, unsigned int pixels, unsigned char* output) 85 83 { 86 static const SkUnPreMultiply::Scale* scale = SkUnPreMultiply::GetScaleTable();87 88 84 for (; pixels-- > 0; ++input) { 89 const unsigned alpha = SkGetPackedA32(*input); 90 if ((alpha != 0) && (alpha != 255)) { 91 *output++ = SkUnPreMultiply::ApplyScale(scale[alpha], SkGetPackedR32(*input)); 92 *output++ = SkUnPreMultiply::ApplyScale(scale[alpha], SkGetPackedG32(*input)); 93 *output++ = SkUnPreMultiply::ApplyScale(scale[alpha], SkGetPackedB32(*input)); 94 } else { 95 *output++ = SkGetPackedR32(*input); 96 *output++ = SkGetPackedG32(*input); 97 *output++ = SkGetPackedB32(*input); 98 } 85 *output++ = SkGetPackedR32(*input); 86 *output++ = SkGetPackedG32(*input); 87 *output++ = SkGetPackedB32(*input); 99 88 } 100 89 }
Note:
See TracChangeset
for help on using the changeset viewer.