Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(788)

Unified Diff: samplecode/SampleAtlas.cpp

Issue 1269563006: add helper to create RSXform w/ anchorPt (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: don't post-translate by anchor Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/core/SkRSXform.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samplecode/SampleAtlas.cpp
diff --git a/samplecode/SampleAtlas.cpp b/samplecode/SampleAtlas.cpp
index ed208c3a77a865eb80f8c66d2829711ccf95eedf..079d679fb850690a5cb6bb04bcac3e6cf00074f4 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();
« no previous file with comments | « include/core/SkRSXform.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698