summaryrefslogtreecommitdiff
path: root/libs/hwui/Matrix.cpp
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2013-02-26 19:10:14 -0800
committerRomain Guy <romainguy@google.com>2013-02-27 15:49:57 -0800
commitc74f45a334f0e3725c23cdd270cbcb0efac4ea75 (patch)
tree1b198e8b6b7d6d4a69237116a580236836744294 /libs/hwui/Matrix.cpp
parentd80806b305ce337283c24f14522cc58fea090b8c (diff)
Properly scale text
This change does not apply to drawPosText() and drawTextOnPath() yet. Prior to this change, glyphs were always rasterized based on the font size specified in the paint. All transforms were then applied on the resulting texture. This creates rather ugly results when text is scaled and/or rotated. With this change, the font renderer will apply the current transform matrix to the glyph before they are rasterized. This generates much better looking results. Change-Id: I0141b6ff18db35e1213e7a3ab9db1ecaf03d7a9c
Diffstat (limited to 'libs/hwui/Matrix.cpp')
-rw-r--r--libs/hwui/Matrix.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/libs/hwui/Matrix.cpp b/libs/hwui/Matrix.cpp
index 5cec5a83c9a2..2d017dfd0691 100644
--- a/libs/hwui/Matrix.cpp
+++ b/libs/hwui/Matrix.cpp
@@ -39,6 +39,11 @@ static const float EPSILON = 0.0000001f;
// Matrix
///////////////////////////////////////////////////////////////////////////////
+const Matrix4& Matrix4::identity() {
+ static Matrix4 sIdentity;
+ return sIdentity;
+}
+
void Matrix4::loadIdentity() {
data[kScaleX] = 1.0f;
data[kSkewY] = 0.0f;