Lines Matching refs:canvas
16 static void save_layer_unclipped(SkCanvas* canvas, in save_layer_unclipped() argument
19 canvas->saveLayer({ &rect, nullptr, nullptr, nullptr, nullptr, in save_layer_unclipped()
23 static void do_draw(SkCanvas* canvas) { in do_draw() argument
29 canvas->drawRect({ 15, 15, 290, 40 }, paint); in do_draw()
30 canvas->translate(0, 30); in do_draw()
57 void onDraw(SkCanvas* canvas) override { in onDraw() argument
63 canvas->clipRect({ L, T, R, B }); in onDraw()
66 SkAutoCanvasRestore acr(canvas, true); in onDraw()
68 save_layer_unclipped(canvas, L, T, R, T + 20); in onDraw()
69 save_layer_unclipped(canvas, L, B - 20, R, B); in onDraw()
72 canvas->saveLayer({ L, T, R, B }, nullptr); in onDraw()
75 do_draw(canvas); in onDraw()
87 DEF_SIMPLE_GM(picture_savelayer, canvas, 320, 640) {
95 canvas->translate(100 * i, 0);
98 canvas->saveLayer({ &rect1, &paint1, nullptr, nullptr, nullptr, flag});
99 canvas->saveLayer({ &rect2, &paint2, nullptr, nullptr, nullptr, flag});
100 canvas->drawRect(rect3, paint3);
101 canvas->restore();
102 canvas->restore();
112 DEF_SIMPLE_GM(savelayer_initfromprev, canvas, 256, 256) {
113 canvas->drawImage(GetResourceAsImage("images/mandrill_256.png"), 0, 0, nullptr);
120 canvas->saveLayer(rec);
122 canvas->drawCircle(128, 128, 96, paint);
123 canvas->restore();
132 static void draw_mask(SkCanvas* canvas, int size) { in draw_mask() argument
141 canvas->drawPaint(paint); in draw_mask()
145 canvas->drawCircle(cx, cy, size / 4, paint); in draw_mask()
148 DEF_SIMPLE_GM(savelayer_clipmask, canvas, 1200, 1200) {
203 canvas->drawColor(0xffcccccc);
217 canvas->save();
221 canvas->saveLayer(rec);
225 canvas->drawRect(SkRect::MakeWH(50, 50), paint);
227 canvas->drawRect(SkRect::MakeXYWH(50, 0, 50, 50), paint);
229 canvas->drawRect(SkRect::MakeXYWH(50, 50, 50, 50), paint);
231 canvas->drawRect(SkRect::MakeXYWH(0, 50, 50, 50), paint);
233 canvas->restore();
234 canvas->translate(120, 0);
236 canvas->restore();
237 canvas->translate(0, 120);
242 DEF_SIMPLE_GM(savelayer_coverage, canvas, 500, 500) {
243 canvas->saveLayer(nullptr, nullptr);
251 auto proc = [layerPaint](SkCanvas* canvas, SkCanvas::SaveLayerRec& rec) { in __anon62f1ea880802() argument
255 canvas->saveLayer(rec); in __anon62f1ea880802()
256 canvas->drawCircle(100, 100, 50, paint); in __anon62f1ea880802()
258 canvas->drawRect({10, 90, 190, 110}, paint); in __anon62f1ea880802()
259 canvas->restore(); in __anon62f1ea880802()
266 canvas->save();
267 canvas->translate(x * 200.f, y * 200.f);
270 canvas->drawImageRect(image, r, nullptr);
271 proc(canvas, rec);
273 canvas->restore();
277 canvas->restore();
284 static void draw_cell(SkCanvas* canvas, sk_sp<SkTextBlob> blob, SkColor c, SkScalar w, SkScalar h, in draw_cell() argument
290 canvas->drawRect(r, p); in draw_cell()
297 SkDEBUGCODE(int sc0 =) canvas->getSaveCount(); in draw_cell()
298 SkDEBUGCODE(int sc1 =) SkCanvasPriv::SaveBehind(canvas, &r); in draw_cell()
299 SkDEBUGCODE(int sc2 =) canvas->getSaveCount(); in draw_cell()
305 canvas->drawTextBlob(blob, 10, 30, p); in draw_cell()
315 SkCanvasPriv::DrawBehind(canvas, p); in draw_cell()
317 canvas->drawRect(r, p); in draw_cell()
321 canvas->restore(); in draw_cell()
322 SkDEBUGCODE(int sc3 =) canvas->getSaveCount(); in draw_cell()
331 static void draw_list(SkCanvas* canvas, sk_sp<SkTextBlob> blob, bool useDrawBehind) { in draw_list() argument
332 SkAutoCanvasRestore acr(canvas, true); in draw_list()
340 draw_cell(canvas, blob, c, w, h, useDrawBehind); in draw_list()
341 canvas->translate(0, h); in draw_list()
345 DEF_SIMPLE_GM(save_behind, canvas, 830, 670) {
352 canvas->save();
354 draw_list(canvas, blob, useDrawBehind);
355 canvas->translate(0, 350);
356 canvas->saveLayer({0, 0, 400, 320}, nullptr);
357 draw_list(canvas, blob, useDrawBehind);
358 canvas->restore();
360 canvas->restore();
361 canvas->translate(430, 0);