Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(267)

Side by Side Diff: src/images/SkImageDecoder_libpng.cpp

Issue 611093002: remove alphatype from colortable (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update codecs Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/images/SkImageDecoder_libgif.cpp ('k') | src/images/SkImageDecoder_wbmp.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkImageDecoder.h" 8 #include "SkImageDecoder.h"
9 #include "SkImageEncoder.h" 9 #include "SkImageEncoder.h"
10 #include "SkColor.h" 10 #include "SkColor.h"
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 for (; index < numPalette; index++) { 702 for (; index < numPalette; index++) {
703 *colorPtr++ = SkPackARGB32(0xFF, palette->red, palette->green, palette-> blue); 703 *colorPtr++ = SkPackARGB32(0xFF, palette->red, palette->green, palette-> blue);
704 palette++; 704 palette++;
705 } 705 }
706 706
707 // see BUGGY IMAGE WORKAROUND comment above 707 // see BUGGY IMAGE WORKAROUND comment above
708 if (numPalette < 256) { 708 if (numPalette < 256) {
709 *colorPtr = colorPtr[-1]; 709 *colorPtr = colorPtr[-1];
710 } 710 }
711 711
712 SkAlphaType alphaType = kOpaque_SkAlphaType; 712 *colorTablep = SkNEW_ARGS(SkColorTable, (colorStorage, colorCount));
713 if (reallyHasAlpha) {
714 if (this->getRequireUnpremultipliedColors()) {
715 alphaType = kUnpremul_SkAlphaType;
716 } else {
717 alphaType = kPremul_SkAlphaType;
718 }
719 }
720
721 *colorTablep = SkNEW_ARGS(SkColorTable,
722 (colorStorage, colorCount, alphaType));
723 *reallyHasAlphap = reallyHasAlpha; 713 *reallyHasAlphap = reallyHasAlpha;
724 return true; 714 return true;
725 } 715 }
726 716
727 #ifdef SK_BUILD_FOR_ANDROID 717 #ifdef SK_BUILD_FOR_ANDROID
728 718
729 bool SkPNGImageDecoder::onBuildTileIndex(SkStreamRewindable* sk_stream, int *wid th, int *height) { 719 bool SkPNGImageDecoder::onBuildTileIndex(SkStreamRewindable* sk_stream, int *wid th, int *height) {
730 png_structp png_ptr; 720 png_structp png_ptr;
731 png_infop info_ptr; 721 png_infop info_ptr;
732 722
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
1278 return SkImageDecoder::kUnknown_Format; 1268 return SkImageDecoder::kUnknown_Format;
1279 } 1269 }
1280 1270
1281 SkImageEncoder* sk_libpng_efactory(SkImageEncoder::Type t) { 1271 SkImageEncoder* sk_libpng_efactory(SkImageEncoder::Type t) {
1282 return (SkImageEncoder::kPNG_Type == t) ? SkNEW(SkPNGImageEncoder) : NULL; 1272 return (SkImageEncoder::kPNG_Type == t) ? SkNEW(SkPNGImageEncoder) : NULL;
1283 } 1273 }
1284 1274
1285 static SkImageDecoder_DecodeReg gDReg(sk_libpng_dfactory); 1275 static SkImageDecoder_DecodeReg gDReg(sk_libpng_dfactory);
1286 static SkImageDecoder_FormatReg gFormatReg(get_format_png); 1276 static SkImageDecoder_FormatReg gFormatReg(get_format_png);
1287 static SkImageEncoder_EncodeReg gEReg(sk_libpng_efactory); 1277 static SkImageEncoder_EncodeReg gEReg(sk_libpng_efactory);
OLDNEW
« no previous file with comments | « src/images/SkImageDecoder_libgif.cpp ('k') | src/images/SkImageDecoder_wbmp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698