diff options
author | Romain Guy <romainguy@google.com> | 2013-08-12 13:25:29 -0700 |
---|---|---|
committer | Romain Guy <romainguy@google.com> | 2013-08-12 13:25:29 -0700 |
commit | b15b446f420b3ec69424dabcbcbc8cf019d6c8d6 (patch) | |
tree | 82db238022f761899efdf9efc8dcd9577a8ca3ff /core/jni | |
parent | 790552b240c05d58407f7c14acba656b2e85c523 (diff) | |
download | frameworks_base-b15b446f420b3ec69424dabcbcbc8cf019d6c8d6.zip frameworks_base-b15b446f420b3ec69424dabcbcbc8cf019d6c8d6.tar.gz frameworks_base-b15b446f420b3ec69424dabcbcbc8cf019d6c8d6.tar.bz2 |
Take text alignment into account to compue text bounds
Bug #10258621
Change-Id: I91abf1829a1814410ce8c0c2c17d888031987f18
Diffstat (limited to 'core/jni')
-rw-r--r-- | core/jni/android_view_GLES20Canvas.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/core/jni/android_view_GLES20Canvas.cpp b/core/jni/android_view_GLES20Canvas.cpp index 70a4daa..6d46cf9 100644 --- a/core/jni/android_view_GLES20Canvas.cpp +++ b/core/jni/android_view_GLES20Canvas.cpp @@ -610,6 +610,7 @@ static void renderText(OpenGLRenderer* renderer, const jchar* text, int count, const jchar* glyphs = value->getGlyphs(); size_t glyphsCount = value->getGlyphsCount(); jfloat totalAdvance = value->getTotalAdvance(); + x += xOffsetForTextAlign(paint, totalAdvance); const float* positions = value->getPos(); int bytesCount = glyphsCount * sizeof(jchar); const SkRect& r = value->getBounds(); @@ -617,8 +618,7 @@ static void renderText(OpenGLRenderer* renderer, const jchar* text, int count, bounds.translate(x, y); renderer->drawText((const char*) glyphs, bytesCount, glyphsCount, - x + xOffsetForTextAlign(paint, totalAdvance), y, positions, - paint, totalAdvance, bounds); + x, y, positions, paint, totalAdvance, bounds); } static void renderTextOnPath(OpenGLRenderer* renderer, const jchar* text, int count, @@ -646,6 +646,7 @@ static void renderTextRun(OpenGLRenderer* renderer, const jchar* text, const jchar* glyphs = value->getGlyphs(); size_t glyphsCount = value->getGlyphsCount(); jfloat totalAdvance = value->getTotalAdvance(); + x += xOffsetForTextAlign(paint, totalAdvance); const float* positions = value->getPos(); int bytesCount = glyphsCount * sizeof(jchar); const SkRect& r = value->getBounds(); @@ -653,8 +654,7 @@ static void renderTextRun(OpenGLRenderer* renderer, const jchar* text, bounds.translate(x, y); renderer->drawText((const char*) glyphs, bytesCount, glyphsCount, - x + xOffsetForTextAlign(paint, totalAdvance), y, positions, - paint, totalAdvance, bounds); + x, y, positions, paint, totalAdvance, bounds); } static void android_view_GLES20Canvas_drawTextArray(JNIEnv* env, jobject clazz, |