Lines Matching refs:canvas
14 static void do_draw(SkCanvas* canvas, const SkRect& r) { in do_draw() argument
18 canvas->drawRect(r, paint); in do_draw()
47 DEF_SIMPLE_GM(dont_clip_to_layer, canvas, 120, 120) {
52 canvas->saveLayer(&r, nullptr);
53 canvas->drawColor(SK_ColorRED);
63 canvas->saveLayer(rec);
65 canvas->saveLayer(rec);
66 do_draw(canvas, r);
67 canvas->restore();
68 canvas->restore();
70 canvas->restore(); // red-layer
77 static void draw(SkCanvas* canvas, SkRect& target, int x, int y) { in draw() argument
88 canvas->save(); in draw()
89 canvas->translate(SkIntToScalar(x), SkIntToScalar(y)); in draw()
91 canvas->drawRect(target, borderPaint); in draw()
93 canvas->drawRect(target, backgroundPaint); in draw()
94 canvas->clipRect(target, true); in draw()
96 canvas->drawRect(target, foregroundPaint); in draw()
97 canvas->restore(); in draw()
100 static void draw_square(SkCanvas* canvas, int x, int y) { in draw_square() argument
102 draw(canvas, target, x, y); in draw_square()
105 static void draw_column(SkCanvas* canvas, int x, int y) { in draw_column() argument
107 draw(canvas, target, x, y); in draw_column()
110 static void draw_bar(SkCanvas* canvas, int x, int y) { in draw_bar() argument
112 draw(canvas, target, x, y); in draw_bar()
115 static void draw_rect_tests(SkCanvas* canvas) { in draw_rect_tests() argument
116 draw_square(canvas, 10, 10); in draw_rect_tests()
117 draw_column(canvas, 30, 10); in draw_rect_tests()
118 draw_bar(canvas, 10, 30); in draw_rect_tests()
127 DEF_SIMPLE_GM(aaclip, canvas, 240, 120) {
129 draw_rect_tests(canvas);
132 canvas->translate(SK_Scalar1 / 5, SK_Scalar1 / 5);
133 canvas->translate(SkIntToScalar(50), 0);
134 draw_rect_tests(canvas);
136 canvas->translate(SK_Scalar1 / 5, SK_Scalar1 / 5);
137 canvas->translate(SkIntToScalar(50), 0);
138 draw_rect_tests(canvas);
140 canvas->translate(SK_Scalar1 / 5, SK_Scalar1 / 5);
141 canvas->translate(SkIntToScalar(50), 0);
142 draw_rect_tests(canvas);
144 canvas->translate(SK_Scalar1 / 5, SK_Scalar1 / 5);
145 canvas->translate(SkIntToScalar(50), 0);
146 draw_rect_tests(canvas);
165 static void test_image(SkCanvas* canvas, const SkImageInfo& info) { in test_image() argument
179 canvas->drawBitmap(bm, 10, 10); in test_image()
185 canvas->drawBitmap(bm2, 10, 120); in test_image()
186 canvas->drawImage(SkMakeImageFromCGImage(image), 10, 120 + bm2.height() + 10); in test_image()
191 DEF_SIMPLE_GM(cgimage, canvas, 800, 250) {
209 test_image(canvas, info);
210 canvas->translate(info.width() + 10, 0);
243 void doDraw(SkCanvas* canvas, const SkPath& path) { in doDraw() argument
248 canvas->drawPath(path, paint); in doDraw()
252 canvas->drawPath(path, paint); in doDraw()
255 void drawAndClip(SkCanvas* canvas, const SkPath& path, SkScalar dx, SkScalar dy) { in drawAndClip() argument
256 SkAutoCanvasRestore acr(canvas, true); in drawAndClip()
262 canvas->drawRect(r, paint); in drawAndClip()
263 this->doDraw(canvas, path); in drawAndClip()
265 canvas->translate(dx, dy); in drawAndClip()
267 canvas->drawRect(r, paint); in drawAndClip()
268 canvas->clipRect(r); in drawAndClip()
269 this->doDraw(canvas, path); in drawAndClip()
272 void onDraw(SkCanvas* canvas) override { in onDraw() argument
273 canvas->translate(80, 10); in onDraw()
274 this->drawAndClip(canvas, fVPath, 200, 0); in onDraw()
275 canvas->translate(0, 200); in onDraw()
276 this->drawAndClip(canvas, fHPath, 200, 0); in onDraw()