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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 } | 49 } |
50 | 50 |
51 const char* filterLevelToString() { | 51 const char* filterLevelToString() { |
52 static const char *filterLevelNames[] = { | 52 static const char *filterLevelNames[] = { |
53 "none", "low", "medium", "high" | 53 "none", "low", "medium", "high" |
54 }; | 54 }; |
55 return filterLevelNames[fFilterLevel]; | 55 return filterLevelNames[fFilterLevel]; |
56 } | 56 } |
57 | 57 |
58 protected: | 58 protected: |
59 uint32_t onGetFlags() const SK_OVERRIDE { | |
60 return kSkipTiled_Flag; | |
61 } | |
62 | 59 |
63 SkString onShortName() SK_OVERRIDE { | 60 SkString onShortName() SK_OVERRIDE { |
64 return fName; | 61 return fName; |
65 } | 62 } |
66 | 63 |
67 SkISize onISize() SK_OVERRIDE { | 64 SkISize onISize() SK_OVERRIDE { |
68 make_bitmap_wrapper(); | 65 make_bitmap_wrapper(); |
69 return SkISize::Make(fBM.width(), 4 * fBM.height()); | 66 return SkISize::Make(fBM.width(), 4 * fBM.height()); |
70 } | 67 } |
71 | 68 |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 class ShowMipLevels : public skiagm::GM { | 195 class ShowMipLevels : public skiagm::GM { |
199 public: | 196 public: |
200 SkBitmap fBM; | 197 SkBitmap fBM; |
201 | 198 |
202 ShowMipLevels() { | 199 ShowMipLevels() { |
203 this->setBGColor(0xFFDDDDDD); | 200 this->setBGColor(0xFFDDDDDD); |
204 make_checker(&fBM, 512, 256); | 201 make_checker(&fBM, 512, 256); |
205 } | 202 } |
206 | 203 |
207 protected: | 204 protected: |
208 #if 0 | |
209 uint32_t onGetFlags() const SK_OVERRIDE { | |
210 return kSkipTiled_Flag; | |
211 } | |
212 #endif | |
213 | 205 |
214 SkString onShortName() SK_OVERRIDE { | 206 SkString onShortName() SK_OVERRIDE { |
215 return SkString("showmiplevels"); | 207 return SkString("showmiplevels"); |
216 } | 208 } |
217 | 209 |
218 SkISize onISize() SK_OVERRIDE { | 210 SkISize onISize() SK_OVERRIDE { |
219 return SkISize::Make(fBM.width() + 8, 2 * fBM.height() + 80); | 211 return SkISize::Make(fBM.width() + 8, 2 * fBM.height() + 80); |
220 } | 212 } |
221 | 213 |
222 void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 214 void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
(...skipping 11 matching lines...) Expand all Loading... |
234 SkBitmap bm; | 226 SkBitmap bm; |
235 bm.installPixels(info, level.fPixels, level.fRowBytes); | 227 bm.installPixels(info, level.fPixels, level.fRowBytes); |
236 canvas->drawBitmap(bm, x, y, NULL); | 228 canvas->drawBitmap(bm, x, y, NULL); |
237 y += bm.height() + 4; | 229 y += bm.height() + 4; |
238 scale /= 2; | 230 scale /= 2; |
239 if (info.width() == 1 || info.height() == 1) { | 231 if (info.width() == 1 || info.height() == 1) { |
240 break; | 232 break; |
241 } | 233 } |
242 } | 234 } |
243 } | 235 } |
244 | 236 |
245 private: | 237 private: |
246 typedef skiagm::GM INHERITED; | 238 typedef skiagm::GM INHERITED; |
247 }; | 239 }; |
248 DEF_GM( return new ShowMipLevels; ) | 240 DEF_GM( return new ShowMipLevels; ) |
249 | 241 |
250 ////////////////////////////////////////////////////////////////////////////// | 242 ////////////////////////////////////////////////////////////////////////////// |
251 | 243 |
252 DEF_GM( return new DownsampleBitmapTextGM(72, SkPaint::kHigh_FilterLevel); ) | 244 DEF_GM( return new DownsampleBitmapTextGM(72, SkPaint::kHigh_FilterLevel); ) |
253 DEF_GM( return new DownsampleBitmapCheckerboardGM(512,256, SkPaint::kHigh_Filter
Level); ) | 245 DEF_GM( return new DownsampleBitmapCheckerboardGM(512,256, SkPaint::kHigh_Filter
Level); ) |
254 DEF_GM( return new DownsampleBitmapImageGM("mandrill_512.png", SkPaint::kHigh_Fi
lterLevel); ) | 246 DEF_GM( return new DownsampleBitmapImageGM("mandrill_512.png", SkPaint::kHigh_Fi
lterLevel); ) |
(...skipping 10 matching lines...) Expand all Loading... |
265 DEF_GM( return new DownsampleBitmapCheckerboardGM(512,256, SkPaint::kLow_FilterL
evel); ) | 257 DEF_GM( return new DownsampleBitmapCheckerboardGM(512,256, SkPaint::kLow_FilterL
evel); ) |
266 DEF_GM( return new DownsampleBitmapImageGM("mandrill_512.png", SkPaint::kLow_Fil
terLevel); ) | 258 DEF_GM( return new DownsampleBitmapImageGM("mandrill_512.png", SkPaint::kLow_Fil
terLevel); ) |
267 DEF_GM( return new DownsampleBitmapImageGM("mandrill_132x132_12x12.astc", | 259 DEF_GM( return new DownsampleBitmapImageGM("mandrill_132x132_12x12.astc", |
268 SkPaint::kLow_FilterLevel); ) | 260 SkPaint::kLow_FilterLevel); ) |
269 | 261 |
270 DEF_GM( return new DownsampleBitmapTextGM(72, SkPaint::kNone_FilterLevel); ) | 262 DEF_GM( return new DownsampleBitmapTextGM(72, SkPaint::kNone_FilterLevel); ) |
271 DEF_GM( return new DownsampleBitmapCheckerboardGM(512,256, SkPaint::kNone_Filter
Level); ) | 263 DEF_GM( return new DownsampleBitmapCheckerboardGM(512,256, SkPaint::kNone_Filter
Level); ) |
272 DEF_GM( return new DownsampleBitmapImageGM("mandrill_512.png", SkPaint::kNone_Fi
lterLevel); ) | 264 DEF_GM( return new DownsampleBitmapImageGM("mandrill_512.png", SkPaint::kNone_Fi
lterLevel); ) |
273 DEF_GM( return new DownsampleBitmapImageGM("mandrill_132x132_12x12.astc", | 265 DEF_GM( return new DownsampleBitmapImageGM("mandrill_132x132_12x12.astc", |
274 SkPaint::kNone_FilterLevel); ) | 266 SkPaint::kNone_FilterLevel); ) |
OLD | NEW |