| 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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 | 187 |
| 188 protected: | 188 protected: |
| 189 SkString fFilename; | 189 SkString fFilename; |
| 190 int fSize; | 190 int fSize; |
| 191 | 191 |
| 192 SkScalar getScale() SK_OVERRIDE { | 192 SkScalar getScale() SK_OVERRIDE { |
| 193 return 192.f/fSize; | 193 return 192.f/fSize; |
| 194 } | 194 } |
| 195 | 195 |
| 196 void makeBitmap() SK_OVERRIDE { | 196 void makeBitmap() SK_OVERRIDE { |
| 197 SkString resourcePath = GetResourcePath(); | |
| 198 resourcePath.append("/"); | |
| 199 resourcePath.append(fFilename); | |
| 200 | |
| 201 SkImageDecoder* codec = NULL; | 197 SkImageDecoder* codec = NULL; |
| 198 SkString resourcePath = GetResourcePath(fFilename.c_str()); |
| 202 SkFILEStream stream(resourcePath.c_str()); | 199 SkFILEStream stream(resourcePath.c_str()); |
| 203 if (stream.isValid()) { | 200 if (stream.isValid()) { |
| 204 codec = SkImageDecoder::Factory(&stream); | 201 codec = SkImageDecoder::Factory(&stream); |
| 205 } | 202 } |
| 206 if (codec) { | 203 if (codec) { |
| 207 stream.rewind(); | 204 stream.rewind(); |
| 208 codec->decode(&stream, &fBM, kN32_SkColorType, SkImageDecoder::kDe
codePixels_Mode); | 205 codec->decode(&stream, &fBM, kN32_SkColorType, SkImageDecoder::kDe
codePixels_Mode); |
| 209 SkDELETE(codec); | 206 SkDELETE(codec); |
| 210 } else { | 207 } else { |
| 211 fBM.allocN32Pixels(1, 1); | 208 fBM.allocN32Pixels(1, 1); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 226 DEF_GM( return new FilterBitmapCheckerboardGM(32,32); ) | 223 DEF_GM( return new FilterBitmapCheckerboardGM(32,32); ) |
| 227 DEF_GM( return new FilterBitmapCheckerboardGM(32,8); ) | 224 DEF_GM( return new FilterBitmapCheckerboardGM(32,8); ) |
| 228 DEF_GM( return new FilterBitmapCheckerboardGM(32,2); ) | 225 DEF_GM( return new FilterBitmapCheckerboardGM(32,2); ) |
| 229 DEF_GM( return new FilterBitmapCheckerboardGM(192,192); ) | 226 DEF_GM( return new FilterBitmapCheckerboardGM(192,192); ) |
| 230 DEF_GM( return new FilterBitmapImageGM("mandrill_16.png"); ) | 227 DEF_GM( return new FilterBitmapImageGM("mandrill_16.png"); ) |
| 231 DEF_GM( return new FilterBitmapImageGM("mandrill_32.png"); ) | 228 DEF_GM( return new FilterBitmapImageGM("mandrill_32.png"); ) |
| 232 DEF_GM( return new FilterBitmapImageGM("mandrill_64.png"); ) | 229 DEF_GM( return new FilterBitmapImageGM("mandrill_64.png"); ) |
| 233 DEF_GM( return new FilterBitmapImageGM("mandrill_128.png"); ) | 230 DEF_GM( return new FilterBitmapImageGM("mandrill_128.png"); ) |
| 234 DEF_GM( return new FilterBitmapImageGM("mandrill_256.png"); ) | 231 DEF_GM( return new FilterBitmapImageGM("mandrill_256.png"); ) |
| 235 DEF_GM( return new FilterBitmapImageGM("mandrill_512.png"); ) | 232 DEF_GM( return new FilterBitmapImageGM("mandrill_512.png"); ) |
| OLD | NEW |