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 #include "SkGradientShader.h" | 9 #include "SkGradientShader.h" |
10 | 10 |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 path.append("/"); | 176 path.append("/"); |
177 path.append(fFilename); | 177 path.append(fFilename); |
178 | 178 |
179 SkImageDecoder *codec = NULL; | 179 SkImageDecoder *codec = NULL; |
180 SkFILEStream stream(path.c_str()); | 180 SkFILEStream stream(path.c_str()); |
181 if (stream.isValid()) { | 181 if (stream.isValid()) { |
182 codec = SkImageDecoder::Factory(&stream); | 182 codec = SkImageDecoder::Factory(&stream); |
183 } | 183 } |
184 if (codec) { | 184 if (codec) { |
185 stream.rewind(); | 185 stream.rewind(); |
186 codec->decode(&stream, &fBM, SkBitmap::kARGB_8888_Config, | 186 codec->decode(&stream, &fBM, kN32_SkColorType, SkImageDecoder::kDe
codePixels_Mode); |
187 SkImageDecoder::kDecodePixels_Mode); | |
188 SkDELETE(codec); | 187 SkDELETE(codec); |
189 } else { | 188 } else { |
190 fBM.allocN32Pixels(1, 1); | 189 fBM.allocN32Pixels(1, 1); |
191 *(fBM.getAddr32(0,0)) = 0xFF0000FF; // red == bad | 190 *(fBM.getAddr32(0,0)) = 0xFF0000FF; // red == bad |
192 } | 191 } |
193 fSize = fBM.height(); | 192 fSize = fBM.height(); |
194 } | 193 } |
195 private: | 194 private: |
196 typedef DownsampleBitmapGM INHERITED; | 195 typedef DownsampleBitmapGM INHERITED; |
197 }; | 196 }; |
198 | 197 |
199 ////////////////////////////////////////////////////////////////////////////// | 198 ////////////////////////////////////////////////////////////////////////////// |
200 | 199 |
201 DEF_GM( return new DownsampleBitmapTextGM(72, SkPaint::kHigh_FilterLevel); ) | 200 DEF_GM( return new DownsampleBitmapTextGM(72, SkPaint::kHigh_FilterLevel); ) |
202 DEF_GM( return new DownsampleBitmapCheckerboardGM(512,256, SkPaint::kHigh_Filter
Level); ) | 201 DEF_GM( return new DownsampleBitmapCheckerboardGM(512,256, SkPaint::kHigh_Filter
Level); ) |
203 DEF_GM( return new DownsampleBitmapImageGM("mandrill_512.png", SkPaint::kHigh_Fi
lterLevel); ) | 202 DEF_GM( return new DownsampleBitmapImageGM("mandrill_512.png", SkPaint::kHigh_Fi
lterLevel); ) |
204 | 203 |
205 DEF_GM( return new DownsampleBitmapTextGM(72, SkPaint::kMedium_FilterLevel); ) | 204 DEF_GM( return new DownsampleBitmapTextGM(72, SkPaint::kMedium_FilterLevel); ) |
206 DEF_GM( return new DownsampleBitmapCheckerboardGM(512,256, SkPaint::kMedium_Filt
erLevel); ) | 205 DEF_GM( return new DownsampleBitmapCheckerboardGM(512,256, SkPaint::kMedium_Filt
erLevel); ) |
207 DEF_GM( return new DownsampleBitmapImageGM("mandrill_512.png", SkPaint::kMedium_
FilterLevel); ) | 206 DEF_GM( return new DownsampleBitmapImageGM("mandrill_512.png", SkPaint::kMedium_
FilterLevel); ) |
208 | 207 |
209 DEF_GM( return new DownsampleBitmapTextGM(72, SkPaint::kLow_FilterLevel); ) | 208 DEF_GM( return new DownsampleBitmapTextGM(72, SkPaint::kLow_FilterLevel); ) |
210 DEF_GM( return new DownsampleBitmapCheckerboardGM(512,256, SkPaint::kLow_FilterL
evel); ) | 209 DEF_GM( return new DownsampleBitmapCheckerboardGM(512,256, SkPaint::kLow_FilterL
evel); ) |
211 DEF_GM( return new DownsampleBitmapImageGM("mandrill_512.png", SkPaint::kLow_Fil
terLevel); ) | 210 DEF_GM( return new DownsampleBitmapImageGM("mandrill_512.png", SkPaint::kLow_Fil
terLevel); ) |
212 | 211 |
213 DEF_GM( return new DownsampleBitmapTextGM(72, SkPaint::kNone_FilterLevel); ) | 212 DEF_GM( return new DownsampleBitmapTextGM(72, SkPaint::kNone_FilterLevel); ) |
214 DEF_GM( return new DownsampleBitmapCheckerboardGM(512,256, SkPaint::kNone_Filter
Level); ) | 213 DEF_GM( return new DownsampleBitmapCheckerboardGM(512,256, SkPaint::kNone_Filter
Level); ) |
215 DEF_GM( return new DownsampleBitmapImageGM("mandrill_512.png", SkPaint::kNone_Fi
lterLevel); ) | 214 DEF_GM( return new DownsampleBitmapImageGM("mandrill_512.png", SkPaint::kNone_Fi
lterLevel); ) |
OLD | NEW |