aboutsummaryrefslogtreecommitdiffhomepage
path: root/samplecode/SampleAtlas.cpp
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2015-07-30 05:46:05 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-07-30 05:46:05 -0700
commit6b38eabc16c2c002d982e5ffbd376aa09c1781b7 (patch)
treeb42f6ec3a65cf82ddaa6c71f429c339e4ea8acde /samplecode/SampleAtlas.cpp
parent6c72d5740231f47c664a8e765a8df05cd124c88c (diff)
add helper to create RSXform w/ anchorPt
Diffstat (limited to 'samplecode/SampleAtlas.cpp')
-rw-r--r--samplecode/SampleAtlas.cpp16
1 files changed, 3 insertions, 13 deletions
diff --git a/samplecode/SampleAtlas.cpp b/samplecode/SampleAtlas.cpp
index ed208c3a77..079d679fb8 100644
--- a/samplecode/SampleAtlas.cpp
+++ b/samplecode/SampleAtlas.cpp
@@ -96,18 +96,8 @@ class DrawAtlasDrawable : public SkDrawable {
}
SkRSXform asRSXform() const {
- SkMatrix m;
- m.setTranslate(-8, -8);
- m.postScale(fScale, fScale);
- m.postRotate(SkRadiansToDegrees(fRadian));
- m.postTranslate(fCenter.fX, fCenter.fY);
-
- SkRSXform x;
- x.fSCos = m.getScaleX();
- x.fSSin = m.getSkewY();
- x.fTx = m.getTranslateX();
- x.fTy = m.getTranslateY();
- return x;
+ return SkRSXform::MakeFromRadians(fScale, fRadian, fCenter.x(), fCenter.y(),
+ SkScalarHalf(kCellSize), SkScalarHalf(kCellSize));
}
};
@@ -138,7 +128,7 @@ public:
fRec[i].fVelocity.fX = rand.nextSScalar1() * kMaxSpeed;
fRec[i].fVelocity.fY = rand.nextSScalar1() * kMaxSpeed;
fRec[i].fScale = 1;
- fRec[i].fDScale = rand.nextSScalar1() / 4;
+ fRec[i].fDScale = rand.nextSScalar1() / 16;
fRec[i].fRadian = 0;
fRec[i].fDRadian = rand.nextSScalar1() / 8;
fRec[i].fAlpha = rand.nextUScalar1();