update to surface.getCanvas()
authormike@reedtribe.org <mike@reedtribe.org@2bbb7eff-a529-9590-31e7-b0007b416f81>
Tue, 31 Jul 2012 02:45:15 +0000 (02:45 +0000)
committermike@reedtribe.org <mike@reedtribe.org@2bbb7eff-a529-9590-31e7-b0007b416f81>
Tue, 31 Jul 2012 02:45:15 +0000 (02:45 +0000)
git-svn-id: http://skia.googlecode.com/svn/trunk@4844 2bbb7eff-a529-9590-31e7-b0007b416f81

gm/image.cpp

index 8947f0a..2227956 100644 (file)
@@ -11,7 +11,7 @@
 
 static void drawContents(SkSurface* surface, SkColor fillC) {
     SkSize size = SkSize::Make(surface->width(), surface->height());
-    SkAutoTUnref<SkCanvas> 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);