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

Unified Diff: src/core/SkMatrix.cpp

Issue 1531323002: SkMatrix::preScale() is too conservative (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: comment + guard Created 5 years 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkMatrix.cpp
diff --git a/src/core/SkMatrix.cpp b/src/core/SkMatrix.cpp
index 6101eb9f9a57f66831abf0f95823ed68ed9799e8..67ae052e06d0197175dd2ad3d4be48b9df1e6ed0 100644
--- a/src/core/SkMatrix.cpp
+++ b/src/core/SkMatrix.cpp
@@ -380,7 +380,20 @@ void SkMatrix::preScale(SkScalar sx, SkScalar sy) {
fMat[kMScaleY] *= sy;
fMat[kMPersp1] *= sy;
+#ifndef SK_SUPPORT_LEGACY_PRESCALE_SEMANTICS
+ // Attempt to simplify our type when applying an inverse scale.
+ // TODO: The persp/affine preconditions are in place to keep the mask consistent with
+ // what computeTypeMask() would produce (persp/skew always implies kScale).
+ // We should investigate whether these flag dependencies are truly needed.
+ if (fMat[kMScaleX] == 1 && fMat[kMScaleY] == 1
+ && !(fTypeMask & (kPerspective_Mask | kAffine_Mask))) {
+ this->clearTypeMask(kScale_Mask);
+ } else {
+ this->orTypeMask(kScale_Mask);
+ }
+#else
this->orTypeMask(kScale_Mask);
+#endif
}
void SkMatrix::postScale(SkScalar sx, SkScalar sy, SkScalar px, SkScalar py) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698