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