summaryrefslogtreecommitdiffstats
path: root/graphics/java
diff options
context:
space:
mode:
authorFabrice Di Meglio <fdimeglio@google.com>2011-04-05 17:02:36 -0700
committerFabrice Di Meglio <fdimeglio@google.com>2011-04-08 14:37:18 -0700
commitfcf2be1846935e7983ea2fe87fdd4d7af27764b6 (patch)
treeb891830d00d48f63aaf00a665861a056d6e24fc3 /graphics/java
parentfcdebf88a483faa2f9bbde2b9a4093ca98b2ba6c (diff)
downloadframeworks_base-fcf2be1846935e7983ea2fe87fdd4d7af27764b6.zip
frameworks_base-fcf2be1846935e7983ea2fe87fdd4d7af27764b6.tar.gz
frameworks_base-fcf2be1846935e7983ea2fe87fdd4d7af27764b6.tar.bz2
TextLayoutCache - add glyphs caching
- cache glyphs after Harfbuzz shaping - use "m" prefix for member variables - add temporary API for drawing text with glyphs - update BiDiTest app Change-Id: I619b3f313b15f010018daad21b3e5e486619b4e4
Diffstat (limited to 'graphics/java')
-rw-r--r--graphics/java/android/graphics/Canvas.java95
1 files changed, 72 insertions, 23 deletions
diff --git a/graphics/java/android/graphics/Canvas.java b/graphics/java/android/graphics/Canvas.java
index e493b18..0b488c9 100644
--- a/graphics/java/android/graphics/Canvas.java
+++ b/graphics/java/android/graphics/Canvas.java
@@ -1330,29 +1330,6 @@ public class Canvas {
}
/**
- * Draw the glyphs, with origin at (x,y), using the specified paint. The
- * origin is interpreted based on the Align setting in the paint.
- *
- * @param glyphs The glyphs to be drawn
- * @param x The x-coordinate of the origin of the text being drawn
- * @param y The y-coordinate of the origin of the text being drawn
- * @param paint The paint used for the text (e.g. color, size, style)
- *
- * @hide
- *
- * Used only for BiDi / RTL Tests
- */
- public void drawGlyphs(char[] glyphs, int index, int count, float x, float y,
- Paint paint) {
- if ((index | count | (index + count) |
- (glyphs.length - index - count)) < 0) {
- throw new IndexOutOfBoundsException();
- }
- native_drawGlyphs(mNativeCanvas, glyphs, index, count, x, y, paint.mBidiFlags,
- paint.mNativePaint);
- }
-
- /**
* Draw the text, with origin at (x,y), using the specified paint. The
* origin is interpreted based on the Align setting in the paint.
*
@@ -1418,6 +1395,70 @@ public class Canvas {
}
/**
+ * Draw the text, with origin at (x,y), using the specified paint. The
+ * origin is interpreted based on the Align setting in the paint.
+ *
+ * @param text The text to be drawn
+ * @param x The x-coordinate of the origin of the text being drawn
+ * @param y The y-coordinate of the origin of the text being drawn
+ * @param paint The paint used for the text (e.g. color, size, style)
+ *
+ * @hide
+ *
+ * Used only for BiDi / RTL Tests
+ */
+ public void drawTextWithGlyphs(char[] text, int index, int count, float x, float y,
+ Paint paint) {
+ if ((index | count | (index + count) |
+ (text.length - index - count)) < 0) {
+ throw new IndexOutOfBoundsException();
+ }
+ native_drawTextWithGlyphs(mNativeCanvas, text, index, count, x, y, paint.mBidiFlags,
+ paint.mNativePaint);
+ }
+
+ /**
+ * Draw the text, with origin at (x,y), using the specified paint. The
+ * origin is interpreted based on the Align setting in the paint.
+ *
+ * @param text The text to be drawn
+ * @param x The x-coordinate of the origin of the text being drawn
+ * @param y The y-coordinate of the origin of the text being drawn
+ * @param paint The paint used for the text (e.g. color, size, style)
+ *
+ * @hide
+ *
+ * Used only for BiDi / RTL Tests
+ */
+ public void drawTextWithGlyphs(String text, float x, float y, Paint paint) {
+ native_drawTextWithGlyphs(mNativeCanvas, text, 0, text.length(), x, y, paint.mBidiFlags,
+ paint.mNativePaint);
+ }
+
+ /**
+ * Draw the glyphs, with origin at (x,y), using the specified paint. The
+ * origin is interpreted based on the Align setting in the paint.
+ *
+ * @param glyphs The glyphs to be drawn
+ * @param x The x-coordinate of the origin of the text being drawn
+ * @param y The y-coordinate of the origin of the text being drawn
+ * @param paint The paint used for the text (e.g. color, size, style)
+ *
+ * @hide
+ *
+ * Used only for BiDi / RTL Tests
+ */
+ public void drawGlyphs(char[] glyphs, int index, int count, float x, float y,
+ Paint paint) {
+ if ((index | count | (index + count) |
+ (glyphs.length - index - count)) < 0) {
+ throw new IndexOutOfBoundsException();
+ }
+ native_drawGlyphs(mNativeCanvas, glyphs, index, count, x, y, paint.mBidiFlags,
+ paint.mNativePaint);
+ }
+
+ /**
* Render a run of all LTR or all RTL text, with shaping. This does not run
* bidi on the provided text, but renders it as a uniform right-to-left or
* left-to-right run, as indicated by dir. Alignment of the text is as
@@ -1745,9 +1786,17 @@ public class Canvas {
private static native void native_drawText(int nativeCanvas, String text,
int start, int end, float x,
float y, int flags, int paint);
+
+ private static native void native_drawTextWithGlyphs(int nativeCanvas, char[] text,
+ int index, int count, float x,
+ float y, int flags, int paint);
+ private static native void native_drawTextWithGlyphs(int nativeCanvas, String text,
+ int start, int end, float x,
+ float y, int flags, int paint);
private static native void native_drawGlyphs(int nativeCanvas, char[] glyphs,
int index, int count, float x,
float y, int flags, int paint);
+
private static native void native_drawTextRun(int nativeCanvas, String text,
int start, int end, int contextStart, int contextEnd,
float x, float y, int flags, int paint);