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

Unified Diff: include/core/SkMatrix.h

Issue 2122093002: make setScaleTranslate public (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 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 | « no previous file | tests/MatrixTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkMatrix.h
diff --git a/include/core/SkMatrix.h b/include/core/SkMatrix.h
index d6d029597f14598dfeb4140767227b7ae7b506f2..5b22a774814de5c02111d0e3c656b10f90526551 100644
--- a/include/core/SkMatrix.h
+++ b/include/core/SkMatrix.h
@@ -710,6 +710,32 @@ public:
this->setTypeMask(kUnknown_Mask);
}
+ /**
+ * Initialize the matrix to be scale + post-translate.
+ */
+ void setScaleTranslate(SkScalar sx, SkScalar sy, SkScalar tx, SkScalar ty) {
+ fMat[kMScaleX] = sx;
+ fMat[kMSkewX] = 0;
+ fMat[kMTransX] = tx;
+
+ fMat[kMSkewY] = 0;
+ fMat[kMScaleY] = sy;
+ fMat[kMTransY] = ty;
+
+ fMat[kMPersp0] = 0;
+ fMat[kMPersp1] = 0;
+ fMat[kMPersp2] = 1;
+
+ unsigned mask = 0;
+ if (sx != 1 || sy != 1) {
+ mask |= kScale_Mask;
+ }
+ if (tx || ty) {
+ mask |= kTranslate_Mask;
+ }
+ this->setTypeMask(mask | kRectStaysRect_Mask);
+ }
+
private:
enum {
/** Set if the matrix will map a rectangle to another rectangle. This
@@ -748,29 +774,6 @@ private:
static void ComputeInv(SkScalar dst[9], const SkScalar src[9], double invDet, bool isPersp);
- void setScaleTranslate(SkScalar sx, SkScalar sy, SkScalar tx, SkScalar ty) {
- fMat[kMScaleX] = sx;
- fMat[kMSkewX] = 0;
- fMat[kMTransX] = tx;
-
- fMat[kMSkewY] = 0;
- fMat[kMScaleY] = sy;
- fMat[kMTransY] = ty;
-
- fMat[kMPersp0] = 0;
- fMat[kMPersp1] = 0;
- fMat[kMPersp2] = 1;
-
- unsigned mask = 0;
- if (sx != 1 || sy != 1) {
- mask |= kScale_Mask;
- }
- if (tx || ty) {
- mask |= kTranslate_Mask;
- }
- this->setTypeMask(mask | kRectStaysRect_Mask);
- }
-
uint8_t computeTypeMask() const;
uint8_t computePerspectiveTypeMask() const;
« no previous file with comments | « no previous file | tests/MatrixTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698