| 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 | 9 |
| 10 #include "Resources.h" | 10 #include "Resources.h" |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 void makeBitmap() override { | 198 void makeBitmap() override { |
| 199 SkImageDecoder* codec = NULL; | 199 SkImageDecoder* codec = NULL; |
| 200 SkString resourcePath = GetResourcePath(fFilename.c_str()); | 200 SkString resourcePath = GetResourcePath(fFilename.c_str()); |
| 201 SkFILEStream stream(resourcePath.c_str()); | 201 SkFILEStream stream(resourcePath.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, kN32_SkColorType, SkImageDecoder::kDe
codePixels_Mode); | 207 codec->decode(&stream, &fBM, kN32_SkColorType, SkImageDecoder::kDe
codePixels_Mode); |
| 208 SkDELETE(codec); | 208 delete codec; |
| 209 } else { | 209 } else { |
| 210 fBM.allocN32Pixels(1, 1); | 210 fBM.allocN32Pixels(1, 1); |
| 211 *(fBM.getAddr32(0,0)) = 0xFF0000FF; // red == bad | 211 *(fBM.getAddr32(0,0)) = 0xFF0000FF; // red == bad |
| 212 } | 212 } |
| 213 fSize = fBM.height(); | 213 fSize = fBM.height(); |
| 214 if (fConvertToG8) { | 214 if (fConvertToG8) { |
| 215 SkBitmap tmp; | 215 SkBitmap tmp; |
| 216 fBM.copyTo(&tmp, kGray_8_SkColorType); | 216 fBM.copyTo(&tmp, kGray_8_SkColorType); |
| 217 fBM = tmp; | 217 fBM = tmp; |
| 218 } | 218 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 234 DEF_GM( return new FilterBitmapCheckerboardGM(32,2); ) | 234 DEF_GM( return new FilterBitmapCheckerboardGM(32,2); ) |
| 235 DEF_GM( return new FilterBitmapCheckerboardGM(192,192); ) | 235 DEF_GM( return new FilterBitmapCheckerboardGM(192,192); ) |
| 236 DEF_GM( return new FilterBitmapImageGM("mandrill_16.png"); ) | 236 DEF_GM( return new FilterBitmapImageGM("mandrill_16.png"); ) |
| 237 DEF_GM( return new FilterBitmapImageGM("mandrill_32.png"); ) | 237 DEF_GM( return new FilterBitmapImageGM("mandrill_32.png"); ) |
| 238 DEF_GM( return new FilterBitmapImageGM("mandrill_64.png"); ) | 238 DEF_GM( return new FilterBitmapImageGM("mandrill_64.png"); ) |
| 239 DEF_GM( return new FilterBitmapImageGM("mandrill_64.png", true); ) | 239 DEF_GM( return new FilterBitmapImageGM("mandrill_64.png", true); ) |
| 240 DEF_GM( return new FilterBitmapImageGM("mandrill_128.png"); ) | 240 DEF_GM( return new FilterBitmapImageGM("mandrill_128.png"); ) |
| 241 DEF_GM( return new FilterBitmapImageGM("mandrill_256.png"); ) | 241 DEF_GM( return new FilterBitmapImageGM("mandrill_256.png"); ) |
| 242 DEF_GM( return new FilterBitmapImageGM("mandrill_512.png"); ) | 242 DEF_GM( return new FilterBitmapImageGM("mandrill_512.png"); ) |
| 243 DEF_GM( return new FilterBitmapImageGM("color_wheel.png"); ) | 243 DEF_GM( return new FilterBitmapImageGM("color_wheel.png"); ) |
| OLD | NEW |