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

Side by Side Diff: dm/DMSrcSink.cpp

Issue 1076923002: SkJpegCodec (Closed) Base URL: https://skia.googlesource.com/skia.git@gif-real
Patch Set: Added comment Created 5 years, 8 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 | « dm/DM.cpp ('k') | gyp/codec.gyp » ('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 "DMSrcSink.h" 8 #include "DMSrcSink.h"
9 #include "SamplePipeControllers.h" 9 #include "SamplePipeControllers.h"
10 #include "SkCommonFlags.h" 10 #include "SkCommonFlags.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(encoded)); 73 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(encoded));
74 if (NULL == codec.get()) { 74 if (NULL == codec.get()) {
75 return SkStringPrintf("Couldn't create codec for %s.", fPath.c_str()); 75 return SkStringPrintf("Couldn't create codec for %s.", fPath.c_str());
76 } 76 }
77 77
78 // Choose the color type to decode to 78 // Choose the color type to decode to
79 SkImageInfo decodeInfo = codec->getInfo(); 79 SkImageInfo decodeInfo = codec->getInfo();
80 SkColorType canvasColorType = canvasInfo.colorType(); 80 SkColorType canvasColorType = canvasInfo.colorType();
81 switch (fDstColorType) { 81 switch (fDstColorType) {
82 case kIndex8_Always_DstColorType: 82 case kIndex8_Always_DstColorType:
83 case kGrayscale_Always_DstColorType: 83 decodeInfo = codec->getInfo().makeColorType(kIndex_8_SkColorType);
84 if (kRGB_565_SkColorType == canvasColorType) { 84 if (kRGB_565_SkColorType == canvasColorType) {
85 return Error::Nonfatal("Testing non-565 to 565 is uninteresting. "); 85 return Error::Nonfatal("Testing non-565 to 565 is uninteresting. ");
86 } 86 }
87 break;
88 case kGrayscale_Always_DstColorType:
89 decodeInfo = codec->getInfo().makeColorType(kGray_8_SkColorType);
90 if (kRGB_565_SkColorType == canvasColorType) {
91 return Error::Nonfatal("Testing non-565 to 565 is uninteresting. ");
92 }
87 break; 93 break;
88 default: 94 default:
89 decodeInfo = decodeInfo.makeColorType(canvasColorType); 95 decodeInfo = decodeInfo.makeColorType(canvasColorType);
90 break; 96 break;
91 } 97 }
92 98
93 // Construct a color table for the decode if necessary 99 // Construct a color table for the decode if necessary
94 SkAutoTUnref<SkColorTable> colorTable(NULL); 100 SkAutoTUnref<SkColorTable> colorTable(NULL);
95 SkPMColor* colorPtr = NULL; 101 SkPMColor* colorPtr = NULL;
96 int* colorCountPtr = NULL; 102 int* colorCountPtr = NULL;
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 canvas->drawPicture(pic); 701 canvas->drawPicture(pic);
696 return ""; 702 return "";
697 } 703 }
698 SkISize size() const override { return fSrc.size(); } 704 SkISize size() const override { return fSrc.size(); }
699 Name name() const override { sk_throw(); return ""; } // No one should be calling this. 705 Name name() const override { sk_throw(); return ""; } // No one should be calling this.
700 } proxy(src); 706 } proxy(src);
701 return fSink->draw(proxy, bitmap, stream, log); 707 return fSink->draw(proxy, bitmap, stream, log);
702 } 708 }
703 709
704 } // namespace DM 710 } // namespace DM
OLDNEW
« no previous file with comments | « dm/DM.cpp ('k') | gyp/codec.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698