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

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

Issue 1277593002: Support decoding PNG to 565. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 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/SkSwizzler.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 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 break; 412 break;
413 default: 413 default:
414 // We cannot decode a non-opaque image to opaque (or unknown) 414 // We cannot decode a non-opaque image to opaque (or unknown)
415 return false; 415 return false;
416 } 416 }
417 } 417 }
418 // Check for supported color types 418 // Check for supported color types
419 switch (dst.colorType()) { 419 switch (dst.colorType()) {
420 case kN32_SkColorType: 420 case kN32_SkColorType:
421 return true; 421 return true;
422 case kRGB_565_SkColorType:
423 return src.alphaType() == kOpaque_SkAlphaType;
422 default: 424 default:
423 return dst.colorType() == src.colorType(); 425 return dst.colorType() == src.colorType();
424 } 426 }
425 } 427 }
426 428
427 SkCodec::Result SkPngCodec::initializeSwizzler(const SkImageInfo& requestedInfo, 429 SkCodec::Result SkPngCodec::initializeSwizzler(const SkImageInfo& requestedInfo,
428 const Options& options, 430 const Options& options,
429 SkPMColor ctable[], 431 SkPMColor ctable[],
430 int* ctableCount) { 432 int* ctableCount) {
431 // FIXME: Could we use the return value of setjmp to specify the type of 433 // FIXME: Could we use the return value of setjmp to specify the type of
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 807
806 const SkImageInfo& srcInfo = codec->getInfo(); 808 const SkImageInfo& srcInfo = codec->getInfo();
807 if (codec->fNumberPasses > 1) { 809 if (codec->fNumberPasses > 1) {
808 // interlaced image 810 // interlaced image
809 return SkNEW_ARGS(SkPngInterlacedScanlineDecoder, (srcInfo, codec.detach ())); 811 return SkNEW_ARGS(SkPngInterlacedScanlineDecoder, (srcInfo, codec.detach ()));
810 } 812 }
811 813
812 return SkNEW_ARGS(SkPngScanlineDecoder, (srcInfo, codec.detach())); 814 return SkNEW_ARGS(SkPngScanlineDecoder, (srcInfo, codec.detach()));
813 } 815 }
814 816
OLDNEW
« no previous file with comments | « no previous file | src/codec/SkSwizzler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698