Changeset 47991 in webkit


Ignore:
Timestamp:
Sep 2, 2009 1:38:52 PM (15 years ago)
Author:
eric@webkit.org
Message:

2009-09-02 Dirk Schulze <krit@webkit.org>

Reviewed by Eric Seidel.

SVG Filter premultiplied color support for getImageDate/putImageData
https://bugs.webkit.org/show_bug.cgi?id=27933

Patch to get premultiplied color support for Skia on getImageDate/putImageData.

  • platform/graphics/skia/ImageBufferSkia.cpp: (WebCore::getImageData): (WebCore::putImageData):
Location:
trunk/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r47990 r47991  
     12009-09-02  Dirk Schulze  <krit@webkit.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        SVG Filter premultiplied color support for getImageDate/putImageData
     6        [https://bugs.webkit.org/show_bug.cgi?id=27933]
     7
     8        Patch to get premultiplied color support for Skia on getImageDate/putImageData.
     9
     10        * platform/graphics/skia/ImageBufferSkia.cpp:
     11        (WebCore::getImageData):
     12        (WebCore::putImageData):
     13
    1142009-09-02  Brady Eidson  <beidson@apple.com>
    215
  • trunk/WebCore/platform/graphics/skia/ImageBufferSkia.cpp

    r47126 r47991  
    162162        uint32_t* srcRow = bitmap.getAddr32(originX, originY + y);
    163163        for (int x = 0; x < numColumns; ++x) {
    164             // TODO: Support for premultiplied colors
    165             SkColor color = SkPMColorToColor(srcRow[x]);
    166164            unsigned char* destPixel = &destRow[x * 4];
    167             destPixel[0] = SkColorGetR(color);
    168             destPixel[1] = SkColorGetG(color);
    169             destPixel[2] = SkColorGetB(color);
    170             destPixel[3] = SkColorGetA(color);
     165            if (multiplied == Unmultiplied) {
     166                SkColor color = SkPMColorToColor(srcRow[x]);
     167                destPixel[0] = SkColorGetR(color);
     168                destPixel[1] = SkColorGetG(color);
     169                destPixel[2] = SkColorGetB(color);
     170                destPixel[3] = SkColorGetA(color);
     171            } else {
     172                // Input and output are both pre-multiplied, we just need to re-arrange the
     173                // bytes from the bitmap format to RGBA.
     174                destPixel[0] = SkGetPackedR32(srcRow[x]);
     175                destPixel[1] = SkGetPackedG32(srcRow[x]);
     176                destPixel[2] = SkGetPackedB32(srcRow[x]);
     177                destPixel[3] = SkGetPackedA32(srcRow[x]);
     178            }
    171179        }
    172180        destRow += destBytesPerRow;
     
    226234        uint32_t* destRow = bitmap.getAddr32(destX, destY + y);
    227235        for (int x = 0; x < numColumns; ++x) {
    228             // TODO: Support for premultiplied colors
    229236            const unsigned char* srcPixel = &srcRow[x * 4];
    230             destRow[x] = SkPreMultiplyARGB(srcPixel[3], srcPixel[0],
    231                                            srcPixel[1], srcPixel[2]);
     237            if (multiplied == Unpremultiplied)
     238                destRow[x] = SkPreMultiplyARGB(srcPixel[3], srcPixel[0],
     239                                               srcPixel[1], srcPixel[2]);
     240            else
     241                destRow[x] = SkPackARGB32(srcPixel[3], srcPixel[0],
     242                                          srcPixel[1], srcPixel[2]);
    232243        }
    233244        srcRow += srcBytesPerRow;
Note: See TracChangeset for help on using the changeset viewer.