summaryrefslogtreecommitdiff
path: root/libs/hwui/Matrix.h
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2013-03-05 10:27:35 -0800
committerRomain Guy <romainguy@google.com>2013-03-05 10:27:35 -0800
commit3b753829ae858d424fe109f714745379a6daf455 (patch)
tree2b4c370574319ff1cfbd5014be3748d17e362b4a /libs/hwui/Matrix.h
parente78b8003a5870c0e80ed92c4df442871fb9d0b61 (diff)
Fix colored rects clipping and code cleanup
The drawColorRects() method was clipping individual rectangles using the wrong parameters left, top, right and bottom instead of l, r, t and b. It also checked for count == 0 after the loop when it should have checked for vertexCount == 0. The quickReject is now not part of the loop since it's a bit overkill to perform so many matrix multiplications. What we really care about is the final quickReject performed on the max bounds of the entire set of rectangles. This change also replaces all instances of mSnapshot->transform by currentTransform() to make the code slightly more readable. Change-Id: I6485280414499716852f7dbfba186774eb6763d4
Diffstat (limited to 'libs/hwui/Matrix.h')
-rw-r--r--libs/hwui/Matrix.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/libs/hwui/Matrix.h b/libs/hwui/Matrix.h
index 2fe96bc8c0df..be5bea706e4b 100644
--- a/libs/hwui/Matrix.h
+++ b/libs/hwui/Matrix.h
@@ -79,6 +79,20 @@ public:
load(v);
}
+ float operator[](int index) const {
+ return data[index];
+ }
+
+ float& operator[](int index) {
+ mType = kTypeUnknown;
+ return data[index];
+ }
+
+ Matrix4& operator=(const SkMatrix& v) {
+ load(v);
+ return *this;
+ }
+
void loadIdentity();
void load(const float* v);
@@ -150,6 +164,8 @@ public:
float getTranslateX();
float getTranslateY();
+ void decomposeScale(float& sx, float& sy) const;
+
void dump() const;
static const Matrix4& identity();