diff options
author | Raph Levien <raph@google.com> | 2013-05-22 16:16:59 -0700 |
---|---|---|
committer | Raph Levien <raph@google.com> | 2013-11-18 10:32:20 -0800 |
commit | a033630e805c407080221e20b236b6054f324670 (patch) | |
tree | cef5c28c60081bcf257c58937ed47cfeb6f5fa71 /graphics/java | |
parent | c0b53515550f0100a11ac332d253bf9b76982c02 (diff) | |
download | frameworks_base-a033630e805c407080221e20b236b6054f324670.zip frameworks_base-a033630e805c407080221e20b236b6054f324670.tar.gz frameworks_base-a033630e805c407080221e20b236b6054f324670.tar.bz2 |
Initial integration of Minikin to framework
With this patch, framework does at least some of its text rendering
using Minikin instead of TextLayoutCache. There's a lot of stuff broken
and not yet implemented, but the phone will boot.
Changes are hidden behind USE_MINIKIN, which should be set in
BoardConfig.mk for the brave. Without that, there are changes to
signatures in JNI methods and so on, but shouldn't be any visible
changes.
This commit also introduces a new abstraction for Typeface:
The new TypefaceImpl abstraction represents the functionality that
corresponds to a Java Typeface object. Currently it is backed by
SkTypeface, but in the migration to Minikin it is a FontCollection
combined with a FontStyle. This patch introduces a USE_MINIKIN
preprocessor switch, so there is no substantial change to existing
Skia-based code, but which lets us start replacing the implementation
with the Minikin version.
Change-Id: I532c4c2d32d4f4c1f349dc1db37caa112af587ea
Diffstat (limited to 'graphics/java')
-rw-r--r-- | graphics/java/android/graphics/Canvas.java | 24 | ||||
-rw-r--r-- | graphics/java/android/graphics/Paint.java | 7 | ||||
-rw-r--r-- | graphics/java/android/graphics/Typeface.java | 5 |
3 files changed, 23 insertions, 13 deletions
diff --git a/graphics/java/android/graphics/Canvas.java b/graphics/java/android/graphics/Canvas.java index d46238f..13f4299 100644 --- a/graphics/java/android/graphics/Canvas.java +++ b/graphics/java/android/graphics/Canvas.java @@ -1403,7 +1403,7 @@ public class Canvas { throw new IndexOutOfBoundsException(); } native_drawText(mNativeCanvas, text, index, count, x, y, paint.mBidiFlags, - paint.mNativePaint); + paint.mNativePaint, paint.mNativeTypeface); } /** @@ -1417,7 +1417,7 @@ public class Canvas { */ public void drawText(String text, float x, float y, Paint paint) { native_drawText(mNativeCanvas, text, 0, text.length(), x, y, paint.mBidiFlags, - paint.mNativePaint); + paint.mNativePaint, paint.mNativeTypeface); } /** @@ -1436,7 +1436,7 @@ public class Canvas { throw new IndexOutOfBoundsException(); } native_drawText(mNativeCanvas, text, start, end, x, y, paint.mBidiFlags, - paint.mNativePaint); + paint.mNativePaint, paint.mNativeTypeface); } /** @@ -1456,7 +1456,7 @@ public class Canvas { if (text instanceof String || text instanceof SpannedString || text instanceof SpannableString) { native_drawText(mNativeCanvas, text.toString(), start, end, x, y, - paint.mBidiFlags, paint.mNativePaint); + paint.mBidiFlags, paint.mNativePaint, paint.mNativeTypeface); } else if (text instanceof GraphicsOperations) { ((GraphicsOperations) text).drawText(this, start, end, x, y, paint); @@ -1464,7 +1464,7 @@ public class Canvas { char[] buf = TemporaryBuffer.obtain(end - start); TextUtils.getChars(text, start, end, buf, 0); native_drawText(mNativeCanvas, buf, 0, end - start, x, y, - paint.mBidiFlags, paint.mNativePaint); + paint.mBidiFlags, paint.mNativePaint, paint.mNativeTypeface); TemporaryBuffer.recycle(buf); } } @@ -1507,7 +1507,7 @@ public class Canvas { } native_drawTextRun(mNativeCanvas, text, index, count, - contextIndex, contextCount, x, y, dir, paint.mNativePaint); + contextIndex, contextCount, x, y, dir, paint.mNativePaint, paint.mNativeTypeface); } /** @@ -1545,7 +1545,7 @@ public class Canvas { if (text instanceof String || text instanceof SpannedString || text instanceof SpannableString) { native_drawTextRun(mNativeCanvas, text.toString(), start, end, - contextStart, contextEnd, x, y, flags, paint.mNativePaint); + contextStart, contextEnd, x, y, flags, paint.mNativePaint, paint.mNativeTypeface); } else if (text instanceof GraphicsOperations) { ((GraphicsOperations) text).drawTextRun(this, start, end, contextStart, contextEnd, x, y, flags, paint); @@ -1555,7 +1555,7 @@ public class Canvas { char[] buf = TemporaryBuffer.obtain(contextLen); TextUtils.getChars(text, contextStart, contextEnd, buf, 0); native_drawTextRun(mNativeCanvas, buf, start - contextStart, len, - 0, contextLen, x, y, flags, paint.mNativePaint); + 0, contextLen, x, y, flags, paint.mNativePaint, paint.mNativeTypeface); TemporaryBuffer.recycle(buf); } } @@ -1814,18 +1814,18 @@ public class Canvas { private static native void native_drawText(int nativeCanvas, char[] text, int index, int count, float x, - float y, int flags, int paint); + float y, int flags, int paint, int typeface); private static native void native_drawText(int nativeCanvas, String text, int start, int end, float x, - float y, int flags, int paint); + float y, int flags, int paint, int typeface); 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); + float x, float y, int flags, int paint, int typeface); private static native void native_drawTextRun(int nativeCanvas, char[] text, int start, int count, int contextStart, int contextCount, - float x, float y, int flags, int paint); + float x, float y, int flags, int paint, int typeface); private static native void native_drawPosText(int nativeCanvas, char[] text, int index, diff --git a/graphics/java/android/graphics/Paint.java b/graphics/java/android/graphics/Paint.java index 5fc2588..c2d4df2 100644 --- a/graphics/java/android/graphics/Paint.java +++ b/graphics/java/android/graphics/Paint.java @@ -33,6 +33,10 @@ public class Paint { * @hide */ public int mNativePaint; + /** + * @hide + */ + public int mNativeTypeface; private ColorFilter mColorFilter; private MaskFilter mMaskFilter; @@ -481,6 +485,7 @@ public class Paint { mRasterizer = null; mShader = null; mTypeface = null; + mNativeTypeface = 0; mXfermode = null; mHasCompatScaling = false; @@ -525,6 +530,7 @@ public class Paint { mShader = null; } mTypeface = paint.mTypeface; + mNativeTypeface = paint.mNativeTypeface; mXfermode = paint.mXfermode; mHasCompatScaling = paint.mHasCompatScaling; @@ -1087,6 +1093,7 @@ public class Paint { } native_setTypeface(mNativePaint, typefaceNative); mTypeface = typeface; + mNativeTypeface = typefaceNative; return typeface; } diff --git a/graphics/java/android/graphics/Typeface.java b/graphics/java/android/graphics/Typeface.java index c68c9f7..aea3ee5 100644 --- a/graphics/java/android/graphics/Typeface.java +++ b/graphics/java/android/graphics/Typeface.java @@ -48,7 +48,10 @@ public class Typeface { private static final SparseArray<SparseArray<Typeface>> sTypefaceCache = new SparseArray<SparseArray<Typeface>>(3); - int native_instance; + /** + * @hide + */ + public int native_instance; // Style public static final int NORMAL = 0; |