| 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 : INHERITED(filterLevel), fFilename(filename) | 165 : INHERITED(filterLevel), fFilename(filename) |
| 166 { | 166 { |
| 167 fName.printf("downsamplebitmap_image_%s_%s", this->filterLevelToStri
ng(), filename); | 167 fName.printf("downsamplebitmap_image_%s_%s", this->filterLevelToStri
ng(), filename); |
| 168 } | 168 } |
| 169 | 169 |
| 170 protected: | 170 protected: |
| 171 SkString fFilename; | 171 SkString fFilename; |
| 172 int fSize; | 172 int fSize; |
| 173 | 173 |
| 174 virtual void make_bitmap() SK_OVERRIDE { | 174 virtual void make_bitmap() SK_OVERRIDE { |
| 175 SkString resourcePath = GetResourcePath(); | |
| 176 resourcePath.append("/"); | |
| 177 resourcePath.append(fFilename); | |
| 178 | |
| 179 SkImageDecoder* codec = NULL; | 175 SkImageDecoder* codec = NULL; |
| 176 SkString resourcePath = GetResourcePath(fFilename.c_str()); |
| 180 SkFILEStream stream(resourcePath.c_str()); | 177 SkFILEStream stream(resourcePath.c_str()); |
| 181 if (stream.isValid()) { | 178 if (stream.isValid()) { |
| 182 codec = SkImageDecoder::Factory(&stream); | 179 codec = SkImageDecoder::Factory(&stream); |
| 183 } | 180 } |
| 184 if (codec) { | 181 if (codec) { |
| 185 stream.rewind(); | 182 stream.rewind(); |
| 186 codec->decode(&stream, &fBM, kN32_SkColorType, SkImageDecoder::kDe
codePixels_Mode); | 183 codec->decode(&stream, &fBM, kN32_SkColorType, SkImageDecoder::kDe
codePixels_Mode); |
| 187 SkDELETE(codec); | 184 SkDELETE(codec); |
| 188 } else { | 185 } else { |
| 189 fBM.allocN32Pixels(1, 1); | 186 fBM.allocN32Pixels(1, 1); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 205 DEF_GM( return new DownsampleBitmapCheckerboardGM(512,256, SkPaint::kMedium_Filt
erLevel); ) | 202 DEF_GM( return new DownsampleBitmapCheckerboardGM(512,256, SkPaint::kMedium_Filt
erLevel); ) |
| 206 DEF_GM( return new DownsampleBitmapImageGM("mandrill_512.png", SkPaint::kMedium_
FilterLevel); ) | 203 DEF_GM( return new DownsampleBitmapImageGM("mandrill_512.png", SkPaint::kMedium_
FilterLevel); ) |
| 207 | 204 |
| 208 DEF_GM( return new DownsampleBitmapTextGM(72, SkPaint::kLow_FilterLevel); ) | 205 DEF_GM( return new DownsampleBitmapTextGM(72, SkPaint::kLow_FilterLevel); ) |
| 209 DEF_GM( return new DownsampleBitmapCheckerboardGM(512,256, SkPaint::kLow_FilterL
evel); ) | 206 DEF_GM( return new DownsampleBitmapCheckerboardGM(512,256, SkPaint::kLow_FilterL
evel); ) |
| 210 DEF_GM( return new DownsampleBitmapImageGM("mandrill_512.png", SkPaint::kLow_Fil
terLevel); ) | 207 DEF_GM( return new DownsampleBitmapImageGM("mandrill_512.png", SkPaint::kLow_Fil
terLevel); ) |
| 211 | 208 |
| 212 DEF_GM( return new DownsampleBitmapTextGM(72, SkPaint::kNone_FilterLevel); ) | 209 DEF_GM( return new DownsampleBitmapTextGM(72, SkPaint::kNone_FilterLevel); ) |
| 213 DEF_GM( return new DownsampleBitmapCheckerboardGM(512,256, SkPaint::kNone_Filter
Level); ) | 210 DEF_GM( return new DownsampleBitmapCheckerboardGM(512,256, SkPaint::kNone_Filter
Level); ) |
| 214 DEF_GM( return new DownsampleBitmapImageGM("mandrill_512.png", SkPaint::kNone_Fi
lterLevel); ) | 211 DEF_GM( return new DownsampleBitmapImageGM("mandrill_512.png", SkPaint::kNone_Fi
lterLevel); ) |
| OLD | NEW |