Lines Matching refs:canvas
20 static void drawJpeg(SkCanvas* canvas, const SkISize& size) { in drawJpeg() argument
30 SkAutoCanvasRestore acr(canvas, true); in drawJpeg()
31 canvas->scale(size.width() * 1.0f / image->width(), in drawJpeg()
33 canvas->drawImage(image, 0, 0, nullptr); in drawJpeg()
41 SkCanvas* canvas = surface->getCanvas(); in drawContents() local
50 canvas->drawCircle(size.fWidth/2, size.fHeight/2, radius, paint); in drawContents()
55 canvas->drawCircle(size.fWidth/2, size.fHeight/2, radius, paint); in drawContents()
58 static void test_surface(SkCanvas* canvas, SkSurface* surf, bool usePaint) { in test_surface() argument
80 canvas->drawImage(imgR, 0, 0, usePaint ? &paint : nullptr); in test_surface()
81 canvas->drawImage(imgG, 0, 80, usePaint ? &paint : nullptr); in test_surface()
82 surf->draw(canvas, 0, 160, usePaint ? &paint : nullptr); in test_surface()
96 canvas->drawImageRect(imgR, src1, dst1, usePaint ? &paint : nullptr); in test_surface()
97 canvas->drawImageRect(imgG, src2, dst2, usePaint ? &paint : nullptr); in test_surface()
98 canvas->drawImageRect(imgR, src3, dst3, usePaint ? &paint : nullptr); in test_surface()
99 canvas->drawImageRect(imgG, dst4, usePaint ? &paint : nullptr); in test_surface()
134 void onDraw(SkCanvas* canvas) override { in onDraw() argument
135 drawJpeg(canvas, this->getISize()); in onDraw()
137 canvas->scale(2, 2); in onDraw()
156 canvas->drawText(kLabel1, strlen(kLabel1), 10, 60, textPaint); in onDraw()
157 canvas->drawText(kLabel2, strlen(kLabel2), 10, 140, textPaint); in onDraw()
158 canvas->drawText(kLabel3, strlen(kLabel3), 10, 220, textPaint); in onDraw()
159 canvas->drawText(kLabel4, strlen(kLabel4), 10, 300, textPaint); in onDraw()
160 canvas->drawText(kLabel5, strlen(kLabel5), 10, 380, textPaint); in onDraw()
161 canvas->drawText(kLabel6, strlen(kLabel6), 10, 460, textPaint); in onDraw()
162 canvas->drawText(kLabel7, strlen(kLabel7), 10, 540, textPaint); in onDraw()
164 canvas->drawText(kLabel8, strlen(kLabel8), 80, 10, textPaint); in onDraw()
165 canvas->drawText(kLabel9, strlen(kLabel9), 160, 10, textPaint); in onDraw()
166 canvas->drawText(kLabel10, strlen(kLabel10), 265, 10, textPaint); in onDraw()
168 canvas->translate(80, 20); in onDraw()
179 surf2.reset(SkSurface::NewRenderTarget(canvas->getGrContext(), in onDraw()
183 test_surface(canvas, surf0, true); in onDraw()
184 canvas->translate(80, 0); in onDraw()
185 test_surface(canvas, surf1, true); in onDraw()
187 canvas->translate(80, 0); in onDraw()
188 test_surface(canvas, surf2, true); in onDraw()
201 static void draw_pixmap(SkCanvas* canvas, const SkPixmap& pmap) {
204 canvas->drawBitmap(bitmap, 0, 0, nullptr);
207 static void show_scaled_pixels(SkCanvas* canvas, SkImage* image) { in show_scaled_pixels() argument
208 SkAutoCanvasRestore acr(canvas, true); in show_scaled_pixels()
210 canvas->drawImage(image, 0, 0, nullptr); in show_scaled_pixels()
211 canvas->translate(110, 10); in show_scaled_pixels()
225 canvas->save(); in show_scaled_pixels()
228 draw_pixmap(canvas, storage); in show_scaled_pixels()
230 canvas->translate(70, 0); in show_scaled_pixels()
232 canvas->restore(); in show_scaled_pixels()
233 canvas->translate(0, 45); in show_scaled_pixels()
237 static void draw_contents(SkCanvas* canvas) { in draw_contents() argument
241 canvas->drawCircle(50, 50, 35, paint); in draw_contents()
285 void onDraw(SkCanvas* canvas) override { in onDraw() argument
292 SkAutoTUnref<SkImage> image(proc(info, canvas->getGrContext(), draw_contents)); in onDraw()
294 show_scaled_pixels(canvas, image); in onDraw()
296 canvas->translate(0, 120); in onDraw()
332 static void draw_opaque_contents(SkCanvas* canvas) { in draw_opaque_contents() argument
333 canvas->drawColor(0xFFFF8844); in draw_opaque_contents()
338 canvas->drawCircle(50, 50, 35, paint); in draw_opaque_contents()
369 static void show_scaled_generator(SkCanvas* canvas, SkImageGenerator* gen) { in show_scaled_generator() argument
372 SkAutoCanvasRestore acr(canvas, true); in show_scaled_generator()
377 canvas->drawBitmap(bm, 0, 0, nullptr); in show_scaled_generator()
379 canvas->translate(110, 0); in show_scaled_generator()
391 canvas->drawBitmap(bm, 0, SkIntToScalar(genInfo.height() - info.height())/2); in show_scaled_generator()
394 canvas->translate(100, 0); in show_scaled_generator()
411 void onDraw(SkCanvas* canvas) override { in onDraw() argument
412 canvas->translate(10, 10); in onDraw()
423 show_scaled_generator(canvas, gen); in onDraw()
425 canvas->translate(0, 120); in onDraw()
438 DEF_SIMPLE_GM(new_texture_image, canvas, 225, 60) {
441 context = canvas->getGrContext();
445 skiagm::GM::DrawGpuOnlyMessage(canvas);
449 auto render_image = [](SkCanvas* canvas) { in __anon780ff07f0202() argument
450 canvas->clear(SK_ColorBLUE); in __anon780ff07f0202()
453 canvas->drawRect(SkRect::MakeXYWH(10.f,10.f,10.f,10.f), paint); in __anon780ff07f0202()
455 canvas->drawRect(SkRect::MakeXYWH(30.f,10.f,10.f,10.f), paint); in __anon780ff07f0202()
457 canvas->drawRect(SkRect::MakeXYWH(10.f,30.f,10.f,10.f), paint); in __anon780ff07f0202()
459 canvas->drawRect(SkRect::MakeXYWH(30.f,30.f,10.f,10.f), paint); in __anon780ff07f0202()
482 SkCanvas* canvas = recorder.beginRecording(SkIntToScalar(kSize), SkIntToScalar(kSize)); in __anon780ff07f0502() local
483 render_image(canvas); in __anon780ff07f0502()
501 canvas->translate(kPad, kPad);
510 canvas->drawImage(texImage, 0, 0);
513 canvas->translate(image->width() + kPad, 0);