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

Side by Side Diff: samplecode/SampleUnpremul.cpp

Issue 647023006: Qualify the return value of SkImageDecoder::decode (Closed) Base URL: https://skia.googlesource.com/skia.git/+/master
Patch Set: fix a sample Created 6 years, 1 month 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 | « include/core/SkImageDecoder.h ('k') | src/images/SkDecodingImageGenerator.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 2013 Google Inc. 2 * Copyright 2013 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 "gm.h" 8 #include "gm.h"
9 9
10 #include "Resources.h" 10 #include "Resources.h"
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 SkFILEStream stream(fCurrFile.c_str()); 175 SkFILEStream stream(fCurrFile.c_str());
176 SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(&stream)); 176 SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(&stream));
177 if (NULL == decoder.get()) { 177 if (NULL == decoder.get()) {
178 fDecodeSucceeded = false; 178 fDecodeSucceeded = false;
179 return; 179 return;
180 } 180 }
181 if (!fPremul) { 181 if (!fPremul) {
182 decoder->setRequireUnpremultipliedColors(true); 182 decoder->setRequireUnpremultipliedColors(true);
183 } 183 }
184 fDecodeSucceeded = decoder->decode(&stream, &fBitmap, kN32_SkColorType, 184 fDecodeSucceeded = decoder->decode(&stream, &fBitmap, kN32_SkColorType,
185 SkImageDecoder::kDecodePixels_Mode); 185 SkImageDecoder::kDecodePixels_Mode) != SkImageDecoder::kFailure;
186 this->inval(NULL); 186 this->inval(NULL);
187 } 187 }
188 188
189 void togglePremul() { 189 void togglePremul() {
190 fPremul = !fPremul; 190 fPremul = !fPremul;
191 this->decodeCurrFile(); 191 this->decodeCurrFile();
192 } 192 }
193 193
194 typedef SampleView INHERITED; 194 typedef SampleView INHERITED;
195 }; 195 };
196 196
197 ////////////////////////////////////////////////////////////////////////////// 197 //////////////////////////////////////////////////////////////////////////////
198 198
199 static SkView* MyFactory() { 199 static SkView* MyFactory() {
200 return new UnpremulView(GetResourcePath()); 200 return new UnpremulView(GetResourcePath());
201 } 201 }
202 static SkViewRegister reg(MyFactory); 202 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « include/core/SkImageDecoder.h ('k') | src/images/SkDecodingImageGenerator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698