aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar mike@reedtribe.org <mike@reedtribe.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-07-31 02:45:15 +0000
committerGravatar mike@reedtribe.org <mike@reedtribe.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-07-31 02:45:15 +0000
commitd2782edf0736c8c37e1075462d384342af283148 (patch)
tree44869f99116267e7b80b768760f4411ffa601327
parent8a3eab3b547429b70b0e9886364a5801443c7136 (diff)
update to surface.getCanvas()
git-svn-id: http://skia.googlecode.com/svn/trunk@4844 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r--gm/image.cpp15
1 files 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<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);