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 "SkPath.h" | 10 #include "SkPath.h" |
| 11 | 11 |
| 12 static void test_aamask(SkCanvas* canvas) { | |
| 13 canvas->drawColor(SK_ColorBLUE); | |
|
mtklein
2013/11/01 21:55:46
Can you add this as a bench too?
| |
| 14 | |
| 15 SkPaint paint; | |
| 16 paint.setAntiAlias(true); | |
| 17 SkPath path; | |
| 18 path.moveTo(0, 0); | |
| 19 path.quadTo(500, 0, 500, 500); | |
| 20 path.quadTo(250, 0, 0, 500); | |
| 21 | |
| 22 for (int i = 0; i < 100; ++i) | |
| 23 canvas->drawPath(path, paint); | |
|
mtklein
2013/11/01 21:55:46
{} ?
| |
| 24 } | |
| 25 | |
| 12 static void test_quadstroke(SkCanvas* canvas) { | 26 static void test_quadstroke(SkCanvas* canvas) { |
| 13 SkPath path; | 27 SkPath path; |
| 14 path.moveTo(6, 0); | 28 path.moveTo(6, 0); |
| 15 path.quadTo(150, 150, 0, 6); | 29 path.quadTo(150, 150, 0, 6); |
| 16 | 30 |
| 17 SkPaint paint; | 31 SkPaint paint; |
| 18 | 32 |
| 19 paint.setAntiAlias(true); | 33 paint.setAntiAlias(true); |
| 20 paint.setStyle(SkPaint::kStroke_Style); | 34 paint.setStyle(SkPaint::kStroke_Style); |
| 21 canvas->translate(20, 20); | 35 canvas->translate(20, 20); |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 266 protected: | 280 protected: |
| 267 virtual SkString onShortName() SK_OVERRIDE { | 281 virtual SkString onShortName() SK_OVERRIDE { |
| 268 return SkString("aaclip"); | 282 return SkString("aaclip"); |
| 269 } | 283 } |
| 270 | 284 |
| 271 virtual SkISize onISize() SK_OVERRIDE { | 285 virtual SkISize onISize() SK_OVERRIDE { |
| 272 return SkISize::Make(640, 480); | 286 return SkISize::Make(640, 480); |
| 273 } | 287 } |
| 274 | 288 |
| 275 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 289 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
| 290 if (true) { test_aamask(canvas); return; } | |
| 276 if (false) { test_quadstroke(canvas); return; } | 291 if (false) { test_quadstroke(canvas); return; } |
| 277 if (false) { test_conic(canvas); return; } | 292 if (false) { test_conic(canvas); return; } |
| 278 if (false) { | 293 if (false) { |
| 279 SkRect bounds; | 294 SkRect bounds; |
| 280 canvas->getClipBounds(&bounds); | 295 canvas->getClipBounds(&bounds); |
| 281 test_shallow_gradient(canvas, bounds.width(), bounds.height()); retu rn; | 296 test_shallow_gradient(canvas, bounds.width(), bounds.height()); retu rn; |
| 282 } | 297 } |
| 283 if (false) { | 298 if (false) { |
| 284 test_giant_dash(canvas); return; | 299 test_giant_dash(canvas); return; |
| 285 } | 300 } |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 311 draw_rect_tests(canvas); | 326 draw_rect_tests(canvas); |
| 312 } | 327 } |
| 313 | 328 |
| 314 virtual uint32_t onGetFlags() const { return kSkipPipe_Flag; } | 329 virtual uint32_t onGetFlags() const { return kSkipPipe_Flag; } |
| 315 | 330 |
| 316 private: | 331 private: |
| 317 typedef skiagm::GM INHERITED; | 332 typedef skiagm::GM INHERITED; |
| 318 }; | 333 }; |
| 319 | 334 |
| 320 DEF_GM( return SkNEW(AAClipGM); ) | 335 DEF_GM( return SkNEW(AAClipGM); ) |
| OLD | NEW |