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

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

Issue 1641273003: Support decoding opaque to *premul (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update SkMaskSwizzler to support opaque to premul Created 4 years, 10 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
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 "SkCodecPriv.h" 8 #include "SkCodecPriv.h"
9 #include "SkColorPriv.h" 9 #include "SkColorPriv.h"
10 #include "SkColorTable.h" 10 #include "SkColorTable.h"
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 // We've already read all the scanlines. This is a success. 528 // We've already read all the scanlines. This is a success.
529 return kSuccess; 529 return kSuccess;
530 } 530 }
531 531
532 // read rest of file, and get additional comment and time chunks in info_ptr 532 // read rest of file, and get additional comment and time chunks in info_ptr
533 png_read_end(fPng_ptr, fInfo_ptr); 533 png_read_end(fPng_ptr, fInfo_ptr);
534 534
535 return kSuccess; 535 return kSuccess;
536 } 536 }
537 537
538 uint32_t SkPngCodec::onGetFillValue(SkColorType colorType, SkAlphaType alphaType ) const { 538 uint32_t SkPngCodec::onGetFillValue(SkColorType colorType) const {
539 const SkPMColor* colorPtr = get_color_ptr(fColorTable.get()); 539 const SkPMColor* colorPtr = get_color_ptr(fColorTable.get());
540 if (colorPtr) { 540 if (colorPtr) {
541 return get_color_table_fill_value(colorType, colorPtr, 0); 541 return get_color_table_fill_value(colorType, colorPtr, 0);
542 } 542 }
543 return INHERITED::onGetFillValue(colorType, alphaType); 543 return INHERITED::onGetFillValue(colorType);
544 } 544 }
545 545
546 // Subclass of SkPngCodec which supports scanline decoding 546 // Subclass of SkPngCodec which supports scanline decoding
547 class SkPngScanlineDecoder : public SkPngCodec { 547 class SkPngScanlineDecoder : public SkPngCodec {
548 public: 548 public:
549 SkPngScanlineDecoder(const SkImageInfo& srcInfo, SkStream* stream, 549 SkPngScanlineDecoder(const SkImageInfo& srcInfo, SkStream* stream,
550 SkPngChunkReader* chunkReader, png_structp png_ptr, png_infop info_p tr, int bitDepth) 550 SkPngChunkReader* chunkReader, png_structp png_ptr, png_infop info_p tr, int bitDepth)
551 : INHERITED(srcInfo, stream, chunkReader, png_ptr, info_ptr, bitDepth, 1 ) 551 : INHERITED(srcInfo, stream, chunkReader, png_ptr, info_ptr, bitDepth, 1 )
552 , fSrcRow(nullptr) 552 , fSrcRow(nullptr)
553 {} 553 {}
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 } 748 }
749 749
750 if (1 == numberPasses) { 750 if (1 == numberPasses) {
751 return new SkPngScanlineDecoder(imageInfo, streamDeleter.detach(), chunk Reader, 751 return new SkPngScanlineDecoder(imageInfo, streamDeleter.detach(), chunk Reader,
752 png_ptr, info_ptr, bitDepth); 752 png_ptr, info_ptr, bitDepth);
753 } 753 }
754 754
755 return new SkPngInterlacedScanlineDecoder(imageInfo, streamDeleter.detach(), chunkReader, 755 return new SkPngInterlacedScanlineDecoder(imageInfo, streamDeleter.detach(), chunkReader,
756 png_ptr, info_ptr, bitDepth, numbe rPasses); 756 png_ptr, info_ptr, bitDepth, numbe rPasses);
757 } 757 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698