| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 path.append("/"); | 197 path.append("/"); |
| 198 path.append(fFilename); | 198 path.append(fFilename); |
| 199 | 199 |
| 200 SkImageDecoder *codec = NULL; | 200 SkImageDecoder *codec = NULL; |
| 201 SkFILEStream stream(path.c_str()); | 201 SkFILEStream stream(path.c_str()); |
| 202 if (stream.isValid()) { | 202 if (stream.isValid()) { |
| 203 codec = SkImageDecoder::Factory(&stream); | 203 codec = SkImageDecoder::Factory(&stream); |
| 204 } | 204 } |
| 205 if (codec) { | 205 if (codec) { |
| 206 stream.rewind(); | 206 stream.rewind(); |
| 207 codec->decode(&stream, &fBM, SkBitmap::kARGB_8888_Config, | 207 codec->decode(&stream, &fBM, kN32_SkColorType, SkImageDecoder::kDe
codePixels_Mode); |
| 208 SkImageDecoder::kDecodePixels_Mode); | |
| 209 SkDELETE(codec); | 208 SkDELETE(codec); |
| 210 } else { | 209 } else { |
| 211 fBM.allocN32Pixels(1, 1); | 210 fBM.allocN32Pixels(1, 1); |
| 212 *(fBM.getAddr32(0,0)) = 0xFF0000FF; // red == bad | 211 *(fBM.getAddr32(0,0)) = 0xFF0000FF; // red == bad |
| 213 } | 212 } |
| 214 fSize = fBM.height(); | 213 fSize = fBM.height(); |
| 215 } | 214 } |
| 216 private: | 215 private: |
| 217 typedef FilterBitmapGM INHERITED; | 216 typedef FilterBitmapGM INHERITED; |
| 218 }; | 217 }; |
| 219 | 218 |
| 220 ////////////////////////////////////////////////////////////////////////////// | 219 ////////////////////////////////////////////////////////////////////////////// |
| 221 | 220 |
| 222 DEF_GM( return new FilterBitmapTextGM(3); ) | 221 DEF_GM( return new FilterBitmapTextGM(3); ) |
| 223 DEF_GM( return new FilterBitmapTextGM(7); ) | 222 DEF_GM( return new FilterBitmapTextGM(7); ) |
| 224 DEF_GM( return new FilterBitmapTextGM(10); ) | 223 DEF_GM( return new FilterBitmapTextGM(10); ) |
| 225 DEF_GM( return new FilterBitmapCheckerboardGM(4,4); ) | 224 DEF_GM( return new FilterBitmapCheckerboardGM(4,4); ) |
| 226 DEF_GM( return new FilterBitmapCheckerboardGM(32,32); ) | 225 DEF_GM( return new FilterBitmapCheckerboardGM(32,32); ) |
| 227 DEF_GM( return new FilterBitmapCheckerboardGM(32,8); ) | 226 DEF_GM( return new FilterBitmapCheckerboardGM(32,8); ) |
| 228 DEF_GM( return new FilterBitmapCheckerboardGM(32,2); ) | 227 DEF_GM( return new FilterBitmapCheckerboardGM(32,2); ) |
| 229 DEF_GM( return new FilterBitmapCheckerboardGM(192,192); ) | 228 DEF_GM( return new FilterBitmapCheckerboardGM(192,192); ) |
| 230 DEF_GM( return new FilterBitmapImageGM("mandrill_16.png"); ) | 229 DEF_GM( return new FilterBitmapImageGM("mandrill_16.png"); ) |
| 231 DEF_GM( return new FilterBitmapImageGM("mandrill_32.png"); ) | 230 DEF_GM( return new FilterBitmapImageGM("mandrill_32.png"); ) |
| 232 DEF_GM( return new FilterBitmapImageGM("mandrill_64.png"); ) | 231 DEF_GM( return new FilterBitmapImageGM("mandrill_64.png"); ) |
| 233 DEF_GM( return new FilterBitmapImageGM("mandrill_128.png"); ) | 232 DEF_GM( return new FilterBitmapImageGM("mandrill_128.png"); ) |
| 234 DEF_GM( return new FilterBitmapImageGM("mandrill_256.png"); ) | 233 DEF_GM( return new FilterBitmapImageGM("mandrill_256.png"); ) |
| 235 DEF_GM( return new FilterBitmapImageGM("mandrill_512.png"); ) | 234 DEF_GM( return new FilterBitmapImageGM("mandrill_512.png"); ) |
| OLD | NEW |