diff options
author | reed <reed@google.com> | 2014-10-02 12:58:43 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-02 12:58:43 -0700 |
commit | d1f0ebd0e237c74876f780126696daed9d63f80b (patch) | |
tree | 6deec6352142c88a32df2a4680e9e8f302dd8e77 /include/core | |
parent | b4b7a4c9ea2e399db550f93e3754c351e5b2079a (diff) |
specialize setConcat for scale+translate
This reverts commit 2a382f519999109b2e3445e73ddb4f0eae926b51.
BUG=skia:
Review URL: https://codereview.chromium.org/626583002
Diffstat (limited to 'include/core')
-rw-r--r-- | include/core/SkMatrix.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/include/core/SkMatrix.h b/include/core/SkMatrix.h index 9f44bed9c4..b3c7378ab2 100644 --- a/include/core/SkMatrix.h +++ b/include/core/SkMatrix.h @@ -646,6 +646,29 @@ private: SkScalar fMat[9]; mutable SkTRacy<uint32_t> fTypeMask; + 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; |