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

Side by Side Diff: samplecode/SampleUnpremul.cpp

Issue 334793002: hide Config in SkImageDecoder -- use SkColorType instead (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix warning Created 6 years, 6 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 | « samplecode/SampleSubpixelTranslate.cpp ('k') | src/image/SkImagePriv.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 #include "gm.h" 8 #include "gm.h"
8 #include "SampleCode.h" 9 #include "SampleCode.h"
9 #include "SkBlurMask.h" 10 #include "SkBlurMask.h"
10 #include "SkBlurDrawLooper.h" 11 #include "SkBlurDrawLooper.h"
11 #include "SkCanvas.h" 12 #include "SkCanvas.h"
12 #include "SkColorPriv.h" 13 #include "SkColorPriv.h"
13 #include "SkForceLinking.h" 14 #include "SkForceLinking.h"
14 #include "SkImageDecoder.h" 15 #include "SkImageDecoder.h"
15 #include "SkOSFile.h" 16 #include "SkOSFile.h"
16 #include "SkStream.h" 17 #include "SkStream.h"
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 } 176 }
176 SkFILEStream stream(fCurrFile.c_str()); 177 SkFILEStream stream(fCurrFile.c_str());
177 SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(&stream)); 178 SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(&stream));
178 if (NULL == decoder.get()) { 179 if (NULL == decoder.get()) {
179 fDecodeSucceeded = false; 180 fDecodeSucceeded = false;
180 return; 181 return;
181 } 182 }
182 if (!fPremul) { 183 if (!fPremul) {
183 decoder->setRequireUnpremultipliedColors(true); 184 decoder->setRequireUnpremultipliedColors(true);
184 } 185 }
185 fDecodeSucceeded = decoder->decode(&stream, &fBitmap, 186 fDecodeSucceeded = decoder->decode(&stream, &fBitmap, kN32_SkColorType,
186 SkBitmap::kARGB_8888_Config,
187 SkImageDecoder::kDecodePixels_Mode); 187 SkImageDecoder::kDecodePixels_Mode);
188 this->inval(NULL); 188 this->inval(NULL);
189 } 189 }
190 190
191 void togglePremul() { 191 void togglePremul() {
192 fPremul = !fPremul; 192 fPremul = !fPremul;
193 this->decodeCurrFile(); 193 this->decodeCurrFile();
194 } 194 }
195 195
196 typedef SampleView INHERITED; 196 typedef SampleView INHERITED;
197 }; 197 };
198 198
199 ////////////////////////////////////////////////////////////////////////////// 199 //////////////////////////////////////////////////////////////////////////////
200 200
201 static SkView* MyFactory() { 201 static SkView* MyFactory() {
202 return new UnpremulView(skiagm::GM::GetResourcePath()); 202 return new UnpremulView(skiagm::GM::GetResourcePath());
203 } 203 }
204 static SkViewRegister reg(MyFactory); 204 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « samplecode/SampleSubpixelTranslate.cpp ('k') | src/image/SkImagePriv.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698