diff options
author | Romain Guy <romainguy@google.com> | 2013-06-21 01:31:54 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-06-21 01:31:55 +0000 |
commit | d485ef27c795648c4a05c4c089e8c5a15712fd36 (patch) | |
tree | 7608ca3814d7aa0dca699fbe48bb8c5e71970543 | |
parent | fb5dbfea1abc75603c8132e9fb23b79b15f378fa (diff) | |
parent | f6bed4f12a2c975678fc0bdea15054ab169aafb5 (diff) | |
download | frameworks_base-d485ef27c795648c4a05c4c089e8c5a15712fd36.zip frameworks_base-d485ef27c795648c4a05c4c089e8c5a15712fd36.tar.gz frameworks_base-d485ef27c795648c4a05c4c089e8c5a15712fd36.tar.bz2 |
Merge "An identity matrix should be considered a pure translate matrix"
-rw-r--r-- | libs/hwui/Matrix.cpp | 6 | ||||
-rw-r--r-- | libs/hwui/Matrix.h | 10 |
2 files changed, 8 insertions, 8 deletions
diff --git a/libs/hwui/Matrix.cpp b/libs/hwui/Matrix.cpp index 6a5ea51..65e7eae 100644 --- a/libs/hwui/Matrix.cpp +++ b/libs/hwui/Matrix.cpp @@ -72,7 +72,7 @@ static bool isZero(float f) { return fabs(f) <= EPSILON; } -uint32_t Matrix4::getType() const { +uint8_t Matrix4::getType() const { if (mType & kTypeUnknown) { mType = kTypeIdentity; @@ -114,7 +114,7 @@ uint32_t Matrix4::getType() const { return mType; } -uint32_t Matrix4::getGeometryType() const { +uint8_t Matrix4::getGeometryType() const { return getType() & sGeometryMask; } @@ -127,7 +127,7 @@ bool Matrix4::changesBounds() const { } bool Matrix4::isPureTranslate() const { - return getGeometryType() == kTypeTranslate; + return getGeometryType() <= kTypeTranslate; } bool Matrix4::isSimple() const { diff --git a/libs/hwui/Matrix.h b/libs/hwui/Matrix.h index af520bd..5116203 100644 --- a/libs/hwui/Matrix.h +++ b/libs/hwui/Matrix.h @@ -124,7 +124,7 @@ public: void loadOrtho(float left, float right, float bottom, float top, float near, float far); - uint32_t getType() const; + uint8_t getType() const; void multiply(const Matrix4& v) { Matrix4 u; @@ -135,13 +135,13 @@ public: void multiply(float v); void translate(float x, float y) { - if ((getType() & sGeometryMask) == kTypeTranslate) { + if ((getType() & sGeometryMask) <= kTypeTranslate) { data[kTranslateX] += x; data[kTranslateY] += y; } else { // Doing a translation will only affect the translate bit of the type // Save the type - uint32_t type = mType; + uint8_t type = mType; Matrix4 u; u.loadTranslate(x, y, 0.0f); @@ -202,7 +202,7 @@ public: static const Matrix4& identity(); private: - mutable uint32_t mType; + mutable uint8_t mType; inline float get(int i, int j) const { return data[i * 4 + j]; @@ -212,7 +212,7 @@ private: data[i * 4 + j] = v; } - uint32_t getGeometryType() const; + uint8_t getGeometryType() const; }; // class Matrix4 |