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_quadstroke(SkCanvas* canvas) { |
| 13 SkPath path; |
| 14 path.moveTo(6, 0); |
| 15 path.quadTo(150, 150, 0, 6); |
| 16 |
| 17 SkPaint paint; |
| 18 |
| 19 paint.setAntiAlias(true); |
| 20 paint.setStyle(SkPaint::kStroke_Style); |
| 21 canvas->translate(20, 20); |
| 22 |
| 23 #if 1 |
| 24 canvas->drawPath(path, paint); |
| 25 canvas->translate(100, 0); |
| 26 #endif |
| 27 |
| 28 paint.setStrokeWidth(1.01f); |
| 29 canvas->drawPath(path, paint); |
| 30 } |
| 31 |
12 static void draw_conic(SkCanvas* canvas, SkScalar weight, const SkPaint& paint)
{ | 32 static void draw_conic(SkCanvas* canvas, SkScalar weight, const SkPaint& paint)
{ |
13 SkPath path; | 33 SkPath path; |
14 path.moveTo(100, 100); | 34 path.moveTo(100, 100); |
15 path.conicTo(300, 100, 300, 300, weight); | 35 path.conicTo(300, 100, 300, 300, weight); |
16 canvas->drawPath(path, paint); | 36 canvas->drawPath(path, paint); |
17 } | 37 } |
18 | 38 |
19 static void test_conic(SkCanvas* canvas) { | 39 static void test_conic(SkCanvas* canvas) { |
20 SkPaint paint; | 40 SkPaint paint; |
21 paint.setAntiAlias(true); | 41 paint.setAntiAlias(true); |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 protected: | 266 protected: |
247 virtual SkString onShortName() SK_OVERRIDE { | 267 virtual SkString onShortName() SK_OVERRIDE { |
248 return SkString("aaclip"); | 268 return SkString("aaclip"); |
249 } | 269 } |
250 | 270 |
251 virtual SkISize onISize() SK_OVERRIDE { | 271 virtual SkISize onISize() SK_OVERRIDE { |
252 return SkISize::Make(640, 480); | 272 return SkISize::Make(640, 480); |
253 } | 273 } |
254 | 274 |
255 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 275 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
| 276 if (false) { test_quadstroke(canvas); return; } |
256 if (false) { test_conic(canvas); return; } | 277 if (false) { test_conic(canvas); return; } |
257 if (false) { | 278 if (false) { |
258 SkRect bounds; | 279 SkRect bounds; |
259 canvas->getClipBounds(&bounds); | 280 canvas->getClipBounds(&bounds); |
260 test_shallow_gradient(canvas, bounds.width(), bounds.height()); retu
rn; | 281 test_shallow_gradient(canvas, bounds.width(), bounds.height()); retu
rn; |
261 } | 282 } |
262 if (false) { | 283 if (false) { |
263 test_giant_dash(canvas); return; | 284 test_giant_dash(canvas); return; |
264 } | 285 } |
265 if (false) { | 286 if (false) { |
(...skipping 24 matching lines...) Expand all Loading... |
290 draw_rect_tests(canvas); | 311 draw_rect_tests(canvas); |
291 } | 312 } |
292 | 313 |
293 virtual uint32_t onGetFlags() const { return kSkipPipe_Flag; } | 314 virtual uint32_t onGetFlags() const { return kSkipPipe_Flag; } |
294 | 315 |
295 private: | 316 private: |
296 typedef skiagm::GM INHERITED; | 317 typedef skiagm::GM INHERITED; |
297 }; | 318 }; |
298 | 319 |
299 DEF_GM( return SkNEW(AAClipGM); ) | 320 DEF_GM( return SkNEW(AAClipGM); ) |
OLD | NEW |