Lines Matching refs:canvas
57 static void show_mesh(SkCanvas* canvas, const SkRect& r) { in show_mesh() argument
61 canvas->drawRect(r, paint); in show_mesh()
62 canvas->drawLine(r.fLeft, r.fTop, r.fRight, r.fBottom, paint); in show_mesh()
65 static void drawLine(SkCanvas* canvas, const SkPoint& p0, const SkPoint& p1, in drawLine() argument
67 canvas->drawLine(p0.fX, p0.fY, p1.fX, p1.fY, paint); in drawLine()
70 static void show_mesh(SkCanvas* canvas, const SkPoint pts[], in show_mesh() argument
76 drawLine(canvas, pts[indices[i]], pts[indices[i+1]], paint); in show_mesh()
77 drawLine(canvas, pts[indices[i+1]], pts[indices[i+2]], paint); in show_mesh()
78 drawLine(canvas, pts[indices[i+2]], pts[indices[i]], paint); in show_mesh()
82 static void show_glframe(SkCanvas* canvas, const SkPath& path) { in show_glframe() argument
85 canvas->drawPath(path, paint); in show_glframe()
88 static void show_mesh_between(SkCanvas* canvas, const SkPath& p0, const SkPath& p1) { in show_mesh_between() argument
107 show_mesh(canvas, pts0, indices, ndx - indices); in show_mesh_between()
110 static void show_fan(SkCanvas* canvas, const SkPath& path, SkScalar cx, SkScalar cy) { in show_fan() argument
114 canvas->drawPath(path, paint); in show_fan()
119 canvas->drawLine(pts[i].fX, pts[i].fY, cx, cy, paint); in show_fan()
125 typedef void (*DrawProc)(SkCanvas* canvas, bool showGL, int flags);
127 static void draw_line(SkCanvas* canvas, bool showGL, int flags) { in draw_line() argument
134 canvas->drawLine(50, 50, 400, 100, paint); in draw_line()
137 canvas->rotate(40); in draw_line()
140 canvas->drawLine(100, 50, 450, 50, paint); in draw_line()
142 show_mesh(canvas, SkRect::MakeLTRB(100, 50-20, 450, 50+20)); in draw_line()
146 static void draw_rect(SkCanvas* canvas, bool showGL, int flags) { in draw_rect() argument
153 canvas->drawRect(r, paint); in draw_rect()
155 show_mesh(canvas, r); in draw_rect()
158 canvas->translate(320, 0); in draw_rect()
162 canvas->drawRect(r, paint); in draw_rect()
174 show_mesh(canvas, pts, indices, SK_ARRAY_COUNT(indices)); in draw_rect()
178 static void draw_oval(SkCanvas* canvas, bool showGL, int flags) { in draw_oval() argument
185 canvas->drawOval(r, paint); in draw_oval()
191 show_glframe(canvas, path); in draw_oval()
198 show_fan(canvas, dst, r.centerX(), r.centerY()); in draw_oval()
202 show_mesh(canvas, r); in draw_oval()
205 canvas->drawCircle(r.centerX(), r.centerY(), 3, p); in draw_oval()
210 canvas->translate(320, 0); in draw_oval()
214 canvas->drawOval(r, paint); in draw_oval()
224 show_glframe(canvas, path); in draw_oval()
233 show_mesh_between(canvas, path0, path1); in draw_oval()
238 show_glframe(canvas, path); in draw_oval()
241 show_mesh(canvas, r); in draw_oval()
248 canvas->drawRect(r, paint); in draw_oval()
249 show_mesh(canvas, r); in draw_oval()
257 static void draw_image(SkCanvas* canvas, bool showGL, int flags) { in draw_image() argument
270 canvas->save(); in draw_image()
271 canvas->translate(30, 30); in draw_image()
272 canvas->scale(0.8f, 0.8f); in draw_image()
273 canvas->drawBitmap(*gBM, 0, 0, &paint); in draw_image()
275 show_mesh(canvas, r); in draw_image()
277 canvas->restore(); in draw_image()
279 canvas->translate(210, 290); in draw_image()
280 canvas->rotate(-35); in draw_image()
281 canvas->drawBitmap(*gBM, 0, 0, &paint); in draw_image()
283 show_mesh(canvas, r); in draw_image()
287 static void draw_text(SkCanvas* canvas, bool showGL, int flags) { in draw_text() argument
295 canvas->translate(40, 50); in draw_text()
298 canvas->drawText(text, len, 0, 0, paint); in draw_text()
306 show_mesh(canvas, bounds[j]); in draw_text()
310 canvas->translate(0, paint.getTextSize() * 3 / 2); in draw_text()
351 virtual void onDraw(SkCanvas* canvas) { in onDraw() argument
352 SkISize size = canvas->getDeviceSize(); in onDraw()
358 canvas->concat(matrix); in onDraw()
359 fProc(canvas, fShowGL, fFlags); in onDraw()