summaryrefslogtreecommitdiffstats
path: root/core/jni
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2011-06-01 14:52:00 -0700
committerRomain Guy <romainguy@google.com>2011-06-01 14:55:42 -0700
commit726aeba80ffc6778a9bc3e0ee957b8d644183505 (patch)
tree2a270831f12cfa6dd69a07e9068c76c3b737754e /core/jni
parentf09ef51889f75289b041f9e9f949b7b82ed5b686 (diff)
downloadframeworks_base-726aeba80ffc6778a9bc3e0ee957b8d644183505.zip
frameworks_base-726aeba80ffc6778a9bc3e0ee957b8d644183505.tar.gz
frameworks_base-726aeba80ffc6778a9bc3e0ee957b8d644183505.tar.bz2
Add support to OpenGLRendere to draw BiDi text.
Bug #4350336 Change-Id: I1cf31693f7ca9653fa3a41b5b91c27ef288d680f
Diffstat (limited to 'core/jni')
-rw-r--r--core/jni/android_view_GLES20Canvas.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/core/jni/android_view_GLES20Canvas.cpp b/core/jni/android_view_GLES20Canvas.cpp
index e539cd2..e2832ed 100644
--- a/core/jni/android_view_GLES20Canvas.cpp
+++ b/core/jni/android_view_GLES20Canvas.cpp
@@ -42,7 +42,7 @@
#include <SkiaColorFilter.h>
#include <Rect.h>
-#include "TextLayout.h"
+#include <TextLayout.h>
namespace android {
@@ -419,7 +419,7 @@ static void android_view_GLES20Canvas_setupShadow(JNIEnv* env, jobject clazz,
static void renderText(OpenGLRenderer* renderer, const jchar* text, int count,
jfloat x, jfloat y, int flags, SkPaint* paint) {
-#if 0 // TODO: replace "0" by "RTL_USE_HARFBUZZ" when renderer->drawGlyphs() is implemented
+#if RTL_USE_HARFBUZZ
sp<TextLayoutCacheValue> value = gTextLayoutCache.getValue(
paint, text, 0, count, count, flags);
if (value == NULL) {
@@ -431,7 +431,8 @@ static void renderText(OpenGLRenderer* renderer, const jchar* text, int count,
#endif
const jchar* glyphArray = value->getGlyphs();
int glyphCount = value->getGlyphsCount();
- renderer->drawGlyphs((const char*) glyphArray, 0, glyphCount << 1, x, y, paint);
+ int bytesCount = glyphCount * sizeof(jchar);
+ renderer->drawText((const char*) glyphArray, bytesCount, glyphCount, x, y, paint);
#else
const jchar *workText;
jchar* buffer = NULL;
@@ -446,7 +447,7 @@ static void renderText(OpenGLRenderer* renderer, const jchar* text, int count,
static void renderTextRun(OpenGLRenderer* renderer, const jchar* text,
jint start, jint count, jint contextCount, jfloat x, jfloat y,
int flags, SkPaint* paint) {
-#if 0 // TODO: replace "0" by "RTL_USE_HARFBUZZ" when renderer->drawGlyphs() is implemented
+#if RTL_USE_HARFBUZZ
sp<TextLayoutCacheValue> value = gTextLayoutCache.getValue(
paint, text, start, count, contextCount, flags);
if (value == NULL) {
@@ -458,7 +459,8 @@ static void renderTextRun(OpenGLRenderer* renderer, const jchar* text,
#endif
const jchar* glyphArray = value->getGlyphs();
int glyphCount = value->getGlyphsCount();
- renderer->drawGlyphs((const char*) glyphArray, 0, glyphCount << 1, x, y, paint);
+ int bytesCount = glyphCount * sizeof(jchar);
+ renderer->drawText((const char*) glyphArray, bytesCount, glyphCount, x, y, paint);
#else
uint8_t rtl = flags & 0x1;
if (rtl) {