aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-06-01 15:11:22 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-06-01 15:11:22 +0000
commit3fb5187647397e056843c1f41a508992be22175d (patch)
tree119a14084dd42d5334140525d599548b32bb4612 /include
parentac2e663762cb88dfea334d77052c6428b1a07d87 (diff)
speed-up SkMatrix::preScale by 3x, by special-casing it instead of just calling
concat. Inspired by the profile of the fishtank site git-svn-id: http://skia.googlecode.com/svn/trunk@1462 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r--include/core/SkMatrix.h21
1 files changed, 19 insertions, 2 deletions
diff --git a/include/core/SkMatrix.h b/include/core/SkMatrix.h
index 7c779027be..480e0777ac 100644
--- a/include/core/SkMatrix.h
+++ b/include/core/SkMatrix.h
@@ -438,6 +438,7 @@ public:
*/
bool fixedStepInX(SkScalar y, SkFixed* stepX, SkFixed* stepY) const;
+#ifdef SK_SCALAR_IS_FIXED
friend bool operator==(const SkMatrix& a, const SkMatrix& b) {
return memcmp(a.fMat, b.fMat, sizeof(a.fMat)) == 0;
}
@@ -445,6 +446,12 @@ public:
friend bool operator!=(const SkMatrix& a, const SkMatrix& b) {
return memcmp(a.fMat, b.fMat, sizeof(a.fMat)) != 0;
}
+#else
+ friend bool operator==(const SkMatrix& a, const SkMatrix& b);
+ friend bool operator!=(const SkMatrix& a, const SkMatrix& b) {
+ return !(a == b);
+ }
+#endif
enum {
// flatten/unflatten will never return a value larger than this
@@ -488,7 +495,12 @@ private:
kRectStaysRect_Mask = 0x10,
kUnknown_Mask = 0x80,
-
+
+ kORableMasks = kTranslate_Mask |
+ kScale_Mask |
+ kAffine_Mask |
+ kPerspective_Mask,
+
kAllMasks = kTranslate_Mask |
kScale_Mask |
kAffine_Mask |
@@ -506,7 +518,12 @@ private:
SkASSERT(kUnknown_Mask == mask || (mask & kAllMasks) == mask);
fTypeMask = SkToU8(mask);
}
-
+
+ void orTypeMask(int mask) {
+ SkASSERT((mask & kORableMasks) == mask);
+ fTypeMask = SkToU8(fTypeMask | mask);
+ }
+
void clearTypeMask(int mask) {
// only allow a valid mask
SkASSERT((mask & kAllMasks) == mask);