summaryrefslogtreecommitdiff
path: root/libs/hwui/Matrix.cpp
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.cpp
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.cpp')
-rw-r--r--libs/hwui/Matrix.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/libs/hwui/Matrix.cpp b/libs/hwui/Matrix.cpp
index 2d017dfd0691..204e8f564f11 100644
--- a/libs/hwui/Matrix.cpp
+++ b/libs/hwui/Matrix.cpp
@@ -454,6 +454,14 @@ void Matrix4::mapRect(Rect& r) const {
}
}
+void Matrix4::decomposeScale(float& sx, float& sy) const {
+ float len;
+ len = data[mat4::kScaleX] * data[mat4::kScaleX] + data[mat4::kSkewX] * data[mat4::kSkewX];
+ sx = copysignf(sqrtf(len), data[mat4::kScaleX]);
+ len = data[mat4::kScaleY] * data[mat4::kScaleY] + data[mat4::kSkewY] * data[mat4::kSkewY];
+ sy = copysignf(sqrtf(len), data[mat4::kScaleY]);
+}
+
void Matrix4::dump() const {
ALOGD("Matrix4[simple=%d, type=0x%x", isSimple(), getType());
ALOGD(" %f %f %f %f", data[kScaleX], data[kSkewX], data[8], data[kTranslateX]);