OLD | NEW |
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 Loading... |
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); |
OLD | NEW |