aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
authorGravatar vollick@chromium.org <vollick@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-12-10 20:16:10 +0000
committerGravatar vollick@chromium.org <vollick@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-12-10 20:16:10 +0000
commit57a54e33cfe771c792b1086ba67484cb95938d5d (patch)
treecc6e2bd2a84b329244b67669f5a50bdc42c97e42 /include
parent45a15f551b5b3c6c747d8eaf6466b7d3b76a8fae (diff)
Add SkMatrix44 constructor that allows user to control the initialization
method. Preliminary results using Chromium's cc_perftests show that we can avoid almost half of the default constructors from redundantly/unnecessarily initializing the matrix to identity. Review URL: https://codereview.appspot.com/6872056 git-svn-id: http://skia.googlecode.com/svn/trunk@6742 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r--include/utils/SkMatrix44.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/utils/SkMatrix44.h b/include/utils/SkMatrix44.h
index af61a11c68..4789e7e209 100644
--- a/include/utils/SkMatrix44.h
+++ b/include/utils/SkMatrix44.h
@@ -103,6 +103,17 @@ struct SkVector4 {
class SK_API SkMatrix44 {
public:
+
+ enum Uninitialized_Constructor {
+ kUninitialized_Constructor
+ };
+ enum Identity_Constructor {
+ kIdentity_Constructor
+ };
+
+ SkMatrix44(Uninitialized_Constructor) { }
+ SkMatrix44(Identity_Constructor) { this->setIdentity(); }
+
SkMatrix44() { this->setIdentity(); }
SkMatrix44(const SkMatrix44&);
SkMatrix44(const SkMatrix44& a, const SkMatrix44& b);