From d2782edf0736c8c37e1075462d384342af283148 Mon Sep 17 00:00:00 2001 From: "mike@reedtribe.org" Date: Tue, 31 Jul 2012 02:45:15 +0000 Subject: update to surface.getCanvas() git-svn-id: http://skia.googlecode.com/svn/trunk@4844 2bbb7eff-a529-9590-31e7-b0007b416f81 --- gm/image.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/gm/image.cpp b/gm/image.cpp index 8947f0a4b7..22279563e0 100644 --- a/gm/image.cpp +++ b/gm/image.cpp @@ -11,7 +11,7 @@ static void drawContents(SkSurface* surface, SkColor fillC) { SkSize size = SkSize::Make(surface->width(), surface->height()); - SkAutoTUnref canvas(surface->newCanvas()); + SkCanvas* canvas = surface->getCanvas(); SkScalar stroke = size.fWidth / 10; SkScalar radius = (size.fWidth - stroke) / 2; @@ -37,9 +37,13 @@ static void test_surface(SkCanvas* canvas, SkSurface* surf) { drawContents(surf, SK_ColorBLUE); - imgR->draw(canvas, 0, 0, NULL); - imgG->draw(canvas, 0, 80, NULL); - surf->draw(canvas, 0, 160, NULL); + SkPaint paint; +// paint.setFilterBitmap(true); +// paint.setAlpha(0x80); + + imgR->draw(canvas, 0, 0, &paint); + imgG->draw(canvas, 0, 80, &paint); + surf->draw(canvas, 0, 160, &paint); imgG->unref(); imgR->unref(); @@ -76,6 +80,9 @@ protected: } virtual void onDraw(SkCanvas* canvas) { + canvas->translate(10, 10); + canvas->scale(2, 2); + // since we draw into this directly, we need to start fresh sk_bzero(fBuffer, fBufferSize); -- cgit v1.2.3