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

Side by Side Diff: src/codec/SkCodec_libpng.cpp

Issue 1582083005: Clean up unused or overly complex modes in SkSwizzler (Closed) Base URL: https://skia.googlesource.com/skia.git@neon-unpremul
Patch Set: Response to comments Created 4 years, 11 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 | « no previous file | src/codec/SkJpegCodec.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 2015 Google Inc. 2 * Copyright 2015 Google Inc.
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 "SkCodec_libpng.h" 8 #include "SkCodec_libpng.h"
9 #include "SkCodecPriv.h" 9 #include "SkCodecPriv.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 skColorType = kIndex_8_SkColorType; 306 skColorType = kIndex_8_SkColorType;
307 skAlphaType = has_transparency_in_tRNS(png_ptr, info_ptr) ? 307 skAlphaType = has_transparency_in_tRNS(png_ptr, info_ptr) ?
308 kUnpremul_SkAlphaType : kOpaque_SkAlphaType; 308 kUnpremul_SkAlphaType : kOpaque_SkAlphaType;
309 break; 309 break;
310 case PNG_COLOR_TYPE_RGB: 310 case PNG_COLOR_TYPE_RGB:
311 if (has_transparency_in_tRNS(png_ptr, info_ptr)) { 311 if (has_transparency_in_tRNS(png_ptr, info_ptr)) {
312 //convert to RGBA with tranparency information in tRNS chunk if it exists 312 //convert to RGBA with tranparency information in tRNS chunk if it exists
313 png_set_tRNS_to_alpha(png_ptr); 313 png_set_tRNS_to_alpha(png_ptr);
314 skAlphaType = kUnpremul_SkAlphaType; 314 skAlphaType = kUnpremul_SkAlphaType;
315 } else { 315 } else {
316 //convert to RGBA with Opaque Alpha
317 png_set_filler(png_ptr, 0xff, PNG_FILLER_AFTER);
318 skAlphaType = kOpaque_SkAlphaType; 316 skAlphaType = kOpaque_SkAlphaType;
319 } 317 }
320 skColorType = kN32_SkColorType; 318 skColorType = kN32_SkColorType;
321 break; 319 break;
322 case PNG_COLOR_TYPE_GRAY: 320 case PNG_COLOR_TYPE_GRAY:
323 if (has_transparency_in_tRNS(png_ptr, info_ptr)) { 321 if (has_transparency_in_tRNS(png_ptr, info_ptr)) {
324 //FIXME: support gray with alpha as a color type 322 //FIXME: support gray with alpha as a color type
325 //convert to RGBA if there is transparentcy info in the tRNS chu nk 323 //convert to RGBA if there is transparentcy info in the tRNS chu nk
326 png_set_tRNS_to_alpha(png_ptr); 324 png_set_tRNS_to_alpha(png_ptr);
327 png_set_gray_to_rgb(png_ptr); 325 png_set_gray_to_rgb(png_ptr);
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 if (!this->decodePalette(kPremul_SkAlphaType == requestedInfo.alphaT ype(), 418 if (!this->decodePalette(kPremul_SkAlphaType == requestedInfo.alphaT ype(),
421 ctableCount)) { 419 ctableCount)) {
422 return kInvalidInput; 420 return kInvalidInput;
423 } 421 }
424 break; 422 break;
425 case kGray_8_SkColorType: 423 case kGray_8_SkColorType:
426 fSrcConfig = SkSwizzler::kGray; 424 fSrcConfig = SkSwizzler::kGray;
427 break; 425 break;
428 case kN32_SkColorType: 426 case kN32_SkColorType:
429 if (this->getInfo().alphaType() == kOpaque_SkAlphaType) { 427 if (this->getInfo().alphaType() == kOpaque_SkAlphaType) {
430 fSrcConfig = SkSwizzler::kRGBX; 428 fSrcConfig = SkSwizzler::kRGB;
431 } else { 429 } else {
432 fSrcConfig = SkSwizzler::kRGBA; 430 fSrcConfig = SkSwizzler::kRGBA;
433 } 431 }
434 break; 432 break;
435 default: 433 default:
436 //would have exited before now if the colorType was supported by png 434 //would have exited before now if the colorType was supported by png
437 SkASSERT(false); 435 SkASSERT(false);
438 } 436 }
439 437
440 // Copy the color table to the client if they request kIndex8 mode 438 // Copy the color table to the client if they request kIndex8 mode
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 } 778 }
781 779
782 if (1 == numberPasses) { 780 if (1 == numberPasses) {
783 return new SkPngScanlineDecoder(imageInfo, streamDeleter.detach(), chunk Reader, 781 return new SkPngScanlineDecoder(imageInfo, streamDeleter.detach(), chunk Reader,
784 png_ptr, info_ptr, bitDepth); 782 png_ptr, info_ptr, bitDepth);
785 } 783 }
786 784
787 return new SkPngInterlacedScanlineDecoder(imageInfo, streamDeleter.detach(), chunkReader, 785 return new SkPngInterlacedScanlineDecoder(imageInfo, streamDeleter.detach(), chunkReader,
788 png_ptr, info_ptr, bitDepth, numbe rPasses); 786 png_ptr, info_ptr, bitDepth, numbe rPasses);
789 } 787 }
OLDNEW
« no previous file with comments | « no previous file | src/codec/SkJpegCodec.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698