aboutsummaryrefslogtreecommitdiffstats
path: root/gm/shapes.cpp
diff options
context:
space:
mode:
authorDerek Sollenberger <djsollen@google.com>2011-01-07 13:32:14 -0500
committerDerek Sollenberger <djsollen@google.com>2011-02-23 14:59:05 -0500
commit40528743dbb9ce7f39f093e0cdc47849ac8887cf (patch)
tree9f27d91d1210746846b76e2ab85a82258243fe1f /gm/shapes.cpp
parentdd3f189dfde60f95f6be0517f1c28ad2879973a1 (diff)
downloadexternal_skia-40528743dbb9ce7f39f093e0cdc47849ac8887cf.zip
external_skia-40528743dbb9ce7f39f093e0cdc47849ac8887cf.tar.gz
external_skia-40528743dbb9ce7f39f093e0cdc47849ac8887cf.tar.bz2
Skia Merge (revision 808)
This merge has companion changes in the following projects in order to be compatible with changes to skia interfaces and practices: 1. /frameworks/base 2. /external/webkit Change-Id: I54092971305579e81a8fdb27bbe04ec340792e3b
Diffstat (limited to 'gm/shapes.cpp')
-rw-r--r--gm/shapes.cpp33
1 files changed, 17 insertions, 16 deletions
diff --git a/gm/shapes.cpp b/gm/shapes.cpp
index b3d4863..324ce7e 100644
--- a/gm/shapes.cpp
+++ b/gm/shapes.cpp
@@ -53,40 +53,40 @@ public:
fGroup.appendShape(make_shape1(), m)->unref();
m.postTranslate(0, SkIntToScalar(120));
fGroup.appendShape(make_shape2(), m)->unref();
-
+
for (size_t i = 0; i < SK_ARRAY_COUNT(fMatrixRefs); i++) {
SkSafeRef(fMatrixRefs[i] = fGroup.getShapeMatrixRef(i));
}
}
-
+
virtual ~ShapesGM() {
for (size_t i = 0; i < SK_ARRAY_COUNT(fMatrixRefs); i++) {
SkSafeUnref(fMatrixRefs[i]);
}
}
-
+
protected:
virtual SkString onShortName() {
return SkString("shapes");
}
-
+
virtual SkISize onISize() {
return make_isize(380, 480);
}
-
+
void drawBG(SkCanvas* canvas) {
canvas->drawColor(0xFFDDDDDD);
}
-
+
virtual void onDraw(SkCanvas* canvas) {
this->drawBG(canvas);
-
+
SkMatrix saveM = *fMatrixRefs[3];
SkScalar c = SkIntToScalar(50);
fMatrixRefs[3]->preRotate(SkIntToScalar(30), c, c);
-
+
SkMatrix matrix;
-
+
SkGroupShape* gs = new SkGroupShape;
SkAutoUnref aur(gs);
gs->appendShape(&fGroup);
@@ -96,24 +96,25 @@ protected:
matrix.setTranslate(SkIntToScalar(240), 0);
matrix.preScale(SK_Scalar1*2, SK_Scalar1*2);
gs->appendShape(&fGroup, matrix);
-
-#if 0
+
+#if 0
canvas->drawShape(gs);
#else
- SkPicture pict;
- SkCanvas* cv = pict.beginRecording(1000, 1000);
+ SkPicture* pict = new SkPicture;
+ SkCanvas* cv = pict->beginRecording(1000, 1000);
cv->scale(SK_ScalarHalf, SK_ScalarHalf);
cv->drawShape(gs);
cv->translate(SkIntToScalar(680), SkIntToScalar(480));
cv->scale(-SK_Scalar1, SK_Scalar1);
cv->drawShape(gs);
- pict.endRecording();
- canvas->drawPicture(pict);
+ pict->endRecording();
+ canvas->drawPicture(*pict);
+ pict->unref();
#endif
*fMatrixRefs[3] = saveM;
}
-
+
private:
typedef GM INHERITED;
};