OSDN Git Service

Fix native method signatures
authorDeepanshu Gupta <deepanshu@google.com>
Wed, 29 Jan 2014 02:55:33 +0000 (18:55 -0800)
committerDeepanshu Gupta <deepanshu@google.com>
Thu, 30 Jan 2014 01:14:40 +0000 (17:14 -0800)
Some new methods have been added which are yet to be implemented.

Change-Id: Ie5a0657c7ccbe95200c270d5c15b516a385b083b

tools/layoutlib/bridge/src/android/animation/PropertyValuesHolder_Delegate.java
tools/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java
tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
tools/layoutlib/bridge/src/android/graphics/ColorFilter_Delegate.java
tools/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java
tools/layoutlib/bridge/src/android/graphics/Path_Delegate.java
tools/layoutlib/bridge/src/libcore/icu/ICU_Delegate.java

index 224eac6..ca710cd 100644 (file)
@@ -48,6 +48,20 @@ import com.android.tools.layoutlib.annotations.LayoutlibDelegate;
     }
 
     @LayoutlibDelegate
+    /*package*/ static int nGetMultipleIntMethod(Class<?> targetClass, String methodName,
+            int numParams) {
+        // TODO: return the right thing.
+        return 0;
+    }
+
+    @LayoutlibDelegate
+    /*package*/ static int nGetMultipleFloatMethod(Class<?> targetClass, String methodName,
+            int numParams) {
+        // TODO: return the right thing.
+        return 0;
+    }
+
+    @LayoutlibDelegate
     /*package*/ static void nCallIntMethod(Object target, long methodID, int arg) {
         // do nothing
     }
@@ -56,4 +70,40 @@ import com.android.tools.layoutlib.annotations.LayoutlibDelegate;
     /*package*/ static void nCallFloatMethod(Object target, long methodID, float arg) {
         // do nothing
     }
+
+    @LayoutlibDelegate
+    /*package*/ static void nCallTwoIntMethod(Object target, long methodID, int arg1,
+            int arg2) {
+        // do nothing
+    }
+
+    @LayoutlibDelegate
+    /*package*/ static void nCallFourIntMethod(Object target, long methodID, int arg1,
+            int arg2, int arg3, int arg4) {
+        // do nothing
+    }
+
+    @LayoutlibDelegate
+    /*package*/ static void nCallMultipleIntMethod(Object target, long methodID,
+            int[] args) {
+        // do nothing
+    }
+
+    @LayoutlibDelegate
+    /*package*/ static void nCallTwoFloatMethod(Object target, long methodID, float arg1,
+            float arg2) {
+        // do nothing
+    }
+
+    @LayoutlibDelegate
+    /*package*/ static void nCallFourFloatMethod(Object target, long methodID, float arg1,
+            float arg2, float arg3, float arg4) {
+        // do nothing
+    }
+
+    @LayoutlibDelegate
+    /*package*/ static void nCallMultipleFloatMethod(Object target, long methodID,
+            float[] args) {
+        // do nothing
+    }
 }
index 89d7e23..7016136 100644 (file)
@@ -518,7 +518,8 @@ public final class Bitmap_Delegate {
     }
 
     @LayoutlibDelegate
-    /*package*/ static void nativeSetHasAlpha(long nativeBitmap, boolean hasAlpha) {
+    /*package*/ static void nativeSetAlphaAndPremultiplied(long nativeBitmap, boolean hasAlpha,
+            boolean isPremul) {
         // get the delegate from the native int.
         Bitmap_Delegate delegate = sManager.getDelegate(nativeBitmap);
         if (delegate == null) {
index ba771dd..602717b 100644 (file)
@@ -786,7 +786,7 @@ public final class Canvas_Delegate {
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_drawPath(long nativeCanvas, int path, long paint) {
+    /*package*/ static void native_drawPath(long nativeCanvas, long path, long paint) {
         final Path_Delegate pathDelegate = Path_Delegate.getDelegate(path);
         if (pathDelegate == null) {
             return;
@@ -975,8 +975,10 @@ public final class Canvas_Delegate {
     @LayoutlibDelegate
     /*package*/ static void native_drawText(long nativeCanvas,
             final char[] text, final int index, final int count,
-            final float startX, final float startY, final int flags, long paint) {
+            final float startX, final float startY, final int flags, long paint,
+            long typeface) {
 
+        // TODO: use typeface.
         draw(nativeCanvas, paint, false /*compositeOnly*/, false /*forceSrcMode*/,
                 new GcSnapshot.Drawable() {
             @Override
@@ -1005,30 +1007,31 @@ public final class Canvas_Delegate {
 
     @LayoutlibDelegate
     /*package*/ static void native_drawText(long nativeCanvas, String text,
-            int start, int end, float x, float y, final int flags, long paint) {
+            int start, int end, float x, float y, final int flags, long paint,
+            long typeface) {
         int count = end - start;
         char[] buffer = TemporaryBuffer.obtain(count);
         TextUtils.getChars(text, start, end, buffer, 0);
 
-        native_drawText(nativeCanvas, buffer, 0, count, x, y, flags, paint);
+        native_drawText(nativeCanvas, buffer, 0, count, x, y, flags, paint, typeface);
     }
 
     @LayoutlibDelegate
     /*package*/ static void native_drawTextRun(long nativeCanvas, String text,
             int start, int end, int contextStart, int contextEnd,
-            float x, float y, int flags, long paint) {
+            float x, float y, int flags, long paint, long typeface) {
         int count = end - start;
         char[] buffer = TemporaryBuffer.obtain(count);
         TextUtils.getChars(text, start, end, buffer, 0);
 
-        native_drawText(nativeCanvas, buffer, 0, count, x, y, flags, paint);
+        native_drawText(nativeCanvas, buffer, 0, count, x, y, flags, paint, typeface);
     }
 
     @LayoutlibDelegate
     /*package*/ static void native_drawTextRun(long nativeCanvas, char[] text,
             int start, int count, int contextStart, int contextCount,
-            float x, float y, int flags, long paint) {
-        native_drawText(nativeCanvas, text, start, count, x, y, flags, paint);
+            float x, float y, int flags, long paint, long typeface) {
+        native_drawText(nativeCanvas, text, start, count, x, y, flags, paint, typeface);
     }
 
     @LayoutlibDelegate
index d6b3da1..38174f1 100644 (file)
@@ -56,7 +56,7 @@ public abstract class ColorFilter_Delegate {
     // ---- native methods ----
 
     @LayoutlibDelegate
-    /*package*/ static void finalizer(long native_instance, long nativeColorFilter) {
+    /*package*/ static void destroyFilter(long native_instance, long nativeColorFilter) {
         sManager.removeJavaReferenceFor(native_instance);
     }
 
index 1d66586..ebfe9bc 100644 (file)
@@ -654,7 +654,7 @@ public final class Matrix_Delegate {
     }
 
     @LayoutlibDelegate
-    /*package*/ static boolean native_invert(long native_object, int inverse) {
+    /*package*/ static boolean native_invert(long native_object, long inverse) {
         Matrix_Delegate d = sManager.getDelegate(native_object);
         if (d == null) {
             return false;
index 4e9c129..2a302ba 100644 (file)
@@ -401,17 +401,17 @@ public final class Path_Delegate {
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_addPath(long nPath, int src, float dx, float dy) {
+    /*package*/ static void native_addPath(long nPath, long src, float dx, float dy) {
         addPath(nPath, src, AffineTransform.getTranslateInstance(dx, dy));
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_addPath(long nPath, int src) {
+    /*package*/ static void native_addPath(long nPath, long src) {
         addPath(nPath, src, null /*transform*/);
     }
 
     @LayoutlibDelegate
-    /*package*/ static void native_addPath(long nPath, int src, long matrix) {
+    /*package*/ static void native_addPath(long nPath, long src, long matrix) {
         Matrix_Delegate matrixDelegate = Matrix_Delegate.getDelegate(matrix);
         if (matrixDelegate == null) {
             return;
@@ -474,7 +474,7 @@ public final class Path_Delegate {
     }
 
     @LayoutlibDelegate
-    /*package*/ static boolean native_op(long nPath1, long nPath2, int op, int result) {
+    /*package*/ static boolean native_op(long nPath1, long nPath2, int op, long result) {
         Bridge.getLog().error(LayoutLog.TAG_UNSUPPORTED, "Path.op() not supported", null);
         return false;
     }
@@ -484,6 +484,25 @@ public final class Path_Delegate {
         sManager.removeJavaReferenceFor(nPath);
     }
 
+    @LayoutlibDelegate
+    /*package*/ static float[] native_approximate(long nPath, float error) {
+        Bridge.getLog().error(LayoutLog.TAG_UNSUPPORTED, "Path.approximate() not supported", null);
+        return new float[0];
+    }
+
+    @LayoutlibDelegate
+    /*package*/ static long native_trim(long nPath, long nTargetPath, long nPathMeasure,
+            float trimStart, float trimEnd, float trimOffset) {
+        // TODO: add trim.
+        Bridge.getLog().error(LayoutLog.TAG_UNSUPPORTED, "Path.trim() not supported", null);
+        return nPathMeasure;
+
+    }
+
+    @LayoutlibDelegate
+    private static void native_destroyMeasure(long nPathMeasure) {
+        sPathMeasureManager.removeJavaReferenceFor(nPathMeasure);
+    }
 
     // ---- Private helper methods ----
 
index ad4103b..d40352f 100644 (file)
@@ -137,6 +137,11 @@ public class ICU_Delegate {
     }
 
     @LayoutlibDelegate
+    /*package*/ static String getDisplayScriptNative(String variantCode, String locale) {
+        return "";
+    }
+
+    @LayoutlibDelegate
     /*package*/ static String getISO3CountryNative(String locale) {
         return "";
     }
@@ -166,6 +171,17 @@ public class ICU_Delegate {
         return Locale.getISOCountries();
     }
 
+
+    @LayoutlibDelegate
+    /*package*/ static String localeForLanguageTag(String languageTag, boolean strict) {
+        return "";
+    }
+
+    @LayoutlibDelegate
+    /*package*/ static String languageTagForLocale(String locale) {
+        return "";
+    }
+
     @LayoutlibDelegate
     /*package*/ static boolean initLocaleDataNative(String locale, LocaleData result) {