diff options
author | jrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-14 22:31:18 +0000 |
---|---|---|
committer | jrg@chromium.org <jrg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-14 22:31:18 +0000 |
commit | 1b044845625fa5ce2cdb40c5a9c9bde1de4c557c (patch) | |
tree | a63b030428bd203839bf697173db131fcd653e4d /gfx | |
parent | 4212ccdaedaef19695b97411f1c9e18236f0906e (diff) | |
download | chromium_src-1b044845625fa5ce2cdb40c5a9c9bde1de4c557c.zip chromium_src-1b044845625fa5ce2cdb40c5a9c9bde1de4c557c.tar.gz chromium_src-1b044845625fa5ce2cdb40c5a9c9bde1de4c557c.tar.bz2 |
Landing http://codereview.chromium.org/3786003 for Grace
TBR=brettw@chromium.org
Original description:
We should use SkGetPackedX32 instead SkColorGetX to get the components out of a SkPMColor.
Review URL: http://codereview.chromium.org/3802005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62664 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gfx')
-rw-r--r-- | gfx/codec/png_codec.cc | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/gfx/codec/png_codec.cc b/gfx/codec/png_codec.cc index 66fa787..5fd6d7a 100644 --- a/gfx/codec/png_codec.cc +++ b/gfx/codec/png_codec.cc @@ -80,16 +80,16 @@ void ConvertSkiatoRGB(const unsigned char* skia, int pixel_width, const uint32_t pixel_in = *reinterpret_cast<const uint32_t*>(&skia[x * 4]); unsigned char* pixel_out = &rgb[x * 3]; - int alpha = SkColorGetA(pixel_in); + int alpha = SkGetPackedA32(pixel_in); if (alpha != 0 && alpha != 255) { SkColor unmultiplied = SkUnPreMultiply::PMColorToColor(pixel_in); pixel_out[0] = SkColorGetR(unmultiplied); pixel_out[1] = SkColorGetG(unmultiplied); pixel_out[2] = SkColorGetB(unmultiplied); } else { - pixel_out[0] = SkColorGetR(pixel_in); - pixel_out[1] = SkColorGetG(pixel_in); - pixel_out[2] = SkColorGetB(pixel_in); + pixel_out[0] = SkGetPackedR32(pixel_in); + pixel_out[1] = SkGetPackedG32(pixel_in); + pixel_out[2] = SkGetPackedB32(pixel_in); } } } @@ -101,7 +101,7 @@ void ConvertSkiatoRGBA(const unsigned char* skia, int pixel_width, const uint32_t pixel_in = *reinterpret_cast<const uint32_t*>(&skia[i]); // Pack the components here. - int alpha = SkColorGetA(pixel_in); + int alpha = SkGetPackedA32(pixel_in); if (alpha != 0 && alpha != 255) { SkColor unmultiplied = SkUnPreMultiply::PMColorToColor(pixel_in); rgba[i + 0] = SkColorGetR(unmultiplied); @@ -109,9 +109,9 @@ void ConvertSkiatoRGBA(const unsigned char* skia, int pixel_width, rgba[i + 2] = SkColorGetB(unmultiplied); rgba[i + 3] = alpha; } else { - rgba[i + 0] = SkColorGetR(pixel_in); - rgba[i + 1] = SkColorGetG(pixel_in); - rgba[i + 2] = SkColorGetB(pixel_in); + rgba[i + 0] = SkGetPackedR32(pixel_in); + rgba[i + 1] = SkGetPackedG32(pixel_in); + rgba[i + 2] = SkGetPackedB32(pixel_in); rgba[i + 3] = alpha; } } |