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" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 SkPaint foregroundPaint; | 78 SkPaint foregroundPaint; |
79 foregroundPaint.setColor(SkColorSetRGB(0x0, 0x0, 0xDD)); | 79 foregroundPaint.setColor(SkColorSetRGB(0x0, 0x0, 0xDD)); |
80 foregroundPaint.setAntiAlias(true); | 80 foregroundPaint.setAntiAlias(true); |
81 | 81 |
82 canvas->save(); | 82 canvas->save(); |
83 canvas->translate(SkIntToScalar(x), SkIntToScalar(y)); | 83 canvas->translate(SkIntToScalar(x), SkIntToScalar(y)); |
84 target.inset(SkIntToScalar(-2), SkIntToScalar(-2)); | 84 target.inset(SkIntToScalar(-2), SkIntToScalar(-2)); |
85 canvas->drawRect(target, borderPaint); | 85 canvas->drawRect(target, borderPaint); |
86 target.inset(SkIntToScalar(2), SkIntToScalar(2)); | 86 target.inset(SkIntToScalar(2), SkIntToScalar(2)); |
87 canvas->drawRect(target, backgroundPaint); | 87 canvas->drawRect(target, backgroundPaint); |
88 canvas->clipRect(target, SkRegion::kIntersect_Op, true); | 88 canvas->clipRect(target, SkCanvas::kIntersect_Op, true); |
89 target.inset(SkIntToScalar(-4), SkIntToScalar(-4)); | 89 target.inset(SkIntToScalar(-4), SkIntToScalar(-4)); |
90 canvas->drawRect(target, foregroundPaint); | 90 canvas->drawRect(target, foregroundPaint); |
91 canvas->restore(); | 91 canvas->restore(); |
92 } | 92 } |
93 | 93 |
94 static void draw_square(SkCanvas* canvas, int x, int y) { | 94 static void draw_square(SkCanvas* canvas, int x, int y) { |
95 SkRect target (SkRect::MakeWH(10 * SK_Scalar1, 10 * SK_Scalar1)); | 95 SkRect target (SkRect::MakeWH(10 * SK_Scalar1, 10 * SK_Scalar1)); |
96 draw(canvas, target, x, y); | 96 draw(canvas, target, x, y); |
97 } | 97 } |
98 | 98 |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 canvas->translate(80, 10); | 309 canvas->translate(80, 10); |
310 this->drawAndClip(canvas, fVPath, 200, 0); | 310 this->drawAndClip(canvas, fVPath, 200, 0); |
311 canvas->translate(0, 200); | 311 canvas->translate(0, 200); |
312 this->drawAndClip(canvas, fHPath, 200, 0); | 312 this->drawAndClip(canvas, fHPath, 200, 0); |
313 } | 313 } |
314 | 314 |
315 private: | 315 private: |
316 typedef skiagm::GM INHERITED; | 316 typedef skiagm::GM INHERITED; |
317 }; | 317 }; |
318 DEF_GM(return new ClipCubicGM;) | 318 DEF_GM(return new ClipCubicGM;) |
OLD | NEW |