Chromium Code Reviews| 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 "SkCanvas.h" | 9 #include "SkCanvas.h" |
| 10 #include "SkColorFilter.h" | 10 #include "SkColorFilter.h" |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 247 } | 247 } |
| 248 | 248 |
| 249 for(size_t j = 0; j < SK_ARRAY_COUNT(filters); ++j) { | 249 for(size_t j = 0; j < SK_ARRAY_COUNT(filters); ++j) { |
| 250 SkSafeUnref(filters[j]); | 250 SkSafeUnref(filters[j]); |
| 251 } | 251 } |
| 252 } | 252 } |
| 253 | 253 |
| 254 private: | 254 private: |
| 255 typedef GM INHERITED; | 255 typedef GM INHERITED; |
| 256 }; | 256 }; |
| 257 DEF_GM( return new ImageFiltersBaseGM; ) | |
| 257 | 258 |
| 258 /////////////////////////////////////////////////////////////////////////////// | 259 /////////////////////////////////////////////////////////////////////////////// |
| 259 | 260 |
|
robertphillips
2015/03/19 19:11:48
// This GM tests that LCD text is disabled when im
| |
| 260 static skiagm::GM* MyFactory(void*) { return new ImageFiltersBaseGM; } | 261 class ImageFiltersTextGM : public skiagm::GM { |
| 261 static skiagm::GMRegistry reg(MyFactory); | 262 public: |
| 263 ImageFiltersTextGM () {} | |
| 264 | |
| 265 protected: | |
|
robertphillips
2015/03/19 19:11:49
override throughout ?
one line ?
| |
| 266 virtual SkString onShortName() { | |
| 267 return SkString("imagefilterstext"); | |
| 268 } | |
| 269 | |
|
robertphillips
2015/03/19 19:11:48
Does this GM need to be this large?
| |
| 270 virtual SkISize onISize() { return SkISize::Make(700, 500); } | |
| 271 | |
| 272 virtual void onDraw(SkCanvas* canvas) { | |
| 273 const uint32_t flags[] = { | |
| 274 0, | |
| 275 SkPaint::kAntiAlias_Flag, | |
| 276 SkPaint::kAntiAlias_Flag | SkPaint::kLCDRenderText_Flag, | |
| 277 }; | |
| 278 | |
| 279 SkAutoTUnref<SkImageFilter> imgf(SkBlurImageFilter::Create(0.5f, 0.5f)); | |
| 280 SkPaint paint; | |
| 281 paint.setTextSize(30); | |
| 282 | |
| 283 canvas->translate(20, 40); | |
|
robertphillips
2015/03/19 19:11:48
Wouldn't it be a more explicit test to actually pe
| |
| 284 for (size_t i = 0; i < SK_ARRAY_COUNT(flags); ++i) { | |
| 285 paint.setFlags(flags[i]); | |
| 286 | |
| 287 paint.setImageFilter(NULL); | |
| 288 canvas->drawText("Hamburgefons", 11, 0, 0, paint); | |
| 289 paint.setImageFilter(imgf); | |
| 290 canvas->drawText("Hamburgefons", 11, 250, 0, paint); | |
| 291 canvas->translate(0, 40); | |
| 292 } | |
| 293 } | |
| 294 | |
| 295 private: | |
| 296 typedef GM INHERITED; | |
| 297 }; | |
| 298 DEF_GM( return new ImageFiltersTextGM; ) | |
| 299 | |
| OLD | NEW |