summaryrefslogtreecommitdiffstats
path: root/libs/hwui
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2010-08-20 18:42:37 -0700
committerRomain Guy <romainguy@google.com>2010-08-20 18:42:37 -0700
commita80d32f7b69aa37026ab99e4ade1ad86dae76a81 (patch)
tree208c28a7cef27756daa88030f4c71ca2a721f41a /libs/hwui
parent29378192f7ac4162d54fea4e34fddd42fd1f00d2 (diff)
downloadframeworks_base-a80d32f7b69aa37026ab99e4ade1ad86dae76a81.zip
frameworks_base-a80d32f7b69aa37026ab99e4ade1ad86dae76a81.tar.gz
frameworks_base-a80d32f7b69aa37026ab99e4ade1ad86dae76a81.tar.bz2
Add support for textScaleX.
This will not look great because we render fonts using bitmaps, not paths. Change-Id: I01b87b81bfbdbfa28460a5d5309d38e2a65e77c4
Diffstat (limited to 'libs/hwui')
-rw-r--r--libs/hwui/OpenGLRenderer.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 3440687..49d49da 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -575,6 +575,14 @@ void OpenGLRenderer::drawText(const char* text, int bytesCount, int count,
return;
}
+ float scaleX = paint->getTextScaleX();
+ bool applyScaleX = scaleX < 0.9999f || scaleX > 1.0001f;
+ if (applyScaleX) {
+ save(0);
+ translate(x - (x * scaleX), 0.0f);
+ scale(scaleX, 1.0f);
+ }
+
float length = -1.0f;
switch (paint->getTextAlign()) {
case SkPaint::kCenter_Align:
@@ -626,6 +634,10 @@ void OpenGLRenderer::drawText(const char* text, int bytesCount, int count,
glDisableVertexAttribArray(mCurrentProgram->getAttrib("texCoords"));
drawTextDecorations(text, bytesCount, length, x, y, paint);
+
+ if (applyScaleX) {
+ restore();
+ }
}
void OpenGLRenderer::drawPath(SkPath* path, SkPaint* paint) {