Merge "Remove logging of DisplayList staleness"
diff --git a/Android.mk b/Android.mk
index 5ee1076..781d5d1 100644
--- a/Android.mk
+++ b/Android.mk
@@ -381,6 +381,16 @@
frameworks/base/core/java/android/os/DropBoxManager.aidl \
frameworks/base/core/java/android/os/ParcelFileDescriptor.aidl \
frameworks/base/core/java/android/os/ParcelUuid.aidl \
+ frameworks/base/core/java/android/print/PrinterInfo.aidl \
+ frameworks/base/core/java/android/print/PageRange.aidl \
+ frameworks/base/core/java/android/print/PrintAttributes.aidl \
+ frameworks/base/core/java/android/print/PrinterCapabilitiesInfo.aidl \
+ frameworks/base/core/java/android/print/PrinterId.aidl \
+ frameworks/base/core/java/android/print/PrintJobId.aidl \
+ frameworks/base/core/java/android/print/PrintJobInfo.aidl \
+ frameworks/base/core/java/android/view/accessibility/AccessibilityEvent.aidl \
+ frameworks/base/core/java/android/view/accessibility/AccessibilityNodeInfo.aidl \
+ frameworks/base/core/java/android/view/accessibility/AccessibilityRecord.aidl \
frameworks/base/core/java/android/view/KeyEvent.aidl \
frameworks/base/core/java/android/view/MotionEvent.aidl \
frameworks/base/core/java/android/view/Surface.aidl \
diff --git a/api/current.txt b/api/current.txt
index fd901f2..52900c9 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -27211,7 +27211,6 @@
method public final java.lang.CharSequence coerceToString();
method public static final java.lang.String coerceToString(int, int);
method public static float complexToDimension(int, android.util.DisplayMetrics);
- method public static float complexToDimensionNoisy(int, android.util.DisplayMetrics);
method public static int complexToDimensionPixelOffset(int, android.util.DisplayMetrics);
method public static int complexToDimensionPixelSize(int, android.util.DisplayMetrics);
method public static float complexToFloat(int);
diff --git a/core/java/android/bluetooth/BluetoothInputDevice.java b/core/java/android/bluetooth/BluetoothInputDevice.java
index c4ba5b1..b8b8f5f 100644
--- a/core/java/android/bluetooth/BluetoothInputDevice.java
+++ b/core/java/android/bluetooth/BluetoothInputDevice.java
@@ -75,6 +75,12 @@
public static final String ACTION_PROTOCOL_MODE_CHANGED =
"android.bluetooth.input.profile.action.PROTOCOL_MODE_CHANGED";
+ /**
+ * @hide
+ */
+ @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
+ public static final String ACTION_REPORT =
+ "android.bluetooth.input.profile.action.REPORT";
/**
* @hide
@@ -129,17 +135,17 @@
/**
* @hide
*/
- public static final byte REPORT_TYPE_INPUT = 0;
+ public static final byte REPORT_TYPE_INPUT = 1;
/**
* @hide
*/
- public static final byte REPORT_TYPE_OUTPUT = 1;
+ public static final byte REPORT_TYPE_OUTPUT = 2;
/**
* @hide
*/
- public static final byte REPORT_TYPE_FEATURE = 2;
+ public static final byte REPORT_TYPE_FEATURE = 3;
/**
* @hide
diff --git a/core/java/android/database/sqlite/SQLiteDatabase.java b/core/java/android/database/sqlite/SQLiteDatabase.java
index 60ccc61..433d5d1c 100644
--- a/core/java/android/database/sqlite/SQLiteDatabase.java
+++ b/core/java/android/database/sqlite/SQLiteDatabase.java
@@ -738,14 +738,16 @@
File dir = file.getParentFile();
if (dir != null) {
final String prefix = file.getName() + "-mj";
- final FileFilter filter = new FileFilter() {
+ File[] files = dir.listFiles(new FileFilter() {
@Override
public boolean accept(File candidate) {
return candidate.getName().startsWith(prefix);
}
- };
- for (File masterJournal : dir.listFiles(filter)) {
- deleted |= masterJournal.delete();
+ });
+ if (files != null) {
+ for (File masterJournal : files) {
+ deleted |= masterJournal.delete();
+ }
}
}
return deleted;
diff --git a/core/java/android/os/BatteryStats.java b/core/java/android/os/BatteryStats.java
index 1ce958b..2afea1f 100644
--- a/core/java/android/os/BatteryStats.java
+++ b/core/java/android/os/BatteryStats.java
@@ -27,6 +27,7 @@
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.telephony.SignalStrength;
+import android.text.format.DateFormat;
import android.util.Printer;
import android.util.SparseArray;
import android.util.TimeUtils;
@@ -895,6 +896,11 @@
public abstract long getNetworkActivityPackets(int type, int which);
/**
+ * Return the wall clock time when battery stats data collection started.
+ */
+ public abstract long getStartClockTime();
+
+ /**
* Return whether we are currently running on battery.
*/
public abstract boolean getIsOnBattery();
@@ -1210,7 +1216,8 @@
dumpLine(pw, 0 /* uid */, category, BATTERY_DATA,
which == STATS_SINCE_CHARGED ? getStartCount() : "N/A",
whichBatteryRealtime / 1000, whichBatteryUptime / 1000,
- totalRealtime / 1000, totalUptime / 1000);
+ totalRealtime / 1000, totalUptime / 1000,
+ getStartClockTime());
// Calculate wakelock times across all uids.
long fullWakeLockTimeTotal = 0;
@@ -1587,7 +1594,9 @@
formatTimeMs(sb, totalUptime / 1000);
sb.append("uptime, ");
pw.println(sb.toString());
-
+ pw.print(" Start clock time: ");
+ pw.println(DateFormat.format("yyyy-MM-dd-HH-mm-ss", getStartClockTime()).toString());
+
final long screenOnTime = getScreenOnTime(batteryRealtime, which);
final long phoneOnTime = getPhoneOnTime(batteryRealtime, which);
final long wifiRunningTime = getGlobalWifiRunningTime(batteryRealtime, which);
diff --git a/core/java/android/util/TypedValue.java b/core/java/android/util/TypedValue.java
index ed45298..931fb81 100644
--- a/core/java/android/util/TypedValue.java
+++ b/core/java/android/util/TypedValue.java
@@ -290,18 +290,14 @@
return -1;
}
+ /**
+ * @hide Was accidentally exposed in API level 1 for debugging purposes.
+ * Kept for compatibility just in case although the debugging code has been removed.
+ */
+ @Deprecated
public static float complexToDimensionNoisy(int data, DisplayMetrics metrics)
{
- float res = complexToDimension(data, metrics);
- System.out.println(
- "Dimension (0x" + ((data>>TypedValue.COMPLEX_MANTISSA_SHIFT)
- & TypedValue.COMPLEX_MANTISSA_MASK)
- + "*" + (RADIX_MULTS[(data>>TypedValue.COMPLEX_RADIX_SHIFT)
- & TypedValue.COMPLEX_RADIX_MASK] / MANTISSA_MULT)
- + ")" + DIMENSION_UNIT_STRS[(data>>COMPLEX_UNIT_SHIFT)
- & COMPLEX_UNIT_MASK]
- + " = " + res);
- return res;
+ return complexToDimension(data, metrics);
}
/**
diff --git a/core/java/android/view/DisplayList.java b/core/java/android/view/DisplayList.java
index 8dd6a91..439fc6c 100644
--- a/core/java/android/view/DisplayList.java
+++ b/core/java/android/view/DisplayList.java
@@ -364,7 +364,7 @@
return mValid && mFinalizer != null;
}
- int getNativeDisplayList() {
+ long getNativeDisplayList() {
if (!mValid || mFinalizer == null) {
throw new IllegalStateException("The display list is not valid.");
}
@@ -1029,73 +1029,73 @@
// Native methods
///////////////////////////////////////////////////////////////////////////
- private static native void nDestroyDisplayList(int displayList);
- private static native int nGetDisplayListSize(int displayList);
- private static native void nSetDisplayListName(int displayList, String name);
+ private static native void nDestroyDisplayList(long displayList);
+ private static native int nGetDisplayListSize(long displayList);
+ private static native void nSetDisplayListName(long displayList, String name);
// Properties
- private static native void nReset(int displayList);
- private static native void nOffsetTopAndBottom(int displayList, float offset);
- private static native void nOffsetLeftAndRight(int displayList, float offset);
- private static native void nSetLeftTopRightBottom(int displayList, int left, int top,
+ private static native void nReset(long displayList);
+ private static native void nOffsetTopAndBottom(long displayList, float offset);
+ private static native void nOffsetLeftAndRight(long displayList, float offset);
+ private static native void nSetLeftTopRightBottom(long displayList, int left, int top,
int right, int bottom);
- private static native void nSetBottom(int displayList, int bottom);
- private static native void nSetRight(int displayList, int right);
- private static native void nSetTop(int displayList, int top);
- private static native void nSetLeft(int displayList, int left);
- private static native void nSetCameraDistance(int displayList, float distance);
- private static native void nSetPivotY(int displayList, float pivotY);
- private static native void nSetPivotX(int displayList, float pivotX);
- private static native void nSetCaching(int displayList, boolean caching);
- private static native void nSetClipToBounds(int displayList, boolean clipToBounds);
- private static native void nSetProjectToContainedVolume(int displayList, boolean shouldProject);
- private static native void nSetIsContainedVolume(int displayList, boolean isContainedVolume);
- private static native void nSetAlpha(int displayList, float alpha);
- private static native void nSetHasOverlappingRendering(int displayList,
+ private static native void nSetBottom(long displayList, int bottom);
+ private static native void nSetRight(long displayList, int right);
+ private static native void nSetTop(long displayList, int top);
+ private static native void nSetLeft(long displayList, int left);
+ private static native void nSetCameraDistance(long displayList, float distance);
+ private static native void nSetPivotY(long displayList, float pivotY);
+ private static native void nSetPivotX(long displayList, float pivotX);
+ private static native void nSetCaching(long displayList, boolean caching);
+ private static native void nSetClipToBounds(long displayList, boolean clipToBounds);
+ private static native void nSetProjectToContainedVolume(long displayList, boolean shouldProject);
+ private static native void nSetIsContainedVolume(long displayList, boolean isContainedVolume);
+ private static native void nSetAlpha(long displayList, float alpha);
+ private static native void nSetHasOverlappingRendering(long displayList,
boolean hasOverlappingRendering);
- private static native void nSetTranslationX(int displayList, float translationX);
- private static native void nSetTranslationY(int displayList, float translationY);
- private static native void nSetTranslationZ(int displayList, float translationZ);
- private static native void nSetRotation(int displayList, float rotation);
- private static native void nSetRotationX(int displayList, float rotationX);
- private static native void nSetRotationY(int displayList, float rotationY);
- private static native void nSetScaleX(int displayList, float scaleX);
- private static native void nSetScaleY(int displayList, float scaleY);
- private static native void nSetTransformationInfo(int displayList, float alpha,
+ private static native void nSetTranslationX(long displayList, float translationX);
+ private static native void nSetTranslationY(long displayList, float translationY);
+ private static native void nSetTranslationZ(long displayList, float translationZ);
+ private static native void nSetRotation(long displayList, float rotation);
+ private static native void nSetRotationX(long displayList, float rotationX);
+ private static native void nSetRotationY(long displayList, float rotationY);
+ private static native void nSetScaleX(long displayList, float scaleX);
+ private static native void nSetScaleY(long displayList, float scaleY);
+ private static native void nSetTransformationInfo(long displayList, float alpha,
float translationX, float translationY, float translationZ,
float rotation, float rotationX, float rotationY, float scaleX, float scaleY);
- private static native void nSetStaticMatrix(int displayList, int nativeMatrix);
- private static native void nSetAnimationMatrix(int displayList, int animationMatrix);
+ private static native void nSetStaticMatrix(long displayList, long nativeMatrix);
+ private static native void nSetAnimationMatrix(long displayList, long animationMatrix);
- private static native boolean nHasOverlappingRendering(int displayList);
- private static native void nGetMatrix(int displayList, int matrix);
- private static native float nGetAlpha(int displayList);
- private static native float nGetLeft(int displayList);
- private static native float nGetTop(int displayList);
- private static native float nGetRight(int displayList);
- private static native float nGetBottom(int displayList);
- private static native float nGetCameraDistance(int displayList);
- private static native float nGetScaleX(int displayList);
- private static native float nGetScaleY(int displayList);
- private static native float nGetTranslationX(int displayList);
- private static native float nGetTranslationY(int displayList);
- private static native float nGetTranslationZ(int displayList);
- private static native float nGetRotation(int displayList);
- private static native float nGetRotationX(int displayList);
- private static native float nGetRotationY(int displayList);
- private static native float nGetPivotX(int displayList);
- private static native float nGetPivotY(int displayList);
- private static native void nOutput(int displayList);
+ private static native boolean nHasOverlappingRendering(long displayList);
+ private static native void nGetMatrix(long displayList, long matrix);
+ private static native float nGetAlpha(long displayList);
+ private static native float nGetLeft(long displayList);
+ private static native float nGetTop(long displayList);
+ private static native float nGetRight(long displayList);
+ private static native float nGetBottom(long displayList);
+ private static native float nGetCameraDistance(long displayList);
+ private static native float nGetScaleX(long displayList);
+ private static native float nGetScaleY(long displayList);
+ private static native float nGetTranslationX(long displayList);
+ private static native float nGetTranslationY(long displayList);
+ private static native float nGetTranslationZ(long displayList);
+ private static native float nGetRotation(long displayList);
+ private static native float nGetRotationX(long displayList);
+ private static native float nGetRotationY(long displayList);
+ private static native float nGetPivotX(long displayList);
+ private static native float nGetPivotY(long displayList);
+ private static native void nOutput(long displayList);
///////////////////////////////////////////////////////////////////////////
// Finalization
///////////////////////////////////////////////////////////////////////////
private static class DisplayListFinalizer {
- final int mNativeDisplayList;
+ final long mNativeDisplayList;
- public DisplayListFinalizer(int nativeDisplayList) {
+ public DisplayListFinalizer(long nativeDisplayList) {
mNativeDisplayList = nativeDisplayList;
}
diff --git a/core/java/android/view/GLES20Canvas.java b/core/java/android/view/GLES20Canvas.java
index 449318e..3384359 100644
--- a/core/java/android/view/GLES20Canvas.java
+++ b/core/java/android/view/GLES20Canvas.java
@@ -49,7 +49,7 @@
private static final int MODIFIER_COLOR_FILTER = 4;
private final boolean mOpaque;
- private int mRenderer;
+ private long mRenderer;
// The native renderer will be destroyed when this object dies.
// DO NOT overwrite this reference once it is set.
@@ -92,7 +92,7 @@
/**
* Creates a canvas to render into an FBO.
*/
- GLES20Canvas(int layer, boolean translucent) {
+ GLES20Canvas(long layer, boolean translucent) {
mOpaque = !translucent;
mRenderer = nCreateLayerRenderer(layer);
setupFinalizer();
@@ -122,16 +122,16 @@
nResetDisplayListRenderer(mRenderer);
}
- private static native int nCreateRenderer();
- private static native int nCreateLayerRenderer(int layer);
- private static native int nCreateDisplayListRenderer();
- private static native void nResetDisplayListRenderer(int renderer);
- private static native void nDestroyRenderer(int renderer);
+ private static native long nCreateRenderer();
+ private static native long nCreateLayerRenderer(long layer);
+ private static native long nCreateDisplayListRenderer();
+ private static native void nResetDisplayListRenderer(long renderer);
+ private static native void nDestroyRenderer(long renderer);
private static final class CanvasFinalizer {
- private final int mRenderer;
+ private final long mRenderer;
- public CanvasFinalizer(int renderer) {
+ public CanvasFinalizer(long renderer) {
mRenderer = renderer;
}
@@ -175,26 +175,26 @@
nClearLayerUpdates(mRenderer);
}
- static native int nCreateTextureLayer(boolean opaque, int[] layerInfo);
- static native int nCreateLayer(int width, int height, boolean isOpaque, int[] layerInfo);
- static native boolean nResizeLayer(int layerId, int width, int height, int[] layerInfo);
- static native void nSetOpaqueLayer(int layerId, boolean isOpaque);
- static native void nSetLayerPaint(int layerId, int nativePaint);
- static native void nSetLayerColorFilter(int layerId, int nativeColorFilter);
- static native void nUpdateTextureLayer(int layerId, int width, int height, boolean opaque,
+ static native long nCreateTextureLayer(boolean opaque, int[] layerInfo);
+ static native long nCreateLayer(int width, int height, boolean isOpaque, int[] layerInfo);
+ static native boolean nResizeLayer(long layerId, int width, int height, int[] layerInfo);
+ static native void nSetOpaqueLayer(long layerId, boolean isOpaque);
+ static native void nSetLayerPaint(long layerId, long nativePaint);
+ static native void nSetLayerColorFilter(long layerId, long nativeColorFilter);
+ static native void nUpdateTextureLayer(long layerId, int width, int height, boolean opaque,
SurfaceTexture surface);
- static native void nClearLayerTexture(int layerId);
- static native void nSetTextureLayerTransform(int layerId, int matrix);
- static native void nDestroyLayer(int layerId);
- static native void nDestroyLayerDeferred(int layerId);
- static native void nUpdateRenderLayer(int layerId, int renderer, int displayList,
+ static native void nClearLayerTexture(long layerId);
+ static native void nSetTextureLayerTransform(long layerId, long matrix);
+ static native void nDestroyLayer(long layerId);
+ static native void nDestroyLayerDeferred(long layerId);
+ static native void nUpdateRenderLayer(long layerId, long renderer, long displayList,
int left, int top, int right, int bottom);
- static native boolean nCopyLayer(int layerId, int bitmap);
+ static native boolean nCopyLayer(long layerId, long bitmap);
- private static native void nClearLayerUpdates(int renderer);
- private static native void nFlushLayerUpdates(int renderer);
- private static native void nPushLayerUpdate(int renderer, int layer);
- private static native void nCancelLayerUpdate(int renderer, int layer);
+ private static native void nClearLayerUpdates(long renderer);
+ private static native void nFlushLayerUpdates(long renderer);
+ private static native void nPushLayerUpdate(long renderer, long layer);
+ private static native void nCancelLayerUpdate(long renderer, long layer);
///////////////////////////////////////////////////////////////////////////
// Canvas management
@@ -231,7 +231,7 @@
/**
* Returns the native OpenGLRenderer object.
*/
- int getRenderer() {
+ long getRenderer() {
return mRenderer;
}
@@ -247,7 +247,7 @@
nSetViewport(mRenderer, width, height);
}
- private static native void nSetViewport(int renderer, int width, int height);
+ private static native void nSetViewport(long renderer, int width, int height);
@Override
public int onPreDraw(Rect dirty) {
@@ -259,8 +259,8 @@
}
}
- private static native int nPrepare(int renderer, boolean opaque);
- private static native int nPrepareDirty(int renderer, int left, int top, int right, int bottom,
+ private static native int nPrepare(long renderer, boolean opaque);
+ private static native int nPrepareDirty(long renderer, int left, int top, int right, int bottom,
boolean opaque);
@Override
@@ -268,7 +268,7 @@
nFinish(mRenderer);
}
- private static native void nFinish(int renderer);
+ private static native void nFinish(long renderer);
/**
* Returns the size of the stencil buffer required by the underlying
@@ -288,45 +288,45 @@
nSetCountOverdrawEnabled(mRenderer, enabled);
}
- static native void nSetCountOverdrawEnabled(int renderer, boolean enabled);
+ static native void nSetCountOverdrawEnabled(long renderer, boolean enabled);
float getOverdraw() {
return nGetOverdraw(mRenderer);
}
- static native float nGetOverdraw(int renderer);
+ static native float nGetOverdraw(long renderer);
///////////////////////////////////////////////////////////////////////////
// Functor
///////////////////////////////////////////////////////////////////////////
@Override
- public int callDrawGLFunction(int drawGLFunction) {
+ public int callDrawGLFunction(long drawGLFunction) {
return nCallDrawGLFunction(mRenderer, drawGLFunction);
}
- private static native int nCallDrawGLFunction(int renderer, int drawGLFunction);
+ private static native int nCallDrawGLFunction(long renderer, long drawGLFunction);
@Override
public int invokeFunctors(Rect dirty) {
return nInvokeFunctors(mRenderer, dirty);
}
- private static native int nInvokeFunctors(int renderer, Rect dirty);
+ private static native int nInvokeFunctors(long renderer, Rect dirty);
@Override
- public void detachFunctor(int functor) {
+ public void detachFunctor(long functor) {
nDetachFunctor(mRenderer, functor);
}
- private static native void nDetachFunctor(int renderer, int functor);
+ private static native void nDetachFunctor(long renderer, long functor);
@Override
- public void attachFunctor(int functor) {
+ public void attachFunctor(long functor) {
nAttachFunctor(mRenderer, functor);
}
- private static native void nAttachFunctor(int renderer, int functor);
+ private static native void nAttachFunctor(long renderer, long functor);
///////////////////////////////////////////////////////////////////////////
// Memory
@@ -400,11 +400,11 @@
// Display list
///////////////////////////////////////////////////////////////////////////
- int getDisplayList(int displayList) {
+ long getDisplayList(long displayList) {
return nGetDisplayList(mRenderer, displayList);
}
- private static native int nGetDisplayList(int renderer, int displayList);
+ private static native long nGetDisplayList(long renderer, long displayList);
@Override
public int drawDisplayList(DisplayList displayList, Rect dirty, int flags) {
@@ -412,7 +412,7 @@
dirty, flags);
}
- private static native int nDrawDisplayList(int renderer, int displayList,
+ private static native int nDrawDisplayList(long renderer, long displayList,
Rect dirty, int flags);
///////////////////////////////////////////////////////////////////////////
@@ -426,7 +426,7 @@
nDrawLayer(mRenderer, glLayer.getLayer(), x, y);
}
- private static native void nDrawLayer(int renderer, int layer, float x, float y);
+ private static native void nDrawLayer(long renderer, long layer, float x, float y);
void interrupt() {
nInterrupt(mRenderer);
@@ -436,8 +436,8 @@
nResume(mRenderer);
}
- private static native void nInterrupt(int renderer);
- private static native void nResume(int renderer);
+ private static native void nInterrupt(long renderer);
+ private static native void nResume(long renderer);
///////////////////////////////////////////////////////////////////////////
// Support
@@ -478,14 +478,14 @@
return nClipPath(mRenderer, path.mNativePath, op.nativeInt);
}
- private static native boolean nClipPath(int renderer, int path, int op);
+ private static native boolean nClipPath(long renderer, long path, int op);
@Override
public boolean clipRect(float left, float top, float right, float bottom) {
return nClipRect(mRenderer, left, top, right, bottom, Region.Op.INTERSECT.nativeInt);
}
- private static native boolean nClipRect(int renderer, float left, float top,
+ private static native boolean nClipRect(long renderer, float left, float top,
float right, float bottom, int op);
@Override
@@ -498,7 +498,7 @@
return nClipRect(mRenderer, left, top, right, bottom, Region.Op.INTERSECT.nativeInt);
}
- private static native boolean nClipRect(int renderer, int left, int top,
+ private static native boolean nClipRect(long renderer, int left, int top,
int right, int bottom, int op);
@Override
@@ -533,21 +533,21 @@
return nClipRegion(mRenderer, region.mNativeRegion, op.nativeInt);
}
- private static native boolean nClipRegion(int renderer, int region, int op);
+ private static native boolean nClipRegion(long renderer, long region, int op);
@Override
public boolean getClipBounds(Rect bounds) {
return nGetClipBounds(mRenderer, bounds);
}
- private static native boolean nGetClipBounds(int renderer, Rect bounds);
+ private static native boolean nGetClipBounds(long renderer, Rect bounds);
@Override
public boolean quickReject(float left, float top, float right, float bottom, EdgeType type) {
return nQuickReject(mRenderer, left, top, right, bottom);
}
- private static native boolean nQuickReject(int renderer, float left, float top,
+ private static native boolean nQuickReject(long renderer, float left, float top,
float right, float bottom);
@Override
@@ -572,35 +572,35 @@
if (dx != 0.0f || dy != 0.0f) nTranslate(mRenderer, dx, dy);
}
- private static native void nTranslate(int renderer, float dx, float dy);
+ private static native void nTranslate(long renderer, float dx, float dy);
@Override
public void skew(float sx, float sy) {
nSkew(mRenderer, sx, sy);
}
- private static native void nSkew(int renderer, float sx, float sy);
+ private static native void nSkew(long renderer, float sx, float sy);
@Override
public void rotate(float degrees) {
nRotate(mRenderer, degrees);
}
- private static native void nRotate(int renderer, float degrees);
+ private static native void nRotate(long renderer, float degrees);
@Override
public void scale(float sx, float sy) {
nScale(mRenderer, sx, sy);
}
- private static native void nScale(int renderer, float sx, float sy);
+ private static native void nScale(long renderer, float sx, float sy);
@Override
public void setMatrix(Matrix matrix) {
nSetMatrix(mRenderer, matrix == null ? 0 : matrix.native_instance);
}
- private static native void nSetMatrix(int renderer, int matrix);
+ private static native void nSetMatrix(long renderer, long matrix);
@SuppressWarnings("deprecation")
@Override
@@ -608,14 +608,14 @@
nGetMatrix(mRenderer, matrix.native_instance);
}
- private static native void nGetMatrix(int renderer, int matrix);
+ private static native void nGetMatrix(long renderer, long matrix);
@Override
public void concat(Matrix matrix) {
if (matrix != null) nConcatMatrix(mRenderer, matrix.native_instance);
}
- private static native void nConcatMatrix(int renderer, int matrix);
+ private static native void nConcatMatrix(long renderer, long matrix);
///////////////////////////////////////////////////////////////////////////
// State management
@@ -631,7 +631,7 @@
return nSave(mRenderer, saveFlags);
}
- private static native int nSave(int renderer, int flags);
+ private static native int nSave(long renderer, int flags);
@Override
public int saveLayer(RectF bounds, Paint paint, int saveFlags) {
@@ -642,7 +642,7 @@
int count;
int modifier = paint != null ? setupColorFilter(paint) : MODIFIER_NONE;
try {
- final int nativePaint = paint == null ? 0 : paint.mNativePaint;
+ final long nativePaint = paint == null ? 0 : paint.mNativePaint;
count = nSaveLayer(mRenderer, nativePaint, saveFlags);
} finally {
if (modifier != MODIFIER_NONE) nResetModifiers(mRenderer, modifier);
@@ -650,7 +650,7 @@
return count;
}
- private static native int nSaveLayer(int renderer, int paint, int saveFlags);
+ private static native int nSaveLayer(long renderer, long paint, int saveFlags);
@Override
public int saveLayer(float left, float top, float right, float bottom, Paint paint,
@@ -659,7 +659,7 @@
int count;
int modifier = paint != null ? setupColorFilter(paint) : MODIFIER_NONE;
try {
- final int nativePaint = paint == null ? 0 : paint.mNativePaint;
+ final long nativePaint = paint == null ? 0 : paint.mNativePaint;
count = nSaveLayer(mRenderer, left, top, right, bottom, nativePaint, saveFlags);
} finally {
if (modifier != MODIFIER_NONE) nResetModifiers(mRenderer, modifier);
@@ -669,8 +669,8 @@
return save(saveFlags);
}
- private static native int nSaveLayer(int renderer, float left, float top,
- float right, float bottom, int paint, int saveFlags);
+ private static native int nSaveLayer(long renderer, float left, float top,
+ float right, float bottom, long paint, int saveFlags);
@Override
public int saveLayerAlpha(RectF bounds, int alpha, int saveFlags) {
@@ -681,7 +681,7 @@
return nSaveLayerAlpha(mRenderer, alpha, saveFlags);
}
- private static native int nSaveLayerAlpha(int renderer, int alpha, int saveFlags);
+ private static native int nSaveLayerAlpha(long renderer, int alpha, int saveFlags);
@Override
public int saveLayerAlpha(float left, float top, float right, float bottom, int alpha,
@@ -692,7 +692,7 @@
return save(saveFlags);
}
- private static native int nSaveLayerAlpha(int renderer, float left, float top, float right,
+ private static native int nSaveLayerAlpha(long renderer, float left, float top, float right,
float bottom, int alpha, int saveFlags);
@Override
@@ -700,21 +700,21 @@
nRestore(mRenderer);
}
- private static native void nRestore(int renderer);
+ private static native void nRestore(long renderer);
@Override
public void restoreToCount(int saveCount) {
nRestoreToCount(mRenderer, saveCount);
}
- private static native void nRestoreToCount(int renderer, int saveCount);
+ private static native void nRestoreToCount(long renderer, int saveCount);
@Override
public int getSaveCount() {
return nGetSaveCount(mRenderer);
}
- private static native int nGetSaveCount(int renderer);
+ private static native int nGetSaveCount(long renderer);
///////////////////////////////////////////////////////////////////////////
// Filtering
@@ -731,8 +731,8 @@
}
}
- private static native void nResetPaintFilter(int renderer);
- private static native void nSetupPaintFilter(int renderer, int clearBits, int setBits);
+ private static native void nResetPaintFilter(long renderer);
+ private static native void nSetupPaintFilter(long renderer, int clearBits, int setBits);
@Override
public DrawFilter getDrawFilter() {
@@ -755,9 +755,9 @@
}
}
- private static native void nDrawArc(int renderer, float left, float top,
+ private static native void nDrawArc(long renderer, float left, float top,
float right, float bottom, float startAngle, float sweepAngle,
- boolean useCenter, int paint);
+ boolean useCenter, long paint);
@Override
public void drawARGB(int a, int r, int g, int b) {
@@ -771,7 +771,7 @@
// Shaders are ignored when drawing patches
int modifier = paint != null ? setupColorFilter(paint) : MODIFIER_NONE;
try {
- final int nativePaint = paint == null ? 0 : paint.mNativePaint;
+ final long nativePaint = paint == null ? 0 : paint.mNativePaint;
nDrawPatch(mRenderer, bitmap.mNativeBitmap, bitmap.mBuffer, patch.mNativeChunk,
dst.left, dst.top, dst.right, dst.bottom, nativePaint);
} finally {
@@ -786,7 +786,7 @@
// Shaders are ignored when drawing patches
int modifier = paint != null ? setupColorFilter(paint) : MODIFIER_NONE;
try {
- final int nativePaint = paint == null ? 0 : paint.mNativePaint;
+ final long nativePaint = paint == null ? 0 : paint.mNativePaint;
nDrawPatch(mRenderer, bitmap.mNativeBitmap, bitmap.mBuffer, patch.mNativeChunk,
dst.left, dst.top, dst.right, dst.bottom, nativePaint);
} finally {
@@ -794,8 +794,8 @@
}
}
- private static native void nDrawPatch(int renderer, int bitmap, byte[] buffer, int chunk,
- float left, float top, float right, float bottom, int paint);
+ private static native void nDrawPatch(long renderer, long bitmap, byte[] buffer, long chunk,
+ float left, float top, float right, float bottom, long paint);
@Override
public void drawBitmap(Bitmap bitmap, float left, float top, Paint paint) {
@@ -803,15 +803,15 @@
// Shaders are ignored when drawing bitmaps
int modifiers = paint != null ? setupModifiers(bitmap, paint) : MODIFIER_NONE;
try {
- final int nativePaint = paint == null ? 0 : paint.mNativePaint;
+ final long nativePaint = paint == null ? 0 : paint.mNativePaint;
nDrawBitmap(mRenderer, bitmap.mNativeBitmap, bitmap.mBuffer, left, top, nativePaint);
} finally {
if (modifiers != MODIFIER_NONE) nResetModifiers(mRenderer, modifiers);
}
}
- private static native void nDrawBitmap(int renderer, int bitmap, byte[] buffer,
- float left, float top, int paint);
+ private static native void nDrawBitmap(long renderer, long bitmap, byte[] buffer,
+ float left, float top, long paint);
@Override
public void drawBitmap(Bitmap bitmap, Matrix matrix, Paint paint) {
@@ -819,7 +819,7 @@
// Shaders are ignored when drawing bitmaps
int modifiers = paint != null ? setupModifiers(bitmap, paint) : MODIFIER_NONE;
try {
- final int nativePaint = paint == null ? 0 : paint.mNativePaint;
+ final long nativePaint = paint == null ? 0 : paint.mNativePaint;
nDrawBitmap(mRenderer, bitmap.mNativeBitmap, bitmap.mBuffer,
matrix.native_instance, nativePaint);
} finally {
@@ -827,8 +827,8 @@
}
}
- private static native void nDrawBitmap(int renderer, int bitmap, byte[] buffer,
- int matrix, int paint);
+ private static native void nDrawBitmap(long renderer, long bitmap, byte[] buffer,
+ long matrix, long paint);
@Override
public void drawBitmap(Bitmap bitmap, Rect src, Rect dst, Paint paint) {
@@ -836,7 +836,7 @@
// Shaders are ignored when drawing bitmaps
int modifiers = paint != null ? setupModifiers(bitmap, paint) : MODIFIER_NONE;
try {
- final int nativePaint = paint == null ? 0 : paint.mNativePaint;
+ final long nativePaint = paint == null ? 0 : paint.mNativePaint;
int left, top, right, bottom;
if (src == null) {
@@ -863,7 +863,7 @@
// Shaders are ignored when drawing bitmaps
int modifiers = paint != null ? setupModifiers(bitmap, paint) : MODIFIER_NONE;
try {
- final int nativePaint = paint == null ? 0 : paint.mNativePaint;
+ final long nativePaint = paint == null ? 0 : paint.mNativePaint;
float left, top, right, bottom;
if (src == null) {
@@ -884,9 +884,9 @@
}
}
- private static native void nDrawBitmap(int renderer, int bitmap, byte[] buffer,
+ private static native void nDrawBitmap(long renderer, long bitmap, byte[] buffer,
float srcLeft, float srcTop, float srcRight, float srcBottom,
- float left, float top, float right, float bottom, int paint);
+ float left, float top, float right, float bottom, long paint);
@Override
public void drawBitmap(int[] colors, int offset, int stride, float x, float y,
@@ -914,7 +914,7 @@
// Shaders are ignored when drawing bitmaps
int modifier = paint != null ? setupColorFilter(paint) : MODIFIER_NONE;
try {
- final int nativePaint = paint == null ? 0 : paint.mNativePaint;
+ final long nativePaint = paint == null ? 0 : paint.mNativePaint;
nDrawBitmap(mRenderer, colors, offset, stride, x, y,
width, height, hasAlpha, nativePaint);
} finally {
@@ -922,8 +922,8 @@
}
}
- private static native void nDrawBitmap(int renderer, int[] colors, int offset, int stride,
- float x, float y, int width, int height, boolean hasAlpha, int nativePaint);
+ private static native void nDrawBitmap(long renderer, int[] colors, int offset, int stride,
+ float x, float y, int width, int height, boolean hasAlpha, long nativePaint);
@Override
public void drawBitmap(int[] colors, int offset, int stride, int x, int y,
@@ -953,7 +953,7 @@
int modifiers = paint != null ? setupModifiers(bitmap, paint) : MODIFIER_NONE;
try {
- final int nativePaint = paint == null ? 0 : paint.mNativePaint;
+ final long nativePaint = paint == null ? 0 : paint.mNativePaint;
nDrawBitmapMesh(mRenderer, bitmap.mNativeBitmap, bitmap.mBuffer, meshWidth, meshHeight,
verts, vertOffset, colors, colorOffset, nativePaint);
} finally {
@@ -961,9 +961,9 @@
}
}
- private static native void nDrawBitmapMesh(int renderer, int bitmap, byte[] buffer,
+ private static native void nDrawBitmapMesh(long renderer, long bitmap, byte[] buffer,
int meshWidth, int meshHeight, float[] verts, int vertOffset,
- int[] colors, int colorOffset, int paint);
+ int[] colors, int colorOffset, long paint);
@Override
public void drawCircle(float cx, float cy, float radius, Paint paint) {
@@ -975,8 +975,8 @@
}
}
- private static native void nDrawCircle(int renderer, float cx, float cy,
- float radius, int paint);
+ private static native void nDrawCircle(long renderer, float cx, float cy,
+ float radius, long paint);
@Override
public void drawColor(int color) {
@@ -988,7 +988,7 @@
nDrawColor(mRenderer, color, mode.nativeInt);
}
- private static native void nDrawColor(int renderer, int color, int mode);
+ private static native void nDrawColor(long renderer, int color, int mode);
@Override
public void drawLine(float startX, float startY, float stopX, float stopY, Paint paint) {
@@ -1015,8 +1015,8 @@
}
}
- private static native void nDrawLines(int renderer, float[] points,
- int offset, int count, int paint);
+ private static native void nDrawLines(long renderer, float[] points,
+ int offset, int count, long paint);
@Override
public void drawLines(float[] pts, Paint paint) {
@@ -1033,8 +1033,8 @@
}
}
- private static native void nDrawOval(int renderer, float left, float top,
- float right, float bottom, int paint);
+ private static native void nDrawOval(long renderer, float left, float top,
+ float right, float bottom, long paint);
@Override
public void drawPaint(Paint paint) {
@@ -1059,8 +1059,8 @@
}
}
- private static native void nDrawPath(int renderer, int path, int paint);
- private static native void nDrawRects(int renderer, int region, int paint);
+ private static native void nDrawPath(long renderer, long path, long paint);
+ private static native void nDrawRects(long renderer, long region, long paint);
void drawRects(float[] rects, int count, Paint paint) {
int modifiers = setupModifiers(paint, MODIFIER_COLOR_FILTER | MODIFIER_SHADER);
@@ -1071,7 +1071,7 @@
}
}
- private static native void nDrawRects(int renderer, float[] rects, int count, int paint);
+ private static native void nDrawRects(long renderer, float[] rects, int count, long paint);
@Override
public void drawPicture(Picture picture) {
@@ -1138,8 +1138,8 @@
}
}
- private static native void nDrawPoints(int renderer, float[] points,
- int offset, int count, int paint);
+ private static native void nDrawPoints(long renderer, float[] points,
+ int offset, int count, long paint);
@SuppressWarnings("deprecation")
@Override
@@ -1156,8 +1156,8 @@
}
}
- private static native void nDrawPosText(int renderer, char[] text, int index, int count,
- float[] pos, int paint);
+ private static native void nDrawPosText(long renderer, char[] text, int index, int count,
+ float[] pos, long paint);
@SuppressWarnings("deprecation")
@Override
@@ -1174,8 +1174,8 @@
}
}
- private static native void nDrawPosText(int renderer, String text, int start, int end,
- float[] pos, int paint);
+ private static native void nDrawPosText(long renderer, String text, int start, int end,
+ float[] pos, long paint);
@Override
public void drawRect(float left, float top, float right, float bottom, Paint paint) {
@@ -1188,8 +1188,8 @@
}
}
- private static native void nDrawRect(int renderer, float left, float top,
- float right, float bottom, int paint);
+ private static native void nDrawRect(long renderer, float left, float top,
+ float right, float bottom, long paint);
@Override
public void drawRect(Rect r, Paint paint) {
@@ -1217,8 +1217,8 @@
}
}
- private static native void nDrawRoundRect(int renderer, float left, float top,
- float right, float bottom, float rx, float y, int paint);
+ private static native void nDrawRoundRect(long renderer, float left, float top,
+ float right, float bottom, float rx, float y, long paint);
@Override
public void drawText(char[] text, int index, int count, float x, float y, Paint paint) {
@@ -1234,8 +1234,8 @@
}
}
- private static native void nDrawText(int renderer, char[] text, int index, int count,
- float x, float y, int bidiFlags, int paint);
+ private static native void nDrawText(long renderer, char[] text, int index, int count,
+ float x, float y, int bidiFlags, long paint);
@Override
public void drawText(CharSequence text, int start, int end, float x, float y, Paint paint) {
@@ -1274,8 +1274,8 @@
}
}
- private static native void nDrawText(int renderer, String text, int start, int end,
- float x, float y, int bidiFlags, int paint);
+ private static native void nDrawText(long renderer, String text, int start, int end,
+ float x, float y, int bidiFlags, long paint);
@Override
public void drawText(String text, float x, float y, Paint paint) {
@@ -1304,8 +1304,8 @@
}
}
- private static native void nDrawTextOnPath(int renderer, char[] text, int index, int count,
- int path, float hOffset, float vOffset, int bidiFlags, int nativePaint);
+ private static native void nDrawTextOnPath(long renderer, char[] text, int index, int count,
+ long path, float hOffset, float vOffset, int bidiFlags, long nativePaint);
@Override
public void drawTextOnPath(String text, Path path, float hOffset, float vOffset, Paint paint) {
@@ -1320,8 +1320,8 @@
}
}
- private static native void nDrawTextOnPath(int renderer, String text, int start, int end,
- int path, float hOffset, float vOffset, int bidiFlags, int nativePaint);
+ private static native void nDrawTextOnPath(long renderer, String text, int start, int end,
+ long path, float hOffset, float vOffset, int bidiFlags, long nativePaint);
@Override
public void drawTextRun(char[] text, int index, int count, int contextIndex, int contextCount,
@@ -1342,8 +1342,8 @@
}
}
- private static native void nDrawTextRun(int renderer, char[] text, int index, int count,
- int contextIndex, int contextCount, float x, float y, int dir, int nativePaint);
+ private static native void nDrawTextRun(long renderer, char[] text, int index, int count,
+ int contextIndex, int contextCount, float x, float y, int dir, long nativePaint);
@Override
public void drawTextRun(CharSequence text, int start, int end, int contextStart, int contextEnd,
@@ -1376,8 +1376,8 @@
}
}
- private static native void nDrawTextRun(int renderer, String text, int start, int end,
- int contextStart, int contextEnd, float x, float y, int flags, int nativePaint);
+ private static native void nDrawTextRun(long renderer, String text, int start, int end,
+ int contextStart, int contextEnd, float x, float y, int flags, long nativePaint);
@Override
public void drawVertices(VertexMode mode, int vertexCount, float[] verts, int vertOffset,
@@ -1457,10 +1457,10 @@
return MODIFIER_NONE;
}
- private static native void nSetupShader(int renderer, int shader);
- private static native void nSetupColorFilter(int renderer, int colorFilter);
- private static native void nSetupShadow(int renderer, float radius,
+ private static native void nSetupShader(long renderer, long shader);
+ private static native void nSetupColorFilter(long renderer, long colorFilter);
+ private static native void nSetupShadow(long renderer, float radius,
float dx, float dy, int color);
- private static native void nResetModifiers(int renderer, int modifiers);
+ private static native void nResetModifiers(long renderer, int modifiers);
}
diff --git a/core/java/android/view/GLES20Layer.java b/core/java/android/view/GLES20Layer.java
index 0e3311c..37154eb 100644
--- a/core/java/android/view/GLES20Layer.java
+++ b/core/java/android/view/GLES20Layer.java
@@ -24,7 +24,7 @@
* An OpenGL ES 2.0 implementation of {@link HardwareLayer}.
*/
abstract class GLES20Layer extends HardwareLayer {
- int mLayer;
+ long mLayer;
Finalizer mFinalizer;
GLES20Layer() {
@@ -39,7 +39,7 @@
*
* @return A pointer to the native layer object, or 0 if the object is NULL
*/
- public int getLayer() {
+ public long getLayer() {
return mLayer;
}
@@ -75,9 +75,9 @@
}
static class Finalizer {
- private int mLayerId;
+ private long mLayerId;
- public Finalizer(int layerId) {
+ public Finalizer(long layerId) {
mLayerId = layerId;
}
diff --git a/core/java/android/view/GLES20RecordingCanvas.java b/core/java/android/view/GLES20RecordingCanvas.java
index 97efa18..b7b6883 100644
--- a/core/java/android/view/GLES20RecordingCanvas.java
+++ b/core/java/android/view/GLES20RecordingCanvas.java
@@ -58,7 +58,7 @@
mDisplayList.clearReferences();
}
- int end(int nativeDisplayList) {
+ long end(long nativeDisplayList) {
return getDisplayList(nativeDisplayList);
}
diff --git a/core/java/android/view/GLRenderer.java b/core/java/android/view/GLRenderer.java
index 1811111..449bad6 100644
--- a/core/java/android/view/GLRenderer.java
+++ b/core/java/android/view/GLRenderer.java
@@ -1406,22 +1406,20 @@
}
@Override
- void detachFunctor(int functor) {
+ void detachFunctor(long functor) {
if (mCanvas != null) {
mCanvas.detachFunctor(functor);
}
}
@Override
- boolean attachFunctor(View.AttachInfo attachInfo, int functor) {
+ void attachFunctor(View.AttachInfo attachInfo, long functor) {
if (mCanvas != null) {
mCanvas.attachFunctor(functor);
mFunctorsRunnable.attachInfo = attachInfo;
attachInfo.mHandler.removeCallbacks(mFunctorsRunnable);
attachInfo.mHandler.postDelayed(mFunctorsRunnable, 0);
- return true;
}
- return false;
}
/**
diff --git a/core/java/android/view/GraphicBuffer.java b/core/java/android/view/GraphicBuffer.java
index 30c077c..5f2a9cd 100644
--- a/core/java/android/view/GraphicBuffer.java
+++ b/core/java/android/view/GraphicBuffer.java
@@ -56,7 +56,7 @@
private final int mFormat;
private final int mUsage;
// Note: do not rename, this field is used by native code
- private final int mNativeObject;
+ private final long mNativeObject;
// These two fields are only used by lock/unlockCanvas()
private Canvas mCanvas;
@@ -77,7 +77,7 @@
* @return A <code>GraphicBuffer</code> instance or null
*/
public static GraphicBuffer create(int width, int height, int format, int usage) {
- int nativeObject = nCreateGraphicBuffer(width, height, format, usage);
+ long nativeObject = nCreateGraphicBuffer(width, height, format, usage);
if (nativeObject != 0) {
return new GraphicBuffer(width, height, format, usage, nativeObject);
}
@@ -87,7 +87,7 @@
/**
* Private use only. See {@link #create(int, int, int, int)}.
*/
- private GraphicBuffer(int width, int height, int format, int usage, int nativeObject) {
+ private GraphicBuffer(int width, int height, int format, int usage, long nativeObject) {
mWidth = width;
mHeight = height;
mFormat = format;
@@ -271,7 +271,7 @@
int height = in.readInt();
int format = in.readInt();
int usage = in.readInt();
- int nativeObject = nReadGraphicBufferFromParcel(in);
+ long nativeObject = nReadGraphicBufferFromParcel(in);
if (nativeObject != 0) {
return new GraphicBuffer(width, height, format, usage, nativeObject);
}
@@ -283,10 +283,10 @@
}
};
- private static native int nCreateGraphicBuffer(int width, int height, int format, int usage);
- private static native void nDestroyGraphicBuffer(int nativeObject);
- private static native void nWriteGraphicBufferToParcel(int nativeObject, Parcel dest);
- private static native int nReadGraphicBufferFromParcel(Parcel in);
- private static native boolean nLockCanvas(int nativeObject, Canvas canvas, Rect dirty);
- private static native boolean nUnlockCanvasAndPost(int nativeObject, Canvas canvas);
+ private static native long nCreateGraphicBuffer(int width, int height, int format, int usage);
+ private static native void nDestroyGraphicBuffer(long nativeObject);
+ private static native void nWriteGraphicBufferToParcel(long nativeObject, Parcel dest);
+ private static native long nReadGraphicBufferFromParcel(Parcel in);
+ private static native boolean nLockCanvas(long nativeObject, Canvas canvas, Rect dirty);
+ private static native boolean nUnlockCanvasAndPost(long nativeObject, Canvas canvas);
}
diff --git a/core/java/android/view/HardwareCanvas.java b/core/java/android/view/HardwareCanvas.java
index 2e972c5..a3c7b63 100644
--- a/core/java/android/view/HardwareCanvas.java
+++ b/core/java/android/view/HardwareCanvas.java
@@ -107,7 +107,7 @@
*
* @hide
*/
- public int callDrawGLFunction(int drawGLFunction) {
+ public int callDrawGLFunction(long drawGLFunction) {
// Noop - this is done in the display list recorder subclass
return DisplayList.STATUS_DONE;
}
@@ -132,12 +132,12 @@
* @param functor The native functor to remove from the execution queue.
*
* @see #invokeFunctors(android.graphics.Rect)
- * @see #callDrawGLFunction(int)
- * @see #detachFunctor(int)
+ * @see #callDrawGLFunction(long)
+ * @see #detachFunctor(long)
*
* @hide
*/
- abstract void detachFunctor(int functor);
+ abstract void detachFunctor(long functor);
/**
* Attaches the specified functor to the current functor execution queue.
@@ -145,12 +145,12 @@
* @param functor The native functor to add to the execution queue.
*
* @see #invokeFunctors(android.graphics.Rect)
- * @see #callDrawGLFunction(int)
- * @see #detachFunctor(int)
+ * @see #callDrawGLFunction(long)
+ * @see #detachFunctor(long)
*
* @hide
*/
- abstract void attachFunctor(int functor);
+ abstract void attachFunctor(long functor);
/**
* Indicates that the specified layer must be updated as soon as possible.
diff --git a/core/java/android/view/HardwareRenderer.java b/core/java/android/view/HardwareRenderer.java
index ac728f1..2013494 100644
--- a/core/java/android/view/HardwareRenderer.java
+++ b/core/java/android/view/HardwareRenderer.java
@@ -453,9 +453,9 @@
* @param functor The native functor to remove from the execution queue.
*
* @see HardwareCanvas#callDrawGLFunction(int)
- * @see #attachFunctor(android.view.View.AttachInfo, int)
+ * @see #attachFunctor(android.view.View.AttachInfo, long)
*/
- abstract void detachFunctor(int functor);
+ abstract void detachFunctor(long functor);
/**
* Schedules the specified functor in the functors execution queue.
@@ -464,11 +464,10 @@
* @param functor The native functor to insert in the execution queue.
*
* @see HardwareCanvas#callDrawGLFunction(int)
- * @see #detachFunctor(int)
+ * @see #detachFunctor(long)
*
- * @return true if the functor was attached successfully
*/
- abstract boolean attachFunctor(View.AttachInfo attachInfo, int functor);
+ abstract void attachFunctor(View.AttachInfo attachInfo, long functor);
/**
* Initializes the hardware renderer for the specified surface and setup the
diff --git a/core/java/android/view/RemoteGLRenderer.java b/core/java/android/view/RemoteGLRenderer.java
deleted file mode 100644
index 2919775..0000000
--- a/core/java/android/view/RemoteGLRenderer.java
+++ /dev/null
@@ -1,1074 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.view;
-
-import android.graphics.Color;
-import android.graphics.Paint;
-import android.graphics.Rect;
-import android.graphics.SurfaceTexture;
-import android.os.IBinder;
-import android.os.RemoteException;
-import android.os.ServiceManager;
-import android.os.SystemProperties;
-import android.os.Trace;
-import android.util.DisplayMetrics;
-import android.util.Log;
-import android.view.Surface.OutOfResourcesException;
-
-import java.io.PrintWriter;
-import java.util.concurrent.locks.ReentrantLock;
-
-/**
- * Hardware renderer using OpenGL that's used as the remote endpoint
- * of ThreadedRenderer
- *
- * Currently this is mostly a copy of GLRenderer, but with a few modifications
- * to deal with the threading issues. Ideally native-side functionality
- * will replace this, but we need this to bootstrap without risking breaking
- * changes in GLRenderer
- *
- * @hide
- */
-public class RemoteGLRenderer extends HardwareRenderer {
- static final int SURFACE_STATE_ERROR = 0;
- static final int SURFACE_STATE_SUCCESS = 1;
- static final int SURFACE_STATE_UPDATED = 2;
-
- static final int FUNCTOR_PROCESS_DELAY = 4;
-
- /**
- * Number of frames to profile.
- */
- private static final int PROFILE_MAX_FRAMES = 128;
-
- /**
- * Number of floats per profiled frame.
- */
- private static final int PROFILE_FRAME_DATA_COUNT = 3;
-
- private static final int PROFILE_DRAW_MARGIN = 0;
- private static final int PROFILE_DRAW_WIDTH = 3;
- private static final int[] PROFILE_DRAW_COLORS = { 0xcf3e66cc, 0xcfdc3912, 0xcfe69800 };
- private static final int PROFILE_DRAW_CURRENT_FRAME_COLOR = 0xcf5faa4d;
- private static final int PROFILE_DRAW_THRESHOLD_COLOR = 0xff5faa4d;
- private static final int PROFILE_DRAW_THRESHOLD_STROKE_WIDTH = 2;
- private static final int PROFILE_DRAW_DP_PER_MS = 7;
-
- private static final String[] VISUALIZERS = {
- PROFILE_PROPERTY_VISUALIZE_BARS,
- PROFILE_PROPERTY_VISUALIZE_LINES
- };
-
- private static final String[] OVERDRAW = {
- OVERDRAW_PROPERTY_SHOW,
- OVERDRAW_PROPERTY_COUNT
- };
- private static final int OVERDRAW_TYPE_COUNT = 1;
- private static final int GL_VERSION = 2;
-
- int mWidth = -1, mHeight = -1;
-
- HardwareCanvas mCanvas;
-
- String mName;
-
- long mFrameCount;
- Paint mDebugPaint;
-
- boolean mDirtyRegionsEnabled;
- boolean mSurfaceUpdated;
-
- boolean mProfileEnabled;
- int mProfileVisualizerType = -1;
- float[] mProfileData;
- ReentrantLock mProfileLock;
- int mProfileCurrentFrame = -PROFILE_FRAME_DATA_COUNT;
-
- GraphDataProvider mDebugDataProvider;
- float[][] mProfileShapes;
- Paint mProfilePaint;
-
- boolean mDebugDirtyRegions;
- int mDebugOverdraw = -1;
- HardwareLayer mDebugOverdrawLayer;
- Paint mDebugOverdrawPaint;
-
- final boolean mTranslucent;
-
- private final Rect mRedrawClip = new Rect();
-
- private final int[] mSurfaceSize = new int[2];
- private final FunctorsRunnable mFunctorsRunnable = new FunctorsRunnable();
-
- private long mDrawDelta = Long.MAX_VALUE;
-
- private GLES20Canvas mGlCanvas;
-
- private DisplayMetrics mDisplayMetrics;
- private ThreadedRenderer mOwningRenderer;
- private long mNativeCanvasContext;
-
- HardwareCanvas createCanvas() {
- return mGlCanvas = new GLES20Canvas(mTranslucent);
- }
-
- void initCaches() {
- if (GLES20Canvas.initCaches()) {
- // Caches were (re)initialized, rebind atlas
- initAtlas();
- }
- }
-
- void initAtlas() {
- IBinder binder = ServiceManager.getService("assetatlas");
- if (binder == null) return;
-
- IAssetAtlas atlas = IAssetAtlas.Stub.asInterface(binder);
- try {
- if (atlas.isCompatible(android.os.Process.myPpid())) {
- GraphicBuffer buffer = atlas.getBuffer();
- if (buffer != null) {
- int[] map = atlas.getMap();
- if (map != null) {
- GLES20Canvas.initAtlas(buffer, map);
- }
- // If IAssetAtlas is not the same class as the IBinder
- // we are using a remote service and we can safely
- // destroy the graphic buffer
- if (atlas.getClass() != binder.getClass()) {
- buffer.destroy();
- }
- }
- }
- } catch (RemoteException e) {
- Log.w(LOG_TAG, "Could not acquire atlas", e);
- }
- }
-
- boolean canDraw() {
- return mCanvas != null && mGlCanvas != null;
- }
-
- int onPreDraw(Rect dirty) {
- return mGlCanvas.onPreDraw(dirty);
- }
-
- void onPostDraw() {
- mGlCanvas.onPostDraw();
- }
-
- void drawProfileData(View.AttachInfo attachInfo) {
- if (mDebugDataProvider != null) {
- final GraphDataProvider provider = mDebugDataProvider;
- initProfileDrawData(attachInfo, provider);
-
- final int height = provider.getVerticalUnitSize();
- final int margin = provider.getHorizontaUnitMargin();
- final int width = provider.getHorizontalUnitSize();
-
- int x = 0;
- int count = 0;
- int current = 0;
-
- final float[] data = provider.getData();
- final int elementCount = provider.getElementCount();
- final int graphType = provider.getGraphType();
-
- int totalCount = provider.getFrameCount() * elementCount;
- if (graphType == GraphDataProvider.GRAPH_TYPE_LINES) {
- totalCount -= elementCount;
- }
-
- for (int i = 0; i < totalCount; i += elementCount) {
- if (data[i] < 0.0f) break;
-
- int index = count * 4;
- if (i == provider.getCurrentFrame() * elementCount) current = index;
-
- x += margin;
- int x2 = x + width;
-
- int y2 = mHeight;
- int y1 = (int) (y2 - data[i] * height);
-
- switch (graphType) {
- case GraphDataProvider.GRAPH_TYPE_BARS: {
- for (int j = 0; j < elementCount; j++) {
- //noinspection MismatchedReadAndWriteOfArray
- final float[] r = mProfileShapes[j];
- r[index] = x;
- r[index + 1] = y1;
- r[index + 2] = x2;
- r[index + 3] = y2;
-
- y2 = y1;
- if (j < elementCount - 1) {
- y1 = (int) (y2 - data[i + j + 1] * height);
- }
- }
- } break;
- case GraphDataProvider.GRAPH_TYPE_LINES: {
- for (int j = 0; j < elementCount; j++) {
- //noinspection MismatchedReadAndWriteOfArray
- final float[] r = mProfileShapes[j];
- r[index] = (x + x2) * 0.5f;
- r[index + 1] = index == 0 ? y1 : r[index - 1];
- r[index + 2] = r[index] + width;
- r[index + 3] = y1;
-
- y2 = y1;
- if (j < elementCount - 1) {
- y1 = (int) (y2 - data[i + j + 1] * height);
- }
- }
- } break;
- }
-
-
- x += width;
- count++;
- }
-
- x += margin;
-
- drawGraph(graphType, count);
- drawCurrentFrame(graphType, current);
- drawThreshold(x, height);
- }
- }
-
- private void drawGraph(int graphType, int count) {
- for (int i = 0; i < mProfileShapes.length; i++) {
- mDebugDataProvider.setupGraphPaint(mProfilePaint, i);
- switch (graphType) {
- case GraphDataProvider.GRAPH_TYPE_BARS:
- mGlCanvas.drawRects(mProfileShapes[i], count * 4, mProfilePaint);
- break;
- case GraphDataProvider.GRAPH_TYPE_LINES:
- mGlCanvas.drawLines(mProfileShapes[i], 0, count * 4, mProfilePaint);
- break;
- }
- }
- }
-
- private void drawCurrentFrame(int graphType, int index) {
- if (index >= 0) {
- mDebugDataProvider.setupCurrentFramePaint(mProfilePaint);
- switch (graphType) {
- case GraphDataProvider.GRAPH_TYPE_BARS:
- mGlCanvas.drawRect(mProfileShapes[2][index], mProfileShapes[2][index + 1],
- mProfileShapes[2][index + 2], mProfileShapes[0][index + 3],
- mProfilePaint);
- break;
- case GraphDataProvider.GRAPH_TYPE_LINES:
- mGlCanvas.drawLine(mProfileShapes[2][index], mProfileShapes[2][index + 1],
- mProfileShapes[2][index], mHeight, mProfilePaint);
- break;
- }
- }
- }
-
- private void drawThreshold(int x, int height) {
- float threshold = mDebugDataProvider.getThreshold();
- if (threshold > 0.0f) {
- mDebugDataProvider.setupThresholdPaint(mProfilePaint);
- int y = (int) (mHeight - threshold * height);
- mGlCanvas.drawLine(0.0f, y, x, y, mProfilePaint);
- }
- }
-
- private void initProfileDrawData(View.AttachInfo attachInfo, GraphDataProvider provider) {
- if (mProfileShapes == null) {
- final int elementCount = provider.getElementCount();
- final int frameCount = provider.getFrameCount();
-
- mProfileShapes = new float[elementCount][];
- for (int i = 0; i < elementCount; i++) {
- mProfileShapes[i] = new float[frameCount * 4];
- }
-
- mProfilePaint = new Paint();
- }
-
- mProfilePaint.reset();
- if (provider.getGraphType() == GraphDataProvider.GRAPH_TYPE_LINES) {
- mProfilePaint.setAntiAlias(true);
- }
-
- if (mDisplayMetrics == null) {
- mDisplayMetrics = new DisplayMetrics();
- }
-
- attachInfo.mDisplay.getMetrics(mDisplayMetrics);
- provider.prepare(mDisplayMetrics);
- }
-
- @Override
- void destroy(boolean full) {
- try {
- if (full && mCanvas != null) {
- mCanvas = null;
- }
- if (mNativeCanvasContext != 0) {
- destroyContext(mNativeCanvasContext);
- mNativeCanvasContext = 0;
- }
- setEnabled(false);
- } finally {
- if (full && mGlCanvas != null) {
- mGlCanvas = null;
- }
- }
- }
-
- @Override
- void pushLayerUpdate(HardwareLayer layer) {
- mGlCanvas.pushLayerUpdate(layer);
- }
-
- @Override
- void cancelLayerUpdate(HardwareLayer layer) {
- mGlCanvas.cancelLayerUpdate(layer);
- }
-
- @Override
- void flushLayerUpdates() {
- mGlCanvas.flushLayerUpdates();
- }
-
- @Override
- HardwareLayer createHardwareLayer(boolean isOpaque) {
- return new GLES20TextureLayer(isOpaque);
- }
-
- @Override
- public HardwareLayer createHardwareLayer(int width, int height, boolean isOpaque) {
- return new GLES20RenderLayer(width, height, isOpaque);
- }
-
- void countOverdraw(HardwareCanvas canvas) {
- ((GLES20Canvas) canvas).setCountOverdrawEnabled(true);
- }
-
- float getOverdraw(HardwareCanvas canvas) {
- return ((GLES20Canvas) canvas).getOverdraw();
- }
-
- @Override
- public SurfaceTexture createSurfaceTexture(HardwareLayer layer) {
- return ((GLES20TextureLayer) layer).getSurfaceTexture();
- }
-
- @Override
- void setSurfaceTexture(HardwareLayer layer, SurfaceTexture surfaceTexture) {
- ((GLES20TextureLayer) layer).setSurfaceTexture(surfaceTexture);
- }
-
- @Override
- boolean safelyRun(Runnable action) {
- boolean needsContext = !isEnabled() || checkRenderContext() == SURFACE_STATE_ERROR;
-
- if (needsContext) {
- if (!usePBufferSurface()) {
- return false;
- }
- }
-
- action.run();
-
- return true;
- }
-
- @Override
- void destroyLayers(final View view) {
- if (view != null) {
- safelyRun(new Runnable() {
- @Override
- public void run() {
- if (mCanvas != null) {
- mCanvas.clearLayerUpdates();
- }
- destroyHardwareLayer(view);
- GLES20Canvas.flushCaches(GLES20Canvas.FLUSH_CACHES_LAYERS);
- }
- });
- }
- }
-
- private static void destroyHardwareLayer(View view) {
- view.destroyLayer(true);
-
- if (view instanceof ViewGroup) {
- ViewGroup group = (ViewGroup) view;
-
- int count = group.getChildCount();
- for (int i = 0; i < count; i++) {
- destroyHardwareLayer(group.getChildAt(i));
- }
- }
- }
-
- @Override
- void destroyHardwareResources(final View view) {
- if (view != null) {
- safelyRun(new Runnable() {
- @Override
- public void run() {
- if (mCanvas != null) {
- mCanvas.clearLayerUpdates();
- }
- destroyResources(view);
- GLES20Canvas.flushCaches(GLES20Canvas.FLUSH_CACHES_LAYERS);
- }
- });
- }
- }
-
- private static void destroyResources(View view) {
- view.destroyHardwareResources();
-
- if (view instanceof ViewGroup) {
- ViewGroup group = (ViewGroup) view;
-
- int count = group.getChildCount();
- for (int i = 0; i < count; i++) {
- destroyResources(group.getChildAt(i));
- }
- }
- }
-
- RemoteGLRenderer(ThreadedRenderer owningRenderer, boolean translucent) {
- mOwningRenderer = owningRenderer;
- mTranslucent = translucent;
-
- loadSystemProperties();
- }
-
- @Override
- boolean loadSystemProperties() {
- boolean value;
- boolean changed = false;
-
- String profiling = SystemProperties.get(PROFILE_PROPERTY);
- int graphType = search(VISUALIZERS, profiling);
- value = graphType >= 0;
-
- if (graphType != mProfileVisualizerType) {
- changed = true;
- mProfileVisualizerType = graphType;
-
- mProfileShapes = null;
- mProfilePaint = null;
-
- if (value) {
- mDebugDataProvider = new DrawPerformanceDataProvider(graphType);
- } else {
- mDebugDataProvider = null;
- }
- }
-
- // If on-screen profiling is not enabled, we need to check whether
- // console profiling only is enabled
- if (!value) {
- value = Boolean.parseBoolean(profiling);
- }
-
- if (value != mProfileEnabled) {
- changed = true;
- mProfileEnabled = value;
-
- if (mProfileEnabled) {
- Log.d(LOG_TAG, "Profiling hardware renderer");
-
- int maxProfileFrames = SystemProperties.getInt(PROFILE_MAXFRAMES_PROPERTY,
- PROFILE_MAX_FRAMES);
- mProfileData = new float[maxProfileFrames * PROFILE_FRAME_DATA_COUNT];
- for (int i = 0; i < mProfileData.length; i += PROFILE_FRAME_DATA_COUNT) {
- mProfileData[i] = mProfileData[i + 1] = mProfileData[i + 2] = -1;
- }
-
- mProfileLock = new ReentrantLock();
- } else {
- mProfileData = null;
- mProfileLock = null;
- mProfileVisualizerType = -1;
- }
-
- mProfileCurrentFrame = -PROFILE_FRAME_DATA_COUNT;
- }
-
- value = SystemProperties.getBoolean(DEBUG_DIRTY_REGIONS_PROPERTY, false);
- if (value != mDebugDirtyRegions) {
- changed = true;
- mDebugDirtyRegions = value;
-
- if (mDebugDirtyRegions) {
- Log.d(LOG_TAG, "Debugging dirty regions");
- }
- }
-
- String overdraw = SystemProperties.get(HardwareRenderer.DEBUG_OVERDRAW_PROPERTY);
- int debugOverdraw = search(OVERDRAW, overdraw);
- if (debugOverdraw != mDebugOverdraw) {
- changed = true;
- mDebugOverdraw = debugOverdraw;
-
- if (mDebugOverdraw != OVERDRAW_TYPE_COUNT) {
- if (mDebugOverdrawLayer != null) {
- mDebugOverdrawLayer.destroy();
- mDebugOverdrawLayer = null;
- mDebugOverdrawPaint = null;
- }
- }
- }
-
- if (GLRenderer.loadProperties()) {
- changed = true;
- }
-
- return changed;
- }
-
- private static int search(String[] values, String value) {
- for (int i = 0; i < values.length; i++) {
- if (values[i].equals(value)) return i;
- }
- return -1;
- }
-
- @Override
- void dumpGfxInfo(PrintWriter pw) {
- if (mProfileEnabled) {
- pw.printf("\n\tDraw\tProcess\tExecute\n");
-
- mProfileLock.lock();
- try {
- for (int i = 0; i < mProfileData.length; i += PROFILE_FRAME_DATA_COUNT) {
- if (mProfileData[i] < 0) {
- break;
- }
- pw.printf("\t%3.2f\t%3.2f\t%3.2f\n", mProfileData[i], mProfileData[i + 1],
- mProfileData[i + 2]);
- mProfileData[i] = mProfileData[i + 1] = mProfileData[i + 2] = -1;
- }
- mProfileCurrentFrame = mProfileData.length;
- } finally {
- mProfileLock.unlock();
- }
- }
- }
-
- @Override
- long getFrameCount() {
- return mFrameCount;
- }
-
- /**
- * Indicates whether this renderer instance can track and update dirty regions.
- */
- boolean hasDirtyRegions() {
- return mDirtyRegionsEnabled;
- }
-
- private void triggerSoftwareFallback() {
- destroy(true);
- // we'll try again if it was context lost
- setRequested(false);
- Log.w(LOG_TAG, "Mountain View, we've had a problem here. "
- + "Switching back to software rendering.");
- }
-
- @Override
- boolean initialize(Surface surface) throws OutOfResourcesException {
- if (isRequested() && !isEnabled()) {
- mNativeCanvasContext = createContext();
- boolean surfaceCreated = createEglSurface(surface);
-
- if (surfaceCreated) {
- if (mCanvas == null) {
- mCanvas = createCanvas();
- }
- setEnabled(true);
- initAtlas();
- return true;
- } else {
- destroy(true);
- setRequested(false);
- }
- }
- return false;
- }
-
- @Override
- void updateSurface(Surface surface) throws OutOfResourcesException {
- if (isRequested() && isEnabled()) {
- createEglSurface(surface);
- }
- }
-
- boolean createEglSurface(Surface surface) throws OutOfResourcesException {
- // Create an EGL surface we can render into.
- if (!setSurface(mNativeCanvasContext, surface)) {
- return false;
- }
- makeCurrent(mNativeCanvasContext);
- mSurfaceUpdated = true;
-
- initCaches();
- return true;
- }
-
- @Override
- void invalidate(Surface surface) {
- setSurface(mNativeCanvasContext, null);
- setEnabled(false);
-
- if (surface.isValid()) {
- if (createEglSurface(surface) && mCanvas != null) {
- setEnabled(true);
- }
- }
- }
-
- @Override
- boolean validate() {
- return checkRenderContext() != SURFACE_STATE_ERROR;
- }
-
- @Override
- void setup(int width, int height) {
- if (validate()) {
- mCanvas.setViewport(width, height);
- mWidth = width;
- mHeight = height;
- }
- }
-
- @Override
- int getWidth() {
- return mWidth;
- }
-
- @Override
- int getHeight() {
- return mHeight;
- }
-
- @Override
- void setName(String name) {
- mName = name;
- }
-
- // TODO: Ping pong is fun and all, but this isn't the time or place
- // However we don't yet have the ability for the RenderThread to run
- // independently nor have a way to postDelayed, so this will work for now
- private Runnable mDispatchFunctorsRunnable = new Runnable() {
- @Override
- public void run() {
- ThreadedRenderer.postToRenderThread(mFunctorsRunnable);
- }
- };
-
- class FunctorsRunnable implements Runnable {
- View.AttachInfo attachInfo;
-
- @Override
- public void run() {
- final HardwareRenderer renderer = attachInfo.mHardwareRenderer;
- if (renderer == null || !renderer.isEnabled() || renderer != mOwningRenderer) {
- return;
- }
-
- if (checkRenderContext() != SURFACE_STATE_ERROR) {
- int status = mCanvas.invokeFunctors(mRedrawClip);
- handleFunctorStatus(attachInfo, status);
- }
- }
- }
-
- /**
- * @param displayList The display list to draw
- * @param attachInfo AttachInfo tied to the specified view.
- * @param callbacks Callbacks invoked when drawing happens.
- * @param dirty The dirty rectangle to update, can be null.
- */
- void drawDisplayList(DisplayList displayList, View.AttachInfo attachInfo,
- HardwareDrawCallbacks callbacks, Rect dirty) {
- if (canDraw()) {
- if (!hasDirtyRegions()) {
- dirty = null;
- }
-
- final int surfaceState = checkRenderContext();
- if (surfaceState != SURFACE_STATE_ERROR) {
- HardwareCanvas canvas = mCanvas;
-
- if (mProfileEnabled) {
- mProfileLock.lock();
- }
-
- dirty = beginFrame(canvas, dirty, surfaceState);
-
- int saveCount = 0;
- int status = DisplayList.STATUS_DONE;
-
- long start = GLRenderer.getSystemTime();
- try {
- status = prepareFrame(dirty);
-
- saveCount = canvas.save();
- callbacks.onHardwarePreDraw(canvas);
-
- status |= doDrawDisplayList(attachInfo, canvas, displayList, status);
- } catch (Exception e) {
- Log.e(LOG_TAG, "An error has occurred while drawing:", e);
- } finally {
- callbacks.onHardwarePostDraw(canvas);
- canvas.restoreToCount(saveCount);
-
- mDrawDelta = GLRenderer.getSystemTime() - start;
-
- if (mDrawDelta > 0) {
- mFrameCount++;
-
- debugOverdraw(attachInfo, dirty, canvas, displayList);
- debugDirtyRegions(dirty, canvas);
- drawProfileData(attachInfo);
- }
- }
-
- onPostDraw();
-
- swapBuffers(status);
-
- if (mProfileEnabled) {
- mProfileLock.unlock();
- }
-
- attachInfo.mIgnoreDirtyState = false;
- }
- }
- }
-
- @Override
- void draw(View view, View.AttachInfo attachInfo, HardwareDrawCallbacks callbacks,
- Rect dirty) {
- throw new IllegalAccessError();
- }
-
- private void debugOverdraw(View.AttachInfo attachInfo, Rect dirty,
- HardwareCanvas canvas, DisplayList displayList) {
-
- if (mDebugOverdraw == OVERDRAW_TYPE_COUNT) {
- if (mDebugOverdrawLayer == null) {
- mDebugOverdrawLayer = createHardwareLayer(mWidth, mHeight, true);
- } else if (mDebugOverdrawLayer.getWidth() != mWidth ||
- mDebugOverdrawLayer.getHeight() != mHeight) {
- mDebugOverdrawLayer.resize(mWidth, mHeight);
- }
-
- if (!mDebugOverdrawLayer.isValid()) {
- mDebugOverdraw = -1;
- return;
- }
-
- HardwareCanvas layerCanvas = mDebugOverdrawLayer.start(canvas, dirty);
- countOverdraw(layerCanvas);
- final int restoreCount = layerCanvas.save();
- layerCanvas.drawDisplayList(displayList, null, DisplayList.FLAG_CLIP_CHILDREN);
- layerCanvas.restoreToCount(restoreCount);
- mDebugOverdrawLayer.end(canvas);
-
- float overdraw = getOverdraw(layerCanvas);
- DisplayMetrics metrics = attachInfo.mRootView.getResources().getDisplayMetrics();
-
- drawOverdrawCounter(canvas, overdraw, metrics.density);
- }
- }
-
- private void drawOverdrawCounter(HardwareCanvas canvas, float overdraw, float density) {
- final String text = String.format("%.2fx", overdraw);
- final Paint paint = setupPaint(density);
- // HSBtoColor will clamp the values in the 0..1 range
- paint.setColor(Color.HSBtoColor(0.28f - 0.28f * overdraw / 3.5f, 0.8f, 1.0f));
-
- canvas.drawText(text, density * 4.0f, mHeight - paint.getFontMetrics().bottom, paint);
- }
-
- private Paint setupPaint(float density) {
- if (mDebugOverdrawPaint == null) {
- mDebugOverdrawPaint = new Paint();
- mDebugOverdrawPaint.setAntiAlias(true);
- mDebugOverdrawPaint.setShadowLayer(density * 3.0f, 0.0f, 0.0f, 0xff000000);
- mDebugOverdrawPaint.setTextSize(density * 20.0f);
- }
- return mDebugOverdrawPaint;
- }
-
- private Rect beginFrame(HardwareCanvas canvas, Rect dirty, int surfaceState) {
- // We had to change the current surface and/or context, redraw everything
- if (surfaceState == SURFACE_STATE_UPDATED) {
- dirty = null;
- GLRenderer.beginFrame(null);
- } else {
- int[] size = mSurfaceSize;
- GLRenderer.beginFrame(size);
-
- if (size[1] != mHeight || size[0] != mWidth) {
- mWidth = size[0];
- mHeight = size[1];
-
- canvas.setViewport(mWidth, mHeight);
-
- dirty = null;
- }
- }
-
- if (mDebugDataProvider != null) dirty = null;
-
- return dirty;
- }
-
- private int prepareFrame(Rect dirty) {
- int status;
- Trace.traceBegin(Trace.TRACE_TAG_VIEW, "prepareFrame");
- try {
- status = onPreDraw(dirty);
- } finally {
- Trace.traceEnd(Trace.TRACE_TAG_VIEW);
- }
- return status;
- }
-
- private int doDrawDisplayList(View.AttachInfo attachInfo, HardwareCanvas canvas,
- DisplayList displayList, int status) {
-
- long drawDisplayListStartTime = 0;
- if (mProfileEnabled) {
- drawDisplayListStartTime = System.nanoTime();
- }
-
- Trace.traceBegin(Trace.TRACE_TAG_VIEW, "drawDisplayList");
- try {
- status |= canvas.drawDisplayList(displayList, mRedrawClip,
- DisplayList.FLAG_CLIP_CHILDREN);
- } finally {
- Trace.traceEnd(Trace.TRACE_TAG_VIEW);
- }
-
- if (mProfileEnabled) {
- long now = System.nanoTime();
- float total = (now - drawDisplayListStartTime) * 0.000001f;
- mProfileData[mProfileCurrentFrame + 1] = total;
- }
-
- handleFunctorStatus(attachInfo, status);
- return status;
- }
-
- private void swapBuffers(int status) {
- if ((status & DisplayList.STATUS_DREW) == DisplayList.STATUS_DREW) {
- long eglSwapBuffersStartTime = 0;
- if (mProfileEnabled) {
- eglSwapBuffersStartTime = System.nanoTime();
- }
-
- if (!swapBuffers(mNativeCanvasContext)) {
- triggerSoftwareFallback();
- }
- mSurfaceUpdated = false;
-
- if (mProfileEnabled) {
- long now = System.nanoTime();
- float total = (now - eglSwapBuffersStartTime) * 0.000001f;
- mProfileData[mProfileCurrentFrame + 2] = total;
- }
- }
- }
-
- private void debugDirtyRegions(Rect dirty, HardwareCanvas canvas) {
- if (mDebugDirtyRegions) {
- if (mDebugPaint == null) {
- mDebugPaint = new Paint();
- mDebugPaint.setColor(0x7fff0000);
- }
-
- if (dirty != null && (mFrameCount & 1) == 0) {
- canvas.drawRect(dirty, mDebugPaint);
- }
- }
- }
-
- private void handleFunctorStatus(final View.AttachInfo attachInfo, int status) {
- // If the draw flag is set, functors will be invoked while executing
- // the tree of display lists
- if ((status & DisplayList.STATUS_DRAW) != 0) {
- // TODO: Can we just re-queue ourselves up to draw next frame instead
- // of bouncing back to the UI thread?
- // TODO: Respect mRedrawClip - for now just full inval
- attachInfo.mHandler.post(new Runnable() {
- @Override
- public void run() {
- attachInfo.mViewRootImpl.invalidate();
- }
- });
- mRedrawClip.setEmpty();
- }
-
- if ((status & DisplayList.STATUS_INVOKE) != 0 ||
- attachInfo.mHandler.hasCallbacks(mDispatchFunctorsRunnable)) {
- attachInfo.mHandler.removeCallbacks(mDispatchFunctorsRunnable);
- mFunctorsRunnable.attachInfo = attachInfo;
- attachInfo.mHandler.postDelayed(mDispatchFunctorsRunnable, FUNCTOR_PROCESS_DELAY);
- }
- }
-
- @Override
- void detachFunctor(int functor) {
- if (mCanvas != null) {
- mCanvas.detachFunctor(functor);
- }
- }
-
- @Override
- boolean attachFunctor(View.AttachInfo attachInfo, int functor) {
- if (mCanvas != null) {
- mCanvas.attachFunctor(functor);
- mFunctorsRunnable.attachInfo = attachInfo;
- attachInfo.mHandler.removeCallbacks(mDispatchFunctorsRunnable);
- attachInfo.mHandler.postDelayed(mDispatchFunctorsRunnable, 0);
- return true;
- }
- return false;
- }
-
- /**
- * Ensures the current EGL context and surface are the ones we expect.
- * This method throws an IllegalStateException if invoked from a thread
- * that did not initialize EGL.
- *
- * @return {@link #SURFACE_STATE_ERROR} if the correct EGL context cannot be made current,
- * {@link #SURFACE_STATE_UPDATED} if the EGL context was changed or
- * {@link #SURFACE_STATE_SUCCESS} if the EGL context was the correct one
- *
- * @see #checkRenderContextUnsafe()
- */
- int checkRenderContext() {
- if (!makeCurrent(mNativeCanvasContext)) {
- triggerSoftwareFallback();
- return SURFACE_STATE_ERROR;
- }
- return mSurfaceUpdated ? SURFACE_STATE_UPDATED : SURFACE_STATE_SUCCESS;
- }
-
- private static int dpToPx(int dp, float density) {
- return (int) (dp * density + 0.5f);
- }
-
- class DrawPerformanceDataProvider extends GraphDataProvider {
- private final int mGraphType;
-
- private int mVerticalUnit;
- private int mHorizontalUnit;
- private int mHorizontalMargin;
- private int mThresholdStroke;
-
- DrawPerformanceDataProvider(int graphType) {
- mGraphType = graphType;
- }
-
- @Override
- void prepare(DisplayMetrics metrics) {
- final float density = metrics.density;
-
- mVerticalUnit = dpToPx(PROFILE_DRAW_DP_PER_MS, density);
- mHorizontalUnit = dpToPx(PROFILE_DRAW_WIDTH, density);
- mHorizontalMargin = dpToPx(PROFILE_DRAW_MARGIN, density);
- mThresholdStroke = dpToPx(PROFILE_DRAW_THRESHOLD_STROKE_WIDTH, density);
- }
-
- @Override
- int getGraphType() {
- return mGraphType;
- }
-
- @Override
- int getVerticalUnitSize() {
- return mVerticalUnit;
- }
-
- @Override
- int getHorizontalUnitSize() {
- return mHorizontalUnit;
- }
-
- @Override
- int getHorizontaUnitMargin() {
- return mHorizontalMargin;
- }
-
- @Override
- float[] getData() {
- return mProfileData;
- }
-
- @Override
- float getThreshold() {
- return 16;
- }
-
- @Override
- int getFrameCount() {
- return mProfileData.length / PROFILE_FRAME_DATA_COUNT;
- }
-
- @Override
- int getElementCount() {
- return PROFILE_FRAME_DATA_COUNT;
- }
-
- @Override
- int getCurrentFrame() {
- return mProfileCurrentFrame / PROFILE_FRAME_DATA_COUNT;
- }
-
- @Override
- void setupGraphPaint(Paint paint, int elementIndex) {
- paint.setColor(PROFILE_DRAW_COLORS[elementIndex]);
- if (mGraphType == GRAPH_TYPE_LINES) paint.setStrokeWidth(mThresholdStroke);
- }
-
- @Override
- void setupThresholdPaint(Paint paint) {
- paint.setColor(PROFILE_DRAW_THRESHOLD_COLOR);
- paint.setStrokeWidth(mThresholdStroke);
- }
-
- @Override
- void setupCurrentFramePaint(Paint paint) {
- paint.setColor(PROFILE_DRAW_CURRENT_FRAME_COLOR);
- if (mGraphType == GRAPH_TYPE_LINES) paint.setStrokeWidth(mThresholdStroke);
- }
- }
-
- static native long createContext();
- static native boolean usePBufferSurface();
- static native boolean setSurface(long nativeCanvasContext, Surface surface);
- static native boolean swapBuffers(long nativeCanvasContext);
- static native boolean makeCurrent(long nativeCanvasContext);
- static native void destroyContext(long nativeCanvasContext);
-}
diff --git a/core/java/android/view/Surface.java b/core/java/android/view/Surface.java
index a2775d4..fdaae01 100644
--- a/core/java/android/view/Surface.java
+++ b/core/java/android/view/Surface.java
@@ -37,19 +37,19 @@
public class Surface implements Parcelable {
private static final String TAG = "Surface";
- private static native int nativeCreateFromSurfaceTexture(SurfaceTexture surfaceTexture)
+ private static native long nativeCreateFromSurfaceTexture(SurfaceTexture surfaceTexture)
throws OutOfResourcesException;
- private static native int nativeCreateFromSurfaceControl(int surfaceControlNativeObject);
+ private static native long nativeCreateFromSurfaceControl(long surfaceControlNativeObject);
- private static native int nativeLockCanvas(int nativeObject, Canvas canvas, Rect dirty)
+ private static native long nativeLockCanvas(long nativeObject, Canvas canvas, Rect dirty)
throws OutOfResourcesException;
- private static native void nativeUnlockCanvasAndPost(int nativeObject, Canvas canvas);
+ private static native void nativeUnlockCanvasAndPost(long nativeObject, Canvas canvas);
- private static native void nativeRelease(int nativeObject);
- private static native boolean nativeIsValid(int nativeObject);
- private static native boolean nativeIsConsumerRunningBehind(int nativeObject);
- private static native int nativeReadFromParcel(int nativeObject, Parcel source);
- private static native void nativeWriteToParcel(int nativeObject, Parcel dest);
+ private static native void nativeRelease(long nativeObject);
+ private static native boolean nativeIsValid(long nativeObject);
+ private static native boolean nativeIsConsumerRunningBehind(long nativeObject);
+ private static native long nativeReadFromParcel(long nativeObject, Parcel source);
+ private static native void nativeWriteToParcel(long nativeObject, Parcel dest);
public static final Parcelable.Creator<Surface> CREATOR =
new Parcelable.Creator<Surface>() {
@@ -76,8 +76,8 @@
// Guarded state.
final Object mLock = new Object(); // protects the native state
private String mName;
- int mNativeObject; // package scope only for SurfaceControl access
- private int mLockedObject;
+ long mNativeObject; // package scope only for SurfaceControl access
+ private long mLockedObject;
private int mGenerationId; // incremented each time mNativeObject changes
private final Canvas mCanvas = new CompatibleCanvas();
@@ -140,7 +140,7 @@
}
/* called from android_view_Surface_createFromIGraphicBufferProducer() */
- private Surface(int nativeObject) {
+ private Surface(long nativeObject) {
synchronized (mLock) {
setNativeObjectLocked(nativeObject);
}
@@ -271,8 +271,8 @@
checkNotReleasedLocked();
if (mNativeObject != mLockedObject) {
Log.w(TAG, "WARNING: Surface's mNativeObject (0x" +
- Integer.toHexString(mNativeObject) + ") != mLockedObject (0x" +
- Integer.toHexString(mLockedObject) +")");
+ Long.toHexString(mNativeObject) + ") != mLockedObject (0x" +
+ Long.toHexString(mLockedObject) +")");
}
if (mLockedObject == 0) {
throw new IllegalStateException("Surface was not locked");
@@ -317,12 +317,12 @@
throw new IllegalArgumentException("other must not be null");
}
- int surfaceControlPtr = other.mNativeObject;
+ long surfaceControlPtr = other.mNativeObject;
if (surfaceControlPtr == 0) {
throw new NullPointerException(
"SurfaceControl native object is null. Are you using a released SurfaceControl?");
}
- int newNativeObject = nativeCreateFromSurfaceControl(surfaceControlPtr);
+ long newNativeObject = nativeCreateFromSurfaceControl(surfaceControlPtr);
synchronized (mLock) {
if (mNativeObject != 0) {
@@ -344,7 +344,7 @@
throw new IllegalArgumentException("other must not be null");
}
if (other != this) {
- final int newPtr;
+ final long newPtr;
synchronized (other.mLock) {
newPtr = other.mNativeObject;
other.setNativeObjectLocked(0);
@@ -401,7 +401,7 @@
}
}
- private void setNativeObjectLocked(int ptr) {
+ private void setNativeObjectLocked(long ptr) {
if (mNativeObject != ptr) {
if (mNativeObject == 0 && ptr != 0) {
mCloseGuard.open("release");
diff --git a/core/java/android/view/SurfaceControl.java b/core/java/android/view/SurfaceControl.java
index 914a5ca..a6f856c 100644
--- a/core/java/android/view/SurfaceControl.java
+++ b/core/java/android/view/SurfaceControl.java
@@ -32,11 +32,11 @@
public class SurfaceControl {
private static final String TAG = "SurfaceControl";
- private static native int nativeCreate(SurfaceSession session, String name,
+ private static native long nativeCreate(SurfaceSession session, String name,
int w, int h, int format, int flags)
throws OutOfResourcesException;
- private static native void nativeRelease(int nativeObject);
- private static native void nativeDestroy(int nativeObject);
+ private static native void nativeRelease(long nativeObject);
+ private static native void nativeDestroy(long nativeObject);
private static native Bitmap nativeScreenshot(IBinder displayToken,
int width, int height, int minLayer, int maxLayer, boolean allLayers);
@@ -47,21 +47,21 @@
private static native void nativeCloseTransaction();
private static native void nativeSetAnimationTransaction();
- private static native void nativeSetLayer(int nativeObject, int zorder);
- private static native void nativeSetPosition(int nativeObject, float x, float y);
- private static native void nativeSetSize(int nativeObject, int w, int h);
- private static native void nativeSetTransparentRegionHint(int nativeObject, Region region);
- private static native void nativeSetAlpha(int nativeObject, float alpha);
- private static native void nativeSetMatrix(int nativeObject, float dsdx, float dtdx, float dsdy, float dtdy);
- private static native void nativeSetFlags(int nativeObject, int flags, int mask);
- private static native void nativeSetWindowCrop(int nativeObject, int l, int t, int r, int b);
- private static native void nativeSetLayerStack(int nativeObject, int layerStack);
+ private static native void nativeSetLayer(long nativeObject, int zorder);
+ private static native void nativeSetPosition(long nativeObject, float x, float y);
+ private static native void nativeSetSize(long nativeObject, int w, int h);
+ private static native void nativeSetTransparentRegionHint(long nativeObject, Region region);
+ private static native void nativeSetAlpha(long nativeObject, float alpha);
+ private static native void nativeSetMatrix(long nativeObject, float dsdx, float dtdx, float dsdy, float dtdy);
+ private static native void nativeSetFlags(long nativeObject, int flags, int mask);
+ private static native void nativeSetWindowCrop(long nativeObject, int l, int t, int r, int b);
+ private static native void nativeSetLayerStack(long nativeObject, int layerStack);
private static native IBinder nativeGetBuiltInDisplay(int physicalDisplayId);
private static native IBinder nativeCreateDisplay(String name, boolean secure);
private static native void nativeDestroyDisplay(IBinder displayToken);
private static native void nativeSetDisplaySurface(
- IBinder displayToken, int nativeSurfaceObject);
+ IBinder displayToken, long nativeSurfaceObject);
private static native void nativeSetDisplayLayerStack(
IBinder displayToken, int layerStack);
private static native void nativeSetDisplayProjection(
@@ -76,7 +76,7 @@
private final CloseGuard mCloseGuard = CloseGuard.get();
private final String mName;
- int mNativeObject; // package visibility only for Surface.java access
+ long mNativeObject; // package visibility only for Surface.java access
/* flags used in constructor (keep in sync with ISurfaceComposerClient.h) */
diff --git a/core/java/android/view/TextureView.java b/core/java/android/view/TextureView.java
index bf81811..161fe33 100644
--- a/core/java/android/view/TextureView.java
+++ b/core/java/android/view/TextureView.java
@@ -127,7 +127,7 @@
private final Object[] mNativeWindowLock = new Object[0];
// Used from native code, do not write!
@SuppressWarnings({"UnusedDeclaration"})
- private int mNativeWindow;
+ private long mNativeWindow;
/**
* Creates a new TextureView.
@@ -834,6 +834,6 @@
private native void nCreateNativeWindow(SurfaceTexture surface);
private native void nDestroyNativeWindow();
- private static native boolean nLockCanvas(int nativeWindow, Canvas canvas, Rect dirty);
- private static native void nUnlockCanvasAndPost(int nativeWindow, Canvas canvas);
+ private static native boolean nLockCanvas(long nativeWindow, Canvas canvas, Rect dirty);
+ private static native void nUnlockCanvasAndPost(long nativeWindow, Canvas canvas);
}
diff --git a/core/java/android/view/ThreadedRenderer.java b/core/java/android/view/ThreadedRenderer.java
index 2cd1b6e..2c9f1d9 100644
--- a/core/java/android/view/ThreadedRenderer.java
+++ b/core/java/android/view/ThreadedRenderer.java
@@ -18,25 +18,26 @@
import android.graphics.Rect;
import android.graphics.SurfaceTexture;
-import android.os.Looper;
import android.os.SystemClock;
import android.os.Trace;
-import android.util.Log;
import android.view.Surface.OutOfResourcesException;
import android.view.View.AttachInfo;
import java.io.PrintWriter;
-import java.lang.reflect.Method;
-import java.util.HashMap;
/**
* Hardware renderer that proxies the rendering to a render thread. Most calls
- * are synchronous, however a few such as draw() are posted async. The display list
- * is shared between the two threads and is guarded by a top level lock.
+ * are currently synchronous.
+ * TODO: Make draw() async.
+ * TODO: Figure out how to share the DisplayList between two threads (global lock?)
*
* The UI thread can block on the RenderThread, but RenderThread must never
* block on the UI thread.
*
+ * ThreadedRenderer creates an instance of RenderProxy. RenderProxy in turn creates
+ * and manages a CanvasContext on the RenderThread. The CanvasContext is fully managed
+ * by the lifecycle of the RenderProxy.
+ *
* Note that although currently the EGL context & surfaces are created & managed
* by the render thread, the goal is to move that into a shared structure that can
* be managed by both threads. EGLSurface creation & deletion should ideally be
@@ -48,49 +49,29 @@
public class ThreadedRenderer extends HardwareRenderer {
private static final String LOGTAG = "ThreadedRenderer";
- @SuppressWarnings("serial")
- static HashMap<String, Method> sMethodLut = new HashMap<String, Method>() {{
- Method[] methods = RemoteGLRenderer.class.getDeclaredMethods();
- for (Method m : methods) {
- m.setAccessible(true);
- put(m.getName() + ":" + m.getParameterTypes().length, m);
- }
- }};
- static boolean sNeedsInit = true;
+ private static final Rect NULL_RECT = new Rect(-1, -1, -1, -1);
- private RemoteGLRenderer mRemoteRenderer;
private int mWidth, mHeight;
- private RTJob mPreviousDraw;
+ private long mNativeProxy;
ThreadedRenderer(boolean translucent) {
- mRemoteRenderer = new RemoteGLRenderer(this, translucent);
- setEnabled(true);
- if (sNeedsInit) {
- sNeedsInit = false;
- postToRenderThread(new Runnable() {
- @Override
- public void run() {
- // Hack to allow GLRenderer to create a handler to post the EGL
- // destruction to, although it'll never run
- Looper.prepare();
- }
- });
- }
+ mNativeProxy = nCreateProxy(translucent);
+ setEnabled(mNativeProxy != 0);
}
@Override
void destroy(boolean full) {
- run("destroy", full);
+ nDestroyCanvas(mNativeProxy);
}
@Override
boolean initialize(Surface surface) throws OutOfResourcesException {
- return (Boolean) run("initialize", surface);
+ return nInitialize(mNativeProxy, surface);
}
@Override
void updateSurface(Surface surface) throws OutOfResourcesException {
- post("updateSurface", surface);
+ nUpdateSurface(mNativeProxy, surface);
}
@Override
@@ -100,12 +81,27 @@
@Override
void destroyHardwareResources(View view) {
- run("destroyHardwareResources", view);
+ // TODO: canvas.clearLayerUpdates()
+ destroyResources(view);
+ // TODO: GLES20Canvas.flushCaches(GLES20Canvas.FLUSH_CACHES_LAYERS);
+ }
+
+ private static void destroyResources(View view) {
+ view.destroyHardwareResources();
+
+ if (view instanceof ViewGroup) {
+ ViewGroup group = (ViewGroup) view;
+
+ int count = group.getChildCount();
+ for (int i = 0; i < count; i++) {
+ destroyResources(group.getChildAt(i));
+ }
+ }
}
@Override
void invalidate(Surface surface) {
- post("invalidate", surface);
+ updateSurface(surface);
}
@Override
@@ -116,14 +112,15 @@
@Override
boolean safelyRun(Runnable action) {
- return (Boolean) run("safelyRun", action);
+ // TODO:
+ return false;
}
@Override
void setup(int width, int height) {
mWidth = width;
mHeight = height;
- post("setup", width, height);
+ nSetup(mNativeProxy, width, height);
}
@Override
@@ -149,7 +146,7 @@
@Override
boolean loadSystemProperties() {
- return (Boolean) run("loadSystemProperties");
+ return false;
}
@Override
@@ -174,20 +171,10 @@
*
* @hide */
public void repeatLastDraw() {
- if (mPreviousDraw == null) {
- throw new IllegalStateException("There isn't a previous draw");
- }
- synchronized (mPreviousDraw) {
- mPreviousDraw.completed = false;
- }
- mPreviousDraw.args[3] = null;
- postToRenderThread(mPreviousDraw);
}
@Override
void draw(View view, AttachInfo attachInfo, HardwareDrawCallbacks callbacks, Rect dirty) {
- requireCompletion(mPreviousDraw);
-
attachInfo.mIgnoreDirtyState = true;
attachInfo.mDrawingTime = SystemClock.uptimeMillis();
view.mPrivateFlags |= View.PFLAG_DRAWN;
@@ -202,8 +189,11 @@
view.mRecreateDisplayList = false;
- mPreviousDraw = post("drawDisplayList", displayList, attachInfo,
- callbacks, dirty);
+ if (dirty == null) {
+ dirty = NULL_RECT;
+ }
+ nDrawDisplayList(mNativeProxy, displayList.getNativeDisplayList(),
+ dirty.left, dirty.top, dirty.right, dirty.bottom);
}
@Override
@@ -227,86 +217,41 @@
}
@Override
- void detachFunctor(int functor) {
- run("detachFunctor", functor);
+ void detachFunctor(long functor) {
+ nDetachFunctor(mNativeProxy, functor);
}
@Override
- boolean attachFunctor(AttachInfo attachInfo, int functor) {
- return (Boolean) run("attachFunctor", attachInfo, functor);
+ void attachFunctor(AttachInfo attachInfo, long functor) {
+ nAttachFunctor(mNativeProxy, functor);
}
@Override
void setName(String name) {
- post("setName", name);
}
- private static void requireCompletion(RTJob job) {
- if (job != null) {
- synchronized (job) {
- if (!job.completed) {
- try {
- job.wait();
- } catch (InterruptedException e) {
- throw new RuntimeException(e);
- }
- }
- }
- }
- }
-
- private RTJob post(String method, Object... args) {
- RTJob job = new RTJob();
- job.method = sMethodLut.get(method + ":" + args.length);
- job.args = args;
- job.target = mRemoteRenderer;
- if (job.method == null) {
- throw new NullPointerException("Couldn't find method: " + method);
- }
- postToRenderThread(job);
- return job;
- }
-
- private Object run(String method, Object... args) {
- RTJob job = new RTJob();
- job.method = sMethodLut.get(method + ":" + args.length);
- job.args = args;
- job.target = mRemoteRenderer;
- if (job.method == null) {
- throw new NullPointerException("Couldn't find method: " + method);
- }
- synchronized (job) {
- postToRenderThread(job);
- try {
- job.wait();
- return job.ret;
- } catch (InterruptedException e) {
- throw new RuntimeException(e);
- }
- }
- }
-
- static class RTJob implements Runnable {
- Method method;
- Object[] args;
- Object target;
- Object ret;
- boolean completed = false;
-
- @Override
- public void run() {
- try {
- ret = method.invoke(target, args);
- synchronized (this) {
- completed = true;
- notify();
- }
- } catch (Exception e) {
- Log.e(LOGTAG, "Failed to invoke: " + method.getName(), e);
- }
+ @Override
+ protected void finalize() throws Throwable {
+ try {
+ nDeleteProxy(mNativeProxy);
+ } finally {
+ super.finalize();
}
}
/** @hide */
public static native void postToRenderThread(Runnable runnable);
+
+ private static native long nCreateProxy(boolean translucent);
+ private static native void nDeleteProxy(long nativeProxy);
+
+ private static native boolean nInitialize(long nativeProxy, Surface window);
+ private static native void nUpdateSurface(long nativeProxy, Surface window);
+ private static native void nSetup(long nativeProxy, int width, int height);
+ private static native void nDrawDisplayList(long nativeProxy, long displayList,
+ int dirtyLeft, int dirtyTop, int dirtyRight, int dirtyBottom);
+ private static native void nDestroyCanvas(long nativeProxy);
+
+ private static native void nAttachFunctor(long nativeProxy, long functor);
+ private static native void nDetachFunctor(long nativeProxy, long functor);
}
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index 41b0c67..5aa46f3 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -660,12 +660,11 @@
mHandler.sendMessageAtFrontOfQueue(mHandler.obtainMessage(MSG_FLUSH_LAYER_UPDATES));
}
- public boolean attachFunctor(int functor) {
+ public void attachFunctor(int functor) {
//noinspection SimplifiableIfStatement
if (mAttachInfo.mHardwareRenderer != null && mAttachInfo.mHardwareRenderer.isEnabled()) {
- return mAttachInfo.mHardwareRenderer.attachFunctor(mAttachInfo, functor);
+ mAttachInfo.mHardwareRenderer.attachFunctor(mAttachInfo, functor);
}
- return false;
}
public void detachFunctor(int functor) {
diff --git a/core/java/android/view/accessibility/AccessibilityRecord.aidl b/core/java/android/view/accessibility/AccessibilityRecord.aidl
new file mode 100644
index 0000000..d542af0
--- /dev/null
+++ b/core/java/android/view/accessibility/AccessibilityRecord.aidl
@@ -0,0 +1,19 @@
+/**
+ * Copyright (c) 2014, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.view.accessibility;
+
+parcelable AccessibilityRecord;
diff --git a/core/java/android/webkit/DebugFlags.java b/core/java/android/webkit/DebugFlags.java
index b5ca8c1..7b3cb1b 100644
--- a/core/java/android/webkit/DebugFlags.java
+++ b/core/java/android/webkit/DebugFlags.java
@@ -31,7 +31,6 @@
public static final boolean COOKIE_SYNC_MANAGER = false;
public static final boolean TRACE_API = false;
public static final boolean TRACE_CALLBACK = false;
- public static final boolean TRACE_JAVASCRIPT_BRIDGE = false;
public static final boolean URL_UTIL = false;
public static final boolean WEB_SYNC_MANAGER = false;
diff --git a/core/java/android/widget/CalendarView.java b/core/java/android/widget/CalendarView.java
index a87c7d2..746d34a 100644
--- a/core/java/android/widget/CalendarView.java
+++ b/core/java/android/widget/CalendarView.java
@@ -1638,6 +1638,7 @@
|| mMaxDate.get(Calendar.DAY_OF_WEEK) != mFirstDayOfWeek) {
mTotalWeekCount++;
}
+ notifyDataSetChanged();
}
/**
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index aa8bbb2..15606a45 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -8670,6 +8670,10 @@
super.onRtlPropertiesChanged(layoutDirection);
mTextDir = getTextDirectionHeuristic();
+
+ if (mLayout != null) {
+ checkForRelayout();
+ }
}
TextDirectionHeuristic getTextDirectionHeuristic() {
diff --git a/core/java/android/widget/TimePickerDelegate.java b/core/java/android/widget/TimePickerDelegate.java
index 182d370..c9a9894 100644
--- a/core/java/android/widget/TimePickerDelegate.java
+++ b/core/java/android/widget/TimePickerDelegate.java
@@ -27,6 +27,7 @@
import android.os.Parcelable;
import android.text.TextUtils;
import android.text.format.DateFormat;
+import android.text.format.DateUtils;
import android.util.AttributeSet;
import android.util.Log;
import android.util.TypedValue;
@@ -44,6 +45,7 @@
import java.text.DateFormatSymbols;
import java.util.ArrayList;
import java.util.Calendar;
+import java.util.Locale;
/**
* A view for selecting the time of day, in either 24 hour or AM/PM mode.
@@ -120,6 +122,8 @@
private String mMinutePickerDescription;
private String mSelectMinutes;
+ private Calendar mTempCalendar;
+
public TimePickerDelegate(TimePicker delegator, Context context, AttributeSet attrs,
int defStyleAttr, int defStyleRes) {
super(delegator, context);
@@ -506,23 +510,40 @@
}
@Override
+ public void setCurrentLocale(Locale locale) {
+ super.setCurrentLocale(locale);
+ mTempCalendar = Calendar.getInstance(locale);
+ }
+
+ @Override
public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
- return mRadialTimePickerView.dispatchPopulateAccessibilityEvent(event);
+ onPopulateAccessibilityEvent(event);
+ return true;
}
@Override
public void onPopulateAccessibilityEvent(AccessibilityEvent event) {
- mRadialTimePickerView.onPopulateAccessibilityEvent(event);
+ int flags = DateUtils.FORMAT_SHOW_TIME;
+ if (mIs24HourView) {
+ flags |= DateUtils.FORMAT_24HOUR;
+ } else {
+ flags |= DateUtils.FORMAT_12HOUR;
+ }
+ mTempCalendar.set(Calendar.HOUR_OF_DAY, getCurrentHour());
+ mTempCalendar.set(Calendar.MINUTE, getCurrentMinute());
+ String selectedDate = DateUtils.formatDateTime(mContext,
+ mTempCalendar.getTimeInMillis(), flags);
+ event.getText().add(selectedDate);
}
@Override
public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
- mRadialTimePickerView.onInitializeAccessibilityEvent(event);
+ event.setClassName(TimePicker.class.getName());
}
@Override
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
- mRadialTimePickerView.onInitializeAccessibilityNodeInfo(info);
+ info.setClassName(TimePicker.class.getName());
}
/**
diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java
index 70ba4e3..7425445 100644
--- a/core/java/com/android/internal/os/BatteryStatsImpl.java
+++ b/core/java/com/android/internal/os/BatteryStatsImpl.java
@@ -87,7 +87,7 @@
private static final int MAGIC = 0xBA757475; // 'BATSTATS'
// Current on-disk Parcel version
- private static final int VERSION = 70 + (USE_OLD_HISTORY ? 1000 : 0);
+ private static final int VERSION = 71 + (USE_OLD_HISTORY ? 1000 : 0);
// Maximum number of items we will record in the history.
private static final int MAX_HISTORY_ITEMS = 2000;
@@ -209,6 +209,8 @@
int mStartCount;
+ long mStartClockTime;
+
long mBatteryUptime;
long mBatteryLastUptime;
long mBatteryRealtime;
@@ -2842,6 +2844,10 @@
}
}
+ @Override public long getStartClockTime() {
+ return mStartClockTime;
+ }
+
@Override public boolean getIsOnBattery() {
return mOnBattery;
}
@@ -4959,6 +4965,7 @@
}
void initTimes() {
+ mStartClockTime = System.currentTimeMillis();
mBatteryRealtime = mTrackBatteryPastUptime = 0;
mBatteryUptime = mTrackBatteryPastRealtime = 0;
mUptimeStart = mTrackBatteryUptimeStart = SystemClock.uptimeMillis() * 1000;
@@ -5832,6 +5839,7 @@
mBatteryRealtime = in.readLong();
mUptime = in.readLong();
mRealtime = in.readLong();
+ mStartClockTime = in.readLong();
mDischargeUnplugLevel = in.readInt();
mDischargeCurrentLevel = in.readInt();
mLowDischargeAmountSinceCharge = in.readInt();
@@ -6040,9 +6048,7 @@
* @param out the Parcel to be written to.
*/
public void writeSummaryToParcel(Parcel out) {
- // Need to update with current kernel wake lock counts.
- updateKernelWakelocksLocked();
- updateNetworkActivityLocked();
+ pullPendingStateUpdatesLocked();
final long NOW_SYS = SystemClock.uptimeMillis() * 1000;
final long NOWREAL_SYS = SystemClock.elapsedRealtime() * 1000;
@@ -6058,6 +6064,7 @@
out.writeLong(computeBatteryRealtime(NOWREAL_SYS, STATS_SINCE_CHARGED));
out.writeLong(computeUptime(NOW_SYS, STATS_SINCE_CHARGED));
out.writeLong(computeRealtime(NOWREAL_SYS, STATS_SINCE_CHARGED));
+ out.writeLong(mStartClockTime);
out.writeInt(mDischargeUnplugLevel);
out.writeInt(mDischargeCurrentLevel);
out.writeInt(getLowDischargeAmountSinceCharge());
@@ -6293,6 +6300,7 @@
mBatteryLastUptime = 0;
mBatteryRealtime = in.readLong();
mBatteryLastRealtime = 0;
+ mStartClockTime = in.readLong();
mScreenOn = false;
mScreenOnTimer = new StopwatchTimer(null, -1, null, mUnpluggables, in);
for (int i=0; i<NUM_SCREEN_BRIGHTNESS_BINS; i++) {
@@ -6408,6 +6416,7 @@
out.writeInt(mStartCount);
out.writeLong(mBatteryUptime);
out.writeLong(mBatteryRealtime);
+ out.writeLong(mStartClockTime);
mScreenOnTimer.writeToParcel(out, batteryRealtime);
for (int i=0; i<NUM_SCREEN_BRIGHTNESS_BINS; i++) {
mScreenBrightnessTimer[i].writeToParcel(out, batteryRealtime);
diff --git a/core/jni/Android.mk b/core/jni/Android.mk
index d72b054..f8d96e3 100644
--- a/core/jni/Android.mk
+++ b/core/jni/Android.mk
@@ -58,7 +58,6 @@
android_view_GLRenderer.cpp \
android_view_GLES20Canvas.cpp \
android_view_ThreadedRenderer.cpp \
- android_view_RemoteGLRenderer.cpp \
android_view_MotionEvent.cpp \
android_view_PointerIcon.cpp \
android_view_VelocityTracker.cpp \
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp
index 074d7ac..7ed6641 100644
--- a/core/jni/AndroidRuntime.cpp
+++ b/core/jni/AndroidRuntime.cpp
@@ -124,7 +124,6 @@
extern int register_android_view_GLES20Canvas(JNIEnv* env);
extern int register_android_view_GLRenderer(JNIEnv* env);
extern int register_android_view_ThreadedRenderer(JNIEnv* env);
-extern int register_android_view_RemoteGLRenderer(JNIEnv* env);
extern int register_android_view_Surface(JNIEnv* env);
extern int register_android_view_SurfaceControl(JNIEnv* env);
extern int register_android_view_SurfaceSession(JNIEnv* env);
@@ -1129,7 +1128,6 @@
REG_JNI(register_android_view_GLES20Canvas),
REG_JNI(register_android_view_GLRenderer),
REG_JNI(register_android_view_ThreadedRenderer),
- REG_JNI(register_android_view_RemoteGLRenderer),
REG_JNI(register_android_view_Surface),
REG_JNI(register_android_view_SurfaceControl),
REG_JNI(register_android_view_SurfaceSession),
diff --git a/core/jni/android/graphics/Bitmap.cpp b/core/jni/android/graphics/Bitmap.cpp
index 2125763..24160ab 100644
--- a/core/jni/android/graphics/Bitmap.cpp
+++ b/core/jni/android/graphics/Bitmap.cpp
@@ -289,8 +289,9 @@
}
static jobject Bitmap_creator(JNIEnv* env, jobject, jintArray jColors,
- int offset, int stride, int width, int height,
- SkBitmap::Config config, jboolean isMutable) {
+ jint offset, jint stride, jint width, jint height,
+ jint configHandle, jboolean isMutable) {
+ SkBitmap::Config config = static_cast<SkBitmap::Config>(configHandle);
if (NULL != jColors) {
size_t n = env->GetArrayLength(jColors);
if (n < SkAbs32(stride) * (size_t)height) {
@@ -321,8 +322,10 @@
getPremulBitmapCreateFlags(isMutable), NULL, NULL);
}
-static jobject Bitmap_copy(JNIEnv* env, jobject, const SkBitmap* src,
- SkBitmap::Config dstConfig, jboolean isMutable) {
+static jobject Bitmap_copy(JNIEnv* env, jobject, jlong srcHandle,
+ jint dstConfigHandle, jboolean isMutable) {
+ const SkBitmap* src = reinterpret_cast<SkBitmap*>(srcHandle);
+ SkBitmap::Config dstConfig = static_cast<SkBitmap::Config>(dstConfigHandle);
SkBitmap result;
JavaPixelAllocator allocator(env);
@@ -333,7 +336,8 @@
getPremulBitmapCreateFlags(isMutable), NULL, NULL);
}
-static void Bitmap_destructor(JNIEnv* env, jobject, SkBitmap* bitmap) {
+static void Bitmap_destructor(JNIEnv* env, jobject, jlong bitmapHandle) {
+ SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
#ifdef USE_OPENGL_RENDERER
if (android::uirenderer::Caches::hasInstance()) {
android::uirenderer::Caches::getInstance().resourceCache.destructor(bitmap);
@@ -343,24 +347,28 @@
delete bitmap;
}
-static jboolean Bitmap_recycle(JNIEnv* env, jobject, SkBitmap* bitmap) {
+static jboolean Bitmap_recycle(JNIEnv* env, jobject, jlong bitmapHandle) {
+ SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
#ifdef USE_OPENGL_RENDERER
if (android::uirenderer::Caches::hasInstance()) {
- return android::uirenderer::Caches::getInstance().resourceCache.recycle(bitmap);
+ bool result;
+ result = android::uirenderer::Caches::getInstance().resourceCache.recycle(bitmap);
+ return result ? JNI_TRUE : JNI_FALSE;
}
#endif // USE_OPENGL_RENDERER
bitmap->setPixels(NULL, NULL);
- return true;
+ return JNI_TRUE;
}
-static void Bitmap_reconfigure(JNIEnv* env, jobject clazz, jint bitmapInt,
- int width, int height, SkBitmap::Config config, int allocSize) {
+static void Bitmap_reconfigure(JNIEnv* env, jobject clazz, jlong bitmapHandle,
+ jint width, jint height, jint configHandle, jint allocSize) {
+ SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
+ SkBitmap::Config config = static_cast<SkBitmap::Config>(configHandle);
if (width * height * SkBitmap::ComputeBytesPerPixel(config) > allocSize) {
// done in native as there's no way to get BytesPerPixel in Java
doThrowIAE(env, "Bitmap not large enough to support new configuration");
return;
}
- SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapInt);
SkPixelRef* ref = bitmap->pixelRef();
SkSafeRef(ref);
bitmap->setConfig(config, width, height);
@@ -380,9 +388,10 @@
kWEBP_JavaEncodeFormat = 2
};
-static bool Bitmap_compress(JNIEnv* env, jobject clazz, SkBitmap* bitmap,
- int format, int quality,
- jobject jstream, jbyteArray jstorage) {
+static jboolean Bitmap_compress(JNIEnv* env, jobject clazz, jlong bitmapHandle,
+ jint format, jint quality,
+ jobject jstream, jbyteArray jstorage) {
+ SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
SkImageEncoder::Type fm;
switch (format) {
@@ -396,7 +405,7 @@
fm = SkImageEncoder::kWEBP_Type;
break;
default:
- return false;
+ return JNI_FALSE;
}
bool success = false;
@@ -404,12 +413,12 @@
SkAutoLockPixels alp(*bitmap);
if (NULL == bitmap->getPixels()) {
- return false;
+ return JNI_FALSE;
}
SkWStream* strm = CreateJavaOutputStreamAdaptor(env, jstream, jstorage);
if (NULL == strm) {
- return false;
+ return JNI_FALSE;
}
SkImageEncoder* encoder = SkImageEncoder::Create(fm);
@@ -419,31 +428,37 @@
}
delete strm;
}
- return success;
+ return success ? JNI_TRUE : JNI_FALSE;
}
-static void Bitmap_erase(JNIEnv* env, jobject, SkBitmap* bitmap, jint color) {
+static void Bitmap_erase(JNIEnv* env, jobject, jlong bitmapHandle, jint color) {
+ SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
bitmap->eraseColor(color);
}
-static int Bitmap_rowBytes(JNIEnv* env, jobject, SkBitmap* bitmap) {
- return bitmap->rowBytes();
+static jint Bitmap_rowBytes(JNIEnv* env, jobject, jlong bitmapHandle) {
+ SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
+ return static_cast<jint>(bitmap->rowBytes());
}
-static int Bitmap_config(JNIEnv* env, jobject, SkBitmap* bitmap) {
- return bitmap->config();
+static jint Bitmap_config(JNIEnv* env, jobject, jlong bitmapHandle) {
+ SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
+ return static_cast<jint>(bitmap->config());
}
-static int Bitmap_getGenerationId(JNIEnv* env, jobject, SkBitmap* bitmap) {
- return bitmap->getGenerationID();
+static jint Bitmap_getGenerationId(JNIEnv* env, jobject, jlong bitmapHandle) {
+ SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
+ return static_cast<jint>(bitmap->getGenerationID());
}
-static jboolean Bitmap_hasAlpha(JNIEnv* env, jobject, SkBitmap* bitmap) {
- return !bitmap->isOpaque();
+static jboolean Bitmap_hasAlpha(JNIEnv* env, jobject, jlong bitmapHandle) {
+ SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
+ return !bitmap->isOpaque() ? JNI_TRUE : JNI_FALSE;
}
-static void Bitmap_setAlphaAndPremultiplied(JNIEnv* env, jobject, SkBitmap* bitmap,
+static void Bitmap_setAlphaAndPremultiplied(JNIEnv* env, jobject, jlong bitmapHandle,
jboolean hasAlpha, jboolean isPremul) {
+ SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
if (!hasAlpha) {
bitmap->setAlphaType(kOpaque_SkAlphaType);
} else if (isPremul) {
@@ -451,14 +466,17 @@
} else {
bitmap->setAlphaType(kUnpremul_SkAlphaType);
}
+ bitmap->setIsOpaque(!hasAlpha);
}
-static jboolean Bitmap_hasMipMap(JNIEnv* env, jobject, SkBitmap* bitmap) {
- return bitmap->hasHardwareMipMap();
+static jboolean Bitmap_hasMipMap(JNIEnv* env, jobject, jlong bitmapHandle) {
+ SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
+ return bitmap->hasHardwareMipMap() ? JNI_TRUE : JNI_FALSE;
}
-static void Bitmap_setHasMipMap(JNIEnv* env, jobject, SkBitmap* bitmap,
+static void Bitmap_setHasMipMap(JNIEnv* env, jobject, jlong bitmapHandle,
jboolean hasMipMap) {
+ SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
bitmap->setHasHardwareMipMap(hasMipMap);
}
@@ -532,12 +550,13 @@
}
static jboolean Bitmap_writeToParcel(JNIEnv* env, jobject,
- const SkBitmap* bitmap,
+ jlong bitmapHandle,
jboolean isMutable, jint density,
jobject parcel) {
+ const SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
if (parcel == NULL) {
SkDebugf("------- writeToParcel null parcel\n");
- return false;
+ return JNI_FALSE;
}
android::Parcel* p = android::parcelForJavaObject(env, parcel);
@@ -568,7 +587,7 @@
android::status_t status = p->writeBlob(size, &blob);
if (status) {
doThrowRE(env, "Could not write bitmap to parcel blob.");
- return false;
+ return JNI_FALSE;
}
bitmap->lockPixels();
@@ -581,12 +600,14 @@
bitmap->unlockPixels();
blob.release();
- return true;
+ return JNI_TRUE;
}
static jobject Bitmap_extractAlpha(JNIEnv* env, jobject clazz,
- const SkBitmap* src, const SkPaint* paint,
+ jlong srcHandle, jlong paintHandle,
jintArray offsetXY) {
+ const SkBitmap* src = reinterpret_cast<SkBitmap*>(srcHandle);
+ const SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
SkIPoint offset;
SkBitmap* dst = new SkBitmap;
JavaPixelAllocator allocator(env);
@@ -612,8 +633,9 @@
///////////////////////////////////////////////////////////////////////////////
-static int Bitmap_getPixel(JNIEnv* env, jobject, const SkBitmap* bitmap,
- int x, int y, bool isPremultiplied) {
+static jint Bitmap_getPixel(JNIEnv* env, jobject, jlong bitmapHandle,
+ jint x, jint y, jboolean isPremultiplied) {
+ const SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
SkAutoLockPixels alp(*bitmap);
ToColorProc proc = ChooseToColorProc(*bitmap, isPremultiplied);
@@ -627,12 +649,13 @@
SkColor dst[1];
proc(dst, src, 1, bitmap->getColorTable());
- return dst[0];
+ return static_cast<jint>(dst[0]);
}
-static void Bitmap_getPixels(JNIEnv* env, jobject, const SkBitmap* bitmap,
- jintArray pixelArray, int offset, int stride,
- int x, int y, int width, int height, bool isPremultiplied) {
+static void Bitmap_getPixels(JNIEnv* env, jobject, jlong bitmapHandle,
+ jintArray pixelArray, jint offset, jint stride,
+ jint x, jint y, jint width, jint height, jboolean isPremultiplied) {
+ const SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
SkAutoLockPixels alp(*bitmap);
ToColorProc proc = ChooseToColorProc(*bitmap, isPremultiplied);
@@ -657,8 +680,10 @@
///////////////////////////////////////////////////////////////////////////////
-static void Bitmap_setPixel(JNIEnv* env, jobject, const SkBitmap* bitmap,
- int x, int y, SkColor color, bool isPremultiplied) {
+static void Bitmap_setPixel(JNIEnv* env, jobject, jlong bitmapHandle,
+ jint x, jint y, jint colorHandle, jboolean isPremultiplied) {
+ const SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
+ SkColor color = static_cast<SkColor>(colorHandle);
SkAutoLockPixels alp(*bitmap);
if (NULL == bitmap->getPixels()) {
return;
@@ -673,15 +698,17 @@
bitmap->notifyPixelsChanged();
}
-static void Bitmap_setPixels(JNIEnv* env, jobject, const SkBitmap* bitmap,
- jintArray pixelArray, int offset, int stride,
- int x, int y, int width, int height, bool isPremultiplied) {
+static void Bitmap_setPixels(JNIEnv* env, jobject, jlong bitmapHandle,
+ jintArray pixelArray, jint offset, jint stride,
+ jint x, jint y, jint width, jint height, jboolean isPremultiplied) {
+ const SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
GraphicsJNI::SetPixels(env, pixelArray, offset, stride,
x, y, width, height, *bitmap, isPremultiplied);
}
static void Bitmap_copyPixelsToBuffer(JNIEnv* env, jobject,
- const SkBitmap* bitmap, jobject jbuffer) {
+ jlong bitmapHandle, jobject jbuffer) {
+ const SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
SkAutoLockPixels alp(*bitmap);
const void* src = bitmap->getPixels();
@@ -694,7 +721,8 @@
}
static void Bitmap_copyPixelsFromBuffer(JNIEnv* env, jobject,
- const SkBitmap* bitmap, jobject jbuffer) {
+ jlong bitmapHandle, jobject jbuffer) {
+ SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
SkAutoLockPixels alp(*bitmap);
void* dst = bitmap->getPixels();
@@ -706,12 +734,14 @@
}
}
-static bool Bitmap_sameAs(JNIEnv* env, jobject, const SkBitmap* bm0,
- const SkBitmap* bm1) {
+static jboolean Bitmap_sameAs(JNIEnv* env, jobject, jlong bm0Handle,
+ jlong bm1Handle) {
+ const SkBitmap* bm0 = reinterpret_cast<SkBitmap*>(bm0Handle);
+ const SkBitmap* bm1 = reinterpret_cast<SkBitmap*>(bm1Handle);
if (bm0->width() != bm1->width() ||
bm0->height() != bm1->height() ||
bm0->config() != bm1->config()) {
- return false;
+ return JNI_FALSE;
}
SkAutoLockPixels alp0(*bm0);
@@ -719,24 +749,24 @@
// if we can't load the pixels, return false
if (NULL == bm0->getPixels() || NULL == bm1->getPixels()) {
- return false;
+ return JNI_FALSE;
}
if (bm0->config() == SkBitmap::kIndex8_Config) {
SkColorTable* ct0 = bm0->getColorTable();
SkColorTable* ct1 = bm1->getColorTable();
if (NULL == ct0 || NULL == ct1) {
- return false;
+ return JNI_FALSE;
}
if (ct0->count() != ct1->count()) {
- return false;
+ return JNI_FALSE;
}
SkAutoLockColors alc0(ct0);
SkAutoLockColors alc1(ct1);
const size_t size = ct0->count() * sizeof(SkPMColor);
if (memcmp(alc0.colors(), alc1.colors(), size) != 0) {
- return false;
+ return JNI_FALSE;
}
}
@@ -747,13 +777,14 @@
const size_t size = bm0->width() * bm0->bytesPerPixel();
for (int y = 0; y < h; y++) {
if (memcmp(bm0->getAddr(0, y), bm1->getAddr(0, y), size) != 0) {
- return false;
+ return JNI_FALSE;
}
}
- return true;
+ return JNI_TRUE;
}
-static void Bitmap_prepareToDraw(JNIEnv* env, jobject, SkBitmap* bitmap) {
+static void Bitmap_prepareToDraw(JNIEnv* env, jobject, jlong bitmapHandle) {
+ SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
bitmap->lockPixels();
bitmap->unlockPixels();
}
@@ -765,38 +796,38 @@
static JNINativeMethod gBitmapMethods[] = {
{ "nativeCreate", "([IIIIIIZ)Landroid/graphics/Bitmap;",
(void*)Bitmap_creator },
- { "nativeCopy", "(IIZ)Landroid/graphics/Bitmap;",
+ { "nativeCopy", "(JIZ)Landroid/graphics/Bitmap;",
(void*)Bitmap_copy },
- { "nativeDestructor", "(I)V", (void*)Bitmap_destructor },
- { "nativeRecycle", "(I)Z", (void*)Bitmap_recycle },
- { "nativeReconfigure", "(IIIII)V", (void*)Bitmap_reconfigure },
- { "nativeCompress", "(IIILjava/io/OutputStream;[B)Z",
+ { "nativeDestructor", "(J)V", (void*)Bitmap_destructor },
+ { "nativeRecycle", "(J)Z", (void*)Bitmap_recycle },
+ { "nativeReconfigure", "(JIIII)V", (void*)Bitmap_reconfigure },
+ { "nativeCompress", "(JIILjava/io/OutputStream;[B)Z",
(void*)Bitmap_compress },
- { "nativeErase", "(II)V", (void*)Bitmap_erase },
- { "nativeRowBytes", "(I)I", (void*)Bitmap_rowBytes },
- { "nativeConfig", "(I)I", (void*)Bitmap_config },
- { "nativeHasAlpha", "(I)Z", (void*)Bitmap_hasAlpha },
- { "nativeSetAlphaAndPremultiplied", "(IZZ)V", (void*)Bitmap_setAlphaAndPremultiplied},
- { "nativeHasMipMap", "(I)Z", (void*)Bitmap_hasMipMap },
- { "nativeSetHasMipMap", "(IZ)V", (void*)Bitmap_setHasMipMap },
+ { "nativeErase", "(JI)V", (void*)Bitmap_erase },
+ { "nativeRowBytes", "(J)I", (void*)Bitmap_rowBytes },
+ { "nativeConfig", "(J)I", (void*)Bitmap_config },
+ { "nativeHasAlpha", "(J)Z", (void*)Bitmap_hasAlpha },
+ { "nativeSetAlphaAndPremultiplied", "(JZZ)V", (void*)Bitmap_setAlphaAndPremultiplied},
+ { "nativeHasMipMap", "(J)Z", (void*)Bitmap_hasMipMap },
+ { "nativeSetHasMipMap", "(JZ)V", (void*)Bitmap_setHasMipMap },
{ "nativeCreateFromParcel",
"(Landroid/os/Parcel;)Landroid/graphics/Bitmap;",
(void*)Bitmap_createFromParcel },
- { "nativeWriteToParcel", "(IZILandroid/os/Parcel;)Z",
+ { "nativeWriteToParcel", "(JZILandroid/os/Parcel;)Z",
(void*)Bitmap_writeToParcel },
- { "nativeExtractAlpha", "(II[I)Landroid/graphics/Bitmap;",
+ { "nativeExtractAlpha", "(JJ[I)Landroid/graphics/Bitmap;",
(void*)Bitmap_extractAlpha },
- { "nativeGenerationId", "(I)I", (void*)Bitmap_getGenerationId },
- { "nativeGetPixel", "(IIIZ)I", (void*)Bitmap_getPixel },
- { "nativeGetPixels", "(I[IIIIIIIZ)V", (void*)Bitmap_getPixels },
- { "nativeSetPixel", "(IIIIZ)V", (void*)Bitmap_setPixel },
- { "nativeSetPixels", "(I[IIIIIIIZ)V", (void*)Bitmap_setPixels },
- { "nativeCopyPixelsToBuffer", "(ILjava/nio/Buffer;)V",
+ { "nativeGenerationId", "(J)I", (void*)Bitmap_getGenerationId },
+ { "nativeGetPixel", "(JIIZ)I", (void*)Bitmap_getPixel },
+ { "nativeGetPixels", "(J[IIIIIIIZ)V", (void*)Bitmap_getPixels },
+ { "nativeSetPixel", "(JIIIZ)V", (void*)Bitmap_setPixel },
+ { "nativeSetPixels", "(J[IIIIIIIZ)V", (void*)Bitmap_setPixels },
+ { "nativeCopyPixelsToBuffer", "(JLjava/nio/Buffer;)V",
(void*)Bitmap_copyPixelsToBuffer },
- { "nativeCopyPixelsFromBuffer", "(ILjava/nio/Buffer;)V",
+ { "nativeCopyPixelsFromBuffer", "(JLjava/nio/Buffer;)V",
(void*)Bitmap_copyPixelsFromBuffer },
- { "nativeSameAs", "(II)Z", (void*)Bitmap_sameAs },
- { "nativePrepareToDraw", "(I)V", (void*)Bitmap_prepareToDraw },
+ { "nativeSameAs", "(JJ)Z", (void*)Bitmap_sameAs },
+ { "nativePrepareToDraw", "(J)V", (void*)Bitmap_prepareToDraw },
};
#define kClassPathName "android/graphics/Bitmap"
diff --git a/core/jni/android/graphics/BitmapFactory.cpp b/core/jni/android/graphics/BitmapFactory.cpp
index d042ce9..3e1f26a 100644
--- a/core/jni/android/graphics/BitmapFactory.cpp
+++ b/core/jni/android/graphics/BitmapFactory.cpp
@@ -273,7 +273,7 @@
SkBitmap* outputBitmap = NULL;
unsigned int existingBufferSize = 0;
if (javaBitmap != NULL) {
- outputBitmap = (SkBitmap*) env->GetIntField(javaBitmap, gBitmap_nativeBitmapFieldID);
+ outputBitmap = (SkBitmap*) env->GetLongField(javaBitmap, gBitmap_nativeBitmapFieldID);
if (outputBitmap->isImmutable()) {
ALOGW("Unable to reuse an immutable bitmap as an image decoder target.");
javaBitmap = NULL;
@@ -532,7 +532,7 @@
return doDecode(env, stream, padding, bitmapFactoryOptions, weOwnTheFD);
}
-static jobject nativeDecodeAsset(JNIEnv* env, jobject clazz, jint native_asset,
+static jobject nativeDecodeAsset(JNIEnv* env, jobject clazz, jlong native_asset,
jobject padding, jobject options) {
SkStreamRewindable* stream;
@@ -557,7 +557,7 @@
}
static jobject nativeDecodeByteArray(JNIEnv* env, jobject, jbyteArray byteArray,
- int offset, int length, jobject options) {
+ jint offset, jint length, jobject options) {
/* If optionsShareable() we could decide to just wrap the java array and
share it, but that means adding a globalref to the java array object
@@ -594,7 +594,7 @@
},
{ "nativeDecodeAsset",
- "(ILandroid/graphics/Rect;Landroid/graphics/BitmapFactory$Options;)Landroid/graphics/Bitmap;",
+ "(JLandroid/graphics/Rect;Landroid/graphics/BitmapFactory$Options;)Landroid/graphics/Bitmap;",
(void*)nativeDecodeAsset
},
@@ -647,7 +647,7 @@
jclass bitmap_class = env->FindClass("android/graphics/Bitmap");
SkASSERT(bitmap_class);
- gBitmap_nativeBitmapFieldID = getFieldIDCheck(env, bitmap_class, "mNativeBitmap", "I");
+ gBitmap_nativeBitmapFieldID = getFieldIDCheck(env, bitmap_class, "mNativeBitmap", "J");
gBitmap_layoutBoundsFieldID = getFieldIDCheck(env, bitmap_class, "mLayoutBounds", "[I");
int ret = AndroidRuntime::registerNativeMethods(env,
"android/graphics/BitmapFactory$Options",
diff --git a/core/jni/android/graphics/Camera.cpp b/core/jni/android/graphics/Camera.cpp
index 5176d9a..54d448e 100644
--- a/core/jni/android/graphics/Camera.cpp
+++ b/core/jni/android/graphics/Camera.cpp
@@ -7,84 +7,102 @@
static void Camera_constructor(JNIEnv* env, jobject obj) {
Sk3DView* view = new Sk3DView;
- env->SetIntField(obj, gNativeInstanceFieldID, (int)view);
+ env->SetLongField(obj, gNativeInstanceFieldID, reinterpret_cast<jlong>(view));
}
static void Camera_destructor(JNIEnv* env, jobject obj) {
- delete (Sk3DView*)env->GetIntField(obj, gNativeInstanceFieldID);
+ jlong viewHandle = env->GetLongField(obj, gNativeInstanceFieldID);
+ Sk3DView* view = reinterpret_cast<Sk3DView*>(viewHandle);
+ delete view;
}
static void Camera_save(JNIEnv* env, jobject obj) {
- Sk3DView* v = (Sk3DView*)env->GetIntField(obj, gNativeInstanceFieldID);
+ jlong viewHandle = env->GetLongField(obj, gNativeInstanceFieldID);
+ Sk3DView* v = reinterpret_cast<Sk3DView*>(viewHandle);
v->save();
}
static void Camera_restore(JNIEnv* env, jobject obj) {
- Sk3DView* v = (Sk3DView*)env->GetIntField(obj, gNativeInstanceFieldID);
+ jlong viewHandle = env->GetLongField(obj, gNativeInstanceFieldID);
+ Sk3DView* v = reinterpret_cast<Sk3DView*>(viewHandle);
v->restore();
}
static void Camera_translate(JNIEnv* env, jobject obj,
- float dx, float dy, float dz) {
- Sk3DView* v = (Sk3DView*)env->GetIntField(obj, gNativeInstanceFieldID);
+ jfloat dx, jfloat dy, jfloat dz) {
+ jlong viewHandle = env->GetLongField(obj, gNativeInstanceFieldID);
+ Sk3DView* v = reinterpret_cast<Sk3DView*>(viewHandle);
v->translate(SkFloatToScalar(dx), SkFloatToScalar(dy), SkFloatToScalar(dz));
}
-static void Camera_rotateX(JNIEnv* env, jobject obj, float degrees) {
- Sk3DView* v = (Sk3DView*)env->GetIntField(obj, gNativeInstanceFieldID);
+static void Camera_rotateX(JNIEnv* env, jobject obj, jfloat degrees) {
+ jlong viewHandle = env->GetLongField(obj, gNativeInstanceFieldID);
+ Sk3DView* v = reinterpret_cast<Sk3DView*>(viewHandle);
v->rotateX(SkFloatToScalar(degrees));
}
-static void Camera_rotateY(JNIEnv* env, jobject obj, float degrees) {
- Sk3DView* v = (Sk3DView*)env->GetIntField(obj, gNativeInstanceFieldID);
+static void Camera_rotateY(JNIEnv* env, jobject obj, jfloat degrees) {
+ jlong viewHandle = env->GetLongField(obj, gNativeInstanceFieldID);
+ Sk3DView* v = reinterpret_cast<Sk3DView*>(viewHandle);
v->rotateY(SkFloatToScalar(degrees));
}
-static void Camera_rotateZ(JNIEnv* env, jobject obj, float degrees) {
- Sk3DView* v = (Sk3DView*)env->GetIntField(obj, gNativeInstanceFieldID);
+static void Camera_rotateZ(JNIEnv* env, jobject obj, jfloat degrees) {
+ jlong viewHandle = env->GetLongField(obj, gNativeInstanceFieldID);
+ Sk3DView* v = reinterpret_cast<Sk3DView*>(viewHandle);
v->rotateZ(SkFloatToScalar(degrees));
}
static void Camera_rotate(JNIEnv* env, jobject obj, jfloat x, jfloat y, jfloat z) {
- Sk3DView* v = (Sk3DView*)env->GetIntField(obj, gNativeInstanceFieldID);
+ jlong viewHandle = env->GetLongField(obj, gNativeInstanceFieldID);
+ Sk3DView* v = reinterpret_cast<Sk3DView*>(viewHandle);
v->rotateX(SkFloatToScalar(x));
v->rotateY(SkFloatToScalar(y));
v->rotateZ(SkFloatToScalar(z));
}
static void Camera_setLocation(JNIEnv* env, jobject obj, jfloat x, jfloat y, jfloat z) {
- Sk3DView* v = (Sk3DView*)env->GetIntField(obj, gNativeInstanceFieldID);
+ jlong viewHandle = env->GetLongField(obj, gNativeInstanceFieldID);
+ Sk3DView* v = reinterpret_cast<Sk3DView*>(viewHandle);
v->setCameraLocation(SkFloatToScalar(x), SkFloatToScalar(y), SkFloatToScalar(z));
}
static jfloat Camera_getLocationX(JNIEnv* env, jobject obj) {
- Sk3DView* v = (Sk3DView*)env->GetIntField(obj, gNativeInstanceFieldID);
+ jlong viewHandle = env->GetLongField(obj, gNativeInstanceFieldID);
+ Sk3DView* v = reinterpret_cast<Sk3DView*>(viewHandle);
return SkScalarToFloat(v->getCameraLocationX());
}
static jfloat Camera_getLocationY(JNIEnv* env, jobject obj) {
- Sk3DView* v = (Sk3DView*)env->GetIntField(obj, gNativeInstanceFieldID);
+ jlong viewHandle = env->GetLongField(obj, gNativeInstanceFieldID);
+ Sk3DView* v = reinterpret_cast<Sk3DView*>(viewHandle);
return SkScalarToFloat(v->getCameraLocationY());
}
static jfloat Camera_getLocationZ(JNIEnv* env, jobject obj) {
- Sk3DView* v = (Sk3DView*)env->GetIntField(obj, gNativeInstanceFieldID);
+ jlong viewHandle = env->GetLongField(obj, gNativeInstanceFieldID);
+ Sk3DView* v = reinterpret_cast<Sk3DView*>(viewHandle);
return SkScalarToFloat(v->getCameraLocationZ());
}
-static void Camera_getMatrix(JNIEnv* env, jobject obj, int native_matrix) {
- Sk3DView* v = (Sk3DView*)env->GetIntField(obj, gNativeInstanceFieldID);
- v->getMatrix((SkMatrix*)native_matrix);
+static void Camera_getMatrix(JNIEnv* env, jobject obj, jlong matrixHandle) {
+ SkMatrix* native_matrix = reinterpret_cast<SkMatrix*>(matrixHandle);
+ jlong viewHandle = env->GetLongField(obj, gNativeInstanceFieldID);
+ Sk3DView* v = reinterpret_cast<Sk3DView*>(viewHandle);
+ v->getMatrix(native_matrix);
}
-static void Camera_applyToCanvas(JNIEnv* env, jobject obj, int native_canvas) {
- Sk3DView* v = (Sk3DView*)env->GetIntField(obj, gNativeInstanceFieldID);
+static void Camera_applyToCanvas(JNIEnv* env, jobject obj, jlong canvasHandle) {
+ SkCanvas* native_canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+ jlong viewHandle = env->GetLongField(obj, gNativeInstanceFieldID);
+ Sk3DView* v = reinterpret_cast<Sk3DView*>(viewHandle);
v->applyToCanvas((SkCanvas*)native_canvas);
}
-static float Camera_dotWithNormal(JNIEnv* env, jobject obj,
- float x, float y, float z) {
- Sk3DView* v = (Sk3DView*)env->GetIntField(obj, gNativeInstanceFieldID);
+static jfloat Camera_dotWithNormal(JNIEnv* env, jobject obj,
+ jfloat x, jfloat y, jfloat z) {
+ jlong viewHandle = env->GetLongField(obj, gNativeInstanceFieldID);
+ Sk3DView* v = reinterpret_cast<Sk3DView*>(viewHandle);
SkScalar dot = v->dotWithNormal(SkFloatToScalar(x), SkFloatToScalar(y),
SkFloatToScalar(z));
return SkScalarToFloat(dot);
@@ -111,8 +129,8 @@
{ "getLocationX", "()F", (void*)Camera_getLocationX },
{ "getLocationY", "()F", (void*)Camera_getLocationY },
{ "getLocationZ", "()F", (void*)Camera_getLocationZ },
- { "nativeGetMatrix", "(I)V", (void*)Camera_getMatrix },
- { "nativeApplyToCanvas", "(I)V", (void*)Camera_applyToCanvas },
+ { "nativeGetMatrix", "(J)V", (void*)Camera_getMatrix },
+ { "nativeApplyToCanvas", "(J)V", (void*)Camera_applyToCanvas },
{ "dotWithNormal", "(FFF)F", (void*)Camera_dotWithNormal }
};
@@ -121,7 +139,7 @@
if (clazz == 0) {
return -1;
}
- gNativeInstanceFieldID = env->GetFieldID(clazz, "native_instance", "I");
+ gNativeInstanceFieldID = env->GetFieldID(clazz, "native_instance", "J");
if (gNativeInstanceFieldID == 0) {
return -1;
}
diff --git a/core/jni/android/graphics/Canvas.cpp b/core/jni/android/graphics/Canvas.cpp
index 9a00d538..2cb2812 100644
--- a/core/jni/android/graphics/Canvas.cpp
+++ b/core/jni/android/graphics/Canvas.cpp
@@ -44,13 +44,13 @@
static uint32_t get_thread_msec() {
#if defined(HAVE_POSIX_CLOCKS)
struct timespec tm;
-
+
clock_gettime(CLOCK_THREAD_CPUTIME_ID, &tm);
-
+
return tm.tv_sec * 1000LL + tm.tv_nsec / 1000000;
#else
struct timeval tv;
-
+
gettimeofday(&tv, NULL);
return tv.tv_sec * 1000LL + tv.tv_usec / 1000;
#endif
@@ -76,23 +76,27 @@
class SkCanvasGlue {
public:
- static void finalizer(JNIEnv* env, jobject clazz, SkCanvas* canvas) {
+ static void finalizer(JNIEnv* env, jobject clazz, jlong canvasHandle) {
+ SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
canvas->unref();
}
- static SkCanvas* initRaster(JNIEnv* env, jobject, SkBitmap* bitmap) {
+ static jlong initRaster(JNIEnv* env, jobject, jlong bitmapHandle) {
+ SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
if (bitmap) {
- return new SkCanvas(*bitmap);
+ return reinterpret_cast<jlong>(new SkCanvas(*bitmap));
} else {
// Create an empty bitmap device to prevent callers from crashing
// if they attempt to draw into this canvas.
SkBitmap emptyBitmap;
- return new SkCanvas(emptyBitmap);
+ return reinterpret_cast<jlong>(new SkCanvas(emptyBitmap));
}
}
-
+
static void copyCanvasState(JNIEnv* env, jobject clazz,
- SkCanvas* srcCanvas, SkCanvas* dstCanvas) {
+ jlong srcCanvasHandle, jlong dstCanvasHandle) {
+ SkCanvas* srcCanvas = reinterpret_cast<SkCanvas*>(srcCanvasHandle);
+ SkCanvas* dstCanvas = reinterpret_cast<SkCanvas*>(dstCanvasHandle);
if (srcCanvas && dstCanvas) {
dstCanvas->setMatrix(srcCanvas->getTotalMatrix());
if (NULL != srcCanvas->getDevice() && NULL != dstCanvas->getDevice()) {
@@ -116,73 +120,89 @@
static jboolean isOpaque(JNIEnv* env, jobject jcanvas) {
NPE_CHECK_RETURN_ZERO(env, jcanvas);
SkCanvas* canvas = GraphicsJNI::getNativeCanvas(env, jcanvas);
- return canvas->getDevice()->accessBitmap(false).isOpaque();
- }
-
- static int getWidth(JNIEnv* env, jobject jcanvas) {
- NPE_CHECK_RETURN_ZERO(env, jcanvas);
- SkCanvas* canvas = GraphicsJNI::getNativeCanvas(env, jcanvas);
- return canvas->getDevice()->accessBitmap(false).width();
- }
-
- static int getHeight(JNIEnv* env, jobject jcanvas) {
- NPE_CHECK_RETURN_ZERO(env, jcanvas);
- SkCanvas* canvas = GraphicsJNI::getNativeCanvas(env, jcanvas);
- return canvas->getDevice()->accessBitmap(false).height();
+ bool result = canvas->getDevice()->accessBitmap(false).isOpaque();
+ return result ? JNI_TRUE : JNI_FALSE;
}
- static int saveAll(JNIEnv* env, jobject jcanvas) {
+ static jint getWidth(JNIEnv* env, jobject jcanvas) {
NPE_CHECK_RETURN_ZERO(env, jcanvas);
- return GraphicsJNI::getNativeCanvas(env, jcanvas)->save();
+ SkCanvas* canvas = GraphicsJNI::getNativeCanvas(env, jcanvas);
+ int width = canvas->getDevice()->accessBitmap(false).width();
+ return static_cast<jint>(width);
}
-
- static int save(JNIEnv* env, jobject jcanvas, SkCanvas::SaveFlags flags) {
+
+ static jint getHeight(JNIEnv* env, jobject jcanvas) {
NPE_CHECK_RETURN_ZERO(env, jcanvas);
- return GraphicsJNI::getNativeCanvas(env, jcanvas)->save(flags);
+ SkCanvas* canvas = GraphicsJNI::getNativeCanvas(env, jcanvas);
+ int height = canvas->getDevice()->accessBitmap(false).height();
+ return static_cast<jint>(height);
}
-
- static int saveLayer(JNIEnv* env, jobject, SkCanvas* canvas, jobject bounds,
- SkPaint* paint, int flags) {
+
+ static jint saveAll(JNIEnv* env, jobject jcanvas) {
+ NPE_CHECK_RETURN_ZERO(env, jcanvas);
+ int result = GraphicsJNI::getNativeCanvas(env, jcanvas)->save();
+ return static_cast<jint>(result);
+ }
+
+ static jint save(JNIEnv* env, jobject jcanvas, jint flagsHandle) {
+ SkCanvas::SaveFlags flags = static_cast<SkCanvas::SaveFlags>(flagsHandle);
+ NPE_CHECK_RETURN_ZERO(env, jcanvas);
+ int result = GraphicsJNI::getNativeCanvas(env, jcanvas)->save(flags);
+ return static_cast<jint>(result);
+ }
+
+ static jint saveLayer(JNIEnv* env, jobject, jlong canvasHandle, jobject bounds,
+ jlong paintHandle, jint flags) {
+ SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+ SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
SkRect* bounds_ = NULL;
SkRect storage;
if (bounds != NULL) {
GraphicsJNI::jrectf_to_rect(env, bounds, &storage);
bounds_ = &storage;
}
- return canvas->saveLayer(bounds_, paint, (SkCanvas::SaveFlags)flags);
+ return canvas->saveLayer(bounds_, paint, static_cast<SkCanvas::SaveFlags>(flags));
}
-
- static int saveLayer4F(JNIEnv* env, jobject, SkCanvas* canvas,
+
+ static jint saveLayer4F(JNIEnv* env, jobject, jlong canvasHandle,
jfloat l, jfloat t, jfloat r, jfloat b,
- SkPaint* paint, int flags) {
+ jlong paintHandle, jint flags) {
+ SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+ SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
SkRect bounds;
bounds.set(SkFloatToScalar(l), SkFloatToScalar(t), SkFloatToScalar(r),
SkFloatToScalar(b));
- return canvas->saveLayer(&bounds, paint, (SkCanvas::SaveFlags)flags);
+ int result = canvas->saveLayer(&bounds, paint,
+ static_cast<SkCanvas::SaveFlags>(flags));
+ return static_cast<jint>(result);
}
-
- static int saveLayerAlpha(JNIEnv* env, jobject, SkCanvas* canvas,
- jobject bounds, int alpha, int flags) {
+
+ static jint saveLayerAlpha(JNIEnv* env, jobject, jlong canvasHandle,
+ jobject bounds, jint alpha, jint flags) {
+ SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
SkRect* bounds_ = NULL;
SkRect storage;
if (bounds != NULL) {
GraphicsJNI::jrectf_to_rect(env, bounds, &storage);
bounds_ = &storage;
}
- return canvas->saveLayerAlpha(bounds_, alpha,
- (SkCanvas::SaveFlags)flags);
+ int result = canvas->saveLayerAlpha(bounds_, alpha,
+ static_cast<SkCanvas::SaveFlags>(flags));
+ return static_cast<jint>(result);
}
-
- static int saveLayerAlpha4F(JNIEnv* env, jobject, SkCanvas* canvas,
+
+ static jint saveLayerAlpha4F(JNIEnv* env, jobject, jlong canvasHandle,
jfloat l, jfloat t, jfloat r, jfloat b,
- int alpha, int flags) {
+ jint alpha, jint flags) {
+ SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
SkRect bounds;
bounds.set(SkFloatToScalar(l), SkFloatToScalar(t), SkFloatToScalar(r),
SkFloatToScalar(b));
- return canvas->saveLayerAlpha(&bounds, alpha,
- (SkCanvas::SaveFlags)flags);
+ int result = canvas->saveLayerAlpha(&bounds, alpha,
+ static_cast<SkCanvas::SaveFlags>(flags));
+ return static_cast<jint>(result);
}
-
+
static void restore(JNIEnv* env, jobject jcanvas) {
NPE_CHECK_RETURN_VOID(env, jcanvas);
SkCanvas* canvas = GraphicsJNI::getNativeCanvas(env, jcanvas);
@@ -192,13 +212,14 @@
}
canvas->restore();
}
-
- static int getSaveCount(JNIEnv* env, jobject jcanvas) {
+
+ static jint getSaveCount(JNIEnv* env, jobject jcanvas) {
NPE_CHECK_RETURN_ZERO(env, jcanvas);
- return GraphicsJNI::getNativeCanvas(env, jcanvas)->getSaveCount();
+ int result = GraphicsJNI::getNativeCanvas(env, jcanvas)->getSaveCount();
+ return static_cast<jint>(result);
}
-
- static void restoreToCount(JNIEnv* env, jobject jcanvas, int restoreCount) {
+
+ static void restoreToCount(JNIEnv* env, jobject jcanvas, jint restoreCount) {
NPE_CHECK_RETURN_VOID(env, jcanvas);
SkCanvas* canvas = GraphicsJNI::getNativeCanvas(env, jcanvas);
if (restoreCount < 1) {
@@ -207,48 +228,52 @@
}
canvas->restoreToCount(restoreCount);
}
-
+
static void translate(JNIEnv* env, jobject jcanvas, jfloat dx, jfloat dy) {
NPE_CHECK_RETURN_VOID(env, jcanvas);
SkScalar dx_ = SkFloatToScalar(dx);
SkScalar dy_ = SkFloatToScalar(dy);
(void)GraphicsJNI::getNativeCanvas(env, jcanvas)->translate(dx_, dy_);
}
-
+
static void scale__FF(JNIEnv* env, jobject jcanvas, jfloat sx, jfloat sy) {
NPE_CHECK_RETURN_VOID(env, jcanvas);
SkScalar sx_ = SkFloatToScalar(sx);
SkScalar sy_ = SkFloatToScalar(sy);
(void)GraphicsJNI::getNativeCanvas(env, jcanvas)->scale(sx_, sy_);
}
-
+
static void rotate__F(JNIEnv* env, jobject jcanvas, jfloat degrees) {
NPE_CHECK_RETURN_VOID(env, jcanvas);
SkScalar degrees_ = SkFloatToScalar(degrees);
(void)GraphicsJNI::getNativeCanvas(env, jcanvas)->rotate(degrees_);
}
-
+
static void skew__FF(JNIEnv* env, jobject jcanvas, jfloat sx, jfloat sy) {
NPE_CHECK_RETURN_VOID(env, jcanvas);
SkScalar sx_ = SkFloatToScalar(sx);
SkScalar sy_ = SkFloatToScalar(sy);
(void)GraphicsJNI::getNativeCanvas(env, jcanvas)->skew(sx_, sy_);
}
-
- static void concat(JNIEnv* env, jobject, SkCanvas* canvas,
- const SkMatrix* matrix) {
+
+ static void concat(JNIEnv* env, jobject, jlong canvasHandle,
+ jlong matrixHandle) {
+ SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+ const SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixHandle);
canvas->concat(*matrix);
}
-
- static void setMatrix(JNIEnv* env, jobject, SkCanvas* canvas,
- const SkMatrix* matrix) {
+
+ static void setMatrix(JNIEnv* env, jobject, jlong canvasHandle,
+ jlong matrixHandle) {
+ SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+ const SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixHandle);
if (NULL == matrix) {
canvas->resetMatrix();
} else {
canvas->setMatrix(*matrix);
}
}
-
+
static jboolean clipRect_FFFF(JNIEnv* env, jobject jcanvas, jfloat left,
jfloat top, jfloat right, jfloat bottom) {
NPE_CHECK_RETURN_ZERO(env, jcanvas);
@@ -256,122 +281,149 @@
r.set(SkFloatToScalar(left), SkFloatToScalar(top),
SkFloatToScalar(right), SkFloatToScalar(bottom));
SkCanvas* c = GraphicsJNI::getNativeCanvas(env, jcanvas);
- return c->clipRect(r);
+ bool result = c->clipRect(r);
+ return result ? JNI_TRUE : JNI_FALSE;
}
-
+
static jboolean clipRect_IIII(JNIEnv* env, jobject jcanvas, jint left,
jint top, jint right, jint bottom) {
NPE_CHECK_RETURN_ZERO(env, jcanvas);
SkRect r;
r.set(SkIntToScalar(left), SkIntToScalar(top),
SkIntToScalar(right), SkIntToScalar(bottom));
- return GraphicsJNI::getNativeCanvas(env, jcanvas)->clipRect(r);
+ bool result = GraphicsJNI::getNativeCanvas(env, jcanvas)->clipRect(r);
+ return result ? JNI_TRUE : JNI_FALSE;
}
-
+
static jboolean clipRect_RectF(JNIEnv* env, jobject jcanvas, jobject rectf) {
NPE_CHECK_RETURN_ZERO(env, jcanvas);
NPE_CHECK_RETURN_ZERO(env, rectf);
SkCanvas* c = GraphicsJNI::getNativeCanvas(env, jcanvas);
SkRect tmp;
- return c->clipRect(*GraphicsJNI::jrectf_to_rect(env, rectf, &tmp));
+ bool result = c->clipRect(*GraphicsJNI::jrectf_to_rect(env, rectf, &tmp));
+ return result ? JNI_TRUE : JNI_FALSE;
}
-
+
static jboolean clipRect_Rect(JNIEnv* env, jobject jcanvas, jobject rect) {
NPE_CHECK_RETURN_ZERO(env, jcanvas);
NPE_CHECK_RETURN_ZERO(env, rect);
SkCanvas* c = GraphicsJNI::getNativeCanvas(env, jcanvas);
SkRect tmp;
- return c->clipRect(*GraphicsJNI::jrect_to_rect(env, rect, &tmp));
+ bool result = c->clipRect(*GraphicsJNI::jrect_to_rect(env, rect, &tmp));
+ return result ? JNI_TRUE : JNI_FALSE;
+
}
-
- static jboolean clipRect(JNIEnv* env, jobject, SkCanvas* canvas,
- float left, float top, float right, float bottom,
- int op) {
+
+ static jboolean clipRect(JNIEnv* env, jobject, jlong canvasHandle,
+ jfloat left, jfloat top, jfloat right, jfloat bottom,
+ jint op) {
SkRect rect;
+ SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
rect.set(SkFloatToScalar(left), SkFloatToScalar(top),
SkFloatToScalar(right), SkFloatToScalar(bottom));
- return canvas->clipRect(rect, (SkRegion::Op)op);
+ bool result = canvas->clipRect(rect, static_cast<SkRegion::Op>(op));
+ return result ? JNI_TRUE : JNI_FALSE;
+
}
-
- static jboolean clipPath(JNIEnv* env, jobject, SkCanvas* canvas,
- SkPath* path, int op) {
- return canvas->clipPath(*path, (SkRegion::Op)op);
+
+ static jboolean clipPath(JNIEnv* env, jobject, jlong canvasHandle,
+ SkPath* path, jint op) {
+ SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+ bool result = canvas->clipPath(*path, static_cast<SkRegion::Op>(op));
+ return result ? JNI_TRUE : JNI_FALSE;
}
-
- static jboolean clipRegion(JNIEnv* env, jobject, SkCanvas* canvas,
- SkRegion* deviceRgn, int op) {
- return canvas->clipRegion(*deviceRgn, (SkRegion::Op)op);
+
+ static jboolean clipRegion(JNIEnv* env, jobject, jlong canvasHandle,
+ jlong deviceRgnHandle, jint op) {
+ SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+ SkRegion* deviceRgn = reinterpret_cast<SkRegion*>(deviceRgnHandle);
+ bool result = canvas->clipRegion(*deviceRgn, static_cast<SkRegion::Op>(op));
+ return result ? JNI_TRUE : JNI_FALSE;
}
-
- static void setDrawFilter(JNIEnv* env, jobject, SkCanvas* canvas,
+
+ static void setDrawFilter(JNIEnv* env, jobject, jlong canvasHandle,
SkDrawFilter* filter) {
+ SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
canvas->setDrawFilter(filter);
}
-
- static jboolean quickReject__RectF(JNIEnv* env, jobject, SkCanvas* canvas,
+
+ static jboolean quickReject__RectF(JNIEnv* env, jobject, jlong canvasHandle,
jobject rect) {
+ SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
SkRect rect_;
GraphicsJNI::jrectf_to_rect(env, rect, &rect_);
return canvas->quickReject(rect_);
}
- static jboolean quickReject__Path(JNIEnv* env, jobject, SkCanvas* canvas,
+ static jboolean quickReject__Path(JNIEnv* env, jobject, jlong canvasHandle,
SkPath* path) {
- return canvas->quickReject(*path);
+ SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+ bool result = canvas->quickReject(*path);
+ return result ? JNI_TRUE : JNI_FALSE;
}
- static jboolean quickReject__FFFF(JNIEnv* env, jobject, SkCanvas* canvas,
+ static jboolean quickReject__FFFF(JNIEnv* env, jobject, jlong canvasHandle,
jfloat left, jfloat top, jfloat right,
jfloat bottom) {
+ SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
SkRect r;
r.set(SkFloatToScalar(left), SkFloatToScalar(top),
SkFloatToScalar(right), SkFloatToScalar(bottom));
- return canvas->quickReject(r);
+ bool result = canvas->quickReject(r);
+ return result ? JNI_TRUE : JNI_FALSE;
}
-
- static void drawRGB(JNIEnv* env, jobject, SkCanvas* canvas,
+
+ static void drawRGB(JNIEnv* env, jobject, jlong canvasHandle,
jint r, jint g, jint b) {
+ SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
canvas->drawARGB(0xFF, r, g, b);
}
-
- static void drawARGB(JNIEnv* env, jobject, SkCanvas* canvas,
+
+ static void drawARGB(JNIEnv* env, jobject, jlong canvasHandle,
jint a, jint r, jint g, jint b) {
+ SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
canvas->drawARGB(a, r, g, b);
}
-
- static void drawColor__I(JNIEnv* env, jobject, SkCanvas* canvas,
+
+ static void drawColor__I(JNIEnv* env, jobject, jlong canvasHandle,
jint color) {
+ SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
canvas->drawColor(color);
}
-
- static void drawColor__II(JNIEnv* env, jobject, SkCanvas* canvas,
- jint color, SkPorterDuff::Mode mode) {
+
+ static void drawColor__II(JNIEnv* env, jobject, jlong canvasHandle,
+ jint color, jint modeHandle) {
+ SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+ SkPorterDuff::Mode mode = static_cast<SkPorterDuff::Mode>(modeHandle);
canvas->drawColor(color, SkPorterDuff::ToXfermodeMode(mode));
}
-
- static void drawPaint(JNIEnv* env, jobject, SkCanvas* canvas,
- SkPaint* paint) {
+
+ static void drawPaint(JNIEnv* env, jobject, jlong canvasHandle,
+ jlong paintHandle) {
+ SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+ SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
canvas->drawPaint(*paint);
}
-
+
static void doPoints(JNIEnv* env, jobject jcanvas, jfloatArray jptsArray,
jint offset, jint count, jobject jpaint,
- SkCanvas::PointMode mode) {
+ jint modeHandle) {
NPE_CHECK_RETURN_VOID(env, jcanvas);
NPE_CHECK_RETURN_VOID(env, jptsArray);
NPE_CHECK_RETURN_VOID(env, jpaint);
+ SkCanvas::PointMode mode = static_cast<SkCanvas::PointMode>(modeHandle);
SkCanvas* canvas = GraphicsJNI::getNativeCanvas(env, jcanvas);
const SkPaint& paint = *GraphicsJNI::getNativePaint(env, jpaint);
-
+
AutoJavaFloatArray autoPts(env, jptsArray);
float* floats = autoPts.ptr();
const int length = autoPts.length();
-
+
if ((offset | count) < 0 || offset + count > length) {
doThrowAIOOBE(env);
return;
}
-
+
// now convert the floats into SkPoints
count >>= 1; // now it is the number of points
SkAutoSTMalloc<32, SkPoint> storage(count);
@@ -380,98 +432,118 @@
for (int i = 0; i < count; i++) {
pts[i].set(SkFloatToScalar(src[0]), SkFloatToScalar(src[1]));
src += 2;
- }
+ }
canvas->drawPoints(mode, count, pts, paint);
}
-
+
static void drawPoints(JNIEnv* env, jobject jcanvas, jfloatArray jptsArray,
jint offset, jint count, jobject jpaint) {
doPoints(env, jcanvas, jptsArray, offset, count, jpaint,
SkCanvas::kPoints_PointMode);
}
-
+
static void drawLines(JNIEnv* env, jobject jcanvas, jfloatArray jptsArray,
jint offset, jint count, jobject jpaint) {
doPoints(env, jcanvas, jptsArray, offset, count, jpaint,
SkCanvas::kLines_PointMode);
}
-
- static void drawPoint(JNIEnv* env, jobject jcanvas, float x, float y,
+
+ static void drawPoint(JNIEnv* env, jobject jcanvas, jfloat x, jfloat y,
jobject jpaint) {
NPE_CHECK_RETURN_VOID(env, jcanvas);
NPE_CHECK_RETURN_VOID(env, jpaint);
SkCanvas* canvas = GraphicsJNI::getNativeCanvas(env, jcanvas);
const SkPaint& paint = *GraphicsJNI::getNativePaint(env, jpaint);
-
+
canvas->drawPoint(SkFloatToScalar(x), SkFloatToScalar(y), paint);
}
-
- static void drawLine__FFFFPaint(JNIEnv* env, jobject, SkCanvas* canvas,
+
+ static void drawLine__FFFFPaint(JNIEnv* env, jobject, jlong canvasHandle,
jfloat startX, jfloat startY, jfloat stopX,
- jfloat stopY, SkPaint* paint) {
+ jfloat stopY, jlong paintHandle) {
+ SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+ SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
canvas->drawLine(SkFloatToScalar(startX), SkFloatToScalar(startY),
SkFloatToScalar(stopX), SkFloatToScalar(stopY),
*paint);
}
-
- static void drawRect__RectFPaint(JNIEnv* env, jobject, SkCanvas* canvas,
- jobject rect, SkPaint* paint) {
+
+ static void drawRect__RectFPaint(JNIEnv* env, jobject, jlong canvasHandle,
+ jobject rect, jlong paintHandle) {
+ SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+ SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
SkRect rect_;
GraphicsJNI::jrectf_to_rect(env, rect, &rect_);
canvas->drawRect(rect_, *paint);
}
-
- static void drawRect__FFFFPaint(JNIEnv* env, jobject, SkCanvas* canvas,
+
+ static void drawRect__FFFFPaint(JNIEnv* env, jobject, jlong canvasHandle,
jfloat left, jfloat top, jfloat right,
- jfloat bottom, SkPaint* paint) {
+ jfloat bottom, jlong paintHandle) {
+ SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+ SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
SkScalar left_ = SkFloatToScalar(left);
SkScalar top_ = SkFloatToScalar(top);
SkScalar right_ = SkFloatToScalar(right);
SkScalar bottom_ = SkFloatToScalar(bottom);
canvas->drawRectCoords(left_, top_, right_, bottom_, *paint);
}
-
- static void drawOval(JNIEnv* env, jobject, SkCanvas* canvas, jobject joval,
- SkPaint* paint) {
+
+ static void drawOval(JNIEnv* env, jobject, jlong canvasHandle, jobject joval,
+ jlong paintHandle) {
+ SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+ SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
SkRect oval;
GraphicsJNI::jrectf_to_rect(env, joval, &oval);
canvas->drawOval(oval, *paint);
}
-
- static void drawCircle(JNIEnv* env, jobject, SkCanvas* canvas, jfloat cx,
- jfloat cy, jfloat radius, SkPaint* paint) {
+
+ static void drawCircle(JNIEnv* env, jobject, jlong canvasHandle, jfloat cx,
+ jfloat cy, jfloat radius, jlong paintHandle) {
+ SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+ SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
canvas->drawCircle(SkFloatToScalar(cx), SkFloatToScalar(cy),
SkFloatToScalar(radius), *paint);
}
-
- static void drawArc(JNIEnv* env, jobject, SkCanvas* canvas, jobject joval,
+
+ static void drawArc(JNIEnv* env, jobject, jlong canvasHandle, jobject joval,
jfloat startAngle, jfloat sweepAngle,
- jboolean useCenter, SkPaint* paint) {
+ jboolean useCenter, jlong paintHandle) {
+ SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+ SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
SkRect oval;
GraphicsJNI::jrectf_to_rect(env, joval, &oval);
canvas->drawArc(oval, SkFloatToScalar(startAngle),
SkFloatToScalar(sweepAngle), useCenter, *paint);
}
-
- static void drawRoundRect(JNIEnv* env, jobject, SkCanvas* canvas,
+
+ static void drawRoundRect(JNIEnv* env, jobject, jlong canvasHandle,
jobject jrect, jfloat rx, jfloat ry,
- SkPaint* paint) {
+ jlong paintHandle) {
+ SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+ SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
SkRect rect;
GraphicsJNI::jrectf_to_rect(env, jrect, &rect);
canvas->drawRoundRect(rect, SkFloatToScalar(rx), SkFloatToScalar(ry),
*paint);
}
-
- static void drawPath(JNIEnv* env, jobject, SkCanvas* canvas, SkPath* path,
- SkPaint* paint) {
+
+ static void drawPath(JNIEnv* env, jobject, jlong canvasHandle, jlong pathHandle,
+ jlong paintHandle) {
+ SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+ SkPath* path = reinterpret_cast<SkPath*>(pathHandle);
+ SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
canvas->drawPath(*path, *paint);
}
-
+
static void drawBitmap__BitmapFFPaint(JNIEnv* env, jobject jcanvas,
- SkCanvas* canvas, SkBitmap* bitmap,
+ jlong canvasHandle, jlong bitmapHandle,
jfloat left, jfloat top,
- SkPaint* paint, jint canvasDensity,
+ jlong paintHandle, jint canvasDensity,
jint screenDensity, jint bitmapDensity) {
+ SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+ SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
+ SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
SkScalar left_ = SkFloatToScalar(left);
SkScalar top_ = SkFloatToScalar(top);
@@ -514,7 +586,7 @@
GraphicsJNI::jrect_to_irect(env, srcIRect, &src);
srcPtr = &src;
}
-
+
if (screenDensity != 0 && screenDensity != bitmapDensity) {
SkPaint filteredPaint;
if (paint) {
@@ -527,31 +599,39 @@
}
}
- static void drawBitmapRF(JNIEnv* env, jobject, SkCanvas* canvas,
- SkBitmap* bitmap, jobject srcIRect,
- jobject dstRectF, SkPaint* paint,
+ static void drawBitmapRF(JNIEnv* env, jobject, jlong canvasHandle,
+ jlong bitmapHandle, jobject srcIRect,
+ jobject dstRectF, jlong paintHandle,
jint screenDensity, jint bitmapDensity) {
+ SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+ SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
+ SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
SkRect dst;
GraphicsJNI::jrectf_to_rect(env, dstRectF, &dst);
doDrawBitmap(env, canvas, bitmap, srcIRect, dst, paint,
screenDensity, bitmapDensity);
}
-
- static void drawBitmapRR(JNIEnv* env, jobject, SkCanvas* canvas,
- SkBitmap* bitmap, jobject srcIRect,
- jobject dstRect, SkPaint* paint,
+
+ static void drawBitmapRR(JNIEnv* env, jobject, jlong canvasHandle,
+ jlong bitmapHandle, jobject srcIRect,
+ jobject dstRect, jlong paintHandle,
jint screenDensity, jint bitmapDensity) {
+ SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+ SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
+ SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
SkRect dst;
GraphicsJNI::jrect_to_rect(env, dstRect, &dst);
doDrawBitmap(env, canvas, bitmap, srcIRect, dst, paint,
screenDensity, bitmapDensity);
}
-
- static void drawBitmapArray(JNIEnv* env, jobject, SkCanvas* canvas,
- jintArray jcolors, int offset, int stride,
- jfloat x, jfloat y, int width, int height,
- jboolean hasAlpha, SkPaint* paint)
+
+ static void drawBitmapArray(JNIEnv* env, jobject, jlong canvasHandle,
+ jintArray jcolors, jint offset, jint stride,
+ jfloat x, jfloat y, jint width, jint height,
+ jboolean hasAlpha, jlong paintHandle)
{
+ SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+ SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
SkBitmap bitmap;
bitmap.setConfig(hasAlpha ? SkBitmap::kARGB_8888_Config :
SkBitmap::kRGB_565_Config, width, height);
@@ -567,24 +647,31 @@
canvas->drawBitmap(bitmap, SkFloatToScalar(x), SkFloatToScalar(y),
paint);
}
-
- static void drawBitmapMatrix(JNIEnv* env, jobject, SkCanvas* canvas,
- const SkBitmap* bitmap, const SkMatrix* matrix,
- const SkPaint* paint) {
+
+ static void drawBitmapMatrix(JNIEnv* env, jobject, jlong canvasHandle,
+ jlong bitmapHandle, jlong matrixHandle,
+ jlong paintHandle) {
+ SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+ const SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
+ const SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixHandle);
+ const SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
canvas->drawBitmapMatrix(*bitmap, *matrix, paint);
}
-
- static void drawBitmapMesh(JNIEnv* env, jobject, SkCanvas* canvas,
- const SkBitmap* bitmap, int meshWidth, int meshHeight,
- jfloatArray jverts, int vertIndex, jintArray jcolors,
- int colorIndex, const SkPaint* paint) {
+
+ static void drawBitmapMesh(JNIEnv* env, jobject, jlong canvasHandle,
+ jlong bitmapHandle, jint meshWidth, jint meshHeight,
+ jfloatArray jverts, jint vertIndex, jintArray jcolors,
+ jint colorIndex, jlong paintHandle) {
+ SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+ const SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
+ const SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
const int ptCount = (meshWidth + 1) * (meshHeight + 1);
const int indexCount = meshWidth * meshHeight * 6;
AutoJavaFloatArray vertA(env, jverts, vertIndex + (ptCount << 1));
AutoJavaIntArray colorA(env, jcolors, colorIndex + ptCount);
-
+
/* Our temp storage holds 2 or 3 arrays.
texture points [ptCount * sizeof(SkPoint)]
optionally vertex points [ptCount * sizeof(SkPoint)] if we need a
@@ -623,7 +710,7 @@
const SkScalar h = SkIntToScalar(bitmap->height());
const SkScalar dx = w / meshWidth;
const SkScalar dy = h / meshHeight;
-
+
SkPoint* texsPtr = texs;
SkScalar y = 0;
for (int i = 0; i <= meshHeight; i++) {
@@ -642,7 +729,7 @@
}
SkASSERT(texsPtr - texs == ptCount);
}
-
+
// cons up indices
{
uint16_t* indexPtr = indices;
@@ -690,13 +777,16 @@
indexCount, tmpPaint);
}
- static void drawVertices(JNIEnv* env, jobject, SkCanvas* canvas,
- SkCanvas::VertexMode mode, int vertexCount,
- jfloatArray jverts, int vertIndex,
- jfloatArray jtexs, int texIndex,
- jintArray jcolors, int colorIndex,
- jshortArray jindices, int indexIndex,
- int indexCount, const SkPaint* paint) {
+ static void drawVertices(JNIEnv* env, jobject, jlong canvasHandle,
+ jint modeHandle, jint vertexCount,
+ jfloatArray jverts, jint vertIndex,
+ jfloatArray jtexs, jint texIndex,
+ jintArray jcolors, jint colorIndex,
+ jshortArray jindices, jint indexIndex,
+ jint indexCount, jlong paintHandle) {
+ SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+ SkCanvas::VertexMode mode = static_cast<SkCanvas::VertexMode>(modeHandle);
+ const SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
AutoJavaFloatArray vertA(env, jverts, vertIndex + vertexCount);
AutoJavaFloatArray texA(env, jtexs, texIndex + vertexCount);
@@ -718,7 +808,7 @@
count += ptCount; // += for texs
}
SkAutoMalloc storage(count * sizeof(SkPoint));
- verts = (SkPoint*)storage.get();
+ verts = (SkPoint*)storage.get();
const float* src = vertA.ptr() + vertIndex;
for (int i = 0; i < ptCount; i++) {
verts[i].set(SkFloatToFixed(src[0]), SkFloatToFixed(src[1]));
@@ -748,20 +838,26 @@
}
- static void drawText___CIIFFIPaintTypeface(JNIEnv* env, jobject, SkCanvas* canvas,
- jcharArray text, int index, int count,
- jfloat x, jfloat y, int flags, SkPaint* paint,
- TypefaceImpl *typeface) {
+ static void drawText___CIIFFIPaintTypeface(JNIEnv* env, jobject, jlong canvasHandle,
+ jcharArray text, jint index, jint count,
+ jfloat x, jfloat y, jint flags,
+ jlong paintHandle, jlong typefaceHandle) {
+ SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+ SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
+ TypefaceImpl* typeface = reinterpret_cast<TypefaceImpl*>(typefaceHandle);
jchar* textArray = env->GetCharArrayElements(text, NULL);
drawTextWithGlyphs(canvas, textArray + index, 0, count, x, y, flags, paint, typeface);
env->ReleaseCharArrayElements(text, textArray, JNI_ABORT);
}
static void drawText__StringIIFFIPaintTypeface(JNIEnv* env, jobject,
- SkCanvas* canvas, jstring text,
- int start, int end,
- jfloat x, jfloat y, int flags, SkPaint* paint,
- TypefaceImpl *typeface) {
+ jlong canvasHandle, jstring text,
+ jint start, jint end,
+ jfloat x, jfloat y, jint flags,
+ jlong paintHandle, jlong typefaceHandle) {
+ SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+ SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
+ TypefaceImpl* typeface = reinterpret_cast<TypefaceImpl*>(typefaceHandle);
const jchar* textArray = env->GetStringChars(text, NULL);
drawTextWithGlyphs(canvas, textArray, start, end, x, y, flags, paint, typeface);
env->ReleaseStringChars(text, textArray);
@@ -898,10 +994,12 @@
}
static void drawTextRun___CIIIIFFIPaintTypeface(
- JNIEnv* env, jobject, SkCanvas* canvas, jcharArray text, int index,
- int count, int contextIndex, int contextCount,
- jfloat x, jfloat y, int dirFlags, SkPaint* paint,
- TypefaceImpl* typeface) {
+ JNIEnv* env, jobject, jlong canvasHandle, jcharArray text, jint index,
+ jint count, jint contextIndex, jint contextCount,
+ jfloat x, jfloat y, jint dirFlags, jlong paintHandle, jlong typefaceHandle) {
+ SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+ SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
+ TypefaceImpl* typeface = reinterpret_cast<TypefaceImpl*>(typefaceHandle);
jchar* chars = env->GetCharArrayElements(text, NULL);
drawTextWithGlyphs(canvas, chars + contextIndex, index - contextIndex,
@@ -910,10 +1008,12 @@
}
static void drawTextRun__StringIIIIFFIPaintTypeface(
- JNIEnv* env, jobject obj, SkCanvas* canvas, jstring text, jint start,
+ JNIEnv* env, jobject obj, jlong canvasHandle, jstring text, jint start,
jint end, jint contextStart, jint contextEnd,
- jfloat x, jfloat y, jint dirFlags, SkPaint* paint,
- TypefaceImpl* typeface) {
+ jfloat x, jfloat y, jint dirFlags, jlong paintHandle, jlong typefaceHandle) {
+ SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+ SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
+ TypefaceImpl* typeface = reinterpret_cast<TypefaceImpl*>(typefaceHandle);
jint count = end - start;
jint contextCount = contextEnd - contextStart;
@@ -923,9 +1023,11 @@
env->ReleaseStringChars(text, chars);
}
- static void drawPosText___CII_FPaint(JNIEnv* env, jobject, SkCanvas* canvas,
- jcharArray text, int index, int count,
- jfloatArray pos, SkPaint* paint) {
+ static void drawPosText___CII_FPaint(JNIEnv* env, jobject, jlong canvasHandle,
+ jcharArray text, jint index, jint count,
+ jfloatArray pos, jlong paintHandle) {
+ SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+ SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
jchar* textArray = text ? env->GetCharArrayElements(text, NULL) : NULL;
jsize textCount = text ? env->GetArrayLength(text) : NULL;
float* posArray = pos ? env->GetFloatArrayElements(pos, NULL) : NULL;
@@ -936,12 +1038,12 @@
posPtr[indx].fX = SkFloatToScalar(posArray[indx << 1]);
posPtr[indx].fY = SkFloatToScalar(posArray[(indx << 1) + 1]);
}
-
+
SkPaint::TextEncoding encoding = paint->getTextEncoding();
paint->setTextEncoding(SkPaint::kUTF16_TextEncoding);
canvas->drawPosText(textArray + index, count << 1, posPtr, *paint);
paint->setTextEncoding(encoding);
-
+
if (text) {
env->ReleaseCharArrayElements(text, textArray, 0);
}
@@ -952,9 +1054,11 @@
}
static void drawPosText__String_FPaint(JNIEnv* env, jobject,
- SkCanvas* canvas, jstring text,
+ jlong canvasHandle, jstring text,
jfloatArray pos,
- SkPaint* paint) {
+ jlong paintHandle) {
+ SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+ SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
const void* text_ = text ? env->GetStringChars(text, NULL) : NULL;
int byteLength = text ? env->GetStringLength(text) : 0;
float* posArray = pos ? env->GetFloatArrayElements(pos, NULL) : NULL;
@@ -981,8 +1085,11 @@
}
static void drawTextOnPath___CIIPathFFPaint(JNIEnv* env, jobject,
- SkCanvas* canvas, jcharArray text, int index, int count,
- SkPath* path, jfloat hOffset, jfloat vOffset, jint bidiFlags, SkPaint* paint) {
+ jlong canvasHandle, jcharArray text, jint index, jint count,
+ jlong pathHandle, jfloat hOffset, jfloat vOffset, jint bidiFlags, jlong paintHandle) {
+ SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+ SkPath* path = reinterpret_cast<SkPath*>(pathHandle);
+ SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
jchar* textArray = env->GetCharArrayElements(text, NULL);
TextLayout::drawTextOnPath(paint, textArray + index, count, bidiFlags, hOffset, vOffset,
@@ -991,8 +1098,11 @@
}
static void drawTextOnPath__StringPathFFPaint(JNIEnv* env, jobject,
- SkCanvas* canvas, jstring text, SkPath* path,
- jfloat hOffset, jfloat vOffset, jint bidiFlags, SkPaint* paint) {
+ jlong canvasHandle, jstring text, jlong pathHandle,
+ jfloat hOffset, jfloat vOffset, jint bidiFlags, jlong paintHandle) {
+ SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+ SkPath* path = reinterpret_cast<SkPath*>(pathHandle);
+ SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
const jchar* text_ = env->GetStringChars(text, NULL);
int count = env->GetStringLength(text);
TextLayout::drawTextOnPath(paint, text_, count, bidiFlags, hOffset, vOffset,
@@ -1027,8 +1137,9 @@
return true;
}
- static bool getClipBounds(JNIEnv* env, jobject, SkCanvas* canvas,
- jobject bounds) {
+ static jboolean getClipBounds(JNIEnv* env, jobject, jlong canvasHandle,
+ jobject bounds) {
+ SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
SkRect r;
SkIRect ir;
bool result = getHardClipBounds(canvas, &r);
@@ -1039,30 +1150,32 @@
r.round(&ir);
(void)GraphicsJNI::irect_to_jrect(ir, env, bounds);
- return result;
+ return result ? JNI_TRUE : JNI_FALSE;
}
- static void getCTM(JNIEnv* env, jobject, SkCanvas* canvas,
- SkMatrix* matrix) {
+ static void getCTM(JNIEnv* env, jobject, jlong canvasHandle,
+ jlong matrixHandle) {
+ SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+ SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixHandle);
*matrix = canvas->getTotalMatrix();
}
};
static JNINativeMethod gCanvasMethods[] = {
- {"finalizer", "(I)V", (void*) SkCanvasGlue::finalizer},
- {"initRaster","(I)I", (void*) SkCanvasGlue::initRaster},
- {"copyNativeCanvasState","(II)V", (void*) SkCanvasGlue::copyCanvasState},
+ {"finalizer", "(J)V", (void*) SkCanvasGlue::finalizer},
+ {"initRaster","(J)J", (void*) SkCanvasGlue::initRaster},
+ {"copyNativeCanvasState","(JJ)V", (void*) SkCanvasGlue::copyCanvasState},
{"isOpaque","()Z", (void*) SkCanvasGlue::isOpaque},
{"getWidth","()I", (void*) SkCanvasGlue::getWidth},
{"getHeight","()I", (void*) SkCanvasGlue::getHeight},
{"save","()I", (void*) SkCanvasGlue::saveAll},
{"save","(I)I", (void*) SkCanvasGlue::save},
- {"native_saveLayer","(ILandroid/graphics/RectF;II)I",
+ {"native_saveLayer","(JLandroid/graphics/RectF;JI)I",
(void*) SkCanvasGlue::saveLayer},
- {"native_saveLayer","(IFFFFII)I", (void*) SkCanvasGlue::saveLayer4F},
- {"native_saveLayerAlpha","(ILandroid/graphics/RectF;II)I",
+ {"native_saveLayer","(JFFFFJI)I", (void*) SkCanvasGlue::saveLayer4F},
+ {"native_saveLayerAlpha","(JLandroid/graphics/RectF;II)I",
(void*) SkCanvasGlue::saveLayerAlpha},
- {"native_saveLayerAlpha","(IFFFFII)I",
+ {"native_saveLayerAlpha","(JFFFFII)I",
(void*) SkCanvasGlue::saveLayerAlpha4F},
{"restore","()V", (void*) SkCanvasGlue::restore},
{"getSaveCount","()I", (void*) SkCanvasGlue::getSaveCount},
@@ -1071,77 +1184,77 @@
{"scale","(FF)V", (void*) SkCanvasGlue::scale__FF},
{"rotate","(F)V", (void*) SkCanvasGlue::rotate__F},
{"skew","(FF)V", (void*) SkCanvasGlue::skew__FF},
- {"native_concat","(II)V", (void*) SkCanvasGlue::concat},
- {"native_setMatrix","(II)V", (void*) SkCanvasGlue::setMatrix},
+ {"native_concat","(JJ)V", (void*) SkCanvasGlue::concat},
+ {"native_setMatrix","(JJ)V", (void*) SkCanvasGlue::setMatrix},
{"clipRect","(FFFF)Z", (void*) SkCanvasGlue::clipRect_FFFF},
{"clipRect","(IIII)Z", (void*) SkCanvasGlue::clipRect_IIII},
{"clipRect","(Landroid/graphics/RectF;)Z",
(void*) SkCanvasGlue::clipRect_RectF},
{"clipRect","(Landroid/graphics/Rect;)Z",
(void*) SkCanvasGlue::clipRect_Rect},
- {"native_clipRect","(IFFFFI)Z", (void*) SkCanvasGlue::clipRect},
- {"native_clipPath","(III)Z", (void*) SkCanvasGlue::clipPath},
- {"native_clipRegion","(III)Z", (void*) SkCanvasGlue::clipRegion},
- {"nativeSetDrawFilter", "(II)V", (void*) SkCanvasGlue::setDrawFilter},
- {"native_getClipBounds","(ILandroid/graphics/Rect;)Z",
+ {"native_clipRect","(JFFFFI)Z", (void*) SkCanvasGlue::clipRect},
+ {"native_clipPath","(JJI)Z", (void*) SkCanvasGlue::clipPath},
+ {"native_clipRegion","(JJI)Z", (void*) SkCanvasGlue::clipRegion},
+ {"nativeSetDrawFilter", "(JJ)V", (void*) SkCanvasGlue::setDrawFilter},
+ {"native_getClipBounds","(JLandroid/graphics/Rect;)Z",
(void*) SkCanvasGlue::getClipBounds},
- {"native_getCTM", "(II)V", (void*)SkCanvasGlue::getCTM},
- {"native_quickReject","(ILandroid/graphics/RectF;)Z",
+ {"native_getCTM", "(JJ)V", (void*)SkCanvasGlue::getCTM},
+ {"native_quickReject","(JLandroid/graphics/RectF;)Z",
(void*) SkCanvasGlue::quickReject__RectF},
- {"native_quickReject","(II)Z", (void*) SkCanvasGlue::quickReject__Path},
- {"native_quickReject","(IFFFF)Z", (void*)SkCanvasGlue::quickReject__FFFF},
- {"native_drawRGB","(IIII)V", (void*) SkCanvasGlue::drawRGB},
- {"native_drawARGB","(IIIII)V", (void*) SkCanvasGlue::drawARGB},
- {"native_drawColor","(II)V", (void*) SkCanvasGlue::drawColor__I},
- {"native_drawColor","(III)V", (void*) SkCanvasGlue::drawColor__II},
- {"native_drawPaint","(II)V", (void*) SkCanvasGlue::drawPaint},
+ {"native_quickReject","(JJ)Z", (void*) SkCanvasGlue::quickReject__Path},
+ {"native_quickReject","(JFFFF)Z", (void*)SkCanvasGlue::quickReject__FFFF},
+ {"native_drawRGB","(JIII)V", (void*) SkCanvasGlue::drawRGB},
+ {"native_drawARGB","(JIIII)V", (void*) SkCanvasGlue::drawARGB},
+ {"native_drawColor","(JI)V", (void*) SkCanvasGlue::drawColor__I},
+ {"native_drawColor","(JII)V", (void*) SkCanvasGlue::drawColor__II},
+ {"native_drawPaint","(JJ)V", (void*) SkCanvasGlue::drawPaint},
{"drawPoint", "(FFLandroid/graphics/Paint;)V",
(void*) SkCanvasGlue::drawPoint},
{"drawPoints", "([FIILandroid/graphics/Paint;)V",
(void*) SkCanvasGlue::drawPoints},
{"drawLines", "([FIILandroid/graphics/Paint;)V",
(void*) SkCanvasGlue::drawLines},
- {"native_drawLine","(IFFFFI)V", (void*) SkCanvasGlue::drawLine__FFFFPaint},
- {"native_drawRect","(ILandroid/graphics/RectF;I)V",
+ {"native_drawLine","(JFFFFJ)V", (void*) SkCanvasGlue::drawLine__FFFFPaint},
+ {"native_drawRect","(JLandroid/graphics/RectF;J)V",
(void*) SkCanvasGlue::drawRect__RectFPaint},
- {"native_drawRect","(IFFFFI)V", (void*) SkCanvasGlue::drawRect__FFFFPaint},
- {"native_drawOval","(ILandroid/graphics/RectF;I)V",
+ {"native_drawRect","(JFFFFJ)V", (void*) SkCanvasGlue::drawRect__FFFFPaint},
+ {"native_drawOval","(JLandroid/graphics/RectF;J)V",
(void*) SkCanvasGlue::drawOval},
- {"native_drawCircle","(IFFFI)V", (void*) SkCanvasGlue::drawCircle},
- {"native_drawArc","(ILandroid/graphics/RectF;FFZI)V",
+ {"native_drawCircle","(JFFFJ)V", (void*) SkCanvasGlue::drawCircle},
+ {"native_drawArc","(JLandroid/graphics/RectF;FFZJ)V",
(void*) SkCanvasGlue::drawArc},
- {"native_drawRoundRect","(ILandroid/graphics/RectF;FFI)V",
+ {"native_drawRoundRect","(JLandroid/graphics/RectF;FFJ)V",
(void*) SkCanvasGlue::drawRoundRect},
- {"native_drawPath","(III)V", (void*) SkCanvasGlue::drawPath},
- {"native_drawBitmap","(IIFFIIII)V",
+ {"native_drawPath","(JJJ)V", (void*) SkCanvasGlue::drawPath},
+ {"native_drawBitmap","(JJFFJIII)V",
(void*) SkCanvasGlue::drawBitmap__BitmapFFPaint},
- {"native_drawBitmap","(IILandroid/graphics/Rect;Landroid/graphics/RectF;III)V",
+ {"native_drawBitmap","(JJLandroid/graphics/Rect;Landroid/graphics/RectF;JII)V",
(void*) SkCanvasGlue::drawBitmapRF},
- {"native_drawBitmap","(IILandroid/graphics/Rect;Landroid/graphics/Rect;III)V",
+ {"native_drawBitmap","(JJLandroid/graphics/Rect;Landroid/graphics/Rect;JII)V",
(void*) SkCanvasGlue::drawBitmapRR},
- {"native_drawBitmap", "(I[IIIFFIIZI)V",
+ {"native_drawBitmap", "(J[IIIFFIIZJ)V",
(void*)SkCanvasGlue::drawBitmapArray},
- {"nativeDrawBitmapMatrix", "(IIII)V",
+ {"nativeDrawBitmapMatrix", "(JJJJ)V",
(void*)SkCanvasGlue::drawBitmapMatrix},
- {"nativeDrawBitmapMesh", "(IIII[FI[III)V",
+ {"nativeDrawBitmapMesh", "(JJII[FI[IIJ)V",
(void*)SkCanvasGlue::drawBitmapMesh},
- {"nativeDrawVertices", "(III[FI[FI[II[SIII)V",
+ {"nativeDrawVertices", "(JII[FI[FI[II[SIIJ)V",
(void*)SkCanvasGlue::drawVertices},
- {"native_drawText","(I[CIIFFIII)V",
+ {"native_drawText","(J[CIIFFIJJ)V",
(void*) SkCanvasGlue::drawText___CIIFFIPaintTypeface},
- {"native_drawText","(ILjava/lang/String;IIFFIII)V",
+ {"native_drawText","(JLjava/lang/String;IIFFIJJ)V",
(void*) SkCanvasGlue::drawText__StringIIFFIPaintTypeface},
- {"native_drawTextRun","(I[CIIIIFFIII)V",
+ {"native_drawTextRun","(J[CIIIIFFIJJ)V",
(void*) SkCanvasGlue::drawTextRun___CIIIIFFIPaintTypeface},
- {"native_drawTextRun","(ILjava/lang/String;IIIIFFIII)V",
+ {"native_drawTextRun","(JLjava/lang/String;IIIIFFIJJ)V",
(void*) SkCanvasGlue::drawTextRun__StringIIIIFFIPaintTypeface},
- {"native_drawPosText","(I[CII[FI)V",
+ {"native_drawPosText","(J[CII[FJ)V",
(void*) SkCanvasGlue::drawPosText___CII_FPaint},
- {"native_drawPosText","(ILjava/lang/String;[FI)V",
+ {"native_drawPosText","(JLjava/lang/String;[FJ)V",
(void*) SkCanvasGlue::drawPosText__String_FPaint},
- {"native_drawTextOnPath","(I[CIIIFFII)V",
+ {"native_drawTextOnPath","(J[CIIJFFIJ)V",
(void*) SkCanvasGlue::drawTextOnPath___CIIPathFFPaint},
- {"native_drawTextOnPath","(ILjava/lang/String;IFFII)V",
+ {"native_drawTextOnPath","(JLjava/lang/String;JFFIJ)V",
(void*) SkCanvasGlue::drawTextOnPath__StringPathFFPaint},
{"freeCaches", "()V", (void*) SkCanvasGlue::freeCaches},
@@ -1162,7 +1275,7 @@
int result;
REG(env, "android/graphics/Canvas", gCanvasMethods);
-
+
return result;
}
diff --git a/core/jni/android/graphics/ColorFilter.cpp b/core/jni/android/graphics/ColorFilter.cpp
index 26169e7..da40acff 100644
--- a/core/jni/android/graphics/ColorFilter.cpp
+++ b/core/jni/android/graphics/ColorFilter.cpp
@@ -32,7 +32,9 @@
class SkColorFilterGlue {
public:
- static void finalizer(JNIEnv* env, jobject clazz, SkColorFilter* obj, SkiaColorFilter* f) {
+ static void finalizer(JNIEnv* env, jobject clazz, jlong objHandle, jlong fHandle) {
+ SkColorFilter* obj = reinterpret_cast<SkColorFilter *>(objHandle);
+ SkiaColorFilter* f = reinterpret_cast<SkiaColorFilter *>(fHandle);
if (obj) SkSafeUnref(obj);
// f == NULL when not !USE_OPENGL_RENDERER, so no need to delete outside the ifdef
#ifdef USE_OPENGL_RENDERER
@@ -44,26 +46,30 @@
#endif
}
- static SkiaColorFilter* glCreatePorterDuffFilter(JNIEnv* env, jobject, SkColorFilter *skFilter,
- jint srcColor, SkPorterDuff::Mode mode) {
+ static jlong glCreatePorterDuffFilter(JNIEnv* env, jobject, jlong skFilterHandle,
+ jint srcColor, jint modeHandle) {
+ SkColorFilter *skFilter = reinterpret_cast<SkColorFilter *>(skFilterHandle);
+ SkPorterDuff::Mode mode = static_cast<SkPorterDuff::Mode>(modeHandle);
#ifdef USE_OPENGL_RENDERER
- return new SkiaBlendFilter(skFilter, srcColor, SkPorterDuff::ToXfermodeMode(mode));
+ return reinterpret_cast<jlong>(new SkiaBlendFilter(skFilter, srcColor, SkPorterDuff::ToXfermodeMode(mode)));
#else
return NULL;
#endif
}
- static SkiaColorFilter* glCreateLightingFilter(JNIEnv* env, jobject, SkColorFilter *skFilter,
+ static jlong glCreateLightingFilter(JNIEnv* env, jobject, jlong skFilterHandle,
jint mul, jint add) {
+ SkColorFilter *skFilter = reinterpret_cast<SkColorFilter *>(skFilterHandle);
#ifdef USE_OPENGL_RENDERER
- return new SkiaLightingFilter(skFilter, mul, add);
+ return reinterpret_cast<jlong>(new SkiaLightingFilter(skFilter, mul, add));
#else
return NULL;
#endif
}
- static SkiaColorFilter* glCreateColorMatrixFilter(JNIEnv* env, jobject, SkColorFilter *skFilter,
+ static jlong glCreateColorMatrixFilter(JNIEnv* env, jobject, jlong skFilterHandle,
jfloatArray jarray) {
+ SkColorFilter *skFilter = reinterpret_cast<SkColorFilter *>(skFilterHandle);
#ifdef USE_OPENGL_RENDERER
AutoJavaFloatArray autoArray(env, jarray, 20);
const float* src = autoArray.ptr();
@@ -80,22 +86,23 @@
colorVector[2] = src[14];
colorVector[3] = src[19];
- return new SkiaColorMatrixFilter(skFilter, colorMatrix, colorVector);
+ return reinterpret_cast<jlong>(new SkiaColorMatrixFilter(skFilter, colorMatrix, colorVector));
#else
return NULL;
#endif
}
- static SkColorFilter* CreatePorterDuffFilter(JNIEnv* env, jobject, jint srcColor,
- SkPorterDuff::Mode mode) {
- return SkColorFilter::CreateModeFilter(srcColor, SkPorterDuff::ToXfermodeMode(mode));
+ static jlong CreatePorterDuffFilter(JNIEnv* env, jobject, jint srcColor,
+ jint modeHandle) {
+ SkPorterDuff::Mode mode = (SkPorterDuff::Mode) modeHandle;
+ return reinterpret_cast<jlong>(SkColorFilter::CreateModeFilter(srcColor, SkPorterDuff::ToXfermodeMode(mode)));
}
- static SkColorFilter* CreateLightingFilter(JNIEnv* env, jobject, jint mul, jint add) {
- return SkColorFilter::CreateLightingFilter(mul, add);
+ static jlong CreateLightingFilter(JNIEnv* env, jobject, jint mul, jint add) {
+ return reinterpret_cast<jlong>(SkColorFilter::CreateLightingFilter(mul, add));
}
- static SkColorFilter* CreateColorMatrixFilter(JNIEnv* env, jobject, jfloatArray jarray) {
+ static jlong CreateColorMatrixFilter(JNIEnv* env, jobject, jfloatArray jarray) {
AutoJavaFloatArray autoArray(env, jarray, 20);
const float* src = autoArray.ptr();
@@ -104,30 +111,30 @@
for (int i = 0; i < 20; i++) {
array[i] = SkFloatToScalar(src[i]);
}
- return new SkColorMatrixFilter(array);
+ return reinterpret_cast<jlong>(new SkColorMatrixFilter(array));
#else
- return new SkColorMatrixFilter(src);
+ return reinterpret_cast<jlong>(new SkColorMatrixFilter(src));
#endif
}
};
static JNINativeMethod colorfilter_methods[] = {
- {"destroyFilter", "(II)V", (void*) SkColorFilterGlue::finalizer}
+ {"destroyFilter", "(JJ)V", (void*) SkColorFilterGlue::finalizer}
};
static JNINativeMethod porterduff_methods[] = {
- { "native_CreatePorterDuffFilter", "(II)I", (void*) SkColorFilterGlue::CreatePorterDuffFilter },
- { "nCreatePorterDuffFilter", "(III)I", (void*) SkColorFilterGlue::glCreatePorterDuffFilter }
+ { "native_CreatePorterDuffFilter", "(II)J", (void*) SkColorFilterGlue::CreatePorterDuffFilter },
+ { "nCreatePorterDuffFilter", "(JII)J", (void*) SkColorFilterGlue::glCreatePorterDuffFilter }
};
static JNINativeMethod lighting_methods[] = {
- { "native_CreateLightingFilter", "(II)I", (void*) SkColorFilterGlue::CreateLightingFilter },
- { "nCreateLightingFilter", "(III)I", (void*) SkColorFilterGlue::glCreateLightingFilter },
+ { "native_CreateLightingFilter", "(II)J", (void*) SkColorFilterGlue::CreateLightingFilter },
+ { "nCreateLightingFilter", "(JII)J", (void*) SkColorFilterGlue::glCreateLightingFilter },
};
static JNINativeMethod colormatrix_methods[] = {
- { "nativeColorMatrixFilter", "([F)I", (void*) SkColorFilterGlue::CreateColorMatrixFilter },
- { "nColorMatrixFilter", "(I[F)I", (void*) SkColorFilterGlue::glCreateColorMatrixFilter }
+ { "nativeColorMatrixFilter", "([F)J", (void*) SkColorFilterGlue::CreateColorMatrixFilter },
+ { "nColorMatrixFilter", "(J[F)J", (void*) SkColorFilterGlue::glCreateColorMatrixFilter }
};
#define REG(env, name, array) \
diff --git a/core/jni/android/graphics/DrawFilter.cpp b/core/jni/android/graphics/DrawFilter.cpp
index 2f9fe7e..fbfa2ec 100644
--- a/core/jni/android/graphics/DrawFilter.cpp
+++ b/core/jni/android/graphics/DrawFilter.cpp
@@ -33,18 +33,20 @@
class SkDrawFilterGlue {
public:
- static void finalizer(JNIEnv* env, jobject clazz, SkDrawFilter* obj) {
+ static void finalizer(JNIEnv* env, jobject clazz, jlong objHandle) {
+ SkDrawFilter* obj = reinterpret_cast<SkDrawFilter*>(objHandle);
SkSafeUnref(obj);
}
- static SkDrawFilter* CreatePaintFlagsDF(JNIEnv* env, jobject clazz,
- int clearFlags, int setFlags) {
+ static jlong CreatePaintFlagsDF(JNIEnv* env, jobject clazz,
+ jint clearFlags, jint setFlags) {
// trim off any out-of-range bits
clearFlags &= SkPaint::kAllFlags;
setFlags &= SkPaint::kAllFlags;
if (clearFlags | setFlags) {
- return new SkPaintFlagsDrawFilter(clearFlags, setFlags);
+ SkDrawFilter* filter = new SkPaintFlagsDrawFilter(clearFlags, setFlags);
+ return reinterpret_cast<jlong>(filter);
} else {
return NULL;
}
@@ -52,11 +54,11 @@
};
static JNINativeMethod drawfilter_methods[] = {
- {"nativeDestructor", "(I)V", (void*) SkDrawFilterGlue::finalizer}
+ {"nativeDestructor", "(J)V", (void*) SkDrawFilterGlue::finalizer}
};
static JNINativeMethod paintflags_methods[] = {
- {"nativeConstructor","(II)I", (void*) SkDrawFilterGlue::CreatePaintFlagsDF}
+ {"nativeConstructor","(II)J", (void*) SkDrawFilterGlue::CreatePaintFlagsDF}
};
#define REG(env, name, array) \
diff --git a/core/jni/android/graphics/Graphics.cpp b/core/jni/android/graphics/Graphics.cpp
index 2a2db57..66f9f3d 100644
--- a/core/jni/android/graphics/Graphics.cpp
+++ b/core/jni/android/graphics/Graphics.cpp
@@ -293,7 +293,8 @@
SkASSERT(env);
SkASSERT(bitmap);
SkASSERT(env->IsInstanceOf(bitmap, gBitmap_class));
- SkBitmap* b = (SkBitmap*)env->GetIntField(bitmap, gBitmap_nativeInstanceID);
+ jlong bitmapHandle = env->GetLongField(bitmap, gBitmap_nativeInstanceID);
+ SkBitmap* b = reinterpret_cast<SkBitmap*>(bitmapHandle);
SkASSERT(b);
return b;
}
@@ -316,7 +317,8 @@
SkASSERT(env);
SkASSERT(canvas);
SkASSERT(env->IsInstanceOf(canvas, gCanvas_class));
- SkCanvas* c = (SkCanvas*)env->GetIntField(canvas, gCanvas_nativeInstanceID);
+ jlong canvasHandle = env->GetLongField(canvas, gCanvas_nativeInstanceID);
+ SkCanvas* c = reinterpret_cast<SkCanvas*>(canvasHandle);
SkASSERT(c);
return c;
}
@@ -325,7 +327,8 @@
SkASSERT(env);
SkASSERT(paint);
SkASSERT(env->IsInstanceOf(paint, gPaint_class));
- SkPaint* p = (SkPaint*)env->GetIntField(paint, gPaint_nativeInstanceID);
+ jlong paintHandle = env->GetLongField(paint, gPaint_nativeInstanceID);
+ SkPaint* p = reinterpret_cast<SkPaint*>(paintHandle);
SkASSERT(p);
return p;
}
@@ -335,7 +338,8 @@
SkASSERT(env);
SkASSERT(picture);
SkASSERT(env->IsInstanceOf(picture, gPicture_class));
- SkPicture* p = (SkPicture*)env->GetIntField(picture, gPicture_nativeInstanceID);
+ jlong pictureHandle = env->GetLongField(picture, gPicture_nativeInstanceID);
+ SkPicture* p = reinterpret_cast<SkPicture*>(pictureHandle);
SkASSERT(p);
return p;
}
@@ -345,7 +349,8 @@
SkASSERT(env);
SkASSERT(region);
SkASSERT(env->IsInstanceOf(region, gRegion_class));
- SkRegion* r = (SkRegion*)env->GetIntField(region, gRegion_nativeInstanceID);
+ jlong regionHandle = env->GetLongField(region, gRegion_nativeInstanceID);
+ SkRegion* r = reinterpret_cast<SkRegion*>(regionHandle);
SkASSERT(r);
return r;
}
@@ -377,7 +382,7 @@
assert_premultiplied(*bitmap, isPremultiplied);
jobject obj = env->NewObject(gBitmap_class, gBitmap_constructorMethodID,
- static_cast<jint>(reinterpret_cast<uintptr_t>(bitmap)), buffer,
+ reinterpret_cast<jlong>(bitmap), buffer,
bitmap->width(), bitmap->height(), density, isMutable, isPremultiplied,
ninepatch, layoutbounds);
hasException(env); // For the side effect of logging.
@@ -421,7 +426,7 @@
{
SkASSERT(region != NULL);
jobject obj = env->NewObject(gRegion_class, gRegion_constructorMethodID,
- static_cast<jint>(reinterpret_cast<uintptr_t>(region)), 0);
+ reinterpret_cast<jlong>(region), 0);
hasException(env); // For the side effect of logging.
return obj;
}
@@ -666,8 +671,8 @@
gPointF_yFieldID = getFieldIDCheck(env, gPointF_class, "y", "F");
gBitmap_class = make_globalref(env, "android/graphics/Bitmap");
- gBitmap_nativeInstanceID = getFieldIDCheck(env, gBitmap_class, "mNativeBitmap", "I");
- gBitmap_constructorMethodID = env->GetMethodID(gBitmap_class, "<init>", "(I[BIIIZZ[B[I)V");
+ gBitmap_nativeInstanceID = getFieldIDCheck(env, gBitmap_class, "mNativeBitmap", "J");
+ gBitmap_constructorMethodID = env->GetMethodID(gBitmap_class, "<init>", "(J[BIIIZZ[B[I)V");
gBitmap_reinitMethodID = env->GetMethodID(gBitmap_class, "reinit", "(IIZ)V");
gBitmap_getAllocationByteCountMethodID = env->GetMethodID(gBitmap_class, "getAllocationByteCount", "()I");
gBitmapRegionDecoder_class = make_globalref(env, "android/graphics/BitmapRegionDecoder");
@@ -678,18 +683,18 @@
"nativeInt", "I");
gCanvas_class = make_globalref(env, "android/graphics/Canvas");
- gCanvas_nativeInstanceID = getFieldIDCheck(env, gCanvas_class, "mNativeCanvas", "I");
+ gCanvas_nativeInstanceID = getFieldIDCheck(env, gCanvas_class, "mNativeCanvas", "J");
gPaint_class = make_globalref(env, "android/graphics/Paint");
- gPaint_nativeInstanceID = getFieldIDCheck(env, gPaint_class, "mNativePaint", "I");
+ gPaint_nativeInstanceID = getFieldIDCheck(env, gPaint_class, "mNativePaint", "J");
gPicture_class = make_globalref(env, "android/graphics/Picture");
- gPicture_nativeInstanceID = getFieldIDCheck(env, gPicture_class, "mNativePicture", "I");
+ gPicture_nativeInstanceID = getFieldIDCheck(env, gPicture_class, "mNativePicture", "J");
gRegion_class = make_globalref(env, "android/graphics/Region");
- gRegion_nativeInstanceID = getFieldIDCheck(env, gRegion_class, "mNativeRegion", "I");
+ gRegion_nativeInstanceID = getFieldIDCheck(env, gRegion_class, "mNativeRegion", "J");
gRegion_constructorMethodID = env->GetMethodID(gRegion_class, "<init>",
- "(II)V");
+ "(JI)V");
c = env->FindClass("java/lang/Byte");
gByte_class = (jclass) env->NewGlobalRef(
diff --git a/core/jni/android/graphics/LayerRasterizer.cpp b/core/jni/android/graphics/LayerRasterizer.cpp
index e5bc6f8..29e7db1 100644
--- a/core/jni/android/graphics/LayerRasterizer.cpp
+++ b/core/jni/android/graphics/LayerRasterizer.cpp
@@ -3,11 +3,13 @@
class SkLayerRasterizerGlue {
public:
- static SkRasterizer* create(JNIEnv* env, jobject) {
- return new SkLayerRasterizer();
+ static jlong create(JNIEnv* env, jobject) {
+ return reinterpret_cast<jlong>(new SkLayerRasterizer());
}
- static void addLayer(JNIEnv* env, jobject, SkLayerRasterizer* layer, const SkPaint* paint, float dx, float dy) {
+ static void addLayer(JNIEnv* env, jobject, jlong layerHandle, jlong paintHandle, jfloat dx, jfloat dy) {
+ SkLayerRasterizer* layer = reinterpret_cast<SkLayerRasterizer *>(layerHandle);
+ const SkPaint* paint = reinterpret_cast<SkPaint *>(paintHandle);
SkASSERT(layer);
SkASSERT(paint);
layer->addLayer(*paint, SkFloatToScalar(dx), SkFloatToScalar(dy));
@@ -19,8 +21,8 @@
#include <android_runtime/AndroidRuntime.h>
static JNINativeMethod gLayerRasterizerMethods[] = {
- { "nativeConstructor", "()I", (void*)SkLayerRasterizerGlue::create },
- { "nativeAddLayer", "(IIFF)V", (void*)SkLayerRasterizerGlue::addLayer }
+ { "nativeConstructor", "()J", (void*)SkLayerRasterizerGlue::create },
+ { "nativeAddLayer", "(JJFF)V", (void*)SkLayerRasterizerGlue::addLayer }
};
int register_android_graphics_LayerRasterizer(JNIEnv* env)
diff --git a/core/jni/android/graphics/MaskFilter.cpp b/core/jni/android/graphics/MaskFilter.cpp
index d954ddf..f331af7 100644
--- a/core/jni/android/graphics/MaskFilter.cpp
+++ b/core/jni/android/graphics/MaskFilter.cpp
@@ -13,18 +13,19 @@
class SkMaskFilterGlue {
public:
- static void destructor(JNIEnv* env, jobject, SkMaskFilter* filter) {
+ static void destructor(JNIEnv* env, jobject, jlong filterHandle) {
+ SkMaskFilter* filter = reinterpret_cast<SkMaskFilter *>(filterHandle);
SkSafeUnref(filter);
}
- static SkMaskFilter* createBlur(JNIEnv* env, jobject, float radius, int blurStyle) {
+ static jlong createBlur(JNIEnv* env, jobject, jfloat radius, jint blurStyle) {
SkMaskFilter* filter = SkBlurMaskFilter::Create(SkFloatToScalar(radius),
(SkBlurMaskFilter::BlurStyle)blurStyle);
ThrowIAE_IfNull(env, filter);
- return filter;
+ return reinterpret_cast<jlong>(filter);
}
- static SkMaskFilter* createEmboss(JNIEnv* env, jobject, jfloatArray dirArray, float ambient, float specular, float radius) {
+ static jlong createEmboss(JNIEnv* env, jobject, jfloatArray dirArray, jfloat ambient, jfloat specular, jfloat radius) {
SkScalar direction[3];
AutoJavaFloatArray autoDir(env, dirArray, 3);
@@ -38,39 +39,42 @@
SkFloatToScalar(specular),
SkFloatToScalar(radius));
ThrowIAE_IfNull(env, filter);
- return filter;
+ return reinterpret_cast<jlong>(filter);
}
- static SkMaskFilter* createTable(JNIEnv* env, jobject, jbyteArray jtable) {
+ static jlong createTable(JNIEnv* env, jobject, jbyteArray jtable) {
AutoJavaByteArray autoTable(env, jtable, 256);
- return new SkTableMaskFilter((const uint8_t*)autoTable.ptr());
+ SkMaskFilter* filter = new SkTableMaskFilter((const uint8_t*)autoTable.ptr());
+ return reinterpret_cast<jlong>(filter);
}
- static SkMaskFilter* createClipTable(JNIEnv* env, jobject, int min, int max) {
- return SkTableMaskFilter::CreateClip(min, max);
+ static jlong createClipTable(JNIEnv* env, jobject, jint min, jint max) {
+ SkMaskFilter* filter = SkTableMaskFilter::CreateClip(min, max);
+ return reinterpret_cast<jlong>(filter);
}
- static SkMaskFilter* createGammaTable(JNIEnv* env, jobject, float gamma) {
- return SkTableMaskFilter::CreateGamma(gamma);
+ static jlong createGammaTable(JNIEnv* env, jobject, jfloat gamma) {
+ SkMaskFilter* filter = SkTableMaskFilter::CreateGamma(gamma);
+ return reinterpret_cast<jlong>(filter);
}
};
static JNINativeMethod gMaskFilterMethods[] = {
- { "nativeDestructor", "(I)V", (void*)SkMaskFilterGlue::destructor }
+ { "nativeDestructor", "(J)V", (void*)SkMaskFilterGlue::destructor }
};
static JNINativeMethod gBlurMaskFilterMethods[] = {
- { "nativeConstructor", "(FI)I", (void*)SkMaskFilterGlue::createBlur }
+ { "nativeConstructor", "(FI)J", (void*)SkMaskFilterGlue::createBlur }
};
static JNINativeMethod gEmbossMaskFilterMethods[] = {
- { "nativeConstructor", "([FFFF)I", (void*)SkMaskFilterGlue::createEmboss }
+ { "nativeConstructor", "([FFFF)J", (void*)SkMaskFilterGlue::createEmboss }
};
static JNINativeMethod gTableMaskFilterMethods[] = {
- { "nativeNewTable", "([B)I", (void*)SkMaskFilterGlue::createTable },
- { "nativeNewClip", "(II)I", (void*)SkMaskFilterGlue::createClipTable },
- { "nativeNewGamma", "(F)I", (void*)SkMaskFilterGlue::createGammaTable }
+ { "nativeNewTable", "([B)J", (void*)SkMaskFilterGlue::createTable },
+ { "nativeNewClip", "(II)J", (void*)SkMaskFilterGlue::createClipTable },
+ { "nativeNewGamma", "(F)J", (void*)SkMaskFilterGlue::createGammaTable }
};
#include <android_runtime/AndroidRuntime.h>
diff --git a/core/jni/android/graphics/Matrix.cpp b/core/jni/android/graphics/Matrix.cpp
index 4bd59e7..6ae9fea 100644
--- a/core/jni/android/graphics/Matrix.cpp
+++ b/core/jni/android/graphics/Matrix.cpp
@@ -31,210 +31,237 @@
class SkMatrixGlue {
public:
- static void finalizer(JNIEnv* env, jobject clazz, SkMatrix* obj) {
+ static void finalizer(JNIEnv* env, jobject clazz, jlong objHandle) {
+ SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
delete obj;
}
- static SkMatrix* create(JNIEnv* env, jobject clazz, const SkMatrix* src) {
+ static jlong create(JNIEnv* env, jobject clazz, jlong srcHandle) {
+ const SkMatrix* src = reinterpret_cast<SkMatrix*>(srcHandle);
SkMatrix* obj = new SkMatrix();
if (src)
*obj = *src;
else
obj->reset();
- return obj;
+ return reinterpret_cast<jlong>(obj);
}
-
- static jboolean isIdentity(JNIEnv* env, jobject clazz, SkMatrix* obj) {
- return obj->isIdentity();
+
+ static jboolean isIdentity(JNIEnv* env, jobject clazz, jlong objHandle) {
+ SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
+ return obj->isIdentity() ? JNI_TRUE : JNI_FALSE;
}
-
- static jboolean rectStaysRect(JNIEnv* env, jobject clazz, SkMatrix* obj) {
- return obj->rectStaysRect();
+ static jboolean rectStaysRect(JNIEnv* env, jobject clazz, jlong objHandle) {
+ SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
+ return obj->rectStaysRect() ? JNI_TRUE : JNI_FALSE;
}
-
- static void reset(JNIEnv* env, jobject clazz, SkMatrix* obj) {
+ static void reset(JNIEnv* env, jobject clazz, jlong objHandle) {
+ SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
obj->reset();
}
-
- static void set(JNIEnv* env, jobject clazz, SkMatrix* obj, SkMatrix* other) {
+ static void set(JNIEnv* env, jobject clazz, jlong objHandle, jlong otherHandle) {
+ SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
+ SkMatrix* other = reinterpret_cast<SkMatrix*>(otherHandle);
*obj = *other;
}
-
- static void setTranslate(JNIEnv* env, jobject clazz, SkMatrix* obj, jfloat dx, jfloat dy) {
+ static void setTranslate(JNIEnv* env, jobject clazz, jlong objHandle, jfloat dx, jfloat dy) {
+ SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
SkScalar dx_ = SkFloatToScalar(dx);
SkScalar dy_ = SkFloatToScalar(dy);
obj->setTranslate(dx_, dy_);
}
-
- static void setScale__FFFF(JNIEnv* env, jobject clazz, SkMatrix* obj, jfloat sx, jfloat sy, jfloat px, jfloat py) {
+ static void setScale__FFFF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat sx, jfloat sy, jfloat px, jfloat py) {
+ SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
SkScalar sx_ = SkFloatToScalar(sx);
SkScalar sy_ = SkFloatToScalar(sy);
SkScalar px_ = SkFloatToScalar(px);
SkScalar py_ = SkFloatToScalar(py);
obj->setScale(sx_, sy_, px_, py_);
}
-
- static void setScale__FF(JNIEnv* env, jobject clazz, SkMatrix* obj, jfloat sx, jfloat sy) {
+ static void setScale__FF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat sx, jfloat sy) {
+ SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
SkScalar sx_ = SkFloatToScalar(sx);
SkScalar sy_ = SkFloatToScalar(sy);
obj->setScale(sx_, sy_);
}
-
- static void setRotate__FFF(JNIEnv* env, jobject clazz, SkMatrix* obj, jfloat degrees, jfloat px, jfloat py) {
+ static void setRotate__FFF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat degrees, jfloat px, jfloat py) {
+ SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
SkScalar degrees_ = SkFloatToScalar(degrees);
SkScalar px_ = SkFloatToScalar(px);
SkScalar py_ = SkFloatToScalar(py);
obj->setRotate(degrees_, px_, py_);
}
-
- static void setRotate__F(JNIEnv* env, jobject clazz, SkMatrix* obj, jfloat degrees) {
+ static void setRotate__F(JNIEnv* env, jobject clazz, jlong objHandle, jfloat degrees) {
+ SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
SkScalar degrees_ = SkFloatToScalar(degrees);
obj->setRotate(degrees_);
}
-
- static void setSinCos__FFFF(JNIEnv* env, jobject clazz, SkMatrix* obj, jfloat sinValue, jfloat cosValue, jfloat px, jfloat py) {
+ static void setSinCos__FFFF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat sinValue, jfloat cosValue, jfloat px, jfloat py) {
+ SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
SkScalar sinValue_ = SkFloatToScalar(sinValue);
SkScalar cosValue_ = SkFloatToScalar(cosValue);
SkScalar px_ = SkFloatToScalar(px);
SkScalar py_ = SkFloatToScalar(py);
obj->setSinCos(sinValue_, cosValue_, px_, py_);
}
-
- static void setSinCos__FF(JNIEnv* env, jobject clazz, SkMatrix* obj, jfloat sinValue, jfloat cosValue) {
+ static void setSinCos__FF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat sinValue, jfloat cosValue) {
+ SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
SkScalar sinValue_ = SkFloatToScalar(sinValue);
SkScalar cosValue_ = SkFloatToScalar(cosValue);
obj->setSinCos(sinValue_, cosValue_);
}
-
- static void setSkew__FFFF(JNIEnv* env, jobject clazz, SkMatrix* obj, jfloat kx, jfloat ky, jfloat px, jfloat py) {
+ static void setSkew__FFFF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat kx, jfloat ky, jfloat px, jfloat py) {
+ SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
SkScalar kx_ = SkFloatToScalar(kx);
SkScalar ky_ = SkFloatToScalar(ky);
SkScalar px_ = SkFloatToScalar(px);
SkScalar py_ = SkFloatToScalar(py);
obj->setSkew(kx_, ky_, px_, py_);
}
-
- static void setSkew__FF(JNIEnv* env, jobject clazz, SkMatrix* obj, jfloat kx, jfloat ky) {
+ static void setSkew__FF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat kx, jfloat ky) {
+ SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
SkScalar kx_ = SkFloatToScalar(kx);
SkScalar ky_ = SkFloatToScalar(ky);
obj->setSkew(kx_, ky_);
}
-
- static jboolean setConcat(JNIEnv* env, jobject clazz, SkMatrix* obj, SkMatrix* a, SkMatrix* b) {
- return obj->setConcat(*a, *b);
+ static jboolean setConcat(JNIEnv* env, jobject clazz, jlong objHandle, jlong aHandle, jlong bHandle) {
+ SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
+ SkMatrix* a = reinterpret_cast<SkMatrix*>(aHandle);
+ SkMatrix* b = reinterpret_cast<SkMatrix*>(bHandle);
+ return obj->setConcat(*a, *b) ? JNI_TRUE : JNI_FALSE;
}
-
- static jboolean preTranslate(JNIEnv* env, jobject clazz, SkMatrix* obj, jfloat dx, jfloat dy) {
+
+ static jboolean preTranslate(JNIEnv* env, jobject clazz, jlong objHandle, jfloat dx, jfloat dy) {
+ SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
SkScalar dx_ = SkFloatToScalar(dx);
SkScalar dy_ = SkFloatToScalar(dy);
- return obj->preTranslate(dx_, dy_);
+ return obj->preTranslate(dx_, dy_) ? JNI_TRUE : JNI_FALSE;
}
-
- static jboolean preScale__FFFF(JNIEnv* env, jobject clazz, SkMatrix* obj, jfloat sx, jfloat sy, jfloat px, jfloat py) {
+
+ static jboolean preScale__FFFF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat sx, jfloat sy, jfloat px, jfloat py) {
+ SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
SkScalar sx_ = SkFloatToScalar(sx);
SkScalar sy_ = SkFloatToScalar(sy);
SkScalar px_ = SkFloatToScalar(px);
SkScalar py_ = SkFloatToScalar(py);
- return obj->preScale(sx_, sy_, px_, py_);
+ return obj->preScale(sx_, sy_, px_, py_) ? JNI_TRUE : JNI_FALSE;
}
-
- static jboolean preScale__FF(JNIEnv* env, jobject clazz, SkMatrix* obj, jfloat sx, jfloat sy) {
+
+ static jboolean preScale__FF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat sx, jfloat sy) {
+ SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
SkScalar sx_ = SkFloatToScalar(sx);
SkScalar sy_ = SkFloatToScalar(sy);
- return obj->preScale(sx_, sy_);
+ return obj->preScale(sx_, sy_) ? JNI_TRUE : JNI_FALSE;
}
-
- static jboolean preRotate__FFF(JNIEnv* env, jobject clazz, SkMatrix* obj, jfloat degrees, jfloat px, jfloat py) {
+
+ static jboolean preRotate__FFF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat degrees, jfloat px, jfloat py) {
+ SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
SkScalar degrees_ = SkFloatToScalar(degrees);
SkScalar px_ = SkFloatToScalar(px);
SkScalar py_ = SkFloatToScalar(py);
- return obj->preRotate(degrees_, px_, py_);
+ return obj->preRotate(degrees_, px_, py_) ? JNI_TRUE : JNI_FALSE;
}
-
- static jboolean preRotate__F(JNIEnv* env, jobject clazz, SkMatrix* obj, jfloat degrees) {
+
+ static jboolean preRotate__F(JNIEnv* env, jobject clazz, jlong objHandle, jfloat degrees) {
+ SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
SkScalar degrees_ = SkFloatToScalar(degrees);
- return obj->preRotate(degrees_);
+ return obj->preRotate(degrees_) ? JNI_TRUE : JNI_FALSE;
}
-
- static jboolean preSkew__FFFF(JNIEnv* env, jobject clazz, SkMatrix* obj, jfloat kx, jfloat ky, jfloat px, jfloat py) {
+
+ static jboolean preSkew__FFFF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat kx, jfloat ky, jfloat px, jfloat py) {
+ SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
SkScalar kx_ = SkFloatToScalar(kx);
SkScalar ky_ = SkFloatToScalar(ky);
SkScalar px_ = SkFloatToScalar(px);
SkScalar py_ = SkFloatToScalar(py);
- return obj->preSkew(kx_, ky_, px_, py_);
+ return obj->preSkew(kx_, ky_, px_, py_) ? JNI_TRUE : JNI_FALSE;
}
-
- static jboolean preSkew__FF(JNIEnv* env, jobject clazz, SkMatrix* obj, jfloat kx, jfloat ky) {
+
+ static jboolean preSkew__FF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat kx, jfloat ky) {
+ SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
SkScalar kx_ = SkFloatToScalar(kx);
SkScalar ky_ = SkFloatToScalar(ky);
- return obj->preSkew(kx_, ky_);
+ return obj->preSkew(kx_, ky_) ? JNI_TRUE : JNI_FALSE;
}
-
- static jboolean preConcat(JNIEnv* env, jobject clazz, SkMatrix* obj, SkMatrix* other) {
- return obj->preConcat(*other);
+
+ static jboolean preConcat(JNIEnv* env, jobject clazz, jlong objHandle, jlong otherHandle) {
+ SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
+ SkMatrix* other = reinterpret_cast<SkMatrix*>(otherHandle);
+ return obj->preConcat(*other) ? JNI_TRUE : JNI_FALSE;
}
-
- static jboolean postTranslate(JNIEnv* env, jobject clazz, SkMatrix* obj, jfloat dx, jfloat dy) {
+
+ static jboolean postTranslate(JNIEnv* env, jobject clazz, jlong objHandle, jfloat dx, jfloat dy) {
+ SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
SkScalar dx_ = SkFloatToScalar(dx);
SkScalar dy_ = SkFloatToScalar(dy);
- return obj->postTranslate(dx_, dy_);
+ return obj->postTranslate(dx_, dy_) ? JNI_TRUE : JNI_FALSE;
}
-
- static jboolean postScale__FFFF(JNIEnv* env, jobject clazz, SkMatrix* obj, jfloat sx, jfloat sy, jfloat px, jfloat py) {
+
+ static jboolean postScale__FFFF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat sx, jfloat sy, jfloat px, jfloat py) {
+ SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
SkScalar sx_ = SkFloatToScalar(sx);
SkScalar sy_ = SkFloatToScalar(sy);
SkScalar px_ = SkFloatToScalar(px);
SkScalar py_ = SkFloatToScalar(py);
- return obj->postScale(sx_, sy_, px_, py_);
+ return obj->postScale(sx_, sy_, px_, py_) ? JNI_TRUE : JNI_FALSE;
}
-
- static jboolean postScale__FF(JNIEnv* env, jobject clazz, SkMatrix* obj, jfloat sx, jfloat sy) {
+
+ static jboolean postScale__FF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat sx, jfloat sy) {
+ SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
SkScalar sx_ = SkFloatToScalar(sx);
SkScalar sy_ = SkFloatToScalar(sy);
- return obj->postScale(sx_, sy_);
+ return obj->postScale(sx_, sy_) ? JNI_TRUE : JNI_FALSE;
}
-
- static jboolean postRotate__FFF(JNIEnv* env, jobject clazz, SkMatrix* obj, jfloat degrees, jfloat px, jfloat py) {
+
+ static jboolean postRotate__FFF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat degrees, jfloat px, jfloat py) {
+ SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
SkScalar degrees_ = SkFloatToScalar(degrees);
SkScalar px_ = SkFloatToScalar(px);
SkScalar py_ = SkFloatToScalar(py);
- return obj->postRotate(degrees_, px_, py_);
+ return obj->postRotate(degrees_, px_, py_) ? JNI_TRUE : JNI_FALSE;
}
-
- static jboolean postRotate__F(JNIEnv* env, jobject clazz, SkMatrix* obj, jfloat degrees) {
+
+ static jboolean postRotate__F(JNIEnv* env, jobject clazz, jlong objHandle, jfloat degrees) {
+ SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
SkScalar degrees_ = SkFloatToScalar(degrees);
- return obj->postRotate(degrees_);
+ return obj->postRotate(degrees_) ? JNI_TRUE : JNI_FALSE;
}
-
- static jboolean postSkew__FFFF(JNIEnv* env, jobject clazz, SkMatrix* obj, jfloat kx, jfloat ky, jfloat px, jfloat py) {
+
+ static jboolean postSkew__FFFF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat kx, jfloat ky, jfloat px, jfloat py) {
+ SkMatrix* obj = reinterpret_cast<SkMatrix*>(objHandle);
SkScalar kx_ = SkFloatToScalar(kx);
SkScalar ky_ = SkFloatToScalar(ky);
SkScalar px_ = SkFloatToScalar(px);
SkScalar py_ = SkFloatToScalar(py);
- return obj->postSkew(kx_, ky_, px_, py_);
+ return obj->postSkew(kx_, ky_, px_, py_) ? JNI_TRUE : JNI_FALSE;
}
-
- static jboolean postSkew__FF(JNIEnv* env, jobject clazz, SkMatrix* matrix, jfloat kx, jfloat ky) {
+
+ static jboolean postSkew__FF(JNIEnv* env, jobject clazz, jlong matrixHandle, jfloat kx, jfloat ky) {
+ SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixHandle);
SkScalar kx_ = SkFloatToScalar(kx);
SkScalar ky_ = SkFloatToScalar(ky);
- return matrix->postSkew(kx_, ky_);
+ return matrix->postSkew(kx_, ky_) ? JNI_TRUE : JNI_FALSE;
}
-
- static jboolean postConcat(JNIEnv* env, jobject clazz, SkMatrix* matrix, SkMatrix* other) {
- return matrix->postConcat(*other);
+
+ static jboolean postConcat(JNIEnv* env, jobject clazz, jlong matrixHandle, jlong otherHandle) {
+ SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixHandle);
+ SkMatrix* other = reinterpret_cast<SkMatrix*>(otherHandle);
+ return matrix->postConcat(*other) ? JNI_TRUE : JNI_FALSE;
}
-
- static jboolean setRectToRect(JNIEnv* env, jobject clazz, SkMatrix* matrix, jobject src, jobject dst, SkMatrix::ScaleToFit stf) {
+
+ static jboolean setRectToRect(JNIEnv* env, jobject clazz, jlong matrixHandle, jobject src, jobject dst, jint stfHandle) {
+ SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixHandle);
+ SkMatrix::ScaleToFit stf = static_cast<SkMatrix::ScaleToFit>(stfHandle);
SkRect src_;
GraphicsJNI::jrectf_to_rect(env, src, &src_);
SkRect dst_;
GraphicsJNI::jrectf_to_rect(env, dst, &dst_);
- return matrix->setRectToRect(src_, dst_, stf);
+ return matrix->setRectToRect(src_, dst_, stf) ? JNI_TRUE : JNI_FALSE;
}
-
- static jboolean setPolyToPoly(JNIEnv* env, jobject clazz, SkMatrix* matrix,
- jfloatArray jsrc, int srcIndex,
- jfloatArray jdst, int dstIndex, int ptCount) {
+
+ static jboolean setPolyToPoly(JNIEnv* env, jobject clazz, jlong matrixHandle,
+ jfloatArray jsrc, jint srcIndex,
+ jfloatArray jdst, jint dstIndex, jint ptCount) {
+ SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixHandle);
SkASSERT(srcIndex >= 0);
SkASSERT(dstIndex >= 0);
SkASSERT((unsigned)ptCount <= 4);
@@ -243,6 +270,7 @@
AutoJavaFloatArray autoDst(env, jdst, dstIndex + (ptCount << 1), kRW_JNIAccess);
float* src = autoSrc.ptr() + srcIndex;
float* dst = autoDst.ptr() + dstIndex;
+ bool result;
#ifdef SK_SCALAR_IS_FIXED
SkPoint srcPt[4], dstPt[4];
@@ -252,21 +280,25 @@
srcPt[i].set(SkFloatToScalar(src[x]), SkFloatToScalar(src[y]));
dstPt[i].set(SkFloatToScalar(dst[x]), SkFloatToScalar(dst[y]));
}
- return matrix->setPolyToPoly(srcPt, dstPt, ptCount);
+ result = matrix->setPolyToPoly(srcPt, dstPt, ptCount);
#else
- return matrix->setPolyToPoly((const SkPoint*)src, (const SkPoint*)dst,
+ result = matrix->setPolyToPoly((const SkPoint*)src, (const SkPoint*)dst,
ptCount);
#endif
+ return result ? JNI_TRUE : JNI_FALSE;
}
-
- static jboolean invert(JNIEnv* env, jobject clazz, SkMatrix* matrix, SkMatrix* inverse) {
+
+ static jboolean invert(JNIEnv* env, jobject clazz, jlong matrixHandle, jlong inverseHandle) {
+ SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixHandle);
+ SkMatrix* inverse = reinterpret_cast<SkMatrix*>(inverseHandle);
return matrix->invert(inverse);
}
-
- static void mapPoints(JNIEnv* env, jobject clazz, SkMatrix* matrix,
- jfloatArray dst, int dstIndex,
- jfloatArray src, int srcIndex,
- int ptCount, bool isPts) {
+
+ static void mapPoints(JNIEnv* env, jobject clazz, jlong matrixHandle,
+ jfloatArray dst, jint dstIndex,
+ jfloatArray src, jint srcIndex,
+ jint ptCount, jboolean isPts) {
+ SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixHandle);
SkASSERT(ptCount >= 0);
AutoJavaFloatArray autoSrc(env, src, srcIndex + (ptCount << 1), kRO_JNIAccess);
AutoJavaFloatArray autoDst(env, dst, dstIndex + (ptCount << 1), kRW_JNIAccess);
@@ -304,20 +336,24 @@
ptCount);
#endif
}
-
- static jboolean mapRect__RectFRectF(JNIEnv* env, jobject clazz, SkMatrix* matrix, jobjectArray dst, jobject src) {
+
+ static jboolean mapRect__RectFRectF(JNIEnv* env, jobject clazz, jlong matrixHandle, jobjectArray dst, jobject src) {
+ SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixHandle);
SkRect dst_, src_;
GraphicsJNI::jrectf_to_rect(env, src, &src_);
jboolean rectStaysRect = matrix->mapRect(&dst_, src_);
GraphicsJNI::rect_to_jrectf(dst_, env, dst);
- return rectStaysRect;
+ return rectStaysRect ? JNI_TRUE : JNI_FALSE;
}
-
- static jfloat mapRadius(JNIEnv* env, jobject clazz, SkMatrix* matrix, jfloat radius) {
- return SkScalarToFloat(matrix->mapRadius(SkFloatToScalar(radius)));
+
+ static jfloat mapRadius(JNIEnv* env, jobject clazz, jlong matrixHandle, jfloat radius) {
+ SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixHandle);
+ float result;
+ result = SkScalarToFloat(matrix->mapRadius(SkFloatToScalar(radius)));
+ return static_cast<jfloat>(result);
}
-
- static void getValues(JNIEnv* env, jobject clazz, SkMatrix* matrix, jfloatArray values) {
+ static void getValues(JNIEnv* env, jobject clazz, jlong matrixHandle, jfloatArray values) {
+ SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixHandle);
AutoJavaFloatArray autoValues(env, values, 9, kRW_JNIAccess);
float* dst = autoValues.ptr();
@@ -334,8 +370,9 @@
}
#endif
}
-
- static void setValues(JNIEnv* env, jobject clazz, SkMatrix* matrix, jfloatArray values) {
+
+ static void setValues(JNIEnv* env, jobject clazz, jlong matrixHandle, jfloatArray values) {
+ SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixHandle);
AutoJavaFloatArray autoValues(env, values, 9, kRO_JNIAccess);
const float* src = autoValues.ptr();
@@ -353,53 +390,55 @@
#endif
}
- static jboolean equals(JNIEnv* env, jobject clazz, const SkMatrix* a, const SkMatrix* b) {
+ static jboolean equals(JNIEnv* env, jobject clazz, jlong aHandle, jlong bHandle) {
+ const SkMatrix* a = reinterpret_cast<SkMatrix*>(aHandle);
+ const SkMatrix* b = reinterpret_cast<SkMatrix*>(bHandle);
return *a == *b;
}
};
static JNINativeMethod methods[] = {
- {"finalizer", "(I)V", (void*) SkMatrixGlue::finalizer},
- {"native_create","(I)I", (void*) SkMatrixGlue::create},
- {"native_isIdentity","(I)Z", (void*) SkMatrixGlue::isIdentity},
- {"native_rectStaysRect","(I)Z", (void*) SkMatrixGlue::rectStaysRect},
- {"native_reset","(I)V", (void*) SkMatrixGlue::reset},
- {"native_set","(II)V", (void*) SkMatrixGlue::set},
- {"native_setTranslate","(IFF)V", (void*) SkMatrixGlue::setTranslate},
- {"native_setScale","(IFFFF)V", (void*) SkMatrixGlue::setScale__FFFF},
- {"native_setScale","(IFF)V", (void*) SkMatrixGlue::setScale__FF},
- {"native_setRotate","(IFFF)V", (void*) SkMatrixGlue::setRotate__FFF},
- {"native_setRotate","(IF)V", (void*) SkMatrixGlue::setRotate__F},
- {"native_setSinCos","(IFFFF)V", (void*) SkMatrixGlue::setSinCos__FFFF},
- {"native_setSinCos","(IFF)V", (void*) SkMatrixGlue::setSinCos__FF},
- {"native_setSkew","(IFFFF)V", (void*) SkMatrixGlue::setSkew__FFFF},
- {"native_setSkew","(IFF)V", (void*) SkMatrixGlue::setSkew__FF},
- {"native_setConcat","(III)Z", (void*) SkMatrixGlue::setConcat},
- {"native_preTranslate","(IFF)Z", (void*) SkMatrixGlue::preTranslate},
- {"native_preScale","(IFFFF)Z", (void*) SkMatrixGlue::preScale__FFFF},
- {"native_preScale","(IFF)Z", (void*) SkMatrixGlue::preScale__FF},
- {"native_preRotate","(IFFF)Z", (void*) SkMatrixGlue::preRotate__FFF},
- {"native_preRotate","(IF)Z", (void*) SkMatrixGlue::preRotate__F},
- {"native_preSkew","(IFFFF)Z", (void*) SkMatrixGlue::preSkew__FFFF},
- {"native_preSkew","(IFF)Z", (void*) SkMatrixGlue::preSkew__FF},
- {"native_preConcat","(II)Z", (void*) SkMatrixGlue::preConcat},
- {"native_postTranslate","(IFF)Z", (void*) SkMatrixGlue::postTranslate},
- {"native_postScale","(IFFFF)Z", (void*) SkMatrixGlue::postScale__FFFF},
- {"native_postScale","(IFF)Z", (void*) SkMatrixGlue::postScale__FF},
- {"native_postRotate","(IFFF)Z", (void*) SkMatrixGlue::postRotate__FFF},
- {"native_postRotate","(IF)Z", (void*) SkMatrixGlue::postRotate__F},
- {"native_postSkew","(IFFFF)Z", (void*) SkMatrixGlue::postSkew__FFFF},
- {"native_postSkew","(IFF)Z", (void*) SkMatrixGlue::postSkew__FF},
- {"native_postConcat","(II)Z", (void*) SkMatrixGlue::postConcat},
- {"native_setRectToRect","(ILandroid/graphics/RectF;Landroid/graphics/RectF;I)Z", (void*) SkMatrixGlue::setRectToRect},
- {"native_setPolyToPoly","(I[FI[FII)Z", (void*) SkMatrixGlue::setPolyToPoly},
- {"native_invert","(II)Z", (void*) SkMatrixGlue::invert},
- {"native_mapPoints","(I[FI[FIIZ)V", (void*) SkMatrixGlue::mapPoints},
- {"native_mapRect","(ILandroid/graphics/RectF;Landroid/graphics/RectF;)Z", (void*) SkMatrixGlue::mapRect__RectFRectF},
- {"native_mapRadius","(IF)F", (void*) SkMatrixGlue::mapRadius},
- {"native_getValues","(I[F)V", (void*) SkMatrixGlue::getValues},
- {"native_setValues","(I[F)V", (void*) SkMatrixGlue::setValues},
- {"native_equals", "(II)Z", (void*) SkMatrixGlue::equals}
+ {"finalizer", "(J)V", (void*) SkMatrixGlue::finalizer},
+ {"native_create","(J)J", (void*) SkMatrixGlue::create},
+ {"native_isIdentity","(J)Z", (void*) SkMatrixGlue::isIdentity},
+ {"native_rectStaysRect","(J)Z", (void*) SkMatrixGlue::rectStaysRect},
+ {"native_reset","(J)V", (void*) SkMatrixGlue::reset},
+ {"native_set","(JJ)V", (void*) SkMatrixGlue::set},
+ {"native_setTranslate","(JFF)V", (void*) SkMatrixGlue::setTranslate},
+ {"native_setScale","(JFFFF)V", (void*) SkMatrixGlue::setScale__FFFF},
+ {"native_setScale","(JFF)V", (void*) SkMatrixGlue::setScale__FF},
+ {"native_setRotate","(JFFF)V", (void*) SkMatrixGlue::setRotate__FFF},
+ {"native_setRotate","(JF)V", (void*) SkMatrixGlue::setRotate__F},
+ {"native_setSinCos","(JFFFF)V", (void*) SkMatrixGlue::setSinCos__FFFF},
+ {"native_setSinCos","(JFF)V", (void*) SkMatrixGlue::setSinCos__FF},
+ {"native_setSkew","(JFFFF)V", (void*) SkMatrixGlue::setSkew__FFFF},
+ {"native_setSkew","(JFF)V", (void*) SkMatrixGlue::setSkew__FF},
+ {"native_setConcat","(JJJ)Z", (void*) SkMatrixGlue::setConcat},
+ {"native_preTranslate","(JFF)Z", (void*) SkMatrixGlue::preTranslate},
+ {"native_preScale","(JFFFF)Z", (void*) SkMatrixGlue::preScale__FFFF},
+ {"native_preScale","(JFF)Z", (void*) SkMatrixGlue::preScale__FF},
+ {"native_preRotate","(JFFF)Z", (void*) SkMatrixGlue::preRotate__FFF},
+ {"native_preRotate","(JF)Z", (void*) SkMatrixGlue::preRotate__F},
+ {"native_preSkew","(JFFFF)Z", (void*) SkMatrixGlue::preSkew__FFFF},
+ {"native_preSkew","(JFF)Z", (void*) SkMatrixGlue::preSkew__FF},
+ {"native_preConcat","(JJ)Z", (void*) SkMatrixGlue::preConcat},
+ {"native_postTranslate","(JFF)Z", (void*) SkMatrixGlue::postTranslate},
+ {"native_postScale","(JFFFF)Z", (void*) SkMatrixGlue::postScale__FFFF},
+ {"native_postScale","(JFF)Z", (void*) SkMatrixGlue::postScale__FF},
+ {"native_postRotate","(JFFF)Z", (void*) SkMatrixGlue::postRotate__FFF},
+ {"native_postRotate","(JF)Z", (void*) SkMatrixGlue::postRotate__F},
+ {"native_postSkew","(JFFFF)Z", (void*) SkMatrixGlue::postSkew__FFFF},
+ {"native_postSkew","(JFF)Z", (void*) SkMatrixGlue::postSkew__FF},
+ {"native_postConcat","(JJ)Z", (void*) SkMatrixGlue::postConcat},
+ {"native_setRectToRect","(JLandroid/graphics/RectF;Landroid/graphics/RectF;I)Z", (void*) SkMatrixGlue::setRectToRect},
+ {"native_setPolyToPoly","(J[FI[FII)Z", (void*) SkMatrixGlue::setPolyToPoly},
+ {"native_invert","(JJ)Z", (void*) SkMatrixGlue::invert},
+ {"native_mapPoints","(J[FI[FIIZ)V", (void*) SkMatrixGlue::mapPoints},
+ {"native_mapRect","(JLandroid/graphics/RectF;Landroid/graphics/RectF;)Z", (void*) SkMatrixGlue::mapRect__RectFRectF},
+ {"native_mapRadius","(JF)F", (void*) SkMatrixGlue::mapRadius},
+ {"native_getValues","(J[F)V", (void*) SkMatrixGlue::getValues},
+ {"native_setValues","(J[F)V", (void*) SkMatrixGlue::setValues},
+ {"native_equals", "(JJ)Z", (void*) SkMatrixGlue::equals}
};
static jfieldID sNativeInstanceField;
@@ -409,13 +448,13 @@
sizeof(methods) / sizeof(methods[0]));
jclass clazz = env->FindClass("android/graphics/Matrix");
- sNativeInstanceField = env->GetFieldID(clazz, "native_instance", "I");
+ sNativeInstanceField = env->GetFieldID(clazz, "native_instance", "J");
return result;
}
SkMatrix* android_graphics_Matrix_getSkMatrix(JNIEnv* env, jobject matrixObj) {
- return reinterpret_cast<SkMatrix*>(env->GetIntField(matrixObj, sNativeInstanceField));
+ return reinterpret_cast<SkMatrix*>(env->GetLongField(matrixObj, sNativeInstanceField));
}
}
diff --git a/core/jni/android/graphics/NinePatch.cpp b/core/jni/android/graphics/NinePatch.cpp
index 7e6aeae..871e24d 100644
--- a/core/jni/android/graphics/NinePatch.cpp
+++ b/core/jni/android/graphics/NinePatch.cpp
@@ -46,22 +46,22 @@
public:
static jboolean isNinePatchChunk(JNIEnv* env, jobject, jbyteArray obj) {
if (NULL == obj) {
- return false;
+ return JNI_FALSE;
}
if (env->GetArrayLength(obj) < (int)sizeof(Res_png_9patch)) {
- return false;
+ return JNI_FALSE;
}
const jbyte* array = env->GetByteArrayElements(obj, 0);
if (array != NULL) {
const Res_png_9patch* chunk = reinterpret_cast<const Res_png_9patch*>(array);
int8_t wasDeserialized = chunk->wasDeserialized;
env->ReleaseByteArrayElements(obj, const_cast<jbyte*>(array), JNI_ABORT);
- return wasDeserialized != -1;
+ return (wasDeserialized != -1) ? JNI_TRUE : JNI_FALSE;
}
- return false;
+ return JNI_FALSE;
}
- static int8_t* validateNinePatchChunk(JNIEnv* env, jobject, jint, jbyteArray obj) {
+ static jlong validateNinePatchChunk(JNIEnv* env, jobject, jlong, jbyteArray obj) {
size_t chunkSize = env->GetArrayLength(obj);
if (chunkSize < (int) (sizeof(Res_png_9patch))) {
jniThrowRuntimeException(env, "Array too small for chunk.");
@@ -72,10 +72,11 @@
// This call copies the content of the jbyteArray
env->GetByteArrayRegion(obj, 0, chunkSize, reinterpret_cast<jbyte*>(storage));
// Deserialize in place, return the array we just allocated
- return (int8_t*) Res_png_9patch::deserialize(storage);
+ return reinterpret_cast<jlong>(Res_png_9patch::deserialize(storage));
}
- static void finalize(JNIEnv* env, jobject, int8_t* patch) {
+ static void finalize(JNIEnv* env, jobject, jlong patchHandle) {
+ int8_t* patch = reinterpret_cast<int8_t*>(patchHandle);
#ifdef USE_OPENGL_RENDERER
if (android::uirenderer::Caches::hasInstance()) {
Res_png_9patch* p = (Res_png_9patch*) patch;
@@ -115,9 +116,13 @@
}
}
- static void drawF(JNIEnv* env, jobject, SkCanvas* canvas, jobject boundsRectF,
- const SkBitmap* bitmap, Res_png_9patch* chunk, const SkPaint* paint,
+ static void drawF(JNIEnv* env, jobject, jlong canvasHandle, jobject boundsRectF,
+ jlong bitmapHandle, jlong chunkHandle, jlong paintHandle,
jint destDensity, jint srcDensity) {
+ SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+ const SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
+ Res_png_9patch* chunk = reinterpret_cast<Res_png_9patch*>(chunkHandle);
+ const SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
SkASSERT(canvas);
SkASSERT(boundsRectF);
SkASSERT(bitmap);
@@ -130,9 +135,13 @@
draw(env, canvas, bounds, bitmap, chunk, paint, destDensity, srcDensity);
}
- static void drawI(JNIEnv* env, jobject, SkCanvas* canvas, jobject boundsRect,
- const SkBitmap* bitmap, Res_png_9patch* chunk, const SkPaint* paint,
+ static void drawI(JNIEnv* env, jobject, jlong canvasHandle, jobject boundsRect,
+ jlong bitmapHandle, jlong chunkHandle, jlong paintHandle,
jint destDensity, jint srcDensity) {
+ SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+ const SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
+ Res_png_9patch* chunk = reinterpret_cast<Res_png_9patch*>(chunkHandle);
+ const SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
SkASSERT(canvas);
SkASSERT(boundsRect);
SkASSERT(bitmap);
@@ -144,8 +153,10 @@
draw(env, canvas, bounds, bitmap, chunk, paint, destDensity, srcDensity);
}
- static jint getTransparentRegion(JNIEnv* env, jobject, const SkBitmap* bitmap,
- Res_png_9patch* chunk, jobject boundsRect) {
+ static jlong getTransparentRegion(JNIEnv* env, jobject, jlong bitmapHandle,
+ jlong chunkHandle, jobject boundsRect) {
+ const SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
+ Res_png_9patch* chunk = reinterpret_cast<Res_png_9patch*>(chunkHandle);
SkASSERT(bitmap);
SkASSERT(chunk);
SkASSERT(boundsRect);
@@ -156,7 +167,7 @@
SkRegion* region = NULL;
NinePatch_Draw(NULL, bounds, *bitmap, *chunk, NULL, ®ion);
- return (jint) region;
+ return reinterpret_cast<jlong>(region);
}
};
@@ -167,11 +178,11 @@
static JNINativeMethod gNinePatchMethods[] = {
{ "isNinePatchChunk", "([B)Z", (void*) SkNinePatchGlue::isNinePatchChunk },
- { "validateNinePatchChunk", "(I[B)I", (void*) SkNinePatchGlue::validateNinePatchChunk },
- { "nativeFinalize", "(I)V", (void*) SkNinePatchGlue::finalize },
- { "nativeDraw", "(ILandroid/graphics/RectF;IIIII)V", (void*) SkNinePatchGlue::drawF },
- { "nativeDraw", "(ILandroid/graphics/Rect;IIIII)V", (void*) SkNinePatchGlue::drawI },
- { "nativeGetTransparentRegion", "(IILandroid/graphics/Rect;)I",
+ { "validateNinePatchChunk", "(J[B)J", (void*) SkNinePatchGlue::validateNinePatchChunk },
+ { "nativeFinalize", "(J)V", (void*) SkNinePatchGlue::finalize },
+ { "nativeDraw", "(JLandroid/graphics/RectF;JJJII)V", (void*) SkNinePatchGlue::drawF },
+ { "nativeDraw", "(JLandroid/graphics/Rect;JJJII)V", (void*) SkNinePatchGlue::drawI },
+ { "nativeGetTransparentRegion", "(JJLandroid/graphics/Rect;)J",
(void*) SkNinePatchGlue::getTransparentRegion }
};
diff --git a/core/jni/android/graphics/Paint.cpp b/core/jni/android/graphics/Paint.cpp
index 1ca3f3a..6c81f06 100644
--- a/core/jni/android/graphics/Paint.cpp
+++ b/core/jni/android/graphics/Paint.cpp
@@ -70,33 +70,40 @@
AFTER, AT_OR_AFTER, BEFORE, AT_OR_BEFORE, AT
};
- static void finalizer(JNIEnv* env, jobject clazz, SkPaint* obj) {
+ static void finalizer(JNIEnv* env, jobject clazz, jlong objHandle) {
+ SkPaint* obj = reinterpret_cast<SkPaint*>(objHandle);
delete obj;
}
- static SkPaint* init(JNIEnv* env, jobject clazz) {
+ static jlong init(JNIEnv* env, jobject clazz) {
SkPaint* obj = new SkPaint();
defaultSettingsForAndroid(obj);
- return obj;
+ return reinterpret_cast<jlong>(obj);
}
- static SkPaint* intiWithPaint(JNIEnv* env, jobject clazz, SkPaint* paint) {
+ static jlong initWithPaint(JNIEnv* env, jobject clazz, jlong paintHandle) {
+ SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
SkPaint* obj = new SkPaint(*paint);
- return obj;
+ return reinterpret_cast<jlong>(obj);
}
- static void reset(JNIEnv* env, jobject clazz, SkPaint* obj) {
+ static void reset(JNIEnv* env, jobject clazz, jlong objHandle) {
+ SkPaint* obj = reinterpret_cast<SkPaint*>(objHandle);
obj->reset();
defaultSettingsForAndroid(obj);
}
- static void assign(JNIEnv* env, jobject clazz, SkPaint* dst, const SkPaint* src) {
+ static void assign(JNIEnv* env, jobject clazz, jlong dstPaintHandle, jlong srcPaintHandle) {
+ SkPaint* dst = reinterpret_cast<SkPaint*>(dstPaintHandle);
+ const SkPaint* src = reinterpret_cast<SkPaint*>(srcPaintHandle);
*dst = *src;
}
static jint getFlags(JNIEnv* env, jobject paint) {
NPE_CHECK_RETURN_ZERO(env, paint);
- return GraphicsJNI::getNativePaint(env, paint)->getFlags();
+ int result;
+ result = GraphicsJNI::getNativePaint(env, paint)->getFlags();
+ return static_cast<jint>(result);
}
static void setFlags(JNIEnv* env, jobject paint, jint flags) {
@@ -156,22 +163,29 @@
GraphicsJNI::getNativePaint(env, paint)->setDither(dither);
}
- static jint getStyle(JNIEnv* env, jobject clazz, SkPaint* obj) {
- return obj->getStyle();
+ static jint getStyle(JNIEnv* env, jobject clazz,jlong objHandle) {
+ SkPaint* obj = reinterpret_cast<SkPaint*>(objHandle);
+ return static_cast<jint>(obj->getStyle());
}
- static void setStyle(JNIEnv* env, jobject clazz, SkPaint* obj, SkPaint::Style style) {
+ static void setStyle(JNIEnv* env, jobject clazz, jlong objHandle, jint styleHandle) {
+ SkPaint* obj = reinterpret_cast<SkPaint*>(objHandle);
+ SkPaint::Style style = static_cast<SkPaint::Style>(styleHandle);
obj->setStyle(style);
}
static jint getColor(JNIEnv* env, jobject paint) {
NPE_CHECK_RETURN_ZERO(env, paint);
- return GraphicsJNI::getNativePaint(env, paint)->getColor();
+ int color;
+ color = GraphicsJNI::getNativePaint(env, paint)->getColor();
+ return static_cast<jint>(color);
}
static jint getAlpha(JNIEnv* env, jobject paint) {
NPE_CHECK_RETURN_ZERO(env, paint);
- return GraphicsJNI::getNativePaint(env, paint)->getAlpha();
+ int alpha;
+ alpha = GraphicsJNI::getNativePaint(env, paint)->getAlpha();
+ return static_cast<jint>(alpha);
}
static void setColor(JNIEnv* env, jobject paint, jint color) {
@@ -204,64 +218,90 @@
GraphicsJNI::getNativePaint(env, paint)->setStrokeMiter(SkFloatToScalar(miter));
}
- static jint getStrokeCap(JNIEnv* env, jobject clazz, SkPaint* obj) {
- return obj->getStrokeCap();
+ static jint getStrokeCap(JNIEnv* env, jobject clazz, jlong objHandle) {
+ SkPaint* obj = reinterpret_cast<SkPaint*>(objHandle);
+ return static_cast<jint>(obj->getStrokeCap());
}
- static void setStrokeCap(JNIEnv* env, jobject clazz, SkPaint* obj, SkPaint::Cap cap) {
+ static void setStrokeCap(JNIEnv* env, jobject clazz, jlong objHandle, jint capHandle) {
+ SkPaint* obj = reinterpret_cast<SkPaint*>(objHandle);
+ SkPaint::Cap cap = static_cast<SkPaint::Cap>(capHandle);
obj->setStrokeCap(cap);
}
- static jint getStrokeJoin(JNIEnv* env, jobject clazz, SkPaint* obj) {
- return obj->getStrokeJoin();
+ static jint getStrokeJoin(JNIEnv* env, jobject clazz, jlong objHandle) {
+ SkPaint* obj = reinterpret_cast<SkPaint*>(objHandle);
+ return static_cast<jint>(obj->getStrokeJoin());
}
- static void setStrokeJoin(JNIEnv* env, jobject clazz, SkPaint* obj, SkPaint::Join join) {
+ static void setStrokeJoin(JNIEnv* env, jobject clazz, jlong objHandle, jint joinHandle) {
+ SkPaint* obj = reinterpret_cast<SkPaint*>(objHandle);
+ SkPaint::Join join = (SkPaint::Join) joinHandle;
obj->setStrokeJoin(join);
}
- static jboolean getFillPath(JNIEnv* env, jobject clazz, SkPaint* obj, SkPath* src, SkPath* dst) {
- return obj->getFillPath(*src, dst);
+ static jboolean getFillPath(JNIEnv* env, jobject clazz, jlong objHandle, jlong srcHandle, jlong dstHandle) {
+ SkPaint* obj = reinterpret_cast<SkPaint*>(objHandle);
+ SkPath* src = reinterpret_cast<SkPath*>(srcHandle);
+ SkPath* dst = reinterpret_cast<SkPath*>(dstHandle);
+ return obj->getFillPath(*src, dst) ? JNI_TRUE : JNI_FALSE;
}
- static SkShader* setShader(JNIEnv* env, jobject clazz, SkPaint* obj, SkShader* shader) {
- return obj->setShader(shader);
+ static jlong setShader(JNIEnv* env, jobject clazz, jlong objHandle, jlong shaderHandle) {
+ SkPaint* obj = reinterpret_cast<SkPaint*>(objHandle);
+ SkShader* shader = reinterpret_cast<SkShader*>(shaderHandle);
+ return reinterpret_cast<jlong>(obj->setShader(shader));
}
- static SkColorFilter* setColorFilter(JNIEnv* env, jobject clazz, SkPaint* obj, SkColorFilter* filter) {
- return obj->setColorFilter(filter);
+ static jlong setColorFilter(JNIEnv* env, jobject clazz, jlong objHandle, jlong filterHandle) {
+ SkPaint* obj = reinterpret_cast<SkPaint *>(objHandle);
+ SkColorFilter* filter = reinterpret_cast<SkColorFilter *>(filterHandle);
+ return reinterpret_cast<jlong>(obj->setColorFilter(filter));
}
- static SkXfermode* setXfermode(JNIEnv* env, jobject clazz, SkPaint* obj, SkXfermode* xfermode) {
- return obj->setXfermode(xfermode);
+ static jlong setXfermode(JNIEnv* env, jobject clazz, jlong objHandle, jlong xfermodeHandle) {
+ SkPaint* obj = reinterpret_cast<SkPaint*>(objHandle);
+ SkXfermode* xfermode = reinterpret_cast<SkXfermode*>(xfermodeHandle);
+ return reinterpret_cast<jlong>(obj->setXfermode(xfermode));
}
- static SkPathEffect* setPathEffect(JNIEnv* env, jobject clazz, SkPaint* obj, SkPathEffect* effect) {
- return obj->setPathEffect(effect);
+ static jlong setPathEffect(JNIEnv* env, jobject clazz, jlong objHandle, jlong effectHandle) {
+ SkPaint* obj = reinterpret_cast<SkPaint*>(objHandle);
+ SkPathEffect* effect = reinterpret_cast<SkPathEffect*>(effectHandle);
+ return reinterpret_cast<jlong>(obj->setPathEffect(effect));
}
- static SkMaskFilter* setMaskFilter(JNIEnv* env, jobject clazz, SkPaint* obj, SkMaskFilter* maskfilter) {
- return obj->setMaskFilter(maskfilter);
+ static jlong setMaskFilter(JNIEnv* env, jobject clazz, jlong objHandle, jlong maskfilterHandle) {
+ SkPaint* obj = reinterpret_cast<SkPaint*>(objHandle);
+ SkMaskFilter* maskfilter = reinterpret_cast<SkMaskFilter*>(maskfilterHandle);
+ return reinterpret_cast<jlong>(obj->setMaskFilter(maskfilter));
}
- static SkTypeface* setTypeface(JNIEnv* env, jobject clazz, SkPaint* obj, SkTypeface* typeface) {
+ static jlong setTypeface(JNIEnv* env, jobject clazz, jlong objHandle, jlong typefaceHandle) {
#ifndef USE_MINIKIN
- return obj->setTypeface(typeface);
+ SkPaint* obj = reinterpret_cast<SkPaint*>(objHandle);
+ SkTypeface* typeface = reinterpret_cast<SkTypeface*>(typefaceHandle);
+ return reinterpret_cast<jlong>(obj->setTypeface(typeface));
#else
// TODO(raph): not yet implemented
return NULL;
#endif
}
- static SkRasterizer* setRasterizer(JNIEnv* env, jobject clazz, SkPaint* obj, SkRasterizer* rasterizer) {
- return obj->setRasterizer(rasterizer);
+ static jlong setRasterizer(JNIEnv* env, jobject clazz, jlong objHandle, jlong rasterizerHandle) {
+ SkPaint* obj = reinterpret_cast<SkPaint*>(objHandle);
+ SkRasterizer* rasterizer = reinterpret_cast<SkRasterizer*>(rasterizerHandle);
+ return reinterpret_cast<jlong>(obj->setRasterizer(rasterizer));
}
- static jint getTextAlign(JNIEnv* env, jobject clazz, SkPaint* obj) {
- return obj->getTextAlign();
+ static jint getTextAlign(JNIEnv* env, jobject clazz, jlong objHandle) {
+ SkPaint* obj = reinterpret_cast<SkPaint*>(objHandle);
+ return static_cast<jint>(obj->getTextAlign());
}
- static void setTextAlign(JNIEnv* env, jobject clazz, SkPaint* obj, SkPaint::Align align) {
+ static void setTextAlign(JNIEnv* env, jobject clazz, jlong objHandle, jint alignHandle) {
+ SkPaint* obj = reinterpret_cast<SkPaint*>(objHandle);
+ SkPaint::Align align = static_cast<SkPaint::Align>(alignHandle);
obj->setTextAlign(align);
}
@@ -305,7 +345,8 @@
output[0] = '\0';
}
- static void setTextLocale(JNIEnv* env, jobject clazz, SkPaint* obj, jstring locale) {
+ static void setTextLocale(JNIEnv* env, jobject clazz, jlong objHandle, jstring locale) {
+ SkPaint* obj = reinterpret_cast<SkPaint*>(objHandle);
ScopedUtfChars localeChars(env, locale);
char langTag[ULOC_FULLNAME_CAPACITY];
toLanguageTag(langTag, ULOC_FULLNAME_CAPACITY, localeChars.c_str());
@@ -395,7 +436,7 @@
return descent - ascent + leading;
}
- static jfloat measureText_CIII(JNIEnv* env, jobject jpaint, jcharArray text, int index, int count,
+ static jfloat measureText_CIII(JNIEnv* env, jobject jpaint, jcharArray text, jint index, jint count,
jint bidiFlags) {
NPE_CHECK_RETURN_ZERO(env, jpaint);
NPE_CHECK_RETURN_ZERO(env, text);
@@ -420,7 +461,7 @@
return result;
}
- static jfloat measureText_StringIII(JNIEnv* env, jobject jpaint, jstring text, int start, int end,
+ static jfloat measureText_StringIII(JNIEnv* env, jobject jpaint, jstring text, jint start, jint end,
jint bidiFlags) {
NPE_CHECK_RETURN_ZERO(env, jpaint);
NPE_CHECK_RETURN_ZERO(env, text);
@@ -493,8 +534,9 @@
return count;
}
- static int getTextWidths___CIII_F(JNIEnv* env, jobject clazz, SkPaint* paint, jcharArray text,
- int index, int count, jint bidiFlags, jfloatArray widths) {
+ static jint getTextWidths___CIII_F(JNIEnv* env, jobject clazz, jlong paintHandle, jcharArray text,
+ jint index, jint count, jint bidiFlags, jfloatArray widths) {
+ SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
const jchar* textArray = env->GetCharArrayElements(text, NULL);
count = dotextwidths(env, paint, textArray + index, count, widths, bidiFlags);
env->ReleaseCharArrayElements(text, const_cast<jchar*>(textArray),
@@ -502,8 +544,9 @@
return count;
}
- static int getTextWidths__StringIII_F(JNIEnv* env, jobject clazz, SkPaint* paint, jstring text,
- int start, int end, jint bidiFlags, jfloatArray widths) {
+ static jint getTextWidths__StringIII_F(JNIEnv* env, jobject clazz, jlong paintHandle, jstring text,
+ jint start, jint end, jint bidiFlags, jfloatArray widths) {
+ SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
const jchar* textArray = env->GetStringChars(text, NULL);
int count = dotextwidths(env, paint, textArray + start, end - start, widths, bidiFlags);
env->ReleaseStringChars(text, textArray);
@@ -540,9 +583,10 @@
return glyphsCount;
}
- static int getTextGlyphs__StringIIIII_C(JNIEnv* env, jobject clazz, SkPaint* paint,
+ static jint getTextGlyphs__StringIIIII_C(JNIEnv* env, jobject clazz, jlong paintHandle,
jstring text, jint start, jint end, jint contextStart, jint contextEnd, jint flags,
jcharArray glyphs) {
+ SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
const jchar* textArray = env->GetStringChars(text, NULL);
int count = doTextGlyphs(env, paint, textArray + contextStart, start - contextStart,
end - start, contextEnd - contextStart, flags, glyphs);
@@ -582,9 +626,10 @@
return totalAdvance;
}
- static float getTextRunAdvances___CIIIII_FI(JNIEnv* env, jobject clazz, SkPaint* paint,
+ static jfloat getTextRunAdvances___CIIIII_FI(JNIEnv* env, jobject clazz, jlong paintHandle,
jcharArray text, jint index, jint count, jint contextIndex, jint contextCount,
jint flags, jfloatArray advances, jint advancesIndex) {
+ SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
jchar* textArray = env->GetCharArrayElements(text, NULL);
jfloat result = doTextRunAdvances(env, paint, textArray + contextIndex,
index - contextIndex, count, contextCount, flags, advances, advancesIndex);
@@ -592,9 +637,10 @@
return result;
}
- static float getTextRunAdvances__StringIIIII_FI(JNIEnv* env, jobject clazz, SkPaint* paint,
+ static jfloat getTextRunAdvances__StringIIIII_FI(JNIEnv* env, jobject clazz, jlong paintHandle,
jstring text, jint start, jint end, jint contextStart, jint contextEnd, jint flags,
jfloatArray advances, jint advancesIndex) {
+ SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
const jchar* textArray = env->GetStringChars(text, NULL);
jfloat result = doTextRunAdvances(env, paint, textArray + contextStart,
start - contextStart, end - start, contextEnd - contextStart, flags,
@@ -647,8 +693,9 @@
return pos;
}
- static jint getTextRunCursor___C(JNIEnv* env, jobject clazz, SkPaint* paint, jcharArray text,
+ static jint getTextRunCursor___C(JNIEnv* env, jobject clazz, jlong paintHandle, jcharArray text,
jint contextStart, jint contextCount, jint flags, jint offset, jint cursorOpt) {
+ SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
jchar* textArray = env->GetCharArrayElements(text, NULL);
jint result = doTextRunCursor(env, paint, textArray, contextStart, contextCount, flags,
offset, cursorOpt);
@@ -656,8 +703,9 @@
return result;
}
- static jint getTextRunCursor__String(JNIEnv* env, jobject clazz, SkPaint* paint, jstring text,
+ static jint getTextRunCursor__String(JNIEnv* env, jobject clazz, jlong paintHandle, jstring text,
jint contextStart, jint contextEnd, jint flags, jint offset, jint cursorOpt) {
+ SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
const jchar* textArray = env->GetStringChars(text, NULL);
jint result = doTextRunCursor(env, paint, textArray, contextStart,
contextEnd - contextStart, flags, offset, cursorOpt);
@@ -670,22 +718,26 @@
TextLayout::getTextPath(paint, text, count, bidiFlags, x, y, path);
}
- static void getTextPath___C(JNIEnv* env, jobject clazz, SkPaint* paint, jint bidiFlags,
- jcharArray text, int index, int count, jfloat x, jfloat y, SkPath* path) {
+ static void getTextPath___C(JNIEnv* env, jobject clazz, jlong paintHandle, jint bidiFlags,
+ jcharArray text, jint index, jint count, jfloat x, jfloat y, jlong pathHandle) {
+ SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
+ SkPath* path = reinterpret_cast<SkPath*>(pathHandle);
const jchar* textArray = env->GetCharArrayElements(text, NULL);
getTextPath(env, paint, textArray + index, count, bidiFlags, x, y, path);
env->ReleaseCharArrayElements(text, const_cast<jchar*>(textArray), JNI_ABORT);
}
- static void getTextPath__String(JNIEnv* env, jobject clazz, SkPaint* paint, jint bidiFlags,
- jstring text, int start, int end, jfloat x, jfloat y, SkPath* path) {
+ static void getTextPath__String(JNIEnv* env, jobject clazz, jlong paintHandle, jint bidiFlags,
+ jstring text, jint start, jint end, jfloat x, jfloat y, jlong pathHandle) {
+ SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
+ SkPath* path = reinterpret_cast<SkPath*>(pathHandle);
const jchar* textArray = env->GetStringChars(text, NULL);
getTextPath(env, paint, textArray + start, end - start, bidiFlags, x, y, path);
env->ReleaseStringChars(text, textArray);
}
static void setShadowLayer(JNIEnv* env, jobject jpaint, jfloat radius,
- jfloat dx, jfloat dy, int color) {
+ jfloat dx, jfloat dy, jint color) {
NPE_CHECK_RETURN_VOID(env, jpaint);
SkPaint* paint = GraphicsJNI::getNativePaint(env, jpaint);
@@ -721,8 +773,8 @@
return bytes >> 1;
}
- static int breakTextC(JNIEnv* env, jobject jpaint, jcharArray jtext,
- int index, int count, float maxWidth, jint bidiFlags, jfloatArray jmeasuredWidth) {
+ static jint breakTextC(JNIEnv* env, jobject jpaint, jcharArray jtext,
+ jint index, jint count, jfloat maxWidth, jint bidiFlags, jfloatArray jmeasuredWidth) {
NPE_CHECK_RETURN_ZERO(env, jpaint);
NPE_CHECK_RETURN_ZERO(env, jtext);
@@ -749,8 +801,8 @@
return count;
}
- static int breakTextS(JNIEnv* env, jobject jpaint, jstring jtext,
- bool forwards, float maxWidth, jint bidiFlags, jfloatArray jmeasuredWidth) {
+ static jint breakTextS(JNIEnv* env, jobject jpaint, jstring jtext,
+ jboolean forwards, jfloat maxWidth, jint bidiFlags, jfloatArray jmeasuredWidth) {
NPE_CHECK_RETURN_ZERO(env, jpaint);
NPE_CHECK_RETURN_ZERO(env, jtext);
@@ -781,15 +833,17 @@
GraphicsJNI::irect_to_jrect(ir, env, bounds);
}
- static void getStringBounds(JNIEnv* env, jobject, const SkPaint* paint,
- jstring text, int start, int end, jint bidiFlags, jobject bounds) {
+ static void getStringBounds(JNIEnv* env, jobject, jlong paintHandle,
+ jstring text, jint start, jint end, jint bidiFlags, jobject bounds) {
+ const SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);;
const jchar* textArray = env->GetStringChars(text, NULL);
doTextBounds(env, textArray + start, end - start, bounds, *paint, bidiFlags);
env->ReleaseStringChars(text, textArray);
}
- static void getCharArrayBounds(JNIEnv* env, jobject, const SkPaint* paint,
- jcharArray text, int index, int count, jint bidiFlags, jobject bounds) {
+ static void getCharArrayBounds(JNIEnv* env, jobject, jlong paintHandle,
+ jcharArray text, jint index, jint count, jint bidiFlags, jobject bounds) {
+ const SkPaint* paint = reinterpret_cast<SkPaint*>(paintHandle);
const jchar* textArray = env->GetCharArrayElements(text, NULL);
doTextBounds(env, textArray + index, count, bounds, *paint, bidiFlags);
env->ReleaseCharArrayElements(text, const_cast<jchar*>(textArray),
@@ -799,11 +853,11 @@
};
static JNINativeMethod methods[] = {
- {"finalizer", "(I)V", (void*) SkPaintGlue::finalizer},
- {"native_init","()I", (void*) SkPaintGlue::init},
- {"native_initWithPaint","(I)I", (void*) SkPaintGlue::intiWithPaint},
- {"native_reset","(I)V", (void*) SkPaintGlue::reset},
- {"native_set","(II)V", (void*) SkPaintGlue::assign},
+ {"finalizer", "(J)V", (void*) SkPaintGlue::finalizer},
+ {"native_init","()J", (void*) SkPaintGlue::init},
+ {"native_initWithPaint","(J)J", (void*) SkPaintGlue::initWithPaint},
+ {"native_reset","(J)V", (void*) SkPaintGlue::reset},
+ {"native_set","(JJ)V", (void*) SkPaintGlue::assign},
{"getFlags","()I", (void*) SkPaintGlue::getFlags},
{"setFlags","(I)V", (void*) SkPaintGlue::setFlags},
{"getHinting","()I", (void*) SkPaintGlue::getHinting},
@@ -816,8 +870,8 @@
{"setFakeBoldText","(Z)V", (void*) SkPaintGlue::setFakeBoldText},
{"setFilterBitmap","(Z)V", (void*) SkPaintGlue::setFilterBitmap},
{"setDither","(Z)V", (void*) SkPaintGlue::setDither},
- {"native_getStyle","(I)I", (void*) SkPaintGlue::getStyle},
- {"native_setStyle","(II)V", (void*) SkPaintGlue::setStyle},
+ {"native_getStyle","(J)I", (void*) SkPaintGlue::getStyle},
+ {"native_setStyle","(JI)V", (void*) SkPaintGlue::setStyle},
{"getColor","()I", (void*) SkPaintGlue::getColor},
{"setColor","(I)V", (void*) SkPaintGlue::setColor},
{"getAlpha","()I", (void*) SkPaintGlue::getAlpha},
@@ -826,21 +880,21 @@
{"setStrokeWidth","(F)V", (void*) SkPaintGlue::setStrokeWidth},
{"getStrokeMiter","()F", (void*) SkPaintGlue::getStrokeMiter},
{"setStrokeMiter","(F)V", (void*) SkPaintGlue::setStrokeMiter},
- {"native_getStrokeCap","(I)I", (void*) SkPaintGlue::getStrokeCap},
- {"native_setStrokeCap","(II)V", (void*) SkPaintGlue::setStrokeCap},
- {"native_getStrokeJoin","(I)I", (void*) SkPaintGlue::getStrokeJoin},
- {"native_setStrokeJoin","(II)V", (void*) SkPaintGlue::setStrokeJoin},
- {"native_getFillPath","(III)Z", (void*) SkPaintGlue::getFillPath},
- {"native_setShader","(II)I", (void*) SkPaintGlue::setShader},
- {"native_setColorFilter","(II)I", (void*) SkPaintGlue::setColorFilter},
- {"native_setXfermode","(II)I", (void*) SkPaintGlue::setXfermode},
- {"native_setPathEffect","(II)I", (void*) SkPaintGlue::setPathEffect},
- {"native_setMaskFilter","(II)I", (void*) SkPaintGlue::setMaskFilter},
- {"native_setTypeface","(II)I", (void*) SkPaintGlue::setTypeface},
- {"native_setRasterizer","(II)I", (void*) SkPaintGlue::setRasterizer},
- {"native_getTextAlign","(I)I", (void*) SkPaintGlue::getTextAlign},
- {"native_setTextAlign","(II)V", (void*) SkPaintGlue::setTextAlign},
- {"native_setTextLocale","(ILjava/lang/String;)V", (void*) SkPaintGlue::setTextLocale},
+ {"native_getStrokeCap","(J)I", (void*) SkPaintGlue::getStrokeCap},
+ {"native_setStrokeCap","(JI)V", (void*) SkPaintGlue::setStrokeCap},
+ {"native_getStrokeJoin","(J)I", (void*) SkPaintGlue::getStrokeJoin},
+ {"native_setStrokeJoin","(JI)V", (void*) SkPaintGlue::setStrokeJoin},
+ {"native_getFillPath","(JJJ)Z", (void*) SkPaintGlue::getFillPath},
+ {"native_setShader","(JJ)J", (void*) SkPaintGlue::setShader},
+ {"native_setColorFilter","(JJ)J", (void*) SkPaintGlue::setColorFilter},
+ {"native_setXfermode","(JJ)J", (void*) SkPaintGlue::setXfermode},
+ {"native_setPathEffect","(JJ)J", (void*) SkPaintGlue::setPathEffect},
+ {"native_setMaskFilter","(JJ)J", (void*) SkPaintGlue::setMaskFilter},
+ {"native_setTypeface","(JJ)J", (void*) SkPaintGlue::setTypeface},
+ {"native_setRasterizer","(JJ)J", (void*) SkPaintGlue::setRasterizer},
+ {"native_getTextAlign","(J)I", (void*) SkPaintGlue::getTextAlign},
+ {"native_setTextAlign","(JI)V", (void*) SkPaintGlue::setTextAlign},
+ {"native_setTextLocale","(JLjava/lang/String;)V", (void*) SkPaintGlue::setTextLocale},
{"getTextSize","()F", (void*) SkPaintGlue::getTextSize},
{"setTextSize","(F)V", (void*) SkPaintGlue::setTextSize},
{"getTextScaleX","()F", (void*) SkPaintGlue::getTextScaleX},
@@ -856,24 +910,24 @@
{"native_measureText","(Ljava/lang/String;III)F", (void*) SkPaintGlue::measureText_StringIII},
{"native_breakText","([CIIFI[F)I", (void*) SkPaintGlue::breakTextC},
{"native_breakText","(Ljava/lang/String;ZFI[F)I", (void*) SkPaintGlue::breakTextS},
- {"native_getTextWidths","(I[CIII[F)I", (void*) SkPaintGlue::getTextWidths___CIII_F},
- {"native_getTextWidths","(ILjava/lang/String;III[F)I", (void*) SkPaintGlue::getTextWidths__StringIII_F},
- {"native_getTextRunAdvances","(I[CIIIII[FI)F",
+ {"native_getTextWidths","(J[CIII[F)I", (void*) SkPaintGlue::getTextWidths___CIII_F},
+ {"native_getTextWidths","(JLjava/lang/String;III[F)I", (void*) SkPaintGlue::getTextWidths__StringIII_F},
+ {"native_getTextRunAdvances","(J[CIIIII[FI)F",
(void*) SkPaintGlue::getTextRunAdvances___CIIIII_FI},
- {"native_getTextRunAdvances","(ILjava/lang/String;IIIII[FI)F",
+ {"native_getTextRunAdvances","(JLjava/lang/String;IIIII[FI)F",
(void*) SkPaintGlue::getTextRunAdvances__StringIIIII_FI},
- {"native_getTextGlyphs","(ILjava/lang/String;IIIII[C)I",
+ {"native_getTextGlyphs","(JLjava/lang/String;IIIII[C)I",
(void*) SkPaintGlue::getTextGlyphs__StringIIIII_C},
- {"native_getTextRunCursor", "(I[CIIIII)I", (void*) SkPaintGlue::getTextRunCursor___C},
- {"native_getTextRunCursor", "(ILjava/lang/String;IIIII)I",
+ {"native_getTextRunCursor", "(J[CIIIII)I", (void*) SkPaintGlue::getTextRunCursor___C},
+ {"native_getTextRunCursor", "(JLjava/lang/String;IIIII)I",
(void*) SkPaintGlue::getTextRunCursor__String},
- {"native_getTextPath","(II[CIIFFI)V", (void*) SkPaintGlue::getTextPath___C},
- {"native_getTextPath","(IILjava/lang/String;IIFFI)V", (void*) SkPaintGlue::getTextPath__String},
- {"nativeGetStringBounds", "(ILjava/lang/String;IIILandroid/graphics/Rect;)V",
+ {"native_getTextPath","(JI[CIIFFJ)V", (void*) SkPaintGlue::getTextPath___C},
+ {"native_getTextPath","(JILjava/lang/String;IIFFJ)V", (void*) SkPaintGlue::getTextPath__String},
+ {"nativeGetStringBounds", "(JLjava/lang/String;IIILandroid/graphics/Rect;)V",
(void*) SkPaintGlue::getStringBounds },
- {"nativeGetCharArrayBounds", "(I[CIIILandroid/graphics/Rect;)V",
+ {"nativeGetCharArrayBounds", "(J[CIIILandroid/graphics/Rect;)V",
(void*) SkPaintGlue::getCharArrayBounds },
{"nSetShadowLayer", "(FFFI)V", (void*)SkPaintGlue::setShadowLayer}
};
diff --git a/core/jni/android/graphics/Path.cpp b/core/jni/android/graphics/Path.cpp
index 2126ed4..c4d728f 100644
--- a/core/jni/android/graphics/Path.cpp
+++ b/core/jni/android/graphics/Path.cpp
@@ -36,7 +36,8 @@
class SkPathGlue {
public:
- static void finalizer(JNIEnv* env, jobject clazz, SkPath* obj) {
+ static void finalizer(JNIEnv* env, jobject clazz, jlong objHandle) {
+ SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
#ifdef USE_OPENGL_RENDERER
if (android::uirenderer::Caches::hasInstance()) {
android::uirenderer::Caches::getInstance().resourceCache.destructor(obj);
@@ -46,79 +47,96 @@
delete obj;
}
- static SkPath* init1(JNIEnv* env, jobject clazz) {
- return new SkPath();
+ static jlong init1(JNIEnv* env, jobject clazz) {
+ return reinterpret_cast<jlong>(new SkPath());
}
-
- static SkPath* init2(JNIEnv* env, jobject clazz, SkPath* val) {
- return new SkPath(*val);
+
+ static jlong init2(JNIEnv* env, jobject clazz, jlong valHandle) {
+ SkPath* val = reinterpret_cast<SkPath*>(valHandle);
+ return reinterpret_cast<jlong>(new SkPath(*val));
}
-
- static void reset(JNIEnv* env, jobject clazz, SkPath* obj) {
+
+ static void reset(JNIEnv* env, jobject clazz, jlong objHandle) {
+ SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
obj->reset();
}
- static void rewind(JNIEnv* env, jobject clazz, SkPath* obj) {
+ static void rewind(JNIEnv* env, jobject clazz, jlong objHandle) {
+ SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
obj->rewind();
}
- static void assign(JNIEnv* env, jobject clazz, SkPath* dst, const SkPath* src) {
+ static void assign(JNIEnv* env, jobject clazz, jlong dstHandle, jlong srcHandle) {
+ SkPath* dst = reinterpret_cast<SkPath*>(dstHandle);
+ const SkPath* src = reinterpret_cast<SkPath*>(srcHandle);
*dst = *src;
}
-
- static jint getFillType(JNIEnv* env, jobject clazz, SkPath* obj) {
+
+ static jint getFillType(JNIEnv* env, jobject clazz, jlong objHandle) {
+ SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
return obj->getFillType();
}
- static void setFillType(JNIEnv* env, jobject clazz, SkPath* path, SkPath::FillType ft) {
+ static void setFillType(JNIEnv* env, jobject clazz, jlong pathHandle, jint ftHandle) {
+ SkPath* path = reinterpret_cast<SkPath*>(pathHandle);
+ SkPath::FillType ft = static_cast<SkPath::FillType>(ftHandle);
path->setFillType(ft);
}
-
- static jboolean isEmpty(JNIEnv* env, jobject clazz, SkPath* obj) {
+
+ static jboolean isEmpty(JNIEnv* env, jobject clazz, jlong objHandle) {
+ SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
return obj->isEmpty();
}
- static jboolean isRect(JNIEnv* env, jobject clazz, SkPath* obj, jobject rect) {
+ static jboolean isRect(JNIEnv* env, jobject clazz, jlong objHandle, jobject rect) {
SkRect rect_;
+ SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
jboolean result = obj->isRect(&rect_);
GraphicsJNI::rect_to_jrectf(rect_, env, rect);
return result;
}
- static void computeBounds(JNIEnv* env, jobject clazz, SkPath* obj, jobject bounds) {
+ static void computeBounds(JNIEnv* env, jobject clazz, jlong objHandle, jobject bounds) {
+ SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
const SkRect& bounds_ = obj->getBounds();
GraphicsJNI::rect_to_jrectf(bounds_, env, bounds);
}
- static void incReserve(JNIEnv* env, jobject clazz, SkPath* obj, jint extraPtCount) {
+ static void incReserve(JNIEnv* env, jobject clazz, jlong objHandle, jint extraPtCount) {
+ SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
obj->incReserve(extraPtCount);
}
- static void moveTo__FF(JNIEnv* env, jobject clazz, SkPath* obj, jfloat x, jfloat y) {
+ static void moveTo__FF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat x, jfloat y) {
+ SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
SkScalar x_ = SkFloatToScalar(x);
SkScalar y_ = SkFloatToScalar(y);
obj->moveTo(x_, y_);
}
- static void rMoveTo(JNIEnv* env, jobject clazz, SkPath* obj, jfloat dx, jfloat dy) {
+ static void rMoveTo(JNIEnv* env, jobject clazz, jlong objHandle, jfloat dx, jfloat dy) {
+ SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
SkScalar dx_ = SkFloatToScalar(dx);
SkScalar dy_ = SkFloatToScalar(dy);
obj->rMoveTo(dx_, dy_);
}
- static void lineTo__FF(JNIEnv* env, jobject clazz, SkPath* obj, jfloat x, jfloat y) {
+ static void lineTo__FF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat x, jfloat y) {
+ SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
SkScalar x_ = SkFloatToScalar(x);
SkScalar y_ = SkFloatToScalar(y);
obj->lineTo(x_, y_);
}
- static void rLineTo(JNIEnv* env, jobject clazz, SkPath* obj, jfloat dx, jfloat dy) {
+ static void rLineTo(JNIEnv* env, jobject clazz, jlong objHandle, jfloat dx, jfloat dy) {
+ SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
SkScalar dx_ = SkFloatToScalar(dx);
SkScalar dy_ = SkFloatToScalar(dy);
obj->rLineTo(dx_, dy_);
}
- static void quadTo__FFFF(JNIEnv* env, jobject clazz, SkPath* obj, jfloat x1, jfloat y1, jfloat x2, jfloat y2) {
+ static void quadTo__FFFF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat x1, jfloat y1, jfloat x2, jfloat y2) {
+ SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
SkScalar x1_ = SkFloatToScalar(x1);
SkScalar y1_ = SkFloatToScalar(y1);
SkScalar x2_ = SkFloatToScalar(x2);
@@ -126,7 +144,8 @@
obj->quadTo(x1_, y1_, x2_, y2_);
}
- static void rQuadTo(JNIEnv* env, jobject clazz, SkPath* obj, jfloat dx1, jfloat dy1, jfloat dx2, jfloat dy2) {
+ static void rQuadTo(JNIEnv* env, jobject clazz, jlong objHandle, jfloat dx1, jfloat dy1, jfloat dx2, jfloat dy2) {
+ SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
SkScalar dx1_ = SkFloatToScalar(dx1);
SkScalar dy1_ = SkFloatToScalar(dy1);
SkScalar dx2_ = SkFloatToScalar(dx2);
@@ -134,7 +153,8 @@
obj->rQuadTo(dx1_, dy1_, dx2_, dy2_);
}
- static void cubicTo__FFFFFF(JNIEnv* env, jobject clazz, SkPath* obj, jfloat x1, jfloat y1, jfloat x2, jfloat y2, jfloat x3, jfloat y3) {
+ static void cubicTo__FFFFFF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat x1, jfloat y1, jfloat x2, jfloat y2, jfloat x3, jfloat y3) {
+ SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
SkScalar x1_ = SkFloatToScalar(x1);
SkScalar y1_ = SkFloatToScalar(y1);
SkScalar x2_ = SkFloatToScalar(x2);
@@ -144,7 +164,8 @@
obj->cubicTo(x1_, y1_, x2_, y2_, x3_, y3_);
}
- static void rCubicTo(JNIEnv* env, jobject clazz, SkPath* obj, jfloat x1, jfloat y1, jfloat x2, jfloat y2, jfloat x3, jfloat y3) {
+ static void rCubicTo(JNIEnv* env, jobject clazz, jlong objHandle, jfloat x1, jfloat y1, jfloat x2, jfloat y2, jfloat x3, jfloat y3) {
+ SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
SkScalar x1_ = SkFloatToScalar(x1);
SkScalar y1_ = SkFloatToScalar(y1);
SkScalar x2_ = SkFloatToScalar(x2);
@@ -154,7 +175,8 @@
obj->rCubicTo(x1_, y1_, x2_, y2_, x3_, y3_);
}
- static void arcTo(JNIEnv* env, jobject clazz, SkPath* obj, jobject oval, jfloat startAngle, jfloat sweepAngle, jboolean forceMoveTo) {
+ static void arcTo(JNIEnv* env, jobject clazz, jlong objHandle, jobject oval, jfloat startAngle, jfloat sweepAngle, jboolean forceMoveTo) {
+ SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
SkRect oval_;
GraphicsJNI::jrectf_to_rect(env, oval, &oval_);
SkScalar startAngle_ = SkFloatToScalar(startAngle);
@@ -162,17 +184,22 @@
obj->arcTo(oval_, startAngle_, sweepAngle_, forceMoveTo);
}
- static void close(JNIEnv* env, jobject clazz, SkPath* obj) {
+ static void close(JNIEnv* env, jobject clazz, jlong objHandle) {
+ SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
obj->close();
}
- static void addRect__RectFI(JNIEnv* env, jobject clazz, SkPath* obj, jobject rect, SkPath::Direction dir) {
+ static void addRect__RectFI(JNIEnv* env, jobject clazz, jlong objHandle, jobject rect, jint dirHandle) {
SkRect rect_;
+ SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
+ SkPath::Direction dir = static_cast<SkPath::Direction>(dirHandle);
GraphicsJNI::jrectf_to_rect(env, rect, &rect_);
obj->addRect(rect_, dir);
}
- static void addRect__FFFFI(JNIEnv* env, jobject clazz, SkPath* obj, jfloat left, jfloat top, jfloat right, jfloat bottom, SkPath::Direction dir) {
+ static void addRect__FFFFI(JNIEnv* env, jobject clazz, jlong objHandle, jfloat left, jfloat top, jfloat right, jfloat bottom, jint dirHandle) {
+ SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
+ SkPath::Direction dir = static_cast<SkPath::Direction>(dirHandle);
SkScalar left_ = SkFloatToScalar(left);
SkScalar top_ = SkFloatToScalar(top);
SkScalar right_ = SkFloatToScalar(right);
@@ -180,39 +207,48 @@
obj->addRect(left_, top_, right_, bottom_, dir);
}
- static void addOval(JNIEnv* env, jobject clazz, SkPath* obj, jobject oval, SkPath::Direction dir) {
+ static void addOval(JNIEnv* env, jobject clazz, jlong objHandle, jobject oval, jint dirHandle) {
+ SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
+ SkPath::Direction dir = static_cast<SkPath::Direction>(dirHandle);
SkRect oval_;
GraphicsJNI::jrectf_to_rect(env, oval, &oval_);
obj->addOval(oval_, dir);
}
- static void addCircle(JNIEnv* env, jobject clazz, SkPath* obj, jfloat x, jfloat y, jfloat radius, SkPath::Direction dir) {
+ static void addCircle(JNIEnv* env, jobject clazz, jlong objHandle, jfloat x, jfloat y, jfloat radius, jint dirHandle) {
+ SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
+ SkPath::Direction dir = static_cast<SkPath::Direction>(dirHandle);
SkScalar x_ = SkFloatToScalar(x);
SkScalar y_ = SkFloatToScalar(y);
SkScalar radius_ = SkFloatToScalar(radius);
obj->addCircle(x_, y_, radius_, dir);
}
- static void addArc(JNIEnv* env, jobject clazz, SkPath* obj, jobject oval, jfloat startAngle, jfloat sweepAngle) {
+ static void addArc(JNIEnv* env, jobject clazz, jlong objHandle, jobject oval, jfloat startAngle, jfloat sweepAngle) {
SkRect oval_;
+ SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
GraphicsJNI::jrectf_to_rect(env, oval, &oval_);
SkScalar startAngle_ = SkFloatToScalar(startAngle);
SkScalar sweepAngle_ = SkFloatToScalar(sweepAngle);
obj->addArc(oval_, startAngle_, sweepAngle_);
}
- static void addRoundRectXY(JNIEnv* env, jobject clazz, SkPath* obj, jobject rect,
- jfloat rx, jfloat ry, SkPath::Direction dir) {
+ static void addRoundRectXY(JNIEnv* env, jobject clazz, jlong objHandle, jobject rect,
+ jfloat rx, jfloat ry, jint dirHandle) {
SkRect rect_;
+ SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
+ SkPath::Direction dir = static_cast<SkPath::Direction>(dirHandle);
GraphicsJNI::jrectf_to_rect(env, rect, &rect_);
SkScalar rx_ = SkFloatToScalar(rx);
SkScalar ry_ = SkFloatToScalar(ry);
obj->addRoundRect(rect_, rx_, ry_, dir);
}
- static void addRoundRect8(JNIEnv* env, jobject, SkPath* obj, jobject rect,
- jfloatArray array, SkPath::Direction dir) {
+ static void addRoundRect8(JNIEnv* env, jobject, jlong objHandle, jobject rect,
+ jfloatArray array, jint dirHandle) {
SkRect rect_;
+ SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
+ SkPath::Direction dir = static_cast<SkPath::Direction>(dirHandle);
GraphicsJNI::jrectf_to_rect(env, rect, &rect_);
AutoJavaFloatArray afa(env, array, 8);
const float* src = afa.ptr();
@@ -224,48 +260,68 @@
obj->addRoundRect(rect_, dst, dir);
}
- static void addPath__PathFF(JNIEnv* env, jobject clazz, SkPath* obj, SkPath* src, jfloat dx, jfloat dy) {
+ static void addPath__PathFF(JNIEnv* env, jobject clazz, jlong objHandle, jlong srcHandle, jfloat dx, jfloat dy) {
+ SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
+ SkPath* src = reinterpret_cast<SkPath*>(srcHandle);
SkScalar dx_ = SkFloatToScalar(dx);
SkScalar dy_ = SkFloatToScalar(dy);
obj->addPath(*src, dx_, dy_);
}
- static void addPath__Path(JNIEnv* env, jobject clazz, SkPath* obj, SkPath* src) {
+ static void addPath__Path(JNIEnv* env, jobject clazz, jlong objHandle, jlong srcHandle) {
+ SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
+ SkPath* src = reinterpret_cast<SkPath*>(srcHandle);
obj->addPath(*src);
}
- static void addPath__PathMatrix(JNIEnv* env, jobject clazz, SkPath* obj, SkPath* src, SkMatrix* matrix) {
+ static void addPath__PathMatrix(JNIEnv* env, jobject clazz, jlong objHandle, jlong srcHandle, jlong matrixHandle) {
+ SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
+ SkPath* src = reinterpret_cast<SkPath*>(srcHandle);
+ SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixHandle);
obj->addPath(*src, *matrix);
}
- static void offset__FFPath(JNIEnv* env, jobject clazz, SkPath* obj, jfloat dx, jfloat dy, SkPath* dst) {
+ static void offset__FFPath(JNIEnv* env, jobject clazz, jlong objHandle, jfloat dx, jfloat dy, jlong dstHandle) {
+ SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
+ SkPath* dst = reinterpret_cast<SkPath*>(dstHandle);
SkScalar dx_ = SkFloatToScalar(dx);
SkScalar dy_ = SkFloatToScalar(dy);
obj->offset(dx_, dy_, dst);
}
- static void offset__FF(JNIEnv* env, jobject clazz, SkPath* obj, jfloat dx, jfloat dy) {
+ static void offset__FF(JNIEnv* env, jobject clazz, jlong objHandle, jfloat dx, jfloat dy) {
+ SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
SkScalar dx_ = SkFloatToScalar(dx);
SkScalar dy_ = SkFloatToScalar(dy);
obj->offset(dx_, dy_);
}
- static void setLastPoint(JNIEnv* env, jobject clazz, SkPath* obj, jfloat dx, jfloat dy) {
+ static void setLastPoint(JNIEnv* env, jobject clazz, jlong objHandle, jfloat dx, jfloat dy) {
+ SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
SkScalar dx_ = SkFloatToScalar(dx);
SkScalar dy_ = SkFloatToScalar(dy);
obj->setLastPt(dx_, dy_);
}
- static void transform__MatrixPath(JNIEnv* env, jobject clazz, SkPath* obj, SkMatrix* matrix, SkPath* dst) {
+ static void transform__MatrixPath(JNIEnv* env, jobject clazz, jlong objHandle, jlong matrixHandle, jlong dstHandle) {
+ SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
+ SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixHandle);
+ SkPath* dst = reinterpret_cast<SkPath*>(dstHandle);
obj->transform(*matrix, dst);
}
- static void transform__Matrix(JNIEnv* env, jobject clazz, SkPath* obj, SkMatrix* matrix) {
+ static void transform__Matrix(JNIEnv* env, jobject clazz, jlong objHandle, jlong matrixHandle) {
+ SkPath* obj = reinterpret_cast<SkPath*>(objHandle);
+ SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixHandle);
obj->transform(*matrix);
}
- static jboolean op(JNIEnv* env, jobject clazz, SkPath* p1, SkPath* p2, SkPathOp op, SkPath* r) {
- return Op(*p1, *p2, op, r);
+ static jboolean op(JNIEnv* env, jobject clazz, jlong p1Handle, jlong p2Handle, jint opHandle, jlong rHandle) {
+ SkPath* p1 = reinterpret_cast<SkPath*>(p1Handle);
+ SkPath* p2 = reinterpret_cast<SkPath*>(p2Handle);
+ SkPathOp op = static_cast<SkPathOp>(opHandle);
+ SkPath* r = reinterpret_cast<SkPath*>(rHandle);
+ return Op(*p1, *p2, op, r);
}
typedef SkPoint (*bezierCalculation)(float t, const SkPoint* points);
@@ -421,8 +477,9 @@
// Note that more than one point may have the same length along the path in
// the case of a move.
// NULL can be returned if the Path is empty.
- static jfloatArray approximate(JNIEnv* env, jclass, SkPath* path, float acceptableError)
+ static jfloatArray approximate(JNIEnv* env, jclass, jlong pathHandle, float acceptableError)
{
+ SkPath* path = reinterpret_cast<SkPath*>(pathHandle);
SkASSERT(path);
SkPath::Iter pathIter(*path, false);
SkPath::Verb verb;
@@ -459,8 +516,11 @@
return result;
}
- static SkPathMeasure* trim(JNIEnv* env, jobject clazz, SkPath* inPath, SkPath* outPath,
- SkPathMeasure* pathMeasure, jfloat trimStart, jfloat trimEnd, jfloat trimOffset) {
+ static SkPathMeasure* trim(JNIEnv* env, jobject clazz, jlong inPathPtr, jlong outPathPtr,
+ jlong pathMeasurePtr, jfloat trimStart, jfloat trimEnd, jfloat trimOffset) {
+ SkPath* inPath = reinterpret_cast<SkPath*>(inPathPtr);
+ SkPath* outPath = reinterpret_cast<SkPath*>(outPathPtr);
+ SkPathMeasure* pathMeasure = reinterpret_cast<SkPathMeasure*>(pathMeasurePtr);
if (trimStart == 0 && trimEnd == 1) {
if (outPath != NULL) {
*outPath = *inPath;
@@ -500,53 +560,53 @@
return pathMeasure;
}
- static void destroyMeasure(JNIEnv* env, jobject clazz, SkPathMeasure* measure) {
- delete measure;
+ static void destroyMeasure(JNIEnv* env, jobject clazz, jlong measure) {
+ delete reinterpret_cast<SkPathMeasure*>(measure);
}
};
static JNINativeMethod methods[] = {
- {"finalizer", "(I)V", (void*) SkPathGlue::finalizer},
- {"init1","()I", (void*) SkPathGlue::init1},
- {"init2","(I)I", (void*) SkPathGlue::init2},
- {"native_reset","(I)V", (void*) SkPathGlue::reset},
- {"native_rewind","(I)V", (void*) SkPathGlue::rewind},
- {"native_set","(II)V", (void*) SkPathGlue::assign},
- {"native_getFillType","(I)I", (void*) SkPathGlue::getFillType},
- {"native_setFillType","(II)V", (void*) SkPathGlue::setFillType},
- {"native_isEmpty","(I)Z", (void*) SkPathGlue::isEmpty},
- {"native_isRect","(ILandroid/graphics/RectF;)Z", (void*) SkPathGlue::isRect},
- {"native_computeBounds","(ILandroid/graphics/RectF;)V", (void*) SkPathGlue::computeBounds},
- {"native_incReserve","(II)V", (void*) SkPathGlue::incReserve},
- {"native_moveTo","(IFF)V", (void*) SkPathGlue::moveTo__FF},
- {"native_rMoveTo","(IFF)V", (void*) SkPathGlue::rMoveTo},
- {"native_lineTo","(IFF)V", (void*) SkPathGlue::lineTo__FF},
- {"native_rLineTo","(IFF)V", (void*) SkPathGlue::rLineTo},
- {"native_quadTo","(IFFFF)V", (void*) SkPathGlue::quadTo__FFFF},
- {"native_rQuadTo","(IFFFF)V", (void*) SkPathGlue::rQuadTo},
- {"native_cubicTo","(IFFFFFF)V", (void*) SkPathGlue::cubicTo__FFFFFF},
- {"native_rCubicTo","(IFFFFFF)V", (void*) SkPathGlue::rCubicTo},
- {"native_arcTo","(ILandroid/graphics/RectF;FFZ)V", (void*) SkPathGlue::arcTo},
- {"native_close","(I)V", (void*) SkPathGlue::close},
- {"native_addRect","(ILandroid/graphics/RectF;I)V", (void*) SkPathGlue::addRect__RectFI},
- {"native_addRect","(IFFFFI)V", (void*) SkPathGlue::addRect__FFFFI},
- {"native_addOval","(ILandroid/graphics/RectF;I)V", (void*) SkPathGlue::addOval},
- {"native_addCircle","(IFFFI)V", (void*) SkPathGlue::addCircle},
- {"native_addArc","(ILandroid/graphics/RectF;FF)V", (void*) SkPathGlue::addArc},
- {"native_addRoundRect","(ILandroid/graphics/RectF;FFI)V", (void*) SkPathGlue::addRoundRectXY},
- {"native_addRoundRect","(ILandroid/graphics/RectF;[FI)V", (void*) SkPathGlue::addRoundRect8},
- {"native_addPath","(IIFF)V", (void*) SkPathGlue::addPath__PathFF},
- {"native_addPath","(II)V", (void*) SkPathGlue::addPath__Path},
- {"native_addPath","(III)V", (void*) SkPathGlue::addPath__PathMatrix},
- {"native_offset","(IFFI)V", (void*) SkPathGlue::offset__FFPath},
- {"native_offset","(IFF)V", (void*) SkPathGlue::offset__FF},
- {"native_setLastPoint","(IFF)V", (void*) SkPathGlue::setLastPoint},
- {"native_transform","(III)V", (void*) SkPathGlue::transform__MatrixPath},
- {"native_transform","(II)V", (void*) SkPathGlue::transform__Matrix},
- {"native_op","(IIII)Z", (void*) SkPathGlue::op},
- {"native_approximate", "(IF)[F", (void*) SkPathGlue::approximate},
- {"native_destroyMeasure","(I)V", (void*) SkPathGlue::destroyMeasure},
- {"native_trim","(IIIFFF)I", (void*) SkPathGlue::trim},
+ {"finalizer", "(J)V", (void*) SkPathGlue::finalizer},
+ {"init1","()J", (void*) SkPathGlue::init1},
+ {"init2","(J)J", (void*) SkPathGlue::init2},
+ {"native_reset","(J)V", (void*) SkPathGlue::reset},
+ {"native_rewind","(J)V", (void*) SkPathGlue::rewind},
+ {"native_set","(JJ)V", (void*) SkPathGlue::assign},
+ {"native_getFillType","(J)I", (void*) SkPathGlue::getFillType},
+ {"native_setFillType","(JI)V", (void*) SkPathGlue::setFillType},
+ {"native_isEmpty","(J)Z", (void*) SkPathGlue::isEmpty},
+ {"native_isRect","(JLandroid/graphics/RectF;)Z", (void*) SkPathGlue::isRect},
+ {"native_computeBounds","(JLandroid/graphics/RectF;)V", (void*) SkPathGlue::computeBounds},
+ {"native_incReserve","(JI)V", (void*) SkPathGlue::incReserve},
+ {"native_moveTo","(JFF)V", (void*) SkPathGlue::moveTo__FF},
+ {"native_rMoveTo","(JFF)V", (void*) SkPathGlue::rMoveTo},
+ {"native_lineTo","(JFF)V", (void*) SkPathGlue::lineTo__FF},
+ {"native_rLineTo","(JFF)V", (void*) SkPathGlue::rLineTo},
+ {"native_quadTo","(JFFFF)V", (void*) SkPathGlue::quadTo__FFFF},
+ {"native_rQuadTo","(JFFFF)V", (void*) SkPathGlue::rQuadTo},
+ {"native_cubicTo","(JFFFFFF)V", (void*) SkPathGlue::cubicTo__FFFFFF},
+ {"native_rCubicTo","(JFFFFFF)V", (void*) SkPathGlue::rCubicTo},
+ {"native_arcTo","(JLandroid/graphics/RectF;FFZ)V", (void*) SkPathGlue::arcTo},
+ {"native_close","(J)V", (void*) SkPathGlue::close},
+ {"native_addRect","(JLandroid/graphics/RectF;I)V", (void*) SkPathGlue::addRect__RectFI},
+ {"native_addRect","(JFFFFI)V", (void*) SkPathGlue::addRect__FFFFI},
+ {"native_addOval","(JLandroid/graphics/RectF;I)V", (void*) SkPathGlue::addOval},
+ {"native_addCircle","(JFFFI)V", (void*) SkPathGlue::addCircle},
+ {"native_addArc","(JLandroid/graphics/RectF;FF)V", (void*) SkPathGlue::addArc},
+ {"native_addRoundRect","(JLandroid/graphics/RectF;FFI)V", (void*) SkPathGlue::addRoundRectXY},
+ {"native_addRoundRect","(JLandroid/graphics/RectF;[FI)V", (void*) SkPathGlue::addRoundRect8},
+ {"native_addPath","(JJFF)V", (void*) SkPathGlue::addPath__PathFF},
+ {"native_addPath","(JJ)V", (void*) SkPathGlue::addPath__Path},
+ {"native_addPath","(JJJ)V", (void*) SkPathGlue::addPath__PathMatrix},
+ {"native_offset","(JFFJ)V", (void*) SkPathGlue::offset__FFPath},
+ {"native_offset","(JFF)V", (void*) SkPathGlue::offset__FF},
+ {"native_setLastPoint","(JFF)V", (void*) SkPathGlue::setLastPoint},
+ {"native_transform","(JJJ)V", (void*) SkPathGlue::transform__MatrixPath},
+ {"native_transform","(JJ)V", (void*) SkPathGlue::transform__Matrix},
+ {"native_op","(JJIJ)Z", (void*) SkPathGlue::op},
+ {"native_approximate", "(JF)[F", (void*) SkPathGlue::approximate},
+ {"native_destroyMeasure","(J)V", (void*) SkPathGlue::destroyMeasure},
+ {"native_trim","(JJJFFF)I", (void*) SkPathGlue::trim},
};
int register_android_graphics_Path(JNIEnv* env) {
diff --git a/core/jni/android/graphics/PathEffect.cpp b/core/jni/android/graphics/PathEffect.cpp
index 0503614..2803758 100644
--- a/core/jni/android/graphics/PathEffect.cpp
+++ b/core/jni/android/graphics/PathEffect.cpp
@@ -11,22 +11,29 @@
class SkPathEffectGlue {
public:
- static void destructor(JNIEnv* env, jobject, SkPathEffect* effect) {
+ static void destructor(JNIEnv* env, jobject, jlong effectHandle) {
+ SkPathEffect* effect = reinterpret_cast<SkPathEffect*>(effectHandle);
SkSafeUnref(effect);
}
- static SkPathEffect* Compose_constructor(JNIEnv* env, jobject,
- SkPathEffect* outer, SkPathEffect* inner) {
- return new SkComposePathEffect(outer, inner);
+ static jlong Compose_constructor(JNIEnv* env, jobject,
+ jlong outerHandle, jlong innerHandle) {
+ SkPathEffect* outer = reinterpret_cast<SkPathEffect*>(outerHandle);
+ SkPathEffect* inner = reinterpret_cast<SkPathEffect*>(innerHandle);
+ SkPathEffect* effect = new SkComposePathEffect(outer, inner);
+ return reinterpret_cast<jlong>(effect);
}
- static SkPathEffect* Sum_constructor(JNIEnv* env, jobject,
- SkPathEffect* first, SkPathEffect* second) {
- return new SkSumPathEffect(first, second);
+ static jlong Sum_constructor(JNIEnv* env, jobject,
+ jlong firstHandle, jlong secondHandle) {
+ SkPathEffect* first = reinterpret_cast<SkPathEffect*>(firstHandle);
+ SkPathEffect* second = reinterpret_cast<SkPathEffect*>(secondHandle);
+ SkPathEffect* effect = new SkSumPathEffect(first, second);
+ return reinterpret_cast<jlong>(effect);
}
- static SkPathEffect* Dash_constructor(JNIEnv* env, jobject,
- jfloatArray intervalArray, float phase) {
+ static jlong Dash_constructor(JNIEnv* env, jobject,
+ jfloatArray intervalArray, jfloat phase) {
AutoJavaFloatArray autoInterval(env, intervalArray);
int count = autoInterval.length() & ~1; // even number
float* values = autoInterval.ptr();
@@ -36,24 +43,29 @@
for (int i = 0; i < count; i++) {
intervals[i] = SkFloatToScalar(values[i]);
}
- return new SkDashPathEffect(intervals, count, SkFloatToScalar(phase));
+ SkPathEffect* effect = new SkDashPathEffect(intervals, count, SkFloatToScalar(phase));
+ return reinterpret_cast<jlong>(effect);
}
- static SkPathEffect* OneD_constructor(JNIEnv* env, jobject,
- const SkPath* shape, float advance, float phase, int style) {
+ static jlong OneD_constructor(JNIEnv* env, jobject,
+ jlong shapeHandle, jfloat advance, jfloat phase, jint style) {
+ const SkPath* shape = reinterpret_cast<SkPath*>(shapeHandle);
SkASSERT(shape != NULL);
- return new SkPath1DPathEffect(*shape, SkFloatToScalar(advance),
+ SkPathEffect* effect = new SkPath1DPathEffect(*shape, SkFloatToScalar(advance),
SkFloatToScalar(phase), (SkPath1DPathEffect::Style)style);
+ return reinterpret_cast<jlong>(effect);
}
- static SkPathEffect* Corner_constructor(JNIEnv* env, jobject, float radius){
- return new SkCornerPathEffect(SkFloatToScalar(radius));
+ static jlong Corner_constructor(JNIEnv* env, jobject, jfloat radius){
+ SkPathEffect* effect = new SkCornerPathEffect(SkFloatToScalar(radius));
+ return reinterpret_cast<jlong>(effect);
}
- static SkPathEffect* Discrete_constructor(JNIEnv* env, jobject,
- float length, float deviation) {
- return new SkDiscretePathEffect(SkFloatToScalar(length),
+ static jlong Discrete_constructor(JNIEnv* env, jobject,
+ jfloat length, jfloat deviation) {
+ SkPathEffect* effect = new SkDiscretePathEffect(SkFloatToScalar(length),
SkFloatToScalar(deviation));
+ return reinterpret_cast<jlong>(effect);
}
};
@@ -61,31 +73,31 @@
////////////////////////////////////////////////////////////////////////////////////////////////////////
static JNINativeMethod gPathEffectMethods[] = {
- { "nativeDestructor", "(I)V", (void*)SkPathEffectGlue::destructor }
+ { "nativeDestructor", "(J)V", (void*)SkPathEffectGlue::destructor }
};
static JNINativeMethod gComposePathEffectMethods[] = {
- { "nativeCreate", "(II)I", (void*)SkPathEffectGlue::Compose_constructor }
+ { "nativeCreate", "(JJ)J", (void*)SkPathEffectGlue::Compose_constructor }
};
static JNINativeMethod gSumPathEffectMethods[] = {
- { "nativeCreate", "(II)I", (void*)SkPathEffectGlue::Sum_constructor }
+ { "nativeCreate", "(JJ)J", (void*)SkPathEffectGlue::Sum_constructor }
};
static JNINativeMethod gDashPathEffectMethods[] = {
- { "nativeCreate", "([FF)I", (void*)SkPathEffectGlue::Dash_constructor }
+ { "nativeCreate", "([FF)J", (void*)SkPathEffectGlue::Dash_constructor }
};
static JNINativeMethod gPathDashPathEffectMethods[] = {
- { "nativeCreate", "(IFFI)I", (void*)SkPathEffectGlue::OneD_constructor }
+ { "nativeCreate", "(JFFI)J", (void*)SkPathEffectGlue::OneD_constructor }
};
static JNINativeMethod gCornerPathEffectMethods[] = {
- { "nativeCreate", "(F)I", (void*)SkPathEffectGlue::Corner_constructor }
+ { "nativeCreate", "(F)J", (void*)SkPathEffectGlue::Corner_constructor }
};
static JNINativeMethod gDiscretePathEffectMethods[] = {
- { "nativeCreate", "(FF)I", (void*)SkPathEffectGlue::Discrete_constructor }
+ { "nativeCreate", "(FF)J", (void*)SkPathEffectGlue::Discrete_constructor }
};
#include <android_runtime/AndroidRuntime.h>
diff --git a/core/jni/android/graphics/Picture.cpp b/core/jni/android/graphics/Picture.cpp
index fcf22b8..bac8ef7 100644
--- a/core/jni/android/graphics/Picture.cpp
+++ b/core/jni/android/graphics/Picture.cpp
@@ -28,71 +28,80 @@
class SkPictureGlue {
public:
- static SkPicture* newPicture(JNIEnv* env, jobject, const SkPicture* src) {
+ static jlong newPicture(JNIEnv* env, jobject, jlong srcHandle) {
+ const SkPicture* src = reinterpret_cast<SkPicture*>(srcHandle);
if (src) {
- return new SkPicture(*src);
+ return reinterpret_cast<jlong>(new SkPicture(*src));
} else {
- return new SkPicture;
+ return reinterpret_cast<jlong>(new SkPicture);
}
}
-
- static SkPicture* deserialize(JNIEnv* env, jobject, jobject jstream,
- jbyteArray jstorage) {
+
+ static jlong deserialize(JNIEnv* env, jobject, jobject jstream,
+ jbyteArray jstorage) {
SkPicture* picture = NULL;
SkStream* strm = CreateJavaInputStreamAdaptor(env, jstream, jstorage);
if (strm) {
picture = SkPicture::CreateFromStream(strm);
delete strm;
}
- return picture;
+ return reinterpret_cast<jlong>(picture);
}
-
- static void killPicture(JNIEnv* env, jobject, SkPicture* picture) {
+
+ static void killPicture(JNIEnv* env, jobject, jlong pictureHandle) {
+ SkPicture* picture = reinterpret_cast<SkPicture*>(pictureHandle);
SkASSERT(picture);
picture->unref();
}
-
- static void draw(JNIEnv* env, jobject, SkCanvas* canvas,
- SkPicture* picture) {
+
+ static void draw(JNIEnv* env, jobject, jlong canvasHandle,
+ jlong pictureHandle) {
+ SkCanvas* canvas = reinterpret_cast<SkCanvas*>(canvasHandle);
+ SkPicture* picture = reinterpret_cast<SkPicture*>(pictureHandle);
SkASSERT(canvas);
SkASSERT(picture);
picture->draw(canvas);
}
-
- static bool serialize(JNIEnv* env, jobject, SkPicture* picture,
+
+ static jboolean serialize(JNIEnv* env, jobject, jlong pictureHandle,
jobject jstream, jbyteArray jstorage) {
+ SkPicture* picture = reinterpret_cast<SkPicture*>(pictureHandle);
SkWStream* strm = CreateJavaOutputStreamAdaptor(env, jstream, jstorage);
if (NULL != strm) {
picture->serialize(strm);
delete strm;
- return true;
+ return JNI_TRUE;
}
- return false;
+ return JNI_FALSE;
}
-
- static int getWidth(JNIEnv* env, jobject jpic) {
+
+ static jint getWidth(JNIEnv* env, jobject jpic) {
NPE_CHECK_RETURN_ZERO(env, jpic);
- return GraphicsJNI::getNativePicture(env, jpic)->width();
+ int width = GraphicsJNI::getNativePicture(env, jpic)->width();
+ return static_cast<jint>(width);
}
-
- static int getHeight(JNIEnv* env, jobject jpic) {
+
+ static jint getHeight(JNIEnv* env, jobject jpic) {
NPE_CHECK_RETURN_ZERO(env, jpic);
- return GraphicsJNI::getNativePicture(env, jpic)->height();
+ int height = GraphicsJNI::getNativePicture(env, jpic)->height();
+ return static_cast<jint>(height);
}
-
- static SkCanvas* beginRecording(JNIEnv* env, jobject, SkPicture* pict,
- int w, int h) {
+
+ static jlong beginRecording(JNIEnv* env, jobject, jlong pictHandle,
+ jint w, jint h) {
+ SkPicture* pict = reinterpret_cast<SkPicture*>(pictHandle);
// beginRecording does not ref its return value, it just returns it.
SkCanvas* canvas = pict->beginRecording(w, h);
// the java side will wrap this guy in a Canvas.java, which will call
// unref in its finalizer, so we have to ref it here, so that both that
// Canvas.java and our picture can both be owners
canvas->ref();
- return canvas;
+ return reinterpret_cast<jlong>(canvas);
}
-
- static void endRecording(JNIEnv* env, jobject, SkPicture* pict) {
+
+ static void endRecording(JNIEnv* env, jobject, jlong pictHandle) {
+ SkPicture* pict = reinterpret_cast<SkPicture*>(pictHandle);
pict->endRecording();
}
};
@@ -100,30 +109,30 @@
static JNINativeMethod gPictureMethods[] = {
{"getWidth", "()I", (void*) SkPictureGlue::getWidth},
{"getHeight", "()I", (void*) SkPictureGlue::getHeight},
- {"nativeConstructor", "(I)I", (void*) SkPictureGlue::newPicture},
- {"nativeCreateFromStream", "(Ljava/io/InputStream;[B)I", (void*)SkPictureGlue::deserialize},
- {"nativeBeginRecording", "(III)I", (void*) SkPictureGlue::beginRecording},
- {"nativeEndRecording", "(I)V", (void*) SkPictureGlue::endRecording},
- {"nativeDraw", "(II)V", (void*) SkPictureGlue::draw},
- {"nativeWriteToStream", "(ILjava/io/OutputStream;[B)Z", (void*)SkPictureGlue::serialize},
- {"nativeDestructor","(I)V", (void*) SkPictureGlue::killPicture}
+ {"nativeConstructor", "(J)J", (void*) SkPictureGlue::newPicture},
+ {"nativeCreateFromStream", "(Ljava/io/InputStream;[B)J", (void*)SkPictureGlue::deserialize},
+ {"nativeBeginRecording", "(JII)J", (void*) SkPictureGlue::beginRecording},
+ {"nativeEndRecording", "(J)V", (void*) SkPictureGlue::endRecording},
+ {"nativeDraw", "(JJ)V", (void*) SkPictureGlue::draw},
+ {"nativeWriteToStream", "(JLjava/io/OutputStream;[B)Z", (void*)SkPictureGlue::serialize},
+ {"nativeDestructor","(J)V", (void*) SkPictureGlue::killPicture}
};
#include <android_runtime/AndroidRuntime.h>
-
+
#define REG(env, name, array) \
result = android::AndroidRuntime::registerNativeMethods(env, name, array, \
SK_ARRAY_COUNT(array)); \
if (result < 0) return result
-
+
int register_android_graphics_Picture(JNIEnv* env) {
int result;
-
+
REG(env, "android/graphics/Picture", gPictureMethods);
-
+
return result;
}
-
+
}
diff --git a/core/jni/android/graphics/PorterDuff.cpp b/core/jni/android/graphics/PorterDuff.cpp
index 47de601..8a49eb5 100644
--- a/core/jni/android/graphics/PorterDuff.cpp
+++ b/core/jni/android/graphics/PorterDuff.cpp
@@ -31,15 +31,15 @@
class SkPorterDuffGlue {
public:
- static SkXfermode* CreateXfermode(JNIEnv* env, jobject,
- SkPorterDuff::Mode mode) {
- return SkPorterDuff::CreateXfermode(mode);
+ static jlong CreateXfermode(JNIEnv* env, jobject, jint modeHandle) {
+ SkPorterDuff::Mode mode = static_cast<SkPorterDuff::Mode>(modeHandle);
+ return reinterpret_cast<jlong>(SkPorterDuff::CreateXfermode(mode));
}
};
static JNINativeMethod methods[] = {
- {"nativeCreateXfermode","(I)I", (void*) SkPorterDuffGlue::CreateXfermode},
+ {"nativeCreateXfermode","(I)J", (void*) SkPorterDuffGlue::CreateXfermode},
};
int register_android_graphics_PorterDuff(JNIEnv* env) {
diff --git a/core/jni/android/graphics/Rasterizer.cpp b/core/jni/android/graphics/Rasterizer.cpp
index 4e1b36a..b6450d0 100644
--- a/core/jni/android/graphics/Rasterizer.cpp
+++ b/core/jni/android/graphics/Rasterizer.cpp
@@ -31,14 +31,15 @@
class SkRasterizerGlue {
public:
- static void finalizer(JNIEnv* env, jobject clazz, SkRasterizer* obj) {
+ static void finalizer(JNIEnv* env, jobject clazz, jlong objHandle) {
+ SkRasterizer* obj = reinterpret_cast<SkRasterizer *>(objHandle);
SkSafeUnref(obj);
}
};
static JNINativeMethod methods[] = {
- {"finalizer", "(I)V", (void*) SkRasterizerGlue::finalizer}
+ {"finalizer", "(J)V", (void*) SkRasterizerGlue::finalizer}
};
int register_android_graphics_Rasterizer(JNIEnv* env) {
diff --git a/core/jni/android/graphics/Region.cpp b/core/jni/android/graphics/Region.cpp
index ded2186..bcf1273 100644
--- a/core/jni/android/graphics/Region.cpp
+++ b/core/jni/android/graphics/Region.cpp
@@ -29,95 +29,131 @@
static jfieldID gRegion_nativeInstanceFieldID;
+static inline jboolean boolTojboolean(bool value) {
+ return value ? JNI_TRUE : JNI_FALSE;
+}
+
static inline SkRegion* GetSkRegion(JNIEnv* env, jobject regionObject) {
- SkRegion* rgn = (SkRegion*)env->GetIntField(regionObject, gRegion_nativeInstanceFieldID);
- SkASSERT(rgn != NULL);
- return rgn;
+ jlong regionHandle = env->GetLongField(regionObject, gRegion_nativeInstanceFieldID);
+ SkRegion* region = reinterpret_cast<SkRegion*>(regionHandle);
+ SkASSERT(region != NULL);
+ return region;
}
-static SkRegion* Region_constructor(JNIEnv* env, jobject) {
- return new SkRegion;
+static jlong Region_constructor(JNIEnv* env, jobject) {
+ return reinterpret_cast<jlong>(new SkRegion);
}
-static void Region_destructor(JNIEnv* env, jobject, SkRegion* region) {
+static void Region_destructor(JNIEnv* env, jobject, jlong regionHandle) {
+ SkRegion* region = reinterpret_cast<SkRegion*>(regionHandle);
SkASSERT(region);
delete region;
}
-static void Region_setRegion(JNIEnv* env, jobject, SkRegion* dst, const SkRegion* src) {
+static void Region_setRegion(JNIEnv* env, jobject, jlong dstHandle, jlong srcHandle) {
+ SkRegion* dst = reinterpret_cast<SkRegion*>(dstHandle);
+ const SkRegion* src = reinterpret_cast<SkRegion*>(srcHandle);
SkASSERT(dst && src);
*dst = *src;
}
-static jboolean Region_setRect(JNIEnv* env, jobject, SkRegion* dst, int left, int top, int right, int bottom) {
- return dst->setRect(left, top, right, bottom);
+static jboolean Region_setRect(JNIEnv* env, jobject, jlong dstHandle, jint left, jint top, jint right, jint bottom) {
+ SkRegion* dst = reinterpret_cast<SkRegion*>(dstHandle);
+ bool result = dst->setRect(left, top, right, bottom);
+ return boolTojboolean(result);
}
-static jboolean Region_setPath(JNIEnv* env, jobject, SkRegion* dst,
- const SkPath* path, const SkRegion* clip) {
+static jboolean Region_setPath(JNIEnv* env, jobject, jlong dstHandle,
+ jlong pathHandle, jlong clipHandle) {
+ SkRegion* dst = reinterpret_cast<SkRegion*>(dstHandle);
+ const SkPath* path = reinterpret_cast<SkPath*>(pathHandle);
+ const SkRegion* clip = reinterpret_cast<SkRegion*>(clipHandle);
SkASSERT(dst && path && clip);
- return dst->setPath(*path, *clip);
+ bool result = dst->setPath(*path, *clip);
+ return boolTojboolean(result);
+
}
-static jboolean Region_getBounds(JNIEnv* env, jobject, SkRegion* region, jobject rectBounds) {
+static jboolean Region_getBounds(JNIEnv* env, jobject, jlong regionHandle, jobject rectBounds) {
+ SkRegion* region = reinterpret_cast<SkRegion*>(regionHandle);
GraphicsJNI::irect_to_jrect(region->getBounds(), env, rectBounds);
- return !region->isEmpty();
+ bool result = !region->isEmpty();
+ return boolTojboolean(result);
}
-static jboolean Region_getBoundaryPath(JNIEnv* env, jobject, const SkRegion* region, SkPath* path) {
- return region->getBoundaryPath(path);
+static jboolean Region_getBoundaryPath(JNIEnv* env, jobject, jlong regionHandle, jlong pathHandle) {
+ const SkRegion* region = reinterpret_cast<SkRegion*>(regionHandle);
+ SkPath* path = reinterpret_cast<SkPath*>(pathHandle);
+ bool result = region->getBoundaryPath(path);
+ return boolTojboolean(result);
}
-static jboolean Region_op0(JNIEnv* env, jobject, SkRegion* dst, int left, int top, int right, int bottom, int op) {
+static jboolean Region_op0(JNIEnv* env, jobject, jlong dstHandle, jint left, jint top, jint right, jint bottom, jint op) {
+ SkRegion* dst = reinterpret_cast<SkRegion*>(dstHandle);
SkIRect ir;
ir.set(left, top, right, bottom);
- return dst->op(ir, (SkRegion::Op)op);
+ bool result = dst->op(ir, (SkRegion::Op)op);
+ return boolTojboolean(result);
}
-static jboolean Region_op1(JNIEnv* env, jobject, SkRegion* dst, jobject rectObject, const SkRegion* region, int op) {
+static jboolean Region_op1(JNIEnv* env, jobject, jlong dstHandle, jobject rectObject, jlong regionHandle, jint op) {
+ SkRegion* dst = reinterpret_cast<SkRegion*>(dstHandle);
+ const SkRegion* region = reinterpret_cast<SkRegion*>(regionHandle);
SkIRect ir;
GraphicsJNI::jrect_to_irect(env, rectObject, &ir);
- return dst->op(ir, *region, (SkRegion::Op)op);
+ bool result = dst->op(ir, *region, (SkRegion::Op)op);
+ return boolTojboolean(result);
}
-static jboolean Region_op2(JNIEnv* env, jobject, SkRegion* dst, const SkRegion* region1, const SkRegion* region2, int op) {
- return dst->op(*region1, *region2, (SkRegion::Op)op);
+static jboolean Region_op2(JNIEnv* env, jobject, jlong dstHandle, jlong region1Handle, jlong region2Handle, jint op) {
+ SkRegion* dst = reinterpret_cast<SkRegion*>(dstHandle);
+ const SkRegion* region1 = reinterpret_cast<SkRegion*>(region1Handle);
+ const SkRegion* region2 = reinterpret_cast<SkRegion*>(region2Handle);
+ bool result = dst->op(*region1, *region2, (SkRegion::Op)op);
+ return boolTojboolean(result);
}
//////////////////////////////////// These are methods, not static
static jboolean Region_isEmpty(JNIEnv* env, jobject region) {
- return GetSkRegion(env, region)->isEmpty();
+ bool result = GetSkRegion(env, region)->isEmpty();
+ return boolTojboolean(result);
}
static jboolean Region_isRect(JNIEnv* env, jobject region) {
- return GetSkRegion(env, region)->isRect();
+ bool result = GetSkRegion(env, region)->isRect();
+ return boolTojboolean(result);
}
static jboolean Region_isComplex(JNIEnv* env, jobject region) {
- return GetSkRegion(env, region)->isComplex();
+ bool result = GetSkRegion(env, region)->isComplex();
+ return boolTojboolean(result);
}
-static jboolean Region_contains(JNIEnv* env, jobject region, int x, int y) {
- return GetSkRegion(env, region)->contains(x, y);
+static jboolean Region_contains(JNIEnv* env, jobject region, jint x, jint y) {
+ bool result = GetSkRegion(env, region)->contains(x, y);
+ return boolTojboolean(result);
}
-static jboolean Region_quickContains(JNIEnv* env, jobject region, int left, int top, int right, int bottom) {
- return GetSkRegion(env, region)->quickContains(left, top, right, bottom);
+static jboolean Region_quickContains(JNIEnv* env, jobject region, jint left, jint top, jint right, jint bottom) {
+ bool result = GetSkRegion(env, region)->quickContains(left, top, right, bottom);
+ return boolTojboolean(result);
}
-static jboolean Region_quickRejectIIII(JNIEnv* env, jobject region, int left, int top, int right, int bottom) {
+static jboolean Region_quickRejectIIII(JNIEnv* env, jobject region, jint left, jint top, jint right, jint bottom) {
SkIRect ir;
ir.set(left, top, right, bottom);
- return GetSkRegion(env, region)->quickReject(ir);
+ bool result = GetSkRegion(env, region)->quickReject(ir);
+ return boolTojboolean(result);
}
static jboolean Region_quickRejectRgn(JNIEnv* env, jobject region, jobject other) {
- return GetSkRegion(env, region)->quickReject(*GetSkRegion(env, other));
+ bool result = GetSkRegion(env, region)->quickReject(*GetSkRegion(env, other));
+ return boolTojboolean(result);
}
-static void Region_translate(JNIEnv* env, jobject region, int x, int y, jobject dst) {
+static void Region_translate(JNIEnv* env, jobject region, jint x, jint y, jobject dst) {
SkRegion* rgn = GetSkRegion(env, region);
if (dst)
rgn->translate(x, y, GetSkRegion(env, dst));
@@ -155,7 +191,8 @@
scale_rgn(rgn, *rgn, scale);
}
-static jstring Region_toString(JNIEnv* env, jobject clazz, SkRegion* region) {
+static jstring Region_toString(JNIEnv* env, jobject clazz, jlong regionHandle) {
+ SkRegion* region = reinterpret_cast<SkRegion*>(regionHandle);
char* str = region->toString();
if (str == NULL) {
return NULL;
@@ -167,7 +204,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////////////
-static SkRegion* Region_createFromParcel(JNIEnv* env, jobject clazz, jobject parcel)
+static jlong Region_createFromParcel(JNIEnv* env, jobject clazz, jobject parcel)
{
if (parcel == NULL) {
return NULL;
@@ -179,13 +216,14 @@
size_t size = p->readInt32();
region->readFromMemory(p->readInplace(size));
- return region;
+ return reinterpret_cast<jlong>(region);
}
-static jboolean Region_writeToParcel(JNIEnv* env, jobject clazz, const SkRegion* region, jobject parcel)
+static jboolean Region_writeToParcel(JNIEnv* env, jobject clazz, jlong regionHandle, jobject parcel)
{
+ const SkRegion* region = reinterpret_cast<SkRegion*>(regionHandle);
if (parcel == NULL) {
- return false;
+ return JNI_FALSE;
}
android::Parcel* p = android::parcelForJavaObject(env, parcel);
@@ -194,14 +232,16 @@
p->writeInt32(size);
region->writeToMemory(p->writeInplace(size));
- return true;
+ return JNI_TRUE;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////
-static jboolean Region_equals(JNIEnv* env, jobject clazz, const SkRegion *r1, const SkRegion* r2)
+static jboolean Region_equals(JNIEnv* env, jobject clazz, jlong r1Handle, jlong r2Handle)
{
- return (jboolean) (*r1 == *r2);
+ const SkRegion *r1 = reinterpret_cast<SkRegion*>(r1Handle);
+ const SkRegion *r2 = reinterpret_cast<SkRegion*>(r2Handle);
+ return boolTojboolean(*r1 == *r2);
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -217,20 +257,23 @@
}
};
-static RgnIterPair* RegionIter_constructor(JNIEnv* env, jobject, const SkRegion* region)
+static jlong RegionIter_constructor(JNIEnv* env, jobject, jlong regionHandle)
{
+ const SkRegion* region = reinterpret_cast<SkRegion*>(regionHandle);
SkASSERT(region);
- return new RgnIterPair(*region);
+ return reinterpret_cast<jlong>(new RgnIterPair(*region));
}
-static void RegionIter_destructor(JNIEnv* env, jobject, RgnIterPair* pair)
+static void RegionIter_destructor(JNIEnv* env, jobject, jlong pairHandle)
{
+ RgnIterPair* pair = reinterpret_cast<RgnIterPair*>(pairHandle);
SkASSERT(pair);
delete pair;
}
-static jboolean RegionIter_next(JNIEnv* env, jobject, RgnIterPair* pair, jobject rectObject)
+static jboolean RegionIter_next(JNIEnv* env, jobject, jlong pairHandle, jobject rectObject)
{
+ RgnIterPair* pair = reinterpret_cast<RgnIterPair*>(pairHandle);
// the caller has checked that rectObject is not nul
SkASSERT(pair);
SkASSERT(rectObject);
@@ -238,31 +281,31 @@
if (!pair->fIter.done()) {
GraphicsJNI::irect_to_jrect(pair->fIter.rect(), env, rectObject);
pair->fIter.next();
- return true;
+ return JNI_TRUE;
}
- return false;
+ return JNI_FALSE;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////
static JNINativeMethod gRegionIterMethods[] = {
- { "nativeConstructor", "(I)I", (void*)RegionIter_constructor },
- { "nativeDestructor", "(I)V", (void*)RegionIter_destructor },
- { "nativeNext", "(ILandroid/graphics/Rect;)Z", (void*)RegionIter_next }
+ { "nativeConstructor", "(J)J", (void*)RegionIter_constructor },
+ { "nativeDestructor", "(J)V", (void*)RegionIter_destructor },
+ { "nativeNext", "(JLandroid/graphics/Rect;)Z", (void*)RegionIter_next }
};
static JNINativeMethod gRegionMethods[] = {
// these are static methods
- { "nativeConstructor", "()I", (void*)Region_constructor },
- { "nativeDestructor", "(I)V", (void*)Region_destructor },
- { "nativeSetRegion", "(II)V", (void*)Region_setRegion },
- { "nativeSetRect", "(IIIII)Z", (void*)Region_setRect },
- { "nativeSetPath", "(III)Z", (void*)Region_setPath },
- { "nativeGetBounds", "(ILandroid/graphics/Rect;)Z", (void*)Region_getBounds },
- { "nativeGetBoundaryPath", "(II)Z", (void*)Region_getBoundaryPath },
- { "nativeOp", "(IIIIII)Z", (void*)Region_op0 },
- { "nativeOp", "(ILandroid/graphics/Rect;II)Z", (void*)Region_op1 },
- { "nativeOp", "(IIII)Z", (void*)Region_op2 },
+ { "nativeConstructor", "()J", (void*)Region_constructor },
+ { "nativeDestructor", "(J)V", (void*)Region_destructor },
+ { "nativeSetRegion", "(JJ)V", (void*)Region_setRegion },
+ { "nativeSetRect", "(JIIII)Z", (void*)Region_setRect },
+ { "nativeSetPath", "(JJJ)Z", (void*)Region_setPath },
+ { "nativeGetBounds", "(JLandroid/graphics/Rect;)Z", (void*)Region_getBounds },
+ { "nativeGetBoundaryPath", "(JJ)Z", (void*)Region_getBoundaryPath },
+ { "nativeOp", "(JIIIII)Z", (void*)Region_op0 },
+ { "nativeOp", "(JLandroid/graphics/Rect;JI)Z", (void*)Region_op1 },
+ { "nativeOp", "(JJJI)Z", (void*)Region_op2 },
// these are methods that take the java region object
{ "isEmpty", "()Z", (void*)Region_isEmpty },
{ "isRect", "()Z", (void*)Region_isRect },
@@ -273,11 +316,11 @@
{ "quickReject", "(Landroid/graphics/Region;)Z", (void*)Region_quickRejectRgn },
{ "scale", "(FLandroid/graphics/Region;)V", (void*)Region_scale },
{ "translate", "(IILandroid/graphics/Region;)V", (void*)Region_translate },
- { "nativeToString", "(I)Ljava/lang/String;", (void*)Region_toString },
+ { "nativeToString", "(J)Ljava/lang/String;", (void*)Region_toString },
// parceling methods
- { "nativeCreateFromParcel", "(Landroid/os/Parcel;)I", (void*)Region_createFromParcel },
- { "nativeWriteToParcel", "(ILandroid/os/Parcel;)Z", (void*)Region_writeToParcel },
- { "nativeEquals", "(II)Z", (void*)Region_equals },
+ { "nativeCreateFromParcel", "(Landroid/os/Parcel;)J", (void*)Region_createFromParcel },
+ { "nativeWriteToParcel", "(JLandroid/os/Parcel;)Z", (void*)Region_writeToParcel },
+ { "nativeEquals", "(JJ)Z", (void*)Region_equals },
};
int register_android_graphics_Region(JNIEnv* env)
@@ -285,7 +328,7 @@
jclass clazz = env->FindClass("android/graphics/Region");
SkASSERT(clazz);
- gRegion_nativeInstanceFieldID = env->GetFieldID(clazz, "mNativeRegion", "I");
+ gRegion_nativeInstanceFieldID = env->GetFieldID(clazz, "mNativeRegion", "J");
SkASSERT(gRegion_nativeInstanceFieldID);
int result = android::AndroidRuntime::registerNativeMethods(env, "android/graphics/Region",
diff --git a/core/jni/android/graphics/Shader.cpp b/core/jni/android/graphics/Shader.cpp
index 6323ab3..3047440 100644
--- a/core/jni/android/graphics/Shader.cpp
+++ b/core/jni/android/graphics/Shader.cpp
@@ -24,7 +24,7 @@
}
}
-static void Color_RGBToHSV(JNIEnv* env, jobject, int red, int green, int blue, jfloatArray hsvArray)
+static void Color_RGBToHSV(JNIEnv* env, jobject, jint red, jint green, jint blue, jfloatArray hsvArray)
{
SkScalar hsv[3];
SkRGBToHSV(red, green, blue, hsv);
@@ -36,7 +36,7 @@
}
}
-static int Color_HSVToColor(JNIEnv* env, jobject, int alpha, jfloatArray hsvArray)
+static jint Color_HSVToColor(JNIEnv* env, jobject, jint alpha, jfloatArray hsvArray)
{
AutoJavaFloatArray autoHSV(env, hsvArray, 3);
float* values = autoHSV.ptr();;
@@ -46,13 +46,15 @@
hsv[i] = SkFloatToScalar(values[i]);
}
- return SkHSVToColor(alpha, hsv);
+ return static_cast<jint>(SkHSVToColor(alpha, hsv));
}
///////////////////////////////////////////////////////////////////////////////////////////////
-static void Shader_destructor(JNIEnv* env, jobject o, SkShader* shader, SkiaShader* skiaShader)
+static void Shader_destructor(JNIEnv* env, jobject o, jlong shaderHandle, jlong skiaShaderHandle)
{
+ SkShader* shader = reinterpret_cast<SkShader*>(shaderHandle);
+ SkiaShader* skiaShader = reinterpret_cast<SkiaShader*>(skiaShaderHandle);
SkSafeUnref(shader);
// skiaShader == NULL when not !USE_OPENGL_RENDERER, so no need to delete it outside the ifdef
#ifdef USE_OPENGL_RENDERER
@@ -64,9 +66,12 @@
#endif
}
-static void Shader_setLocalMatrix(JNIEnv* env, jobject o, SkShader* shader, SkiaShader* skiaShader,
- const SkMatrix* matrix)
+static void Shader_setLocalMatrix(JNIEnv* env, jobject o, jlong shaderHandle,
+ jlong skiaShaderHandle, jlong matrixHandle)
{
+ SkShader* shader = reinterpret_cast<SkShader*>(shaderHandle);
+ SkiaShader* skiaShader = reinterpret_cast<SkiaShader*>(skiaShaderHandle);
+ const SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixHandle);
if (shader) {
if (NULL == matrix) {
shader->resetLocalMatrix();
@@ -82,24 +87,27 @@
///////////////////////////////////////////////////////////////////////////////////////////////
-static SkShader* BitmapShader_constructor(JNIEnv* env, jobject o, const SkBitmap* bitmap,
- int tileModeX, int tileModeY)
+static jlong BitmapShader_constructor(JNIEnv* env, jobject o, jlong bitmapHandle,
+ jint tileModeX, jint tileModeY)
{
+ const SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
SkShader* s = SkShader::CreateBitmapShader(*bitmap,
(SkShader::TileMode)tileModeX,
(SkShader::TileMode)tileModeY);
ThrowIAE_IfNull(env, s);
- return s;
+ return reinterpret_cast<jlong>(s);
}
-static SkiaShader* BitmapShader_postConstructor(JNIEnv* env, jobject o, SkShader* shader,
- SkBitmap* bitmap, int tileModeX, int tileModeY) {
+static jlong BitmapShader_postConstructor(JNIEnv* env, jobject o, jlong shaderHandle,
+ jlong bitmapHandle, jint tileModeX, jint tileModeY) {
+ SkShader* shader = reinterpret_cast<SkShader*>(shaderHandle);
+ SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
#ifdef USE_OPENGL_RENDERER
SkiaShader* skiaShader = new SkiaBitmapShader(bitmap, shader,
static_cast<SkShader::TileMode>(tileModeX), static_cast<SkShader::TileMode>(tileModeY),
NULL, (shader->getFlags() & SkShader::kOpaqueAlpha_Flag) == 0);
- return skiaShader;
+ return reinterpret_cast<jlong>(skiaShader);
#else
return NULL;
#endif
@@ -107,9 +115,9 @@
///////////////////////////////////////////////////////////////////////////////////////////////
-static SkShader* LinearGradient_create1(JNIEnv* env, jobject o,
- float x0, float y0, float x1, float y1,
- jintArray colorArray, jfloatArray posArray, int tileMode)
+static jlong LinearGradient_create1(JNIEnv* env, jobject o,
+ jfloat x0, jfloat y0, jfloat x1, jfloat y1,
+ jintArray colorArray, jfloatArray posArray, jint tileMode)
{
SkPoint pts[2];
pts[0].set(SkFloatToScalar(x0), SkFloatToScalar(y0));
@@ -137,13 +145,14 @@
env->ReleaseIntArrayElements(colorArray, const_cast<jint*>(colorValues), JNI_ABORT);
ThrowIAE_IfNull(env, shader);
- return shader;
+ return reinterpret_cast<jlong>(shader);
}
-static SkiaShader* LinearGradient_postCreate1(JNIEnv* env, jobject o, SkShader* shader,
- float x0, float y0, float x1, float y1, jintArray colorArray,
- jfloatArray posArray, int tileMode) {
+static jlong LinearGradient_postCreate1(JNIEnv* env, jobject o, jlong shaderHandle,
+ jfloat x0, jfloat y0, jfloat x1, jfloat y1, jintArray colorArray,
+ jfloatArray posArray, jint tileMode) {
#ifdef USE_OPENGL_RENDERER
+ SkShader* shader = reinterpret_cast<SkShader*>(shaderHandle);
size_t count = env->GetArrayLength(colorArray);
const jint* colorValues = env->GetIntArrayElements(colorArray, NULL);
@@ -206,15 +215,16 @@
(shader->getFlags() & SkShader::kOpaqueAlpha_Flag) == 0);
env->ReleaseIntArrayElements(colorArray, const_cast<jint*>(colorValues), JNI_ABORT);
- return skiaShader;
+ return reinterpret_cast<jlong>(skiaShader);
#else
return NULL;
#endif
}
-static SkiaShader* LinearGradient_postCreate2(JNIEnv* env, jobject o, SkShader* shader,
- float x0, float y0, float x1, float y1, int color0, int color1, int tileMode) {
+static jlong LinearGradient_postCreate2(JNIEnv* env, jobject o, jlong shaderHandle,
+ jfloat x0, jfloat y0, jfloat x1, jfloat y1, jint color0, jint color1, jint tileMode) {
#ifdef USE_OPENGL_RENDERER
+ SkShader* shader = reinterpret_cast<SkShader*>(shaderHandle);
float* storedBounds = new float[4];
storedBounds[0] = x0; storedBounds[1] = y0;
storedBounds[2] = x1; storedBounds[3] = y1;
@@ -231,15 +241,15 @@
storedPositions, 2, shader, static_cast<SkShader::TileMode>(tileMode), NULL,
(shader->getFlags() & SkShader::kOpaqueAlpha_Flag) == 0);
- return skiaShader;
+ return reinterpret_cast<jlong>(skiaShader);
#else
return NULL;
#endif
}
-static SkShader* LinearGradient_create2(JNIEnv* env, jobject o,
- float x0, float y0, float x1, float y1,
- int color0, int color1, int tileMode)
+static jlong LinearGradient_create2(JNIEnv* env, jobject o,
+ jfloat x0, jfloat y0, jfloat x1, jfloat y1,
+ jint color0, jint color1, jint tileMode)
{
SkPoint pts[2];
pts[0].set(SkFloatToScalar(x0), SkFloatToScalar(y0));
@@ -252,13 +262,13 @@
SkShader* s = SkGradientShader::CreateLinear(pts, colors, NULL, 2, (SkShader::TileMode)tileMode);
ThrowIAE_IfNull(env, s);
- return s;
+ return reinterpret_cast<jlong>(s);
}
///////////////////////////////////////////////////////////////////////////////////////////////
-static SkShader* RadialGradient_create1(JNIEnv* env, jobject, float x, float y, float radius,
- jintArray colorArray, jfloatArray posArray, int tileMode) {
+static jlong RadialGradient_create1(JNIEnv* env, jobject, jfloat x, jfloat y, jfloat radius,
+ jintArray colorArray, jfloatArray posArray, jint tileMode) {
SkPoint center;
center.set(SkFloatToScalar(x), SkFloatToScalar(y));
@@ -285,11 +295,11 @@
JNI_ABORT);
ThrowIAE_IfNull(env, shader);
- return shader;
+ return reinterpret_cast<jlong>(shader);
}
-static SkShader* RadialGradient_create2(JNIEnv* env, jobject, float x, float y, float radius,
- int color0, int color1, int tileMode) {
+static jlong RadialGradient_create2(JNIEnv* env, jobject, jfloat x, jfloat y, jfloat radius,
+ jint color0, jint color1, jint tileMode) {
SkPoint center;
center.set(SkFloatToScalar(x), SkFloatToScalar(y));
@@ -300,12 +310,13 @@
SkShader* s = SkGradientShader::CreateRadial(center, SkFloatToScalar(radius), colors, NULL,
2, (SkShader::TileMode)tileMode);
ThrowIAE_IfNull(env, s);
- return s;
+ return reinterpret_cast<jlong>(s);
}
-static SkiaShader* RadialGradient_postCreate1(JNIEnv* env, jobject o, SkShader* shader,
- float x, float y, float radius, jintArray colorArray, jfloatArray posArray, int tileMode) {
+static jlong RadialGradient_postCreate1(JNIEnv* env, jobject o, jlong shaderHandle,
+ jfloat x, jfloat y, jfloat radius, jintArray colorArray, jfloatArray posArray, jint tileMode) {
#ifdef USE_OPENGL_RENDERER
+ SkShader* shader = reinterpret_cast<SkShader*>(shaderHandle);
size_t count = env->GetArrayLength(colorArray);
const jint* colorValues = env->GetIntArrayElements(colorArray, NULL);
@@ -335,15 +346,16 @@
(shader->getFlags() & SkShader::kOpaqueAlpha_Flag) == 0);
env->ReleaseIntArrayElements(colorArray, const_cast<jint*>(colorValues), JNI_ABORT);
- return skiaShader;
+ return reinterpret_cast<jlong>(skiaShader);
#else
return NULL;
#endif
}
-static SkiaShader* RadialGradient_postCreate2(JNIEnv* env, jobject o, SkShader* shader,
- float x, float y, float radius, int color0, int color1, int tileMode) {
+static jlong RadialGradient_postCreate2(JNIEnv* env, jobject o, jlong shaderHandle,
+ jfloat x, jfloat y, jfloat radius, jint color0, jint color1, jint tileMode) {
#ifdef USE_OPENGL_RENDERER
+ SkShader* shader = reinterpret_cast<SkShader*>(shaderHandle);
float* storedPositions = new float[2];
storedPositions[0] = 0.0f;
storedPositions[1] = 1.0f;
@@ -356,7 +368,7 @@
storedPositions, 2, shader, (SkShader::TileMode) tileMode, NULL,
(shader->getFlags() & SkShader::kOpaqueAlpha_Flag) == 0);
- return skiaShader;
+ return reinterpret_cast<jlong>(skiaShader);
#else
return NULL;
#endif
@@ -364,7 +376,7 @@
///////////////////////////////////////////////////////////////////////////////
-static SkShader* SweepGradient_create1(JNIEnv* env, jobject, float x, float y,
+static jlong SweepGradient_create1(JNIEnv* env, jobject, jfloat x, jfloat y,
jintArray jcolors, jfloatArray jpositions) {
size_t count = env->GetArrayLength(jcolors);
const jint* colors = env->GetIntArrayElements(jcolors, NULL);
@@ -388,10 +400,10 @@
env->ReleaseIntArrayElements(jcolors, const_cast<jint*>(colors),
JNI_ABORT);
ThrowIAE_IfNull(env, shader);
- return shader;
+ return reinterpret_cast<jlong>(shader);
}
-static SkShader* SweepGradient_create2(JNIEnv* env, jobject, float x, float y,
+static jlong SweepGradient_create2(JNIEnv* env, jobject, jfloat x, jfloat y,
int color0, int color1) {
SkColor colors[2];
colors[0] = color0;
@@ -399,12 +411,13 @@
SkShader* s = SkGradientShader::CreateSweep(SkFloatToScalar(x), SkFloatToScalar(y),
colors, NULL, 2);
ThrowIAE_IfNull(env, s);
- return s;
+ return reinterpret_cast<jlong>(s);
}
-static SkiaShader* SweepGradient_postCreate1(JNIEnv* env, jobject o, SkShader* shader,
- float x, float y, jintArray colorArray, jfloatArray posArray) {
+static jlong SweepGradient_postCreate1(JNIEnv* env, jobject o, jlong shaderHandle,
+ jfloat x, jfloat y, jintArray colorArray, jfloatArray posArray) {
#ifdef USE_OPENGL_RENDERER
+ SkShader* shader = reinterpret_cast<SkShader*>(shaderHandle);
size_t count = env->GetArrayLength(colorArray);
const jint* colorValues = env->GetIntArrayElements(colorArray, NULL);
@@ -433,15 +446,16 @@
shader, NULL, (shader->getFlags() & SkShader::kOpaqueAlpha_Flag) == 0);
env->ReleaseIntArrayElements(colorArray, const_cast<jint*>(colorValues), JNI_ABORT);
- return skiaShader;
+ return reinterpret_cast<jlong>(skiaShader);
#else
return NULL;
#endif
}
-static SkiaShader* SweepGradient_postCreate2(JNIEnv* env, jobject o, SkShader* shader,
- float x, float y, int color0, int color1) {
+static jlong SweepGradient_postCreate2(JNIEnv* env, jobject o, jlong shaderHandle,
+ jfloat x, jfloat y, jint color0, jint color1) {
#ifdef USE_OPENGL_RENDERER
+ SkShader* shader = reinterpret_cast<SkShader*>(shaderHandle);
float* storedPositions = new float[2];
storedPositions[0] = 0.0f;
storedPositions[1] = 1.0f;
@@ -453,7 +467,7 @@
SkiaShader* skiaShader = new SkiaSweepGradientShader(x, y, storedColors, storedPositions, 2,
shader, NULL, (shader->getFlags() & SkShader::kOpaqueAlpha_Flag) == 0);
- return skiaShader;
+ return reinterpret_cast<jlong>(skiaShader);
#else
return NULL;
#endif
@@ -461,39 +475,57 @@
///////////////////////////////////////////////////////////////////////////////////////////////
-static SkShader* ComposeShader_create1(JNIEnv* env, jobject o,
- SkShader* shaderA, SkShader* shaderB, SkXfermode* mode)
+static jlong ComposeShader_create1(JNIEnv* env, jobject o,
+ jlong shaderAHandle, jlong shaderBHandle, jlong modeHandle)
{
- return new SkComposeShader(shaderA, shaderB, mode);
+ SkShader* shaderA = reinterpret_cast<SkShader *>(shaderAHandle);
+ SkShader* shaderB = reinterpret_cast<SkShader *>(shaderBHandle);
+ SkXfermode* mode = reinterpret_cast<SkXfermode *>(modeHandle);
+ SkShader* shader = new SkComposeShader(shaderA, shaderB, mode);
+ return reinterpret_cast<jlong>(shader);
}
-static SkShader* ComposeShader_create2(JNIEnv* env, jobject o,
- SkShader* shaderA, SkShader* shaderB, SkPorterDuff::Mode porterDuffMode)
+static jlong ComposeShader_create2(JNIEnv* env, jobject o,
+ jlong shaderAHandle, jlong shaderBHandle, jint porterDuffModeHandle)
{
+ SkShader* shaderA = reinterpret_cast<SkShader *>(shaderAHandle);
+ SkShader* shaderB = reinterpret_cast<SkShader *>(shaderBHandle);
+ SkPorterDuff::Mode porterDuffMode = static_cast<SkPorterDuff::Mode>(porterDuffModeHandle);
SkAutoUnref au(SkPorterDuff::CreateXfermode(porterDuffMode));
SkXfermode* mode = (SkXfermode*) au.get();
- return new SkComposeShader(shaderA, shaderB, mode);
+ SkShader* shader = new SkComposeShader(shaderA, shaderB, mode);
+ return reinterpret_cast<jlong>(shader);
}
-static SkiaShader* ComposeShader_postCreate2(JNIEnv* env, jobject o, SkShader* shader,
- SkiaShader* shaderA, SkiaShader* shaderB, SkPorterDuff::Mode porterDuffMode) {
+static jlong ComposeShader_postCreate2(JNIEnv* env, jobject o, jlong shaderHandle,
+ jlong shaderAHandle, jlong shaderBHandle, jint porterDuffModeHandle) {
#ifdef USE_OPENGL_RENDERER
+ SkShader* shader = reinterpret_cast<SkShader *>(shaderHandle);
+ SkiaShader* shaderA = reinterpret_cast<SkiaShader *>(shaderAHandle);
+ SkiaShader* shaderB = reinterpret_cast<SkiaShader *>(shaderBHandle);
+ SkPorterDuff::Mode porterDuffMode = static_cast<SkPorterDuff::Mode>(porterDuffModeHandle);
SkXfermode::Mode mode = SkPorterDuff::ToXfermodeMode(porterDuffMode);
- return new SkiaComposeShader(shaderA, shaderB, mode, shader);
+ SkiaShader* skiaShader = new SkiaComposeShader(shaderA, shaderB, mode, shader);
+ return reinterpret_cast<jlong>(skiaShader);
#else
return NULL;
#endif
}
-static SkiaShader* ComposeShader_postCreate1(JNIEnv* env, jobject o, SkShader* shader,
- SkiaShader* shaderA, SkiaShader* shaderB, SkXfermode* mode) {
+static jlong ComposeShader_postCreate1(JNIEnv* env, jobject o, jlong shaderHandle,
+ jlong shaderAHandle, jlong shaderBHandle, jlong modeHandle) {
#ifdef USE_OPENGL_RENDERER
+ SkShader* shader = reinterpret_cast<SkShader *>(shaderHandle);
+ SkiaShader* shaderA = reinterpret_cast<SkiaShader *>(shaderAHandle);
+ SkiaShader* shaderB = reinterpret_cast<SkiaShader *>(shaderBHandle);
+ SkXfermode* mode = reinterpret_cast<SkXfermode *>(modeHandle);
SkXfermode::Mode skiaMode;
if (!SkXfermode::IsMode(mode, &skiaMode)) {
// TODO: Support other modes
skiaMode = SkXfermode::kSrcOver_Mode;
}
- return new SkiaComposeShader(shaderA, shaderB, skiaMode, shader);
+ SkiaShader* skiaShader = new SkiaComposeShader(shaderA, shaderB, skiaMode, shader);
+ return reinterpret_cast<jlong>(skiaShader);
#else
return NULL;
#endif
@@ -507,41 +539,41 @@
};
static JNINativeMethod gShaderMethods[] = {
- { "nativeDestructor", "(II)V", (void*)Shader_destructor },
- { "nativeSetLocalMatrix", "(III)V", (void*)Shader_setLocalMatrix }
+ { "nativeDestructor", "(JJ)V", (void*)Shader_destructor },
+ { "nativeSetLocalMatrix", "(JJJ)V", (void*)Shader_setLocalMatrix }
};
static JNINativeMethod gBitmapShaderMethods[] = {
- { "nativeCreate", "(III)I", (void*)BitmapShader_constructor },
- { "nativePostCreate", "(IIII)I", (void*)BitmapShader_postConstructor }
+ { "nativeCreate", "(JII)J", (void*)BitmapShader_constructor },
+ { "nativePostCreate", "(JJII)J", (void*)BitmapShader_postConstructor }
};
static JNINativeMethod gLinearGradientMethods[] = {
- { "nativeCreate1", "(FFFF[I[FI)I", (void*)LinearGradient_create1 },
- { "nativeCreate2", "(FFFFIII)I", (void*)LinearGradient_create2 },
- { "nativePostCreate1", "(IFFFF[I[FI)I", (void*)LinearGradient_postCreate1 },
- { "nativePostCreate2", "(IFFFFIII)I", (void*)LinearGradient_postCreate2 }
+ { "nativeCreate1", "(FFFF[I[FI)J", (void*)LinearGradient_create1 },
+ { "nativeCreate2", "(FFFFIII)J", (void*)LinearGradient_create2 },
+ { "nativePostCreate1", "(JFFFF[I[FI)J", (void*)LinearGradient_postCreate1 },
+ { "nativePostCreate2", "(JFFFFIII)J", (void*)LinearGradient_postCreate2 }
};
static JNINativeMethod gRadialGradientMethods[] = {
- { "nativeCreate1", "(FFF[I[FI)I", (void*)RadialGradient_create1 },
- { "nativeCreate2", "(FFFIII)I", (void*)RadialGradient_create2 },
- { "nativePostCreate1", "(IFFF[I[FI)I", (void*)RadialGradient_postCreate1 },
- { "nativePostCreate2", "(IFFFIII)I", (void*)RadialGradient_postCreate2 }
+ { "nativeCreate1", "(FFF[I[FI)J", (void*)RadialGradient_create1 },
+ { "nativeCreate2", "(FFFIII)J", (void*)RadialGradient_create2 },
+ { "nativePostCreate1", "(JFFF[I[FI)J", (void*)RadialGradient_postCreate1 },
+ { "nativePostCreate2", "(JFFFIII)J", (void*)RadialGradient_postCreate2 }
};
static JNINativeMethod gSweepGradientMethods[] = {
- { "nativeCreate1", "(FF[I[F)I", (void*)SweepGradient_create1 },
- { "nativeCreate2", "(FFII)I", (void*)SweepGradient_create2 },
- { "nativePostCreate1", "(IFF[I[F)I", (void*)SweepGradient_postCreate1 },
- { "nativePostCreate2", "(IFFII)I", (void*)SweepGradient_postCreate2 }
+ { "nativeCreate1", "(FF[I[F)J", (void*)SweepGradient_create1 },
+ { "nativeCreate2", "(FFII)J", (void*)SweepGradient_create2 },
+ { "nativePostCreate1", "(JFF[I[F)J", (void*)SweepGradient_postCreate1 },
+ { "nativePostCreate2", "(JFFII)J", (void*)SweepGradient_postCreate2 }
};
static JNINativeMethod gComposeShaderMethods[] = {
- { "nativeCreate1", "(III)I", (void*)ComposeShader_create1 },
- { "nativeCreate2", "(III)I", (void*)ComposeShader_create2 },
- { "nativePostCreate1", "(IIII)I", (void*)ComposeShader_postCreate1 },
- { "nativePostCreate2", "(IIII)I", (void*)ComposeShader_postCreate2 }
+ { "nativeCreate1", "(JJJ)J", (void*)ComposeShader_create1 },
+ { "nativeCreate2", "(JJI)J", (void*)ComposeShader_create2 },
+ { "nativePostCreate1", "(JJJJ)J", (void*)ComposeShader_postCreate1 },
+ { "nativePostCreate2", "(JJJI)J", (void*)ComposeShader_postCreate2 }
};
#include <android_runtime/AndroidRuntime.h>
diff --git a/core/jni/android/graphics/Typeface.cpp b/core/jni/android/graphics/Typeface.cpp
index 04f9fe1..a349a7f 100644
--- a/core/jni/android/graphics/Typeface.cpp
+++ b/core/jni/android/graphics/Typeface.cpp
@@ -44,8 +44,9 @@
const char* fCStr;
};
-static TypefaceImpl* Typeface_create(JNIEnv* env, jobject, jstring name,
- SkTypeface::Style style) {
+static jlong Typeface_create(JNIEnv* env, jobject, jstring name,
+ jint styleHandle) {
+ SkTypeface::Style style = static_cast<SkTypeface::Style>(styleHandle);
TypefaceImpl* face = NULL;
if (NULL != name) {
@@ -57,10 +58,11 @@
if (NULL == face) {
face = TypefaceImpl_createFromName(NULL, style);
}
- return face;
+ return reinterpret_cast<jlong>(face);
}
-static TypefaceImpl* Typeface_createFromTypeface(JNIEnv* env, jobject, TypefaceImpl* family, int style) {
+static jlong Typeface_createFromTypeface(JNIEnv* env, jobject, jlong familyHandle, jint style) {
+ SkTypeface* family = reinterpret_cast<SkTypeface*>(familyHandle);
TypefaceImpl* face = TypefaceImpl_createFromTypeface(family, (SkTypeface::Style)style);
// Try to find the closest matching font, using the standard heuristic
if (NULL == face) {
@@ -72,21 +74,22 @@
if (NULL == face) {
face = TypefaceImpl_createFromName(NULL, (SkTypeface::Style)style);
}
- return face;
+ return reinterpret_cast<jlong>(face);
}
-static void Typeface_unref(JNIEnv* env, jobject obj, TypefaceImpl* face) {
+static void Typeface_unref(JNIEnv* env, jobject obj, jlong faceHandle) {
+ TypefaceImpl* face = reinterpret_cast<TypefaceImpl*>(faceHandle);
TypefaceImpl_unref(face);
}
-static int Typeface_getStyle(JNIEnv* env, jobject obj, TypefaceImpl* face) {
+static jint Typeface_getStyle(JNIEnv* env, jobject obj, jlong faceHandle) {
+ TypefaceImpl* face = reinterpret_cast<TypefaceImpl*>(faceHandle);
return TypefaceImpl_getStyle(face);
}
-static TypefaceImpl* Typeface_createFromAsset(JNIEnv* env, jobject,
- jobject jassetMgr,
- jstring jpath) {
-
+static jlong Typeface_createFromAsset(JNIEnv* env, jobject,
+ jobject jassetMgr,
+ jstring jpath) {
NPE_CHECK_RETURN_ZERO(env, jassetMgr);
NPE_CHECK_RETURN_ZERO(env, jpath);
@@ -95,33 +98,32 @@
return NULL;
}
- AutoJavaStringToUTF8 str(env, jpath);
+ AutoJavaStringToUTF8 str(env, jpath);
Asset* asset = mgr->open(str.c_str(), Asset::ACCESS_BUFFER);
if (NULL == asset) {
return NULL;
}
- return TypefaceImpl_createFromAsset(asset);
+ return reinterpret_cast<jlong>(TypefaceImpl_createFromAsset(asset));
}
-static TypefaceImpl* Typeface_createFromFile(JNIEnv* env, jobject, jstring jpath) {
+static jlong Typeface_createFromFile(JNIEnv* env, jobject, jstring jpath) {
NPE_CHECK_RETURN_ZERO(env, jpath);
AutoJavaStringToUTF8 str(env, jpath);
-
- return TypefaceImpl_createFromFile(str.c_str());
+ return reinterpret_cast<jlong>(TypefaceImpl_createFromFile(str.c_str()));
}
///////////////////////////////////////////////////////////////////////////////
static JNINativeMethod gTypefaceMethods[] = {
- { "nativeCreate", "(Ljava/lang/String;I)I", (void*)Typeface_create },
- { "nativeCreateFromTypeface", "(II)I", (void*)Typeface_createFromTypeface },
- { "nativeUnref", "(I)V", (void*)Typeface_unref },
- { "nativeGetStyle", "(I)I", (void*)Typeface_getStyle },
- { "nativeCreateFromAsset", "(Landroid/content/res/AssetManager;Ljava/lang/String;)I",
+ { "nativeCreate", "(Ljava/lang/String;I)J", (void*)Typeface_create },
+ { "nativeCreateFromTypeface", "(JI)J", (void*)Typeface_createFromTypeface },
+ { "nativeUnref", "(J)V", (void*)Typeface_unref },
+ { "nativeGetStyle", "(J)I", (void*)Typeface_getStyle },
+ { "nativeCreateFromAsset", "(Landroid/content/res/AssetManager;Ljava/lang/String;)J",
(void*)Typeface_createFromAsset },
- { "nativeCreateFromFile", "(Ljava/lang/String;)I",
+ { "nativeCreateFromFile", "(Ljava/lang/String;)J",
(void*)Typeface_createFromFile },
};
diff --git a/core/jni/android/graphics/Xfermode.cpp b/core/jni/android/graphics/Xfermode.cpp
index 976a91f..eedceb7 100644
--- a/core/jni/android/graphics/Xfermode.cpp
+++ b/core/jni/android/graphics/Xfermode.cpp
@@ -26,35 +26,37 @@
class SkXfermodeGlue {
public:
- static void finalizer(JNIEnv* env, jobject, SkXfermode* obj)
+ static void finalizer(JNIEnv* env, jobject, jlong objHandle)
{
+ SkXfermode* obj = reinterpret_cast<SkXfermode *>(objHandle);
SkSafeUnref(obj);
}
- static SkXfermode* avoid_create(JNIEnv* env, jobject, SkColor opColor,
- U8CPU tolerance, SkAvoidXfermode::Mode mode)
+ static jlong avoid_create(JNIEnv* env, jobject, jint opColor,
+ jint tolerance, jint modeHandle)
{
- return new SkAvoidXfermode(opColor, tolerance, mode);
+ SkAvoidXfermode::Mode mode = static_cast<SkAvoidXfermode::Mode>(modeHandle);
+ return reinterpret_cast<jlong>(new SkAvoidXfermode(opColor, tolerance, mode));
}
-
- static SkXfermode* pixelxor_create(JNIEnv* env, jobject, SkColor opColor)
+
+ static jlong pixelxor_create(JNIEnv* env, jobject, jint opColor)
{
- return new SkPixelXorXfermode(opColor);
+ return reinterpret_cast<jlong>(new SkPixelXorXfermode(opColor));
}
};
///////////////////////////////////////////////////////////////////////////////
static JNINativeMethod gXfermodeMethods[] = {
- {"finalizer", "(I)V", (void*) SkXfermodeGlue::finalizer}
+ {"finalizer", "(J)V", (void*) SkXfermodeGlue::finalizer}
};
static JNINativeMethod gAvoidMethods[] = {
- {"nativeCreate", "(III)I", (void*) SkXfermodeGlue::avoid_create}
+ {"nativeCreate", "(III)J", (void*) SkXfermodeGlue::avoid_create}
};
static JNINativeMethod gPixelXorMethods[] = {
- {"nativeCreate", "(I)I", (void*) SkXfermodeGlue::pixelxor_create}
+ {"nativeCreate", "(I)J", (void*) SkXfermodeGlue::pixelxor_create}
};
#include <android_runtime/AndroidRuntime.h>
diff --git a/core/jni/android/opengl/util.cpp b/core/jni/android/opengl/util.cpp
index 4bb091d..a17f328 100644
--- a/core/jni/android/opengl/util.cpp
+++ b/core/jni/android/opengl/util.cpp
@@ -389,7 +389,7 @@
}
static
-int util_frustumCullSpheres(JNIEnv *env, jclass clazz,
+jint util_frustumCullSpheres(JNIEnv *env, jclass clazz,
jfloatArray mvp_ref, jint mvpOffset,
jfloatArray spheres_ref, jint spheresOffset, jint spheresCount,
jintArray results_ref, jint resultsOffset, jint resultsCapacity) {
@@ -436,7 +436,7 @@
*/
static
-int util_visibilityTest(JNIEnv *env, jclass clazz,
+jint util_visibilityTest(JNIEnv *env, jclass clazz,
jfloatArray ws_ref, jint wsOffset,
jfloatArray positions_ref, jint positionsOffset,
jcharArray indices_ref, jint indicesOffset, jint indexCount) {
@@ -553,7 +553,7 @@
void nativeUtilsClassInit(JNIEnv *env, jclass clazz)
{
jclass bitmapClass = env->FindClass("android/graphics/Bitmap");
- nativeBitmapID = env->GetFieldID(bitmapClass, "mNativeBitmap", "I");
+ nativeBitmapID = env->GetFieldID(bitmapClass, "mNativeBitmap", "J");
}
extern void setGLDebugLevel(int level);
@@ -630,7 +630,7 @@
jobject jbitmap)
{
SkBitmap const * nativeBitmap =
- (SkBitmap const *)env->GetIntField(jbitmap, nativeBitmapID);
+ (SkBitmap const *)env->GetLongField(jbitmap, nativeBitmapID);
const SkBitmap& bitmap(*nativeBitmap);
SkBitmap::Config config = bitmap.config();
return getInternalFormat(config);
@@ -640,7 +640,7 @@
jobject jbitmap)
{
SkBitmap const * nativeBitmap =
- (SkBitmap const *)env->GetIntField(jbitmap, nativeBitmapID);
+ (SkBitmap const *)env->GetLongField(jbitmap, nativeBitmapID);
const SkBitmap& bitmap(*nativeBitmap);
SkBitmap::Config config = bitmap.config();
return getType(config);
@@ -651,7 +651,7 @@
jobject jbitmap, jint type, jint border)
{
SkBitmap const * nativeBitmap =
- (SkBitmap const *)env->GetIntField(jbitmap, nativeBitmapID);
+ (SkBitmap const *)env->GetLongField(jbitmap, nativeBitmapID);
const SkBitmap& bitmap(*nativeBitmap);
SkBitmap::Config config = bitmap.config();
if (internalformat < 0) {
@@ -700,7 +700,7 @@
jobject jbitmap, jint format, jint type)
{
SkBitmap const * nativeBitmap =
- (SkBitmap const *)env->GetIntField(jbitmap, nativeBitmapID);
+ (SkBitmap const *)env->GetLongField(jbitmap, nativeBitmapID);
const SkBitmap& bitmap(*nativeBitmap);
SkBitmap::Config config = bitmap.config();
if (format < 0) {
@@ -773,7 +773,7 @@
pointer = _env->CallStaticLongMethod(nioAccessClass,
getBasePointerID, buffer);
if (pointer != 0L) {
- return (void *) (jint) pointer;
+ return reinterpret_cast<void *>(pointer);
}
return NULL;
}
@@ -974,7 +974,7 @@
result = etc1_pkm_is_valid((etc1_byte*) headerB.getData());
}
}
- return result;
+ return result ? JNI_TRUE : JNI_FALSE;
}
/**
@@ -997,7 +997,7 @@
/**
* Read the image height from a PKM header
*/
-static int etc1_getHeight(JNIEnv *env, jclass clazz,
+static jint etc1_getHeight(JNIEnv *env, jclass clazz,
jobject header) {
jint result = 0;
BufferHelper headerB(env, header);
diff --git a/core/jni/android_view_DisplayList.cpp b/core/jni/android_view_DisplayList.cpp
index 9169a16..a796302 100644
--- a/core/jni/android_view_DisplayList.cpp
+++ b/core/jni/android_view_DisplayList.cpp
@@ -42,19 +42,19 @@
// ----------------------------------------------------------------------------
static void android_view_DisplayList_reset(JNIEnv* env,
- jobject clazz, jint displayListPtr) {
+ jobject clazz, jlong displayListPtr) {
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
displayList->reset();
}
static jint android_view_DisplayList_getDisplayListSize(JNIEnv* env,
- jobject clazz, jint displayListPtr) {
+ jobject clazz, jlong displayListPtr) {
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
return displayList->getSize();
}
static void android_view_DisplayList_setDisplayListName(JNIEnv* env,
- jobject clazz, jint displayListPtr, jstring name) {
+ jobject clazz, jlong displayListPtr, jstring name) {
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
if (name != NULL) {
const char* textArray = env->GetStringUTFChars(name, NULL);
@@ -64,13 +64,13 @@
}
static void android_view_DisplayList_output(JNIEnv* env,
- jobject clazz, jint displayListPtr) {
+ jobject clazz, jlong displayListPtr) {
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
displayList->output();
}
static void android_view_DisplayList_destroyDisplayList(JNIEnv* env,
- jobject clazz, jint displayListPtr) {
+ jobject clazz, jlong displayListPtr) {
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
DisplayList::destroyDisplayListDeferred(displayList);
}
@@ -80,105 +80,105 @@
// ----------------------------------------------------------------------------
static void android_view_DisplayList_setCaching(JNIEnv* env,
- jobject clazz, jint displayListPtr, jboolean caching) {
+ jobject clazz, jlong displayListPtr, jboolean caching) {
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
displayList->setCaching(caching);
}
static void android_view_DisplayList_setStaticMatrix(JNIEnv* env,
- jobject clazz, jint displayListPtr, jint matrixPtr) {
+ jobject clazz, jlong displayListPtr, jlong matrixPtr) {
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixPtr);
displayList->setStaticMatrix(matrix);
}
static void android_view_DisplayList_setAnimationMatrix(JNIEnv* env,
- jobject clazz, jint displayListPtr, jint matrixPtr) {
+ jobject clazz, jlong displayListPtr, jlong matrixPtr) {
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixPtr);
displayList->setAnimationMatrix(matrix);
}
static void android_view_DisplayList_setClipToBounds(JNIEnv* env,
- jobject clazz, jint displayListPtr, jboolean clipToBounds) {
+ jobject clazz, jlong displayListPtr, jboolean clipToBounds) {
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
displayList->setClipToBounds(clipToBounds);
}
static void android_view_DisplayList_setIsContainedVolume(JNIEnv* env,
- jobject clazz, jint displayListPtr, jboolean isContainedVolume) {
+ jobject clazz, jlong displayListPtr, jboolean isContainedVolume) {
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
displayList->setIsContainedVolume(isContainedVolume);
}
static void android_view_DisplayList_setProjectToContainedVolume(JNIEnv* env,
- jobject clazz, jint displayListPtr, jboolean shouldProject) {
+ jobject clazz, jlong displayListPtr, jboolean shouldProject) {
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
displayList->setProjectToContainedVolume(shouldProject);
}
static void android_view_DisplayList_setAlpha(JNIEnv* env,
- jobject clazz, jint displayListPtr, float alpha) {
+ jobject clazz, jlong displayListPtr, float alpha) {
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
displayList->setAlpha(alpha);
}
static void android_view_DisplayList_setHasOverlappingRendering(JNIEnv* env,
- jobject clazz, jint displayListPtr, bool hasOverlappingRendering) {
+ jobject clazz, jlong displayListPtr, bool hasOverlappingRendering) {
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
displayList->setHasOverlappingRendering(hasOverlappingRendering);
}
static void android_view_DisplayList_setTranslationX(JNIEnv* env,
- jobject clazz, jint displayListPtr, float tx) {
+ jobject clazz, jlong displayListPtr, float tx) {
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
displayList->setTranslationX(tx);
}
static void android_view_DisplayList_setTranslationY(JNIEnv* env,
- jobject clazz, jint displayListPtr, float ty) {
+ jobject clazz, jlong displayListPtr, float ty) {
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
displayList->setTranslationY(ty);
}
static void android_view_DisplayList_setTranslationZ(JNIEnv* env,
- jobject clazz, jint displayListPtr, float tz) {
+ jobject clazz, jlong displayListPtr, float tz) {
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
displayList->setTranslationZ(tz);
}
static void android_view_DisplayList_setRotation(JNIEnv* env,
- jobject clazz, jint displayListPtr, float rotation) {
+ jobject clazz, jlong displayListPtr, float rotation) {
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
displayList->setRotation(rotation);
}
static void android_view_DisplayList_setRotationX(JNIEnv* env,
- jobject clazz, jint displayListPtr, float rx) {
+ jobject clazz, jlong displayListPtr, float rx) {
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
displayList->setRotationX(rx);
}
static void android_view_DisplayList_setRotationY(JNIEnv* env,
- jobject clazz, jint displayListPtr, float ry) {
+ jobject clazz, jlong displayListPtr, float ry) {
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
displayList->setRotationY(ry);
}
static void android_view_DisplayList_setScaleX(JNIEnv* env,
- jobject clazz, jint displayListPtr, float sx) {
+ jobject clazz, jlong displayListPtr, float sx) {
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
displayList->setScaleX(sx);
}
static void android_view_DisplayList_setScaleY(JNIEnv* env,
- jobject clazz, jint displayListPtr, float sy) {
+ jobject clazz, jlong displayListPtr, float sy) {
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
displayList->setScaleY(sy);
}
static void android_view_DisplayList_setTransformationInfo(JNIEnv* env,
- jobject clazz, jint displayListPtr, float alpha,
+ jobject clazz, jlong displayListPtr, float alpha,
float translationX, float translationY, float translationZ,
float rotation, float rotationX, float rotationY, float scaleX, float scaleY) {
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
@@ -194,68 +194,68 @@
}
static void android_view_DisplayList_setPivotX(JNIEnv* env,
- jobject clazz, jint displayListPtr, float px) {
+ jobject clazz, jlong displayListPtr, float px) {
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
displayList->setPivotX(px);
}
static void android_view_DisplayList_setPivotY(JNIEnv* env,
- jobject clazz, jint displayListPtr, float py) {
+ jobject clazz, jlong displayListPtr, float py) {
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
displayList->setPivotY(py);
}
static void android_view_DisplayList_setCameraDistance(JNIEnv* env,
- jobject clazz, jint displayListPtr, float distance) {
+ jobject clazz, jlong displayListPtr, float distance) {
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
displayList->setCameraDistance(distance);
}
static void android_view_DisplayList_setLeft(JNIEnv* env,
- jobject clazz, jint displayListPtr, int left) {
+ jobject clazz, jlong displayListPtr, int left) {
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
displayList->setLeft(left);
}
static void android_view_DisplayList_setTop(JNIEnv* env,
- jobject clazz, jint displayListPtr, int top) {
+ jobject clazz, jlong displayListPtr, int top) {
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
displayList->setTop(top);
}
static void android_view_DisplayList_setRight(JNIEnv* env,
- jobject clazz, jint displayListPtr, int right) {
+ jobject clazz, jlong displayListPtr, int right) {
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
displayList->setRight(right);
}
static void android_view_DisplayList_setBottom(JNIEnv* env,
- jobject clazz, jint displayListPtr, int bottom) {
+ jobject clazz, jlong displayListPtr, int bottom) {
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
displayList->setBottom(bottom);
}
static void android_view_DisplayList_setLeftTopRightBottom(JNIEnv* env,
- jobject clazz, jint displayListPtr, int left, int top,
+ jobject clazz, jlong displayListPtr, int left, int top,
int right, int bottom) {
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
displayList->setLeftTopRightBottom(left, top, right, bottom);
}
static void android_view_DisplayList_offsetLeftAndRight(JNIEnv* env,
- jobject clazz, jint displayListPtr, float offset) {
+ jobject clazz, jlong displayListPtr, float offset) {
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
displayList->offsetLeftRight(offset);
}
static void android_view_DisplayList_offsetTopAndBottom(JNIEnv* env,
- jobject clazz, jint displayListPtr, float offset) {
+ jobject clazz, jlong displayListPtr, float offset) {
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
displayList->offsetTopBottom(offset);
}
static void android_view_DisplayList_getMatrix(JNIEnv* env,
- jobject clazz, jint displayListPtr, jint matrixPtr) {
+ jobject clazz, jlong displayListPtr, jlong matrixPtr) {
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixPtr);
SkMatrix* source = displayList->getStaticMatrix();
@@ -267,97 +267,97 @@
}
static jboolean android_view_DisplayList_hasOverlappingRendering(JNIEnv* env,
- jobject clazz, jint displayListPtr) {
+ jobject clazz, jlong displayListPtr) {
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
return displayList->hasOverlappingRendering();
}
static jfloat android_view_DisplayList_getAlpha(JNIEnv* env,
- jobject clazz, jint displayListPtr) {
+ jobject clazz, jlong displayListPtr) {
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
return displayList->getAlpha();
}
static jfloat android_view_DisplayList_getLeft(JNIEnv* env,
- jobject clazz, jint displayListPtr) {
+ jobject clazz, jlong displayListPtr) {
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
return displayList->getLeft();
}
static jfloat android_view_DisplayList_getTop(JNIEnv* env,
- jobject clazz, jint displayListPtr) {
+ jobject clazz, jlong displayListPtr) {
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
return displayList->getTop();
}
static jfloat android_view_DisplayList_getRight(JNIEnv* env,
- jobject clazz, jint displayListPtr) {
+ jobject clazz, jlong displayListPtr) {
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
return displayList->getRight();
}
static jfloat android_view_DisplayList_getBottom(JNIEnv* env,
- jobject clazz, jint displayListPtr) {
+ jobject clazz, jlong displayListPtr) {
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
return displayList->getBottom();
}
static jfloat android_view_DisplayList_getCameraDistance(JNIEnv* env,
- jobject clazz, jint displayListPtr) {
+ jobject clazz, jlong displayListPtr) {
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
return displayList->getCameraDistance();
}
static jfloat android_view_DisplayList_getScaleX(JNIEnv* env,
- jobject clazz, jint displayListPtr) {
+ jobject clazz, jlong displayListPtr) {
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
return displayList->getScaleX();
}
static jfloat android_view_DisplayList_getScaleY(JNIEnv* env,
- jobject clazz, jint displayListPtr) {
+ jobject clazz, jlong displayListPtr) {
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
return displayList->getScaleY();
}
static jfloat android_view_DisplayList_getTranslationX(JNIEnv* env,
- jobject clazz, jint displayListPtr) {
+ jobject clazz, jlong displayListPtr) {
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
return displayList->getTranslationX();
}
static jfloat android_view_DisplayList_getTranslationY(JNIEnv* env,
- jobject clazz, jint displayListPtr) {
+ jobject clazz, jlong displayListPtr) {
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
return displayList->getTranslationY();
}
static jfloat android_view_DisplayList_getRotation(JNIEnv* env,
- jobject clazz, jint displayListPtr) {
+ jobject clazz, jlong displayListPtr) {
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
return displayList->getRotation();
}
static jfloat android_view_DisplayList_getRotationX(JNIEnv* env,
- jobject clazz, jint displayListPtr) {
+ jobject clazz, jlong displayListPtr) {
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
return displayList->getRotationX();
}
static jfloat android_view_DisplayList_getRotationY(JNIEnv* env,
- jobject clazz, jint displayListPtr) {
+ jobject clazz, jlong displayListPtr) {
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
return displayList->getRotationY();
}
static jfloat android_view_DisplayList_getPivotX(JNIEnv* env,
- jobject clazz, jint displayListPtr) {
+ jobject clazz, jlong displayListPtr) {
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
return displayList->getPivotX();
}
static jfloat android_view_DisplayList_getPivotY(JNIEnv* env,
- jobject clazz, jint displayListPtr) {
+ jobject clazz, jlong displayListPtr) {
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
return displayList->getPivotY();
}
@@ -372,61 +372,61 @@
static JNINativeMethod gMethods[] = {
#ifdef USE_OPENGL_RENDERER
- { "nDestroyDisplayList", "(I)V", (void*) android_view_DisplayList_destroyDisplayList },
- { "nGetDisplayListSize", "(I)I", (void*) android_view_DisplayList_getDisplayListSize },
- { "nSetDisplayListName", "(ILjava/lang/String;)V",
+ { "nDestroyDisplayList", "(J)V", (void*) android_view_DisplayList_destroyDisplayList },
+ { "nGetDisplayListSize", "(J)I", (void*) android_view_DisplayList_getDisplayListSize },
+ { "nSetDisplayListName", "(JLjava/lang/String;)V",
(void*) android_view_DisplayList_setDisplayListName },
- { "nOutput", "(I)V", (void*) android_view_DisplayList_output },
+ { "nOutput", "(J)V", (void*) android_view_DisplayList_output },
- { "nReset", "(I)V", (void*) android_view_DisplayList_reset },
- { "nSetCaching", "(IZ)V", (void*) android_view_DisplayList_setCaching },
- { "nSetStaticMatrix", "(II)V", (void*) android_view_DisplayList_setStaticMatrix },
- { "nSetAnimationMatrix", "(II)V", (void*) android_view_DisplayList_setAnimationMatrix },
- { "nSetClipToBounds", "(IZ)V", (void*) android_view_DisplayList_setClipToBounds },
- { "nSetIsContainedVolume", "(IZ)V", (void*) android_view_DisplayList_setIsContainedVolume },
- { "nSetProjectToContainedVolume", "(IZ)V",
+ { "nReset", "(J)V", (void*) android_view_DisplayList_reset },
+ { "nSetCaching", "(JZ)V", (void*) android_view_DisplayList_setCaching },
+ { "nSetStaticMatrix", "(JJ)V", (void*) android_view_DisplayList_setStaticMatrix },
+ { "nSetAnimationMatrix", "(JJ)V", (void*) android_view_DisplayList_setAnimationMatrix },
+ { "nSetClipToBounds", "(JZ)V", (void*) android_view_DisplayList_setClipToBounds },
+ { "nSetIsContainedVolume", "(JZ)V", (void*) android_view_DisplayList_setIsContainedVolume },
+ { "nSetProjectToContainedVolume", "(JZ)V",
(void*) android_view_DisplayList_setProjectToContainedVolume },
- { "nSetAlpha", "(IF)V", (void*) android_view_DisplayList_setAlpha },
- { "nSetHasOverlappingRendering", "(IZ)V",
+ { "nSetAlpha", "(JF)V", (void*) android_view_DisplayList_setAlpha },
+ { "nSetHasOverlappingRendering", "(JZ)V",
(void*) android_view_DisplayList_setHasOverlappingRendering },
- { "nSetTranslationX", "(IF)V", (void*) android_view_DisplayList_setTranslationX },
- { "nSetTranslationY", "(IF)V", (void*) android_view_DisplayList_setTranslationY },
- { "nSetTranslationZ", "(IF)V", (void*) android_view_DisplayList_setTranslationZ },
- { "nSetRotation", "(IF)V", (void*) android_view_DisplayList_setRotation },
- { "nSetRotationX", "(IF)V", (void*) android_view_DisplayList_setRotationX },
- { "nSetRotationY", "(IF)V", (void*) android_view_DisplayList_setRotationY },
- { "nSetScaleX", "(IF)V", (void*) android_view_DisplayList_setScaleX },
- { "nSetScaleY", "(IF)V", (void*) android_view_DisplayList_setScaleY },
- { "nSetTransformationInfo","(IFFFFFFFFF)V",
+ { "nSetTranslationX", "(JF)V", (void*) android_view_DisplayList_setTranslationX },
+ { "nSetTranslationY", "(JF)V", (void*) android_view_DisplayList_setTranslationY },
+ { "nSetTranslationZ", "(JF)V", (void*) android_view_DisplayList_setTranslationZ },
+ { "nSetRotation", "(JF)V", (void*) android_view_DisplayList_setRotation },
+ { "nSetRotationX", "(JF)V", (void*) android_view_DisplayList_setRotationX },
+ { "nSetRotationY", "(JF)V", (void*) android_view_DisplayList_setRotationY },
+ { "nSetScaleX", "(JF)V", (void*) android_view_DisplayList_setScaleX },
+ { "nSetScaleY", "(JF)V", (void*) android_view_DisplayList_setScaleY },
+ { "nSetTransformationInfo","(JFFFFFFFFF)V",
(void*) android_view_DisplayList_setTransformationInfo },
- { "nSetPivotX", "(IF)V", (void*) android_view_DisplayList_setPivotX },
- { "nSetPivotY", "(IF)V", (void*) android_view_DisplayList_setPivotY },
- { "nSetCameraDistance", "(IF)V", (void*) android_view_DisplayList_setCameraDistance },
- { "nSetLeft", "(II)V", (void*) android_view_DisplayList_setLeft },
- { "nSetTop", "(II)V", (void*) android_view_DisplayList_setTop },
- { "nSetRight", "(II)V", (void*) android_view_DisplayList_setRight },
- { "nSetBottom", "(II)V", (void*) android_view_DisplayList_setBottom },
- { "nSetLeftTopRightBottom","(IIIII)V", (void*) android_view_DisplayList_setLeftTopRightBottom },
- { "nOffsetLeftAndRight", "(IF)V", (void*) android_view_DisplayList_offsetLeftAndRight },
- { "nOffsetTopAndBottom", "(IF)V", (void*) android_view_DisplayList_offsetTopAndBottom },
+ { "nSetPivotX", "(JF)V", (void*) android_view_DisplayList_setPivotX },
+ { "nSetPivotY", "(JF)V", (void*) android_view_DisplayList_setPivotY },
+ { "nSetCameraDistance", "(JF)V", (void*) android_view_DisplayList_setCameraDistance },
+ { "nSetLeft", "(JI)V", (void*) android_view_DisplayList_setLeft },
+ { "nSetTop", "(JI)V", (void*) android_view_DisplayList_setTop },
+ { "nSetRight", "(JI)V", (void*) android_view_DisplayList_setRight },
+ { "nSetBottom", "(JI)V", (void*) android_view_DisplayList_setBottom },
+ { "nSetLeftTopRightBottom","(JIIII)V", (void*) android_view_DisplayList_setLeftTopRightBottom },
+ { "nOffsetLeftAndRight", "(JF)V", (void*) android_view_DisplayList_offsetLeftAndRight },
+ { "nOffsetTopAndBottom", "(JF)V", (void*) android_view_DisplayList_offsetTopAndBottom },
- { "nGetMatrix", "(II)V", (void*) android_view_DisplayList_getMatrix },
- { "nHasOverlappingRendering", "(I)Z", (void*) android_view_DisplayList_hasOverlappingRendering },
- { "nGetAlpha", "(I)F", (void*) android_view_DisplayList_getAlpha },
- { "nGetLeft", "(I)F", (void*) android_view_DisplayList_getLeft },
- { "nGetTop", "(I)F", (void*) android_view_DisplayList_getTop },
- { "nGetRight", "(I)F", (void*) android_view_DisplayList_getRight },
- { "nGetBottom", "(I)F", (void*) android_view_DisplayList_getBottom },
- { "nGetCameraDistance", "(I)F", (void*) android_view_DisplayList_getCameraDistance },
- { "nGetScaleX", "(I)F", (void*) android_view_DisplayList_getScaleX },
- { "nGetScaleY", "(I)F", (void*) android_view_DisplayList_getScaleY },
- { "nGetTranslationX", "(I)F", (void*) android_view_DisplayList_getTranslationX },
- { "nGetTranslationY", "(I)F", (void*) android_view_DisplayList_getTranslationY },
- { "nGetRotation", "(I)F", (void*) android_view_DisplayList_getRotation },
- { "nGetRotationX", "(I)F", (void*) android_view_DisplayList_getRotationX },
- { "nGetRotationY", "(I)F", (void*) android_view_DisplayList_getRotationY },
- { "nGetPivotX", "(I)F", (void*) android_view_DisplayList_getPivotX },
- { "nGetPivotY", "(I)F", (void*) android_view_DisplayList_getPivotY },
+ { "nGetMatrix", "(JJ)V", (void*) android_view_DisplayList_getMatrix },
+ { "nHasOverlappingRendering", "(J)Z", (void*) android_view_DisplayList_hasOverlappingRendering },
+ { "nGetAlpha", "(J)F", (void*) android_view_DisplayList_getAlpha },
+ { "nGetLeft", "(J)F", (void*) android_view_DisplayList_getLeft },
+ { "nGetTop", "(J)F", (void*) android_view_DisplayList_getTop },
+ { "nGetRight", "(J)F", (void*) android_view_DisplayList_getRight },
+ { "nGetBottom", "(J)F", (void*) android_view_DisplayList_getBottom },
+ { "nGetCameraDistance", "(J)F", (void*) android_view_DisplayList_getCameraDistance },
+ { "nGetScaleX", "(J)F", (void*) android_view_DisplayList_getScaleX },
+ { "nGetScaleY", "(J)F", (void*) android_view_DisplayList_getScaleY },
+ { "nGetTranslationX", "(J)F", (void*) android_view_DisplayList_getTranslationX },
+ { "nGetTranslationY", "(J)F", (void*) android_view_DisplayList_getTranslationY },
+ { "nGetRotation", "(J)F", (void*) android_view_DisplayList_getRotation },
+ { "nGetRotationX", "(J)F", (void*) android_view_DisplayList_getRotationX },
+ { "nGetRotationY", "(J)F", (void*) android_view_DisplayList_getRotationY },
+ { "nGetPivotX", "(J)F", (void*) android_view_DisplayList_getPivotX },
+ { "nGetPivotY", "(J)F", (void*) android_view_DisplayList_getPivotY },
#endif
};
diff --git a/core/jni/android_view_GLES20Canvas.cpp b/core/jni/android_view_GLES20Canvas.cpp
index 32e0f3b..6cc94e3 100644
--- a/core/jni/android_view_GLES20Canvas.cpp
+++ b/core/jni/android_view_GLES20Canvas.cpp
@@ -94,17 +94,17 @@
// ----------------------------------------------------------------------------
static void android_view_GLES20Canvas_flushCaches(JNIEnv* env, jobject clazz,
- Caches::FlushMode mode) {
+ jint mode) {
if (Caches::hasInstance()) {
- Caches::getInstance().flush(mode);
+ Caches::getInstance().flush(static_cast<Caches::FlushMode>(mode));
}
}
-static bool android_view_GLES20Canvas_initCaches(JNIEnv* env, jobject clazz) {
+static jboolean android_view_GLES20Canvas_initCaches(JNIEnv* env, jobject clazz) {
if (Caches::hasInstance()) {
- return Caches::getInstance().init();
+ return Caches::getInstance().init() ? JNI_TRUE : JNI_FALSE;
}
- return false;
+ return JNI_FALSE;
}
static void android_view_GLES20Canvas_terminateCaches(JNIEnv* env, jobject clazz) {
@@ -132,15 +132,15 @@
// Constructors
// ----------------------------------------------------------------------------
-static jint android_view_GLES20Canvas_createRenderer(JNIEnv* env, jobject clazz) {
+static jlong android_view_GLES20Canvas_createRenderer(JNIEnv* env, jobject clazz) {
RENDERER_LOGD("Create OpenGLRenderer");
OpenGLRenderer* renderer = new OpenGLRenderer();
renderer->initProperties();
- return reinterpret_cast<jint>(renderer);
+ return reinterpret_cast<jlong>(renderer);
}
static void android_view_GLES20Canvas_destroyRenderer(JNIEnv* env, jobject clazz,
- jint rendererPtr) {
+ jlong rendererPtr) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
RENDERER_LOGD("Destroy OpenGLRenderer");
delete renderer;
@@ -151,26 +151,26 @@
// ----------------------------------------------------------------------------
static void android_view_GLES20Canvas_setViewport(JNIEnv* env, jobject clazz,
- jint rendererPtr, jint width, jint height) {
+ jlong rendererPtr, jint width, jint height) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
renderer->setViewport(width, height);
}
static int android_view_GLES20Canvas_prepare(JNIEnv* env, jobject clazz,
- jint rendererPtr, jboolean opaque) {
+ jlong rendererPtr, jboolean opaque) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
return renderer->prepare(opaque);
}
static int android_view_GLES20Canvas_prepareDirty(JNIEnv* env, jobject clazz,
- jint rendererPtr, jint left, jint top, jint right, jint bottom,
+ jlong rendererPtr, jint left, jint top, jint right, jint bottom,
jboolean opaque) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
return renderer->prepareDirty(left, top, right, bottom, opaque);
}
static void android_view_GLES20Canvas_finish(JNIEnv* env, jobject clazz,
- jint rendererPtr) {
+ jlong rendererPtr) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
renderer->finish();
}
@@ -198,13 +198,13 @@
}
static void android_view_GLES20Canvas_setCountOverdrawEnabled(JNIEnv* env, jobject clazz,
- jint rendererPtr, jboolean enabled) {
+ jlong rendererPtr, jboolean enabled) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
renderer->setCountOverdrawEnabled(enabled);
}
static jfloat android_view_GLES20Canvas_getOverdraw(JNIEnv* env, jobject clazz,
- jint rendererPtr) {
+ jlong rendererPtr) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
return renderer->getOverdraw();
}
@@ -214,7 +214,7 @@
// ----------------------------------------------------------------------------
static jint android_view_GLES20Canvas_callDrawGLFunction(JNIEnv* env, jobject clazz,
- jint rendererPtr, jint functorPtr) {
+ jlong rendererPtr, jlong functorPtr) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
Functor* functor = reinterpret_cast<Functor*>(functorPtr);
android::uirenderer::Rect dirty;
@@ -222,21 +222,21 @@
}
static void android_view_GLES20Canvas_detachFunctor(JNIEnv* env,
- jobject clazz, jint rendererPtr, jint functorPtr) {
+ jobject clazz, jlong rendererPtr, jint functorPtr) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
Functor* functor = reinterpret_cast<Functor*>(functorPtr);
renderer->detachFunctor(functor);
}
static void android_view_GLES20Canvas_attachFunctor(JNIEnv* env,
- jobject clazz, jint rendererPtr, jint functorPtr) {
+ jobject clazz, jlong rendererPtr, jlong functorPtr) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
Functor* functor = reinterpret_cast<Functor*>(functorPtr);
renderer->attachFunctor(functor);
}
static jint android_view_GLES20Canvas_invokeFunctors(JNIEnv* env,
- jobject clazz, jint rendererPtr, jobject dirty) {
+ jobject clazz, jlong rendererPtr, jobject dirty) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
android::uirenderer::Rect bounds;
status_t status = renderer->invokeFunctors(bounds);
@@ -263,26 +263,26 @@
// State
// ----------------------------------------------------------------------------
-static jint android_view_GLES20Canvas_save(JNIEnv* env, jobject clazz, jint rendererPtr,
+static jint android_view_GLES20Canvas_save(JNIEnv* env, jobject clazz, jlong rendererPtr,
jint flags) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
return renderer->save(flags);
}
static jint android_view_GLES20Canvas_getSaveCount(JNIEnv* env, jobject clazz,
- jint rendererPtr) {
+ jlong rendererPtr) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
return renderer->getSaveCount();
}
static void android_view_GLES20Canvas_restore(JNIEnv* env, jobject clazz,
- jint rendererPtr) {
+ jlong rendererPtr) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
renderer->restore();
}
static void android_view_GLES20Canvas_restoreToCount(JNIEnv* env, jobject clazz,
- jint rendererPtr, jint saveCount) {
+ jlong rendererPtr, jint saveCount) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
renderer->restoreToCount(saveCount);
}
@@ -292,15 +292,15 @@
// ----------------------------------------------------------------------------
static jint android_view_GLES20Canvas_saveLayer(JNIEnv* env, jobject clazz,
- jint rendererPtr, jfloat left, jfloat top, jfloat right, jfloat bottom,
- jint paintPtr, jint saveFlags) {
+ jlong rendererPtr, jfloat left, jfloat top, jfloat right, jfloat bottom,
+ jlong paintPtr, jint saveFlags) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
SkPaint* paint = reinterpret_cast<SkPaint*>(paintPtr);
return renderer->saveLayer(left, top, right, bottom, paint, saveFlags);
}
static jint android_view_GLES20Canvas_saveLayerClip(JNIEnv* env, jobject clazz,
- jint rendererPtr, jint paintPtr, jint saveFlags) {
+ jlong rendererPtr, jlong paintPtr, jint saveFlags) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
SkPaint* paint = reinterpret_cast<SkPaint*>(paintPtr);
const android::uirenderer::Rect& bounds(renderer->getClipBounds());
@@ -309,14 +309,14 @@
}
static jint android_view_GLES20Canvas_saveLayerAlpha(JNIEnv* env, jobject clazz,
- jint rendererPtr, jfloat left, jfloat top, jfloat right, jfloat bottom,
+ jlong rendererPtr, jfloat left, jfloat top, jfloat right, jfloat bottom,
jint alpha, jint saveFlags) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
return renderer->saveLayerAlpha(left, top, right, bottom, alpha, saveFlags);
}
static jint android_view_GLES20Canvas_saveLayerAlphaClip(JNIEnv* env, jobject clazz,
- jint rendererPtr, jint alpha, jint saveFlags) {
+ jlong rendererPtr, jint alpha, jint saveFlags) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
const android::uirenderer::Rect& bounds(renderer->getClipBounds());
return renderer->saveLayerAlpha(bounds.left, bounds.top, bounds.right, bounds.bottom,
@@ -327,49 +327,57 @@
// Clipping
// ----------------------------------------------------------------------------
-static bool android_view_GLES20Canvas_quickReject(JNIEnv* env, jobject clazz,
- jint rendererPtr, jfloat left, jfloat top, jfloat right, jfloat bottom) {
+static jboolean android_view_GLES20Canvas_quickReject(JNIEnv* env, jobject clazz,
+ jlong rendererPtr, jfloat left, jfloat top, jfloat right, jfloat bottom) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
- return renderer->quickRejectConservative(left, top, right, bottom);
+ const bool result = renderer->quickRejectConservative(left, top, right, bottom);
+ return result ? JNI_TRUE : JNI_FALSE;
}
-static bool android_view_GLES20Canvas_clipRectF(JNIEnv* env, jobject clazz,
- jint rendererPtr, jfloat left, jfloat top, jfloat right, jfloat bottom,
- SkRegion::Op op) {
+static jboolean android_view_GLES20Canvas_clipRectF(JNIEnv* env, jobject clazz,
+ jlong rendererPtr, jfloat left, jfloat top, jfloat right, jfloat bottom,
+ jint op) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
- return renderer->clipRect(left, top, right, bottom, op);
+ const bool result = renderer->clipRect(left, top, right, bottom,
+ static_cast<SkRegion::Op>(op));
+ return result ? JNI_TRUE : JNI_FALSE;
}
-static bool android_view_GLES20Canvas_clipRect(JNIEnv* env, jobject clazz,
- jint rendererPtr, jint left, jint top, jint right, jint bottom,
- SkRegion::Op op) {
+static jboolean android_view_GLES20Canvas_clipRect(JNIEnv* env, jobject clazz,
+ jlong rendererPtr, jint left, jint top, jint right, jint bottom,
+ jint op) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
- return renderer->clipRect(float(left), float(top), float(right), float(bottom), op);
+ const bool result = renderer->clipRect(float(left), float(top), float(right),
+ float(bottom),
+ static_cast<SkRegion::Op>(op));
+ return result ? JNI_TRUE : JNI_FALSE;
}
-static bool android_view_GLES20Canvas_clipPath(JNIEnv* env, jobject clazz,
- jint rendererPtr, jint pathPtr, SkRegion::Op op) {
+static jboolean android_view_GLES20Canvas_clipPath(JNIEnv* env, jobject clazz,
+ jlong rendererPtr, jlong pathPtr, jint op) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
SkPath* path = reinterpret_cast<SkPath*>(pathPtr);
- return renderer->clipPath(path, op);
+ const bool result = renderer->clipPath(path, static_cast<SkRegion::Op>(op));
+ return result ? JNI_TRUE : JNI_FALSE;
}
-static bool android_view_GLES20Canvas_clipRegion(JNIEnv* env, jobject clazz,
- jint rendererPtr, jint regionPtr, SkRegion::Op op) {
+static jboolean android_view_GLES20Canvas_clipRegion(JNIEnv* env, jobject clazz,
+ jlong rendererPtr, jlong regionPtr, jint op) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
SkRegion* region = reinterpret_cast<SkRegion*>(regionPtr);
- return renderer->clipRegion(region, op);
+ const bool result = renderer->clipRegion(region, static_cast<SkRegion::Op>(op));
+ return result ? JNI_TRUE : JNI_FALSE;
}
-static bool android_view_GLES20Canvas_getClipBounds(JNIEnv* env, jobject clazz,
- jint rendererPtr, jobject rect) {
+static jboolean android_view_GLES20Canvas_getClipBounds(JNIEnv* env, jobject clazz,
+ jlong rendererPtr, jobject rect) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
const android::uirenderer::Rect& bounds(renderer->getClipBounds());
env->CallVoidMethod(rect, gRectClassInfo.set,
int(bounds.left), int(bounds.top), int(bounds.right), int(bounds.bottom));
- return !bounds.isEmpty();
+ return !bounds.isEmpty() ? JNI_TRUE : JNI_FALSE;
}
// ----------------------------------------------------------------------------
@@ -377,45 +385,45 @@
// ----------------------------------------------------------------------------
static void android_view_GLES20Canvas_translate(JNIEnv* env, jobject clazz,
- jint rendererPtr, jfloat dx, jfloat dy) {
+ jlong rendererPtr, jfloat dx, jfloat dy) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
renderer->translate(dx, dy);
}
static void android_view_GLES20Canvas_rotate(JNIEnv* env, jobject clazz,
- jint rendererPtr, jfloat degrees) {
+ jlong rendererPtr, jfloat degrees) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
renderer->rotate(degrees);
}
static void android_view_GLES20Canvas_scale(JNIEnv* env, jobject clazz,
- jint rendererPtr, jfloat sx, jfloat sy) {
+ jlong rendererPtr, jfloat sx, jfloat sy) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
renderer->scale(sx, sy);
}
static void android_view_GLES20Canvas_skew(JNIEnv* env, jobject clazz,
- jint rendererPtr, jfloat sx, jfloat sy) {
+ jlong rendererPtr, jfloat sx, jfloat sy) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
renderer->skew(sx, sy);
}
static void android_view_GLES20Canvas_setMatrix(JNIEnv* env, jobject clazz,
- jint rendererPtr, jint matrixPtr) {
+ jlong rendererPtr, jlong matrixPtr) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixPtr);
renderer->setMatrix(matrix);
}
static void android_view_GLES20Canvas_getMatrix(JNIEnv* env, jobject clazz,
- jint rendererPtr, jint matrixPtr) {
+ jlong rendererPtr, jlong matrixPtr) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixPtr);
renderer->getMatrix(matrix);
}
static void android_view_GLES20Canvas_concatMatrix(JNIEnv* env, jobject clazz,
- jint rendererPtr, jint matrixPtr) {
+ jlong rendererPtr, jlong matrixPtr) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixPtr);
renderer->concatMatrix(matrix);
@@ -426,8 +434,8 @@
// ----------------------------------------------------------------------------
static void android_view_GLES20Canvas_drawBitmap(JNIEnv* env, jobject clazz,
- jint rendererPtr, jint bitmapPtr, jbyteArray buffer,
- jfloat left, jfloat top, jint paintPtr) {
+ jlong rendererPtr, jlong bitmapPtr, jbyteArray buffer,
+ jfloat left, jfloat top, jlong paintPtr) {
SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapPtr);
// This object allows the renderer to allocate a global JNI ref to the buffer object.
JavaHeapBitmapRef bitmapRef(env, bitmap, buffer);
@@ -438,9 +446,9 @@
}
static void android_view_GLES20Canvas_drawBitmapRect(JNIEnv* env, jobject clazz,
- jint rendererPtr, jint bitmapPtr, jbyteArray buffer,
+ jlong rendererPtr, jlong bitmapPtr, jbyteArray buffer,
float srcLeft, float srcTop, float srcRight, float srcBottom,
- float dstLeft, float dstTop, float dstRight, float dstBottom, jint paintPtr) {
+ float dstLeft, float dstTop, float dstRight, float dstBottom, jlong paintPtr) {
SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapPtr);
// This object allows the renderer to allocate a global JNI ref to the buffer object.
JavaHeapBitmapRef bitmapRef(env, bitmap, buffer);
@@ -452,8 +460,8 @@
}
static void android_view_GLES20Canvas_drawBitmapMatrix(JNIEnv* env, jobject clazz,
- jint rendererPtr, jint bitmapPtr, jbyteArray buffer,
- jint matrixPtr, jint paintPtr) {
+ jlong rendererPtr, jlong bitmapPtr, jbyteArray buffer,
+ jlong matrixPtr, jlong paintPtr) {
SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapPtr);
// This object allows the renderer to allocate a global JNI ref to the buffer object.
JavaHeapBitmapRef bitmapRef(env, bitmap, buffer);
@@ -465,8 +473,8 @@
}
static void android_view_GLES20Canvas_drawBitmapData(JNIEnv* env, jobject clazz,
- jint rendererPtr, jintArray colors, jint offset, jint stride,
- jfloat left, jfloat top, jint width, jint height, jboolean hasAlpha, jint paintPtr) {
+ jlong rendererPtr, jintArray colors, jint offset, jint stride,
+ jfloat left, jfloat top, jint width, jint height, jboolean hasAlpha, jlong paintPtr) {
SkBitmap* bitmap = new SkBitmap;
bitmap->setConfig(hasAlpha ? SkBitmap::kARGB_8888_Config : SkBitmap::kRGB_565_Config,
width, height);
@@ -492,9 +500,9 @@
}
static void android_view_GLES20Canvas_drawBitmapMesh(JNIEnv* env, jobject clazz,
- jint rendererPtr, jint bitmapPtr, jbyteArray buffer,
+ jlong rendererPtr, jlong bitmapPtr, jbyteArray buffer,
jint meshWidth, jint meshHeight, jfloatArray vertices, jint offset, jintArray colors,
- jint colorOffset, jint paintPtr) {
+ jint colorOffset, jlong paintPtr) {
SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapPtr);
// This object allows the renderer to allocate a global JNI ref to the buffer object.
JavaHeapBitmapRef bitmapRef(env, bitmap, buffer);
@@ -511,8 +519,8 @@
}
static void android_view_GLES20Canvas_drawPatch(JNIEnv* env, jobject clazz,
- jint rendererPtr, jint bitmapPtr, jbyteArray buffer, jint patchPtr,
- float left, float top, float right, float bottom, jint paintPtr) {
+ jlong rendererPtr, jlong bitmapPtr, jbyteArray buffer, jlong patchPtr,
+ float left, float top, float right, float bottom, jlong paintPtr) {
SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapPtr);
// This object allows the renderer to allocate a global JNI ref to the buffer object.
JavaHeapBitmapRef bitmapRef(env, bitmap, buffer);
@@ -524,52 +532,52 @@
}
static void android_view_GLES20Canvas_drawColor(JNIEnv* env, jobject clazz,
- jint rendererPtr, jint color, SkXfermode::Mode mode) {
+ jlong rendererPtr, jint color, jint mode) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
- renderer->drawColor(color, mode);
+ renderer->drawColor(color, static_cast<SkXfermode::Mode>(mode));
}
static void android_view_GLES20Canvas_drawRect(JNIEnv* env, jobject clazz,
- jint rendererPtr, jfloat left, jfloat top, jfloat right, jfloat bottom,
- jint paintPtr) {
+ jlong rendererPtr, jfloat left, jfloat top, jfloat right, jfloat bottom,
+ jlong paintPtr) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
SkPaint* paint = reinterpret_cast<SkPaint*>(paintPtr);
renderer->drawRect(left, top, right, bottom, paint);
}
static void android_view_GLES20Canvas_drawRoundRect(JNIEnv* env, jobject clazz,
- jint rendererPtr, jfloat left, jfloat top, jfloat right, jfloat bottom,
- jfloat rx, jfloat ry, jint paintPtr) {
+ jlong rendererPtr, jfloat left, jfloat top, jfloat right, jfloat bottom,
+ jfloat rx, jfloat ry, jlong paintPtr) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
SkPaint* paint = reinterpret_cast<SkPaint*>(paintPtr);
renderer->drawRoundRect(left, top, right, bottom, rx, ry, paint);
}
static void android_view_GLES20Canvas_drawCircle(JNIEnv* env, jobject clazz,
- jint rendererPtr, jfloat x, jfloat y, jfloat radius, jint paintPtr) {
+ jlong rendererPtr, jfloat x, jfloat y, jfloat radius, jlong paintPtr) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
SkPaint* paint = reinterpret_cast<SkPaint*>(paintPtr);
renderer->drawCircle(x, y, radius, paint);
}
static void android_view_GLES20Canvas_drawOval(JNIEnv* env, jobject clazz,
- jint rendererPtr, jfloat left, jfloat top, jfloat right, jfloat bottom,
- jint paintPtr) {
+ jlong rendererPtr, jfloat left, jfloat top, jfloat right, jfloat bottom,
+ jlong paintPtr) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
SkPaint* paint = reinterpret_cast<SkPaint*>(paintPtr);
renderer->drawOval(left, top, right, bottom, paint);
}
static void android_view_GLES20Canvas_drawArc(JNIEnv* env, jobject clazz,
- jint rendererPtr, jfloat left, jfloat top, jfloat right, jfloat bottom,
- jfloat startAngle, jfloat sweepAngle, jboolean useCenter, jint paintPtr) {
+ jlong rendererPtr, jfloat left, jfloat top, jfloat right, jfloat bottom,
+ jfloat startAngle, jfloat sweepAngle, jboolean useCenter, jlong paintPtr) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
SkPaint* paint = reinterpret_cast<SkPaint*>(paintPtr);
renderer->drawArc(left, top, right, bottom, startAngle, sweepAngle, useCenter, paint);
}
static void android_view_GLES20Canvas_drawRegionAsRects(JNIEnv* env, jobject clazz,
- jint rendererPtr, jint regionPtr, jint paintPtr) {
+ jlong rendererPtr, jlong regionPtr, jlong paintPtr) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
SkRegion* region = reinterpret_cast<SkRegion*>(regionPtr);
SkPaint* paint = reinterpret_cast<SkPaint*>(paintPtr);
@@ -599,7 +607,7 @@
}
static void android_view_GLES20Canvas_drawRects(JNIEnv* env, jobject clazz,
- jint rendererPtr, jfloatArray rects, jint count, jint paintPtr) {
+ jlong rendererPtr, jfloatArray rects, jint count, jlong paintPtr) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
jfloat* storage = env->GetFloatArrayElements(rects, NULL);
SkPaint* paint = reinterpret_cast<SkPaint*>(paintPtr);
@@ -608,7 +616,7 @@
}
static void android_view_GLES20Canvas_drawPoints(JNIEnv* env, jobject clazz,
- jint rendererPtr, jfloatArray points, jint offset, jint count, jint paintPtr) {
+ jlong rendererPtr, jfloatArray points, jint offset, jint count, jlong paintPtr) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
jfloat* storage = env->GetFloatArrayElements(points, NULL);
SkPaint* paint = reinterpret_cast<SkPaint*>(paintPtr);
@@ -617,7 +625,7 @@
}
static void android_view_GLES20Canvas_drawPath(JNIEnv* env, jobject clazz,
- jint rendererPtr, jint pathPtr, jint paintPtr) {
+ jlong rendererPtr, jlong pathPtr, jlong paintPtr) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
SkPath* path = reinterpret_cast<SkPath*>(pathPtr);
SkPaint* paint = reinterpret_cast<SkPaint*>(paintPtr);
@@ -625,7 +633,7 @@
}
static void android_view_GLES20Canvas_drawLines(JNIEnv* env, jobject clazz,
- jint rendererPtr, jfloatArray points, jint offset, jint count, jint paintPtr) {
+ jlong rendererPtr, jfloatArray points, jint offset, jint count, jlong paintPtr) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
jfloat* storage = env->GetFloatArrayElements(points, NULL);
SkPaint* paint = reinterpret_cast<SkPaint*>(paintPtr);
@@ -638,7 +646,7 @@
// ----------------------------------------------------------------------------
static void android_view_GLES20Canvas_resetModifiers(JNIEnv* env, jobject clazz,
- jint rendererPtr, jint modifiers) {
+ jlong rendererPtr, jint modifiers) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
if (modifiers & MODIFIER_SHADOW) renderer->resetShadow();
if (modifiers & MODIFIER_SHADER) renderer->resetShader();
@@ -646,21 +654,21 @@
}
static void android_view_GLES20Canvas_setupShader(JNIEnv* env, jobject clazz,
- jint rendererPtr, jint shaderPtr) {
+ jlong rendererPtr, jlong shaderPtr) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
SkiaShader* shader = reinterpret_cast<SkiaShader*>(shaderPtr);
renderer->setupShader(shader);
}
static void android_view_GLES20Canvas_setupColorFilter(JNIEnv* env, jobject clazz,
- jint rendererPtr, jint colorFilterPtr) {
+ jlong rendererPtr, jlong colorFilterPtr) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
SkiaColorFilter* colorFilter = reinterpret_cast<SkiaColorFilter*>(colorFilterPtr);
renderer->setupColorFilter(colorFilter);
}
static void android_view_GLES20Canvas_setupShadow(JNIEnv* env, jobject clazz,
- jint rendererPtr, jfloat radius, jfloat dx, jfloat dy, jint color) {
+ jlong rendererPtr, jfloat radius, jfloat dx, jfloat dy, jint color) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
renderer->setupShadow(radius, dx, dy, color);
}
@@ -670,13 +678,13 @@
// ----------------------------------------------------------------------------
static void android_view_GLES20Canvas_setupPaintFilter(JNIEnv* env, jobject clazz,
- jint rendererPtr, jint clearBits, jint setBits) {
+ jlong rendererPtr, jint clearBits, jint setBits) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
renderer->setupPaintFilter(clearBits, setBits);
}
static void android_view_GLES20Canvas_resetPaintFilter(JNIEnv* env, jobject clazz,
- jint rendererPtr) {
+ jlong rendererPtr) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
renderer->resetPaintFilter();
}
@@ -757,8 +765,8 @@
}
static void android_view_GLES20Canvas_drawTextArray(JNIEnv* env, jobject clazz,
- jint rendererPtr, jcharArray text, jint index, jint count,
- jfloat x, jfloat y, jint flags, jint paintPtr) {
+ jlong rendererPtr, jcharArray text, jint index, jint count,
+ jfloat x, jfloat y, jint flags, jlong paintPtr) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
jchar* textArray = env->GetCharArrayElements(text, NULL);
SkPaint* paint = reinterpret_cast<SkPaint*>(paintPtr);
@@ -768,8 +776,8 @@
}
static void android_view_GLES20Canvas_drawText(JNIEnv* env, jobject clazz,
- jint rendererPtr, jstring text, jint start, jint end,
- jfloat x, jfloat y, jint flags, jint paintPtr) {
+ jlong rendererPtr, jstring text, jint start, jint end,
+ jfloat x, jfloat y, jint flags, jlong paintPtr) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
const jchar* textArray = env->GetStringChars(text, NULL);
SkPaint* paint = reinterpret_cast<SkPaint*>(paintPtr);
@@ -779,8 +787,8 @@
}
static void android_view_GLES20Canvas_drawTextArrayOnPath(JNIEnv* env, jobject clazz,
- jint rendererPtr, jcharArray text, jint index, jint count,
- jint pathPtr, jfloat hOffset, jfloat vOffset, jint flags, jint paintPtr) {
+ jlong rendererPtr, jcharArray text, jint index, jint count,
+ jlong pathPtr, jfloat hOffset, jfloat vOffset, jint flags, jlong paintPtr) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
jchar* textArray = env->GetCharArrayElements(text, NULL);
SkPath* path = reinterpret_cast<SkPath*>(pathPtr);
@@ -792,8 +800,8 @@
}
static void android_view_GLES20Canvas_drawTextOnPath(JNIEnv* env, jobject clazz,
- jint rendererPtr, jstring text, jint start, jint end,
- jint pathPtr, jfloat hOffset, jfloat vOffset, jint flags, jint paintPtr) {
+ jlong rendererPtr, jstring text, jint start, jint end,
+ jlong pathPtr, jfloat hOffset, jfloat vOffset, jint flags, jlong paintPtr) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
const jchar* textArray = env->GetStringChars(text, NULL);
SkPath* path = reinterpret_cast<SkPath*>(pathPtr);
@@ -805,9 +813,9 @@
}
static void android_view_GLES20Canvas_drawTextRunArray(JNIEnv* env, jobject clazz,
- jint rendererPtr, jcharArray text, jint index, jint count,
+ jlong rendererPtr, jcharArray text, jint index, jint count,
jint contextIndex, jint contextCount, jfloat x, jfloat y, jint dirFlags,
- jint paintPtr) {
+ jlong paintPtr) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
jchar* textArray = env->GetCharArrayElements(text, NULL);
SkPaint* paint = reinterpret_cast<SkPaint*>(paintPtr);
@@ -818,9 +826,9 @@
}
static void android_view_GLES20Canvas_drawTextRun(JNIEnv* env, jobject clazz,
- jint rendererPtr, jstring text, jint start, jint end,
+ jlong rendererPtr, jstring text, jint start, jint end,
jint contextStart, int contextEnd, jfloat x, jfloat y, jint dirFlags,
- jint paintPtr) {
+ jlong paintPtr) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
const jchar* textArray = env->GetStringChars(text, NULL);
jint count = end - start;
@@ -848,8 +856,8 @@
}
static void android_view_GLES20Canvas_drawPosTextArray(JNIEnv* env, jobject clazz,
- jint rendererPtr, jcharArray text, jint index, jint count,
- jfloatArray pos, jint paintPtr) {
+ jlong rendererPtr, jcharArray text, jint index, jint count,
+ jfloatArray pos, jlong paintPtr) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
jchar* textArray = env->GetCharArrayElements(text, NULL);
jfloat* positions = env->GetFloatArrayElements(pos, NULL);
@@ -862,8 +870,8 @@
}
static void android_view_GLES20Canvas_drawPosText(JNIEnv* env, jobject clazz,
- jint rendererPtr, jstring text, jint start, jint end,
- jfloatArray pos, jint paintPtr) {
+ jlong rendererPtr, jstring text, jint start, jint end,
+ jfloatArray pos, jlong paintPtr) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
const jchar* textArray = env->GetStringChars(text, NULL);
jfloat* positions = env->GetFloatArrayElements(pos, NULL);
@@ -880,7 +888,7 @@
// ----------------------------------------------------------------------------
static jint android_view_GLES20Canvas_getDisplayList(JNIEnv* env,
- jobject clazz, jint rendererPtr, jint displayListPtr) {
+ jobject clazz, jlong rendererPtr, jlong displayListPtr) {
DisplayListRenderer* renderer = reinterpret_cast<DisplayListRenderer*>(rendererPtr);
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
return reinterpret_cast<jint>(renderer->getDisplayList(displayList));
@@ -892,13 +900,13 @@
}
static void android_view_GLES20Canvas_resetDisplayListRenderer(JNIEnv* env,
- jobject clazz, jint rendererPtr) {
+ jobject clazz, jlong rendererPtr) {
DisplayListRenderer* renderer = reinterpret_cast<DisplayListRenderer*>(rendererPtr);
renderer->reset();
}
static jint android_view_GLES20Canvas_drawDisplayList(JNIEnv* env,
- jobject clazz, jint rendererPtr, jint displayListPtr,
+ jobject clazz, jlong rendererPtr, jlong displayListPtr,
jobject dirty, jint flags) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListPtr);
@@ -916,19 +924,19 @@
// ----------------------------------------------------------------------------
static void android_view_GLES20Canvas_interrupt(JNIEnv* env, jobject clazz,
- jint rendererPtr) {
+ jlong rendererPtr) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
renderer->interrupt();
}
static void android_view_GLES20Canvas_resume(JNIEnv* env, jobject clazz,
- jint rendererPtr) {
+ jlong rendererPtr) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
renderer->resume();
}
static jint android_view_GLES20Canvas_createLayerRenderer(JNIEnv* env,
- jobject clazz, jint layerPtr) {
+ jobject clazz, jlong layerPtr) {
Layer* layer = reinterpret_cast<Layer*>(layerPtr);
if (layer) {
OpenGLRenderer* renderer = new LayerRenderer(layer);
@@ -938,7 +946,7 @@
return NULL;
}
-static jint android_view_GLES20Canvas_createTextureLayer(JNIEnv* env, jobject clazz,
+static jlong android_view_GLES20Canvas_createTextureLayer(JNIEnv* env, jobject clazz,
jboolean isOpaque, jintArray layerInfo) {
Layer* layer = LayerRenderer::createTextureLayer(isOpaque);
@@ -948,10 +956,10 @@
env->ReleaseIntArrayElements(layerInfo, storage, 0);
}
- return reinterpret_cast<jint>(layer);
+ return reinterpret_cast<jlong>(layer);
}
-static jint android_view_GLES20Canvas_createLayer(JNIEnv* env, jobject clazz,
+static jlong android_view_GLES20Canvas_createLayer(JNIEnv* env, jobject clazz,
jint width, jint height, jboolean isOpaque, jintArray layerInfo) {
Layer* layer = LayerRenderer::createLayer(width, height, isOpaque);
@@ -962,24 +970,24 @@
env->ReleaseIntArrayElements(layerInfo, storage, 0);
}
- return reinterpret_cast<jint>(layer);
+ return reinterpret_cast<jlong>(layer);
}
-static bool android_view_GLES20Canvas_resizeLayer(JNIEnv* env, jobject clazz,
- jint layerPtr, jint width, jint height, jintArray layerInfo) {
+static jboolean android_view_GLES20Canvas_resizeLayer(JNIEnv* env, jobject clazz,
+ jlong layerPtr, jint width, jint height, jintArray layerInfo) {
Layer* layer = reinterpret_cast<Layer*>(layerPtr);
if (LayerRenderer::resizeLayer(layer, width, height)) {
jint* storage = env->GetIntArrayElements(layerInfo, NULL);
storage[0] = layer->getWidth();
storage[1] = layer->getHeight();
env->ReleaseIntArrayElements(layerInfo, storage, 0);
- return true;
+ return JNI_TRUE;
}
- return false;
+ return JNI_FALSE;
}
static void android_view_GLES20Canvas_setLayerPaint(JNIEnv* env, jobject clazz,
- jint layerPtr, jint paintPtr) {
+ jlong layerPtr, jlong paintPtr) {
Layer* layer = reinterpret_cast<Layer*>(layerPtr);
if (layer) {
SkPaint* paint = reinterpret_cast<SkPaint*>(paintPtr);
@@ -988,7 +996,7 @@
}
static void android_view_GLES20Canvas_setLayerColorFilter(JNIEnv* env, jobject clazz,
- jint layerPtr, jint colorFilterPtr) {
+ jlong layerPtr, jlong colorFilterPtr) {
Layer* layer = reinterpret_cast<Layer*>(layerPtr);
if (layer) {
SkiaColorFilter* colorFilter = reinterpret_cast<SkiaColorFilter*>(colorFilterPtr);
@@ -997,7 +1005,7 @@
}
static void android_view_GLES20Canvas_setOpaqueLayer(JNIEnv* env, jobject clazz,
- jint layerPtr, jboolean isOpaque) {
+ jlong layerPtr, jboolean isOpaque) {
Layer* layer = reinterpret_cast<Layer*>(layerPtr);
if (layer) {
layer->setBlend(!isOpaque);
@@ -1005,7 +1013,7 @@
}
static void android_view_GLES20Canvas_updateTextureLayer(JNIEnv* env, jobject clazz,
- jint layerPtr, jint width, jint height, jboolean isOpaque, jobject surface) {
+ jlong layerPtr, jint width, jint height, jboolean isOpaque, jobject surface) {
float transform[16];
sp<GLConsumer> surfaceTexture(SurfaceTexture_getSurfaceTexture(env, surface));
@@ -1036,7 +1044,7 @@
}
static void android_view_GLES20Canvas_updateRenderLayer(JNIEnv* env, jobject clazz,
- jint layerPtr, jint rendererPtr, jint displayListPtr,
+ jlong layerPtr, jlong rendererPtr, jlong displayListPtr,
jint left, jint top, jint right, jint bottom) {
Layer* layer = reinterpret_cast<Layer*>(layerPtr);
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
@@ -1045,65 +1053,65 @@
}
static void android_view_GLES20Canvas_clearLayerTexture(JNIEnv* env, jobject clazz,
- jint layerPtr) {
+ jlong layerPtr) {
Layer* layer = reinterpret_cast<Layer*>(layerPtr);
layer->clearTexture();
}
static void android_view_GLES20Canvas_setTextureLayerTransform(JNIEnv* env, jobject clazz,
- jint layerPtr, jint matrixPtr) {
+ jlong layerPtr, jlong matrixPtr) {
Layer* layer = reinterpret_cast<Layer*>(layerPtr);
SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixPtr);
layer->getTransform().load(*matrix);
}
-static void android_view_GLES20Canvas_destroyLayer(JNIEnv* env, jobject clazz, jint layerPtr) {
+static void android_view_GLES20Canvas_destroyLayer(JNIEnv* env, jobject clazz, jlong layerPtr) {
Layer* layer = reinterpret_cast<Layer*>(layerPtr);
LayerRenderer::destroyLayer(layer);
}
static void android_view_GLES20Canvas_destroyLayerDeferred(JNIEnv* env,
- jobject clazz, jint layerPtr) {
+ jobject clazz, jlong layerPtr) {
Layer* layer = reinterpret_cast<Layer*>(layerPtr);
LayerRenderer::destroyLayerDeferred(layer);
}
static void android_view_GLES20Canvas_drawLayer(JNIEnv* env, jobject clazz,
- jint rendererPtr, jint layerPtr, jfloat x, jfloat y) {
+ jlong rendererPtr, jlong layerPtr, jfloat x, jfloat y) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
Layer* layer = reinterpret_cast<Layer*>(layerPtr);
renderer->drawLayer(layer, x, y);
}
static jboolean android_view_GLES20Canvas_copyLayer(JNIEnv* env, jobject clazz,
- jint layerPtr, jint bitmapPtr) {
+ jlong layerPtr, jlong bitmapPtr) {
Layer* layer = reinterpret_cast<Layer*>(layerPtr);
SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapPtr);
return LayerRenderer::copyLayer(layer, bitmap);
}
static void android_view_GLES20Canvas_pushLayerUpdate(JNIEnv* env, jobject clazz,
- jint rendererPtr, jint layerPtr) {
+ jlong rendererPtr, jlong layerPtr) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
Layer* layer = reinterpret_cast<Layer*>(layerPtr);
renderer->pushLayerUpdate(layer);
}
static void android_view_GLES20Canvas_cancelLayerUpdate(JNIEnv* env, jobject clazz,
- jint rendererPtr, jint layerPtr) {
+ jlong rendererPtr, jlong layerPtr) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
Layer* layer = reinterpret_cast<Layer*>(layerPtr);
renderer->cancelLayerUpdate(layer);
}
static void android_view_GLES20Canvas_clearLayerUpdates(JNIEnv* env, jobject clazz,
- jint rendererPtr) {
+ jlong rendererPtr) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
renderer->clearLayerUpdates();
}
static void android_view_GLES20Canvas_flushLayerUpdates(JNIEnv* env, jobject clazz,
- jint rendererPtr) {
+ jlong rendererPtr) {
OpenGLRenderer* renderer = reinterpret_cast<OpenGLRenderer*>(rendererPtr);
renderer->flushLayerUpdates();
}
@@ -1159,131 +1167,131 @@
{ "nInitAtlas", "(Landroid/view/GraphicBuffer;[II)V",
(void*) android_view_GLES20Canvas_initAtlas },
- { "nCreateRenderer", "()I", (void*) android_view_GLES20Canvas_createRenderer },
- { "nDestroyRenderer", "(I)V", (void*) android_view_GLES20Canvas_destroyRenderer },
- { "nSetViewport", "(III)V", (void*) android_view_GLES20Canvas_setViewport },
- { "nPrepare", "(IZ)I", (void*) android_view_GLES20Canvas_prepare },
- { "nPrepareDirty", "(IIIIIZ)I", (void*) android_view_GLES20Canvas_prepareDirty },
- { "nFinish", "(I)V", (void*) android_view_GLES20Canvas_finish },
+ { "nCreateRenderer", "()J", (void*) android_view_GLES20Canvas_createRenderer },
+ { "nDestroyRenderer", "(J)V", (void*) android_view_GLES20Canvas_destroyRenderer },
+ { "nSetViewport", "(JII)V", (void*) android_view_GLES20Canvas_setViewport },
+ { "nPrepare", "(JZ)I", (void*) android_view_GLES20Canvas_prepare },
+ { "nPrepareDirty", "(JIIIIZ)I", (void*) android_view_GLES20Canvas_prepareDirty },
+ { "nFinish", "(J)V", (void*) android_view_GLES20Canvas_finish },
{ "nSetProperty", "(Ljava/lang/String;Ljava/lang/String;)V",
(void*) android_view_GLES20Canvas_setProperty },
- { "nSetCountOverdrawEnabled", "(IZ)V", (void*) android_view_GLES20Canvas_setCountOverdrawEnabled },
- { "nGetOverdraw", "(I)F", (void*) android_view_GLES20Canvas_getOverdraw },
+ { "nSetCountOverdrawEnabled", "(JZ)V", (void*) android_view_GLES20Canvas_setCountOverdrawEnabled },
+ { "nGetOverdraw", "(J)F", (void*) android_view_GLES20Canvas_getOverdraw },
{ "nGetStencilSize", "()I", (void*) android_view_GLES20Canvas_getStencilSize },
- { "nCallDrawGLFunction", "(II)I", (void*) android_view_GLES20Canvas_callDrawGLFunction },
- { "nDetachFunctor", "(II)V", (void*) android_view_GLES20Canvas_detachFunctor },
- { "nAttachFunctor", "(II)V", (void*) android_view_GLES20Canvas_attachFunctor },
- { "nInvokeFunctors", "(ILandroid/graphics/Rect;)I",
+ { "nCallDrawGLFunction", "(JJ)I", (void*) android_view_GLES20Canvas_callDrawGLFunction },
+ { "nDetachFunctor", "(JJ)V", (void*) android_view_GLES20Canvas_detachFunctor },
+ { "nAttachFunctor", "(JJ)V", (void*) android_view_GLES20Canvas_attachFunctor },
+ { "nInvokeFunctors", "(JLandroid/graphics/Rect;)I",
(void*) android_view_GLES20Canvas_invokeFunctors },
- { "nSave", "(II)I", (void*) android_view_GLES20Canvas_save },
- { "nRestore", "(I)V", (void*) android_view_GLES20Canvas_restore },
- { "nRestoreToCount", "(II)V", (void*) android_view_GLES20Canvas_restoreToCount },
- { "nGetSaveCount", "(I)I", (void*) android_view_GLES20Canvas_getSaveCount },
+ { "nSave", "(JI)I", (void*) android_view_GLES20Canvas_save },
+ { "nRestore", "(J)V", (void*) android_view_GLES20Canvas_restore },
+ { "nRestoreToCount", "(JI)V", (void*) android_view_GLES20Canvas_restoreToCount },
+ { "nGetSaveCount", "(J)I", (void*) android_view_GLES20Canvas_getSaveCount },
- { "nSaveLayer", "(IFFFFII)I", (void*) android_view_GLES20Canvas_saveLayer },
- { "nSaveLayer", "(III)I", (void*) android_view_GLES20Canvas_saveLayerClip },
- { "nSaveLayerAlpha", "(IFFFFII)I", (void*) android_view_GLES20Canvas_saveLayerAlpha },
- { "nSaveLayerAlpha", "(III)I", (void*) android_view_GLES20Canvas_saveLayerAlphaClip },
+ { "nSaveLayer", "(JFFFFJI)I", (void*) android_view_GLES20Canvas_saveLayer },
+ { "nSaveLayer", "(JJI)I", (void*) android_view_GLES20Canvas_saveLayerClip },
+ { "nSaveLayerAlpha", "(JFFFFII)I", (void*) android_view_GLES20Canvas_saveLayerAlpha },
+ { "nSaveLayerAlpha", "(JII)I", (void*) android_view_GLES20Canvas_saveLayerAlphaClip },
- { "nQuickReject", "(IFFFF)Z", (void*) android_view_GLES20Canvas_quickReject },
- { "nClipRect", "(IFFFFI)Z", (void*) android_view_GLES20Canvas_clipRectF },
- { "nClipRect", "(IIIIII)Z", (void*) android_view_GLES20Canvas_clipRect },
- { "nClipPath", "(III)Z", (void*) android_view_GLES20Canvas_clipPath },
- { "nClipRegion", "(III)Z", (void*) android_view_GLES20Canvas_clipRegion },
+ { "nQuickReject", "(JFFFF)Z", (void*) android_view_GLES20Canvas_quickReject },
+ { "nClipRect", "(JFFFFI)Z", (void*) android_view_GLES20Canvas_clipRectF },
+ { "nClipRect", "(JIIIII)Z", (void*) android_view_GLES20Canvas_clipRect },
+ { "nClipPath", "(JJI)Z", (void*) android_view_GLES20Canvas_clipPath },
+ { "nClipRegion", "(JJI)Z", (void*) android_view_GLES20Canvas_clipRegion },
- { "nTranslate", "(IFF)V", (void*) android_view_GLES20Canvas_translate },
- { "nRotate", "(IF)V", (void*) android_view_GLES20Canvas_rotate },
- { "nScale", "(IFF)V", (void*) android_view_GLES20Canvas_scale },
- { "nSkew", "(IFF)V", (void*) android_view_GLES20Canvas_skew },
+ { "nTranslate", "(JFF)V", (void*) android_view_GLES20Canvas_translate },
+ { "nRotate", "(JF)V", (void*) android_view_GLES20Canvas_rotate },
+ { "nScale", "(JFF)V", (void*) android_view_GLES20Canvas_scale },
+ { "nSkew", "(JFF)V", (void*) android_view_GLES20Canvas_skew },
- { "nSetMatrix", "(II)V", (void*) android_view_GLES20Canvas_setMatrix },
- { "nGetMatrix", "(II)V", (void*) android_view_GLES20Canvas_getMatrix },
- { "nConcatMatrix", "(II)V", (void*) android_view_GLES20Canvas_concatMatrix },
+ { "nSetMatrix", "(JJ)V", (void*) android_view_GLES20Canvas_setMatrix },
+ { "nGetMatrix", "(JJ)V", (void*) android_view_GLES20Canvas_getMatrix },
+ { "nConcatMatrix", "(JJ)V", (void*) android_view_GLES20Canvas_concatMatrix },
- { "nDrawBitmap", "(II[BFFI)V", (void*) android_view_GLES20Canvas_drawBitmap },
- { "nDrawBitmap", "(II[BFFFFFFFFI)V",(void*) android_view_GLES20Canvas_drawBitmapRect },
- { "nDrawBitmap", "(II[BII)V", (void*) android_view_GLES20Canvas_drawBitmapMatrix },
- { "nDrawBitmap", "(I[IIIFFIIZI)V", (void*) android_view_GLES20Canvas_drawBitmapData },
+ { "nDrawBitmap", "(JJ[BFFJ)V", (void*) android_view_GLES20Canvas_drawBitmap },
+ { "nDrawBitmap", "(JJ[BFFFFFFFFJ)V",(void*) android_view_GLES20Canvas_drawBitmapRect },
+ { "nDrawBitmap", "(JJ[BJJ)V", (void*) android_view_GLES20Canvas_drawBitmapMatrix },
+ { "nDrawBitmap", "(J[IIIFFIIZJ)V", (void*) android_view_GLES20Canvas_drawBitmapData },
- { "nDrawBitmapMesh", "(II[BII[FI[III)V",(void*) android_view_GLES20Canvas_drawBitmapMesh },
+ { "nDrawBitmapMesh", "(JJ[BII[FI[IIJ)V",(void*) android_view_GLES20Canvas_drawBitmapMesh },
- { "nDrawPatch", "(II[BIFFFFI)V", (void*) android_view_GLES20Canvas_drawPatch },
+ { "nDrawPatch", "(JJ[BJFFFFJ)V", (void*) android_view_GLES20Canvas_drawPatch },
- { "nDrawColor", "(III)V", (void*) android_view_GLES20Canvas_drawColor },
- { "nDrawRect", "(IFFFFI)V", (void*) android_view_GLES20Canvas_drawRect },
- { "nDrawRects", "(III)V", (void*) android_view_GLES20Canvas_drawRegionAsRects },
- { "nDrawRects", "(I[FII)V", (void*) android_view_GLES20Canvas_drawRects },
- { "nDrawRoundRect", "(IFFFFFFI)V", (void*) android_view_GLES20Canvas_drawRoundRect },
- { "nDrawCircle", "(IFFFI)V", (void*) android_view_GLES20Canvas_drawCircle },
- { "nDrawOval", "(IFFFFI)V", (void*) android_view_GLES20Canvas_drawOval },
- { "nDrawArc", "(IFFFFFFZI)V", (void*) android_view_GLES20Canvas_drawArc },
- { "nDrawPoints", "(I[FIII)V", (void*) android_view_GLES20Canvas_drawPoints },
+ { "nDrawColor", "(JII)V", (void*) android_view_GLES20Canvas_drawColor },
+ { "nDrawRect", "(JFFFFJ)V", (void*) android_view_GLES20Canvas_drawRect },
+ { "nDrawRects", "(JJJ)V", (void*) android_view_GLES20Canvas_drawRegionAsRects },
+ { "nDrawRects", "(J[FIJ)V", (void*) android_view_GLES20Canvas_drawRects },
+ { "nDrawRoundRect", "(JFFFFFFJ)V", (void*) android_view_GLES20Canvas_drawRoundRect },
+ { "nDrawCircle", "(JFFFJ)V", (void*) android_view_GLES20Canvas_drawCircle },
+ { "nDrawOval", "(JFFFFJ)V", (void*) android_view_GLES20Canvas_drawOval },
+ { "nDrawArc", "(JFFFFFFZJ)V", (void*) android_view_GLES20Canvas_drawArc },
+ { "nDrawPoints", "(J[FIIJ)V", (void*) android_view_GLES20Canvas_drawPoints },
- { "nDrawPath", "(III)V", (void*) android_view_GLES20Canvas_drawPath },
- { "nDrawLines", "(I[FIII)V", (void*) android_view_GLES20Canvas_drawLines },
+ { "nDrawPath", "(JJJ)V", (void*) android_view_GLES20Canvas_drawPath },
+ { "nDrawLines", "(J[FIIJ)V", (void*) android_view_GLES20Canvas_drawLines },
- { "nResetModifiers", "(II)V", (void*) android_view_GLES20Canvas_resetModifiers },
- { "nSetupShader", "(II)V", (void*) android_view_GLES20Canvas_setupShader },
- { "nSetupColorFilter", "(II)V", (void*) android_view_GLES20Canvas_setupColorFilter },
- { "nSetupShadow", "(IFFFI)V", (void*) android_view_GLES20Canvas_setupShadow },
+ { "nResetModifiers", "(JI)V", (void*) android_view_GLES20Canvas_resetModifiers },
+ { "nSetupShader", "(JJ)V", (void*) android_view_GLES20Canvas_setupShader },
+ { "nSetupColorFilter", "(JJ)V", (void*) android_view_GLES20Canvas_setupColorFilter },
+ { "nSetupShadow", "(JFFFI)V", (void*) android_view_GLES20Canvas_setupShadow },
- { "nSetupPaintFilter", "(III)V", (void*) android_view_GLES20Canvas_setupPaintFilter },
- { "nResetPaintFilter", "(I)V", (void*) android_view_GLES20Canvas_resetPaintFilter },
+ { "nSetupPaintFilter", "(JII)V", (void*) android_view_GLES20Canvas_setupPaintFilter },
+ { "nResetPaintFilter", "(J)V", (void*) android_view_GLES20Canvas_resetPaintFilter },
- { "nDrawText", "(I[CIIFFII)V", (void*) android_view_GLES20Canvas_drawTextArray },
- { "nDrawText", "(ILjava/lang/String;IIFFII)V",
+ { "nDrawText", "(J[CIIFFIJ)V", (void*) android_view_GLES20Canvas_drawTextArray },
+ { "nDrawText", "(JLjava/lang/String;IIFFIJ)V",
(void*) android_view_GLES20Canvas_drawText },
- { "nDrawTextOnPath", "(I[CIIIFFII)V", (void*) android_view_GLES20Canvas_drawTextArrayOnPath },
- { "nDrawTextOnPath", "(ILjava/lang/String;IIIFFII)V",
+ { "nDrawTextOnPath", "(J[CIIJFFIJ)V", (void*) android_view_GLES20Canvas_drawTextArrayOnPath },
+ { "nDrawTextOnPath", "(JLjava/lang/String;IIJFFIJ)V",
(void*) android_view_GLES20Canvas_drawTextOnPath },
- { "nDrawTextRun", "(I[CIIIIFFII)V", (void*) android_view_GLES20Canvas_drawTextRunArray },
- { "nDrawTextRun", "(ILjava/lang/String;IIIIFFII)V",
+ { "nDrawTextRun", "(J[CIIIIFFIJ)V", (void*) android_view_GLES20Canvas_drawTextRunArray },
+ { "nDrawTextRun", "(JLjava/lang/String;IIIIFFIJ)V",
(void*) android_view_GLES20Canvas_drawTextRun },
- { "nDrawPosText", "(I[CII[FI)V", (void*) android_view_GLES20Canvas_drawPosTextArray },
- { "nDrawPosText", "(ILjava/lang/String;II[FI)V",
+ { "nDrawPosText", "(J[CII[FJ)V", (void*) android_view_GLES20Canvas_drawPosTextArray },
+ { "nDrawPosText", "(JLjava/lang/String;II[FJ)V",
(void*) android_view_GLES20Canvas_drawPosText },
- { "nGetClipBounds", "(ILandroid/graphics/Rect;)Z",
+ { "nGetClipBounds", "(JLandroid/graphics/Rect;)Z",
(void*) android_view_GLES20Canvas_getClipBounds },
- { "nGetDisplayList", "(II)I", (void*) android_view_GLES20Canvas_getDisplayList },
- { "nDrawDisplayList", "(IILandroid/graphics/Rect;I)I",
+ { "nGetDisplayList", "(JJ)J", (void*) android_view_GLES20Canvas_getDisplayList },
+ { "nDrawDisplayList", "(JJLandroid/graphics/Rect;I)I",
(void*) android_view_GLES20Canvas_drawDisplayList },
- { "nCreateDisplayListRenderer", "()I", (void*) android_view_GLES20Canvas_createDisplayListRenderer },
- { "nResetDisplayListRenderer", "(I)V", (void*) android_view_GLES20Canvas_resetDisplayListRenderer },
+ { "nCreateDisplayListRenderer", "()J", (void*) android_view_GLES20Canvas_createDisplayListRenderer },
+ { "nResetDisplayListRenderer", "(J)V", (void*) android_view_GLES20Canvas_resetDisplayListRenderer },
- { "nInterrupt", "(I)V", (void*) android_view_GLES20Canvas_interrupt },
- { "nResume", "(I)V", (void*) android_view_GLES20Canvas_resume },
+ { "nInterrupt", "(J)V", (void*) android_view_GLES20Canvas_interrupt },
+ { "nResume", "(J)V", (void*) android_view_GLES20Canvas_resume },
- { "nCreateLayerRenderer", "(I)I", (void*) android_view_GLES20Canvas_createLayerRenderer },
- { "nCreateLayer", "(IIZ[I)I", (void*) android_view_GLES20Canvas_createLayer },
- { "nResizeLayer", "(III[I)Z" , (void*) android_view_GLES20Canvas_resizeLayer },
- { "nSetLayerPaint", "(II)V", (void*) android_view_GLES20Canvas_setLayerPaint },
- { "nSetLayerColorFilter", "(II)V", (void*) android_view_GLES20Canvas_setLayerColorFilter },
- { "nSetOpaqueLayer", "(IZ)V", (void*) android_view_GLES20Canvas_setOpaqueLayer },
- { "nCreateTextureLayer", "(Z[I)I", (void*) android_view_GLES20Canvas_createTextureLayer },
- { "nUpdateTextureLayer", "(IIIZLandroid/graphics/SurfaceTexture;)V",
+ { "nCreateLayerRenderer", "(J)J", (void*) android_view_GLES20Canvas_createLayerRenderer },
+ { "nCreateLayer", "(IIZ[I)J", (void*) android_view_GLES20Canvas_createLayer },
+ { "nResizeLayer", "(JII[I)Z" , (void*) android_view_GLES20Canvas_resizeLayer },
+ { "nSetLayerPaint", "(JJ)V", (void*) android_view_GLES20Canvas_setLayerPaint },
+ { "nSetLayerColorFilter", "(JJ)V", (void*) android_view_GLES20Canvas_setLayerColorFilter },
+ { "nSetOpaqueLayer", "(JZ)V", (void*) android_view_GLES20Canvas_setOpaqueLayer },
+ { "nCreateTextureLayer", "(Z[I)J", (void*) android_view_GLES20Canvas_createTextureLayer },
+ { "nUpdateTextureLayer", "(JIIZLandroid/graphics/SurfaceTexture;)V",
(void*) android_view_GLES20Canvas_updateTextureLayer },
- { "nUpdateRenderLayer", "(IIIIIII)V", (void*) android_view_GLES20Canvas_updateRenderLayer },
- { "nClearLayerTexture", "(I)V", (void*) android_view_GLES20Canvas_clearLayerTexture },
- { "nDestroyLayer", "(I)V", (void*) android_view_GLES20Canvas_destroyLayer },
- { "nDestroyLayerDeferred", "(I)V", (void*) android_view_GLES20Canvas_destroyLayerDeferred },
- { "nDrawLayer", "(IIFF)V", (void*) android_view_GLES20Canvas_drawLayer },
- { "nCopyLayer", "(II)Z", (void*) android_view_GLES20Canvas_copyLayer },
- { "nClearLayerUpdates", "(I)V", (void*) android_view_GLES20Canvas_clearLayerUpdates },
- { "nFlushLayerUpdates", "(I)V", (void*) android_view_GLES20Canvas_flushLayerUpdates },
- { "nPushLayerUpdate", "(II)V", (void*) android_view_GLES20Canvas_pushLayerUpdate },
- { "nCancelLayerUpdate", "(II)V", (void*) android_view_GLES20Canvas_cancelLayerUpdate },
+ { "nUpdateRenderLayer", "(JJJIIII)V", (void*) android_view_GLES20Canvas_updateRenderLayer },
+ { "nClearLayerTexture", "(J)V", (void*) android_view_GLES20Canvas_clearLayerTexture },
+ { "nDestroyLayer", "(J)V", (void*) android_view_GLES20Canvas_destroyLayer },
+ { "nDestroyLayerDeferred", "(J)V", (void*) android_view_GLES20Canvas_destroyLayerDeferred },
+ { "nDrawLayer", "(JJFF)V", (void*) android_view_GLES20Canvas_drawLayer },
+ { "nCopyLayer", "(JJ)Z", (void*) android_view_GLES20Canvas_copyLayer },
+ { "nClearLayerUpdates", "(J)V", (void*) android_view_GLES20Canvas_clearLayerUpdates },
+ { "nFlushLayerUpdates", "(J)V", (void*) android_view_GLES20Canvas_flushLayerUpdates },
+ { "nPushLayerUpdate", "(JJ)V", (void*) android_view_GLES20Canvas_pushLayerUpdate },
+ { "nCancelLayerUpdate", "(JJ)V", (void*) android_view_GLES20Canvas_cancelLayerUpdate },
- { "nSetTextureLayerTransform", "(II)V", (void*) android_view_GLES20Canvas_setTextureLayerTransform },
+ { "nSetTextureLayerTransform", "(JJ)V", (void*) android_view_GLES20Canvas_setTextureLayerTransform },
{ "nGetMaximumTextureWidth", "()I", (void*) android_view_GLES20Canvas_getMaxTextureWidth },
{ "nGetMaximumTextureHeight", "()I", (void*) android_view_GLES20Canvas_getMaxTextureHeight },
diff --git a/core/jni/android_view_GraphicBuffer.cpp b/core/jni/android_view_GraphicBuffer.cpp
index d68c0b2..2e8dccf 100644
--- a/core/jni/android_view_GraphicBuffer.cpp
+++ b/core/jni/android_view_GraphicBuffer.cpp
@@ -89,6 +89,12 @@
#define SET_INT(object, field, value) \
env->SetIntField(object, field, value)
+#define GET_LONG(object, field) \
+ env->GetLongField(object, field)
+
+#define SET_LONG(object, field, value) \
+ env->SetLongField(object, field, value)
+
#define INVOKEV(object, method, ...) \
env->CallVoidMethod(object, method, __VA_ARGS__)
@@ -108,7 +114,7 @@
// GraphicBuffer lifecycle
// ----------------------------------------------------------------------------
-static GraphicBufferWrapper* android_view_GraphiceBuffer_create(JNIEnv* env, jobject clazz,
+static jlong android_view_GraphiceBuffer_create(JNIEnv* env, jobject clazz,
jint width, jint height, jint format, jint usage) {
sp<ISurfaceComposer> composer(ComposerService::getComposerService());
@@ -125,11 +131,14 @@
return NULL;
}
- return new GraphicBufferWrapper(buffer);
+ GraphicBufferWrapper* wrapper = new GraphicBufferWrapper(buffer);
+ return reinterpret_cast<jlong>(wrapper);
}
static void android_view_GraphiceBuffer_destroy(JNIEnv* env, jobject clazz,
- GraphicBufferWrapper* wrapper) {
+ jlong wrapperHandle) {
+ GraphicBufferWrapper* wrapper =
+ reinterpret_cast<GraphicBufferWrapper*>(wrapperHandle);
delete wrapper;
}
@@ -140,9 +149,9 @@
static inline void swapCanvasPtr(JNIEnv* env, jobject canvasObj, SkCanvas* newCanvas) {
jobject canvasFinalizerObj = env->GetObjectField(canvasObj, gCanvasClassInfo.mFinalizer);
SkCanvas* previousCanvas = reinterpret_cast<SkCanvas*>(
- GET_INT(canvasObj, gCanvasClassInfo.mNativeCanvas));
- SET_INT(canvasObj, gCanvasClassInfo.mNativeCanvas, (int) newCanvas);
- SET_INT(canvasFinalizerObj, gCanvasFinalizerClassInfo.mNativeCanvas, (int) newCanvas);
+ GET_LONG(canvasObj, gCanvasClassInfo.mNativeCanvas));
+ SET_LONG(canvasObj, gCanvasClassInfo.mNativeCanvas, (long) newCanvas);
+ SET_LONG(canvasFinalizerObj, gCanvasFinalizerClassInfo.mNativeCanvas, (long) newCanvas);
SkSafeUnref(previousCanvas);
}
@@ -160,10 +169,12 @@
}
static jboolean android_view_GraphicBuffer_lockCanvas(JNIEnv* env, jobject,
- GraphicBufferWrapper* wrapper, jobject canvas, jobject dirtyRect) {
+ jlong wrapperHandle, jobject canvas, jobject dirtyRect) {
+ GraphicBufferWrapper* wrapper =
+ reinterpret_cast<GraphicBufferWrapper*>(wrapperHandle);
if (!wrapper) {
- return false;
+ return JNI_FALSE;
}
sp<GraphicBuffer> buffer(wrapper->buffer);
@@ -181,10 +192,10 @@
void* bits = NULL;
status_t status = buffer->lock(LOCK_CANVAS_USAGE, rect, &bits);
- if (status) return false;
+ if (status) return JNI_FALSE;
if (!bits) {
buffer->unlock();
- return false;
+ return JNI_FALSE;
}
ssize_t bytesCount = buffer->getStride() * bytesPerPixel(buffer->getPixelFormat());
@@ -213,21 +224,23 @@
int(rect.left), int(rect.top), int(rect.right), int(rect.bottom));
}
- return true;
+ return JNI_TRUE;
}
static jboolean android_view_GraphicBuffer_unlockCanvasAndPost(JNIEnv* env, jobject,
- GraphicBufferWrapper* wrapper, jobject canvas) {
+ jlong wrapperHandle, jobject canvas) {
+ GraphicBufferWrapper* wrapper =
+ reinterpret_cast<GraphicBufferWrapper*>(wrapperHandle);
SkCanvas* nativeCanvas = SkNEW(SkCanvas);
swapCanvasPtr(env, canvas, nativeCanvas);
if (wrapper) {
status_t status = wrapper->buffer->unlock();
- return status == 0;
+ return status == 0 ? JNI_TRUE : JNI_FALSE;
}
- return false;
+ return JNI_FALSE;
}
// ----------------------------------------------------------------------------
@@ -235,21 +248,23 @@
// ----------------------------------------------------------------------------
static void android_view_GraphiceBuffer_write(JNIEnv* env, jobject clazz,
- GraphicBufferWrapper* wrapper, jobject dest) {
+ jlong wrapperHandle, jobject dest) {
+ GraphicBufferWrapper* wrapper =
+ reinterpret_cast<GraphicBufferWrapper*>(wrapperHandle);
Parcel* parcel = parcelForJavaObject(env, dest);
if (parcel) {
parcel->write(*wrapper->buffer);
}
}
-static GraphicBufferWrapper* android_view_GraphiceBuffer_read(JNIEnv* env, jobject clazz,
+static jlong android_view_GraphiceBuffer_read(JNIEnv* env, jobject clazz,
jobject in) {
Parcel* parcel = parcelForJavaObject(env, in);
if (parcel) {
sp<GraphicBuffer> buffer = new GraphicBuffer();
parcel->read(*buffer);
- return new GraphicBufferWrapper(buffer);
+ return reinterpret_cast<jlong>(new GraphicBufferWrapper(buffer));
}
return NULL;
@@ -261,7 +276,7 @@
sp<GraphicBuffer> graphicBufferForJavaObject(JNIEnv* env, jobject obj) {
if (obj) {
- jint nativeObject = env->GetIntField(obj, gGraphicBufferClassInfo.mNativeObject);
+ jlong nativeObject = env->GetLongField(obj, gGraphicBufferClassInfo.mNativeObject);
GraphicBufferWrapper* wrapper = (GraphicBufferWrapper*) nativeObject;
if (wrapper != NULL) {
sp<GraphicBuffer> buffer(wrapper->buffer);
@@ -290,24 +305,24 @@
const char* const kClassPathName = "android/view/GraphicBuffer";
static JNINativeMethod gMethods[] = {
- { "nCreateGraphicBuffer", "(IIII)I", (void*) android_view_GraphiceBuffer_create },
- { "nDestroyGraphicBuffer", "(I)V", (void*) android_view_GraphiceBuffer_destroy },
+ { "nCreateGraphicBuffer", "(IIII)J", (void*) android_view_GraphiceBuffer_create },
+ { "nDestroyGraphicBuffer", "(J)V", (void*) android_view_GraphiceBuffer_destroy },
- { "nWriteGraphicBufferToParcel", "(ILandroid/os/Parcel;)V",
+ { "nWriteGraphicBufferToParcel", "(JLandroid/os/Parcel;)V",
(void*) android_view_GraphiceBuffer_write },
- { "nReadGraphicBufferFromParcel", "(Landroid/os/Parcel;)I",
+ { "nReadGraphicBufferFromParcel", "(Landroid/os/Parcel;)J",
(void*) android_view_GraphiceBuffer_read },
- { "nLockCanvas", "(ILandroid/graphics/Canvas;Landroid/graphics/Rect;)Z",
+ { "nLockCanvas", "(JLandroid/graphics/Canvas;Landroid/graphics/Rect;)Z",
(void*) android_view_GraphicBuffer_lockCanvas },
- { "nUnlockCanvasAndPost", "(ILandroid/graphics/Canvas;)Z",
+ { "nUnlockCanvasAndPost", "(JLandroid/graphics/Canvas;)Z",
(void*) android_view_GraphicBuffer_unlockCanvasAndPost },
};
int register_android_view_GraphicBuffer(JNIEnv* env) {
jclass clazz;
FIND_CLASS(clazz, "android/view/GraphicBuffer");
- GET_FIELD_ID(gGraphicBufferClassInfo.mNativeObject, clazz, "mNativeObject", "I");
+ GET_FIELD_ID(gGraphicBufferClassInfo.mNativeObject, clazz, "mNativeObject", "J");
FIND_CLASS(clazz, "android/graphics/Rect");
GET_METHOD_ID(gRectClassInfo.set, clazz, "set", "(IIII)V");
@@ -319,11 +334,11 @@
FIND_CLASS(clazz, "android/graphics/Canvas");
GET_FIELD_ID(gCanvasClassInfo.mFinalizer, clazz, "mFinalizer",
"Landroid/graphics/Canvas$CanvasFinalizer;");
- GET_FIELD_ID(gCanvasClassInfo.mNativeCanvas, clazz, "mNativeCanvas", "I");
+ GET_FIELD_ID(gCanvasClassInfo.mNativeCanvas, clazz, "mNativeCanvas", "J");
GET_FIELD_ID(gCanvasClassInfo.mSurfaceFormat, clazz, "mSurfaceFormat", "I");
FIND_CLASS(clazz, "android/graphics/Canvas$CanvasFinalizer");
- GET_FIELD_ID(gCanvasFinalizerClassInfo.mNativeCanvas, clazz, "mNativeCanvas", "I");
+ GET_FIELD_ID(gCanvasFinalizerClassInfo.mNativeCanvas, clazz, "mNativeCanvas", "J");
return AndroidRuntime::registerNativeMethods(env, kClassPathName, gMethods, NELEM(gMethods));
}
diff --git a/core/jni/android_view_RemoteGLRenderer.cpp b/core/jni/android_view_RemoteGLRenderer.cpp
deleted file mode 100644
index 96a203b..0000000
--- a/core/jni/android_view_RemoteGLRenderer.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright (C) 2014 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#define LOG_TAG "RemoteGLRenderer"
-
-#include "jni.h"
-#include <nativehelper/JNIHelp.h>
-
-#include <utils/StrongPointer.h>
-#include <android_runtime/android_view_Surface.h>
-#include <android_runtime/AndroidRuntime.h>
-#include <renderthread/CanvasContext.h>
-#include <system/window.h>
-
-namespace android {
-
-#ifdef USE_OPENGL_RENDERER
-
-#define CHECK_CONTEXT(c) if (!c) ALOGE("Null context passed to %s!", __func__ )
-
-namespace RT = android::uirenderer::renderthread;
-
-static jlong android_view_RemoteGLRenderer_createContext(JNIEnv* env, jobject clazz) {
- RT::CanvasContext* context = new RT::CanvasContext();
- return reinterpret_cast<jlong>(context);
-}
-
-static jboolean android_view_RemoteGLRenderer_usePBufferSurface(JNIEnv* env, jobject clazz) {
- return RT::CanvasContext::useGlobalPBufferSurface();
-}
-
-static jboolean android_view_RemoteGLRenderer_setSurface(JNIEnv* env, jobject clazz,
- jlong jcontextptr, jobject jsurface) {
- RT::CanvasContext* context = reinterpret_cast<RT::CanvasContext*>(jcontextptr);
- CHECK_CONTEXT(context);
- sp<ANativeWindow> window;
- if (jsurface) {
- window = android_view_Surface_getNativeWindow(env, jsurface);
- }
- return context->setSurface(window.get());
-}
-
-static jboolean android_view_RemoteGLRenderer_swapBuffers(JNIEnv* env, jobject clazz,
- jlong jcontextptr) {
- RT::CanvasContext* context = reinterpret_cast<RT::CanvasContext*>(jcontextptr);
- CHECK_CONTEXT(context);
- return context->swapBuffers();
-}
-
-static jboolean android_view_RemoteGLRenderer_makeCurrent(JNIEnv* env, jobject clazz,
- jlong jcontextptr) {
- RT::CanvasContext* context = reinterpret_cast<RT::CanvasContext*>(jcontextptr);
- CHECK_CONTEXT(context);
- return context->makeCurrent();
-}
-
-static void android_view_RemoteGLRenderer_destroyContext(JNIEnv* env, jobject clazz,
- jlong jcontextptr) {
- RT::CanvasContext* context = reinterpret_cast<RT::CanvasContext*>(jcontextptr);
- CHECK_CONTEXT(context);
- delete context;
-}
-#endif
-
-// ----------------------------------------------------------------------------
-// JNI Glue
-// ----------------------------------------------------------------------------
-
-const char* const kClassPathName = "android/view/RemoteGLRenderer";
-
-static JNINativeMethod gMethods[] = {
-#ifdef USE_OPENGL_RENDERER
- { "createContext", "()J", (void*) android_view_RemoteGLRenderer_createContext },
- { "usePBufferSurface", "()Z", (void*) android_view_RemoteGLRenderer_usePBufferSurface },
- { "setSurface", "(JLandroid/view/Surface;)Z", (void*) android_view_RemoteGLRenderer_setSurface },
- { "swapBuffers", "(J)Z", (void*) android_view_RemoteGLRenderer_swapBuffers },
- { "makeCurrent", "(J)Z", (void*) android_view_RemoteGLRenderer_makeCurrent },
- { "destroyContext", "(J)V", (void*) android_view_RemoteGLRenderer_destroyContext },
-#endif
-};
-
-int register_android_view_RemoteGLRenderer(JNIEnv* env) {
- return AndroidRuntime::registerNativeMethods(env, kClassPathName, gMethods, NELEM(gMethods));
-}
-
-}; // namespace android
diff --git a/core/jni/android_view_Surface.cpp b/core/jni/android_view_Surface.cpp
index dd178d8..19ee8a6 100644
--- a/core/jni/android_view_Surface.cpp
+++ b/core/jni/android_view_Surface.cpp
@@ -97,7 +97,7 @@
gSurfaceClassInfo.mLock);
if (env->MonitorEnter(lock) == JNI_OK) {
sur = reinterpret_cast<Surface *>(
- env->GetIntField(surfaceObj, gSurfaceClassInfo.mNativeObject));
+ env->GetLongField(surfaceObj, gSurfaceClassInfo.mNativeObject));
env->MonitorExit(lock);
}
return sur;
@@ -135,7 +135,7 @@
// ----------------------------------------------------------------------------
-static jint nativeCreateFromSurfaceTexture(JNIEnv* env, jclass clazz,
+static jlong nativeCreateFromSurfaceTexture(JNIEnv* env, jclass clazz,
jobject surfaceTextureObj) {
sp<IGraphicBufferProducer> producer(SurfaceTexture_getProducer(env, surfaceTextureObj));
if (producer == NULL) {
@@ -151,20 +151,20 @@
}
surface->incStrong(&sRefBaseOwner);
- return int(surface.get());
+ return jlong(surface.get());
}
-static void nativeRelease(JNIEnv* env, jclass clazz, jint nativeObject) {
+static void nativeRelease(JNIEnv* env, jclass clazz, jlong nativeObject) {
sp<Surface> sur(reinterpret_cast<Surface *>(nativeObject));
sur->decStrong(&sRefBaseOwner);
}
-static jboolean nativeIsValid(JNIEnv* env, jclass clazz, jint nativeObject) {
+static jboolean nativeIsValid(JNIEnv* env, jclass clazz, jlong nativeObject) {
sp<Surface> sur(reinterpret_cast<Surface *>(nativeObject));
return isSurfaceValid(sur) ? JNI_TRUE : JNI_FALSE;
}
-static jboolean nativeIsConsumerRunningBehind(JNIEnv* env, jclass clazz, jint nativeObject) {
+static jboolean nativeIsConsumerRunningBehind(JNIEnv* env, jclass clazz, jlong nativeObject) {
sp<Surface> sur(reinterpret_cast<Surface *>(nativeObject));
if (!isSurfaceValid(sur)) {
doThrowIAE(env);
@@ -193,14 +193,14 @@
static inline void swapCanvasPtr(JNIEnv* env, jobject canvasObj, SkCanvas* newCanvas) {
jobject canvasFinalizerObj = env->GetObjectField(canvasObj, gCanvasClassInfo.mFinalizer);
SkCanvas* previousCanvas = reinterpret_cast<SkCanvas*>(
- env->GetIntField(canvasObj, gCanvasClassInfo.mNativeCanvas));
- env->SetIntField(canvasObj, gCanvasClassInfo.mNativeCanvas, (int)newCanvas);
- env->SetIntField(canvasFinalizerObj, gCanvasFinalizerClassInfo.mNativeCanvas, (int)newCanvas);
+ env->GetLongField(canvasObj, gCanvasClassInfo.mNativeCanvas));
+ env->SetLongField(canvasObj, gCanvasClassInfo.mNativeCanvas, (jlong)newCanvas);
+ env->SetLongField(canvasFinalizerObj, gCanvasFinalizerClassInfo.mNativeCanvas, (jlong)newCanvas);
SkSafeUnref(previousCanvas);
}
-static jint nativeLockCanvas(JNIEnv* env, jclass clazz,
- jint nativeObject, jobject canvasObj, jobject dirtyRectObj) {
+static jlong nativeLockCanvas(JNIEnv* env, jclass clazz,
+ jlong nativeObject, jobject canvasObj, jobject dirtyRectObj) {
sp<Surface> surface(reinterpret_cast<Surface *>(nativeObject));
if (!isSurfaceValid(surface)) {
@@ -264,11 +264,11 @@
// because the latter could be replaced while the surface is locked.
sp<Surface> lockedSurface(surface);
lockedSurface->incStrong(&sRefBaseOwner);
- return (int) lockedSurface.get();
+ return (jlong) lockedSurface.get();
}
static void nativeUnlockCanvasAndPost(JNIEnv* env, jclass clazz,
- jint nativeObject, jobject canvasObj) {
+ jlong nativeObject, jobject canvasObj) {
sp<Surface> surface(reinterpret_cast<Surface *>(nativeObject));
if (!isSurfaceValid(surface)) {
return;
@@ -287,8 +287,8 @@
// ----------------------------------------------------------------------------
-static jint nativeCreateFromSurfaceControl(JNIEnv* env, jclass clazz,
- jint surfaceControlNativeObj) {
+static jlong nativeCreateFromSurfaceControl(JNIEnv* env, jclass clazz,
+ jlong surfaceControlNativeObj) {
/*
* This is used by the WindowManagerService just after constructing
* a Surface and is necessary for returning the Surface reference to
@@ -300,11 +300,11 @@
if (surface != NULL) {
surface->incStrong(&sRefBaseOwner);
}
- return reinterpret_cast<jint>(surface.get());
+ return reinterpret_cast<jlong>(surface.get());
}
-static jint nativeReadFromParcel(JNIEnv* env, jclass clazz,
- jint nativeObject, jobject parcelObj) {
+static jlong nativeReadFromParcel(JNIEnv* env, jclass clazz,
+ jlong nativeObject, jobject parcelObj) {
Parcel* parcel = parcelForJavaObject(env, parcelObj);
if (parcel == NULL) {
doThrowNPE(env);
@@ -319,7 +319,7 @@
if (self != NULL
&& (self->getIGraphicBufferProducer()->asBinder() == binder)) {
// same IGraphicBufferProducer, return ourselves
- return int(self.get());
+ return jlong(self.get());
}
sp<Surface> sur;
@@ -336,11 +336,11 @@
self->decStrong(&sRefBaseOwner);
}
- return int(sur.get());
+ return jlong(sur.get());
}
static void nativeWriteToParcel(JNIEnv* env, jclass clazz,
- jint nativeObject, jobject parcelObj) {
+ jlong nativeObject, jobject parcelObj) {
Parcel* parcel = parcelForJavaObject(env, parcelObj);
if (parcel == NULL) {
doThrowNPE(env);
@@ -353,23 +353,23 @@
// ----------------------------------------------------------------------------
static JNINativeMethod gSurfaceMethods[] = {
- {"nativeCreateFromSurfaceTexture", "(Landroid/graphics/SurfaceTexture;)I",
+ {"nativeCreateFromSurfaceTexture", "(Landroid/graphics/SurfaceTexture;)J",
(void*)nativeCreateFromSurfaceTexture },
- {"nativeRelease", "(I)V",
+ {"nativeRelease", "(J)V",
(void*)nativeRelease },
- {"nativeIsValid", "(I)Z",
+ {"nativeIsValid", "(J)Z",
(void*)nativeIsValid },
- {"nativeIsConsumerRunningBehind", "(I)Z",
+ {"nativeIsConsumerRunningBehind", "(J)Z",
(void*)nativeIsConsumerRunningBehind },
- {"nativeLockCanvas", "(ILandroid/graphics/Canvas;Landroid/graphics/Rect;)I",
+ {"nativeLockCanvas", "(JLandroid/graphics/Canvas;Landroid/graphics/Rect;)J",
(void*)nativeLockCanvas },
- {"nativeUnlockCanvasAndPost", "(ILandroid/graphics/Canvas;)V",
+ {"nativeUnlockCanvasAndPost", "(JLandroid/graphics/Canvas;)V",
(void*)nativeUnlockCanvasAndPost },
- {"nativeCreateFromSurfaceControl", "(I)I",
+ {"nativeCreateFromSurfaceControl", "(J)J",
(void*)nativeCreateFromSurfaceControl },
- {"nativeReadFromParcel", "(ILandroid/os/Parcel;)I",
+ {"nativeReadFromParcel", "(JLandroid/os/Parcel;)J",
(void*)nativeReadFromParcel },
- {"nativeWriteToParcel", "(ILandroid/os/Parcel;)V",
+ {"nativeWriteToParcel", "(JLandroid/os/Parcel;)V",
(void*)nativeWriteToParcel },
};
@@ -381,18 +381,18 @@
jclass clazz = env->FindClass("android/view/Surface");
gSurfaceClassInfo.clazz = jclass(env->NewGlobalRef(clazz));
gSurfaceClassInfo.mNativeObject =
- env->GetFieldID(gSurfaceClassInfo.clazz, "mNativeObject", "I");
+ env->GetFieldID(gSurfaceClassInfo.clazz, "mNativeObject", "J");
gSurfaceClassInfo.mLock =
env->GetFieldID(gSurfaceClassInfo.clazz, "mLock", "Ljava/lang/Object;");
- gSurfaceClassInfo.ctor = env->GetMethodID(gSurfaceClassInfo.clazz, "<init>", "(I)V");
+ gSurfaceClassInfo.ctor = env->GetMethodID(gSurfaceClassInfo.clazz, "<init>", "(J)V");
clazz = env->FindClass("android/graphics/Canvas");
gCanvasClassInfo.mFinalizer = env->GetFieldID(clazz, "mFinalizer", "Landroid/graphics/Canvas$CanvasFinalizer;");
- gCanvasClassInfo.mNativeCanvas = env->GetFieldID(clazz, "mNativeCanvas", "I");
+ gCanvasClassInfo.mNativeCanvas = env->GetFieldID(clazz, "mNativeCanvas", "J");
gCanvasClassInfo.mSurfaceFormat = env->GetFieldID(clazz, "mSurfaceFormat", "I");
clazz = env->FindClass("android/graphics/Canvas$CanvasFinalizer");
- gCanvasFinalizerClassInfo.mNativeCanvas = env->GetFieldID(clazz, "mNativeCanvas", "I");
+ gCanvasFinalizerClassInfo.mNativeCanvas = env->GetFieldID(clazz, "mNativeCanvas", "J");
clazz = env->FindClass("android/graphics/Rect");
gRectClassInfo.left = env->GetFieldID(clazz, "left", "I");
diff --git a/core/jni/android_view_SurfaceControl.cpp b/core/jni/android_view_SurfaceControl.cpp
index 12acfe1..88ec0d7 100644
--- a/core/jni/android_view_SurfaceControl.cpp
+++ b/core/jni/android_view_SurfaceControl.cpp
@@ -122,7 +122,7 @@
// ----------------------------------------------------------------------------
-static jint nativeCreate(JNIEnv* env, jclass clazz, jobject sessionObj,
+static jlong nativeCreate(JNIEnv* env, jclass clazz, jobject sessionObj,
jstring nameStr, jint w, jint h, jint format, jint flags) {
ScopedUtfChars name(env, nameStr);
sp<SurfaceComposerClient> client(android_view_SurfaceSession_getClient(env, sessionObj));
@@ -133,15 +133,15 @@
return 0;
}
surface->incStrong((void *)nativeCreate);
- return int(surface.get());
+ return reinterpret_cast<jlong>(surface.get());
}
-static void nativeRelease(JNIEnv* env, jclass clazz, jint nativeObject) {
+static void nativeRelease(JNIEnv* env, jclass clazz, jlong nativeObject) {
sp<SurfaceControl> ctrl(reinterpret_cast<SurfaceControl *>(nativeObject));
ctrl->decStrong((void *)nativeCreate);
}
-static void nativeDestroy(JNIEnv* env, jclass clazz, jint nativeObject) {
+static void nativeDestroy(JNIEnv* env, jclass clazz, jlong nativeObject) {
sp<SurfaceControl> ctrl(reinterpret_cast<SurfaceControl *>(nativeObject));
ctrl->clear();
ctrl->decStrong((void *)nativeCreate);
@@ -230,7 +230,7 @@
SurfaceComposerClient::setAnimationTransaction();
}
-static void nativeSetLayer(JNIEnv* env, jclass clazz, jint nativeObject, jint zorder) {
+static void nativeSetLayer(JNIEnv* env, jclass clazz, jlong nativeObject, jint zorder) {
SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject);
status_t err = ctrl->setLayer(zorder);
if (err < 0 && err != NO_INIT) {
@@ -238,7 +238,7 @@
}
}
-static void nativeSetPosition(JNIEnv* env, jclass clazz, jint nativeObject, jfloat x, jfloat y) {
+static void nativeSetPosition(JNIEnv* env, jclass clazz, jlong nativeObject, jfloat x, jfloat y) {
SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject);
status_t err = ctrl->setPosition(x, y);
if (err < 0 && err != NO_INIT) {
@@ -246,7 +246,7 @@
}
}
-static void nativeSetSize(JNIEnv* env, jclass clazz, jint nativeObject, jint w, jint h) {
+static void nativeSetSize(JNIEnv* env, jclass clazz, jlong nativeObject, jint w, jint h) {
SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject);
status_t err = ctrl->setSize(w, h);
if (err < 0 && err != NO_INIT) {
@@ -254,7 +254,7 @@
}
}
-static void nativeSetFlags(JNIEnv* env, jclass clazz, jint nativeObject, jint flags, jint mask) {
+static void nativeSetFlags(JNIEnv* env, jclass clazz, jlong nativeObject, jint flags, jint mask) {
SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject);
status_t err = ctrl->setFlags(flags, mask);
if (err < 0 && err != NO_INIT) {
@@ -262,7 +262,7 @@
}
}
-static void nativeSetTransparentRegionHint(JNIEnv* env, jclass clazz, jint nativeObject, jobject regionObj) {
+static void nativeSetTransparentRegionHint(JNIEnv* env, jclass clazz, jlong nativeObject, jobject regionObj) {
SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject);
SkRegion* region = android_graphics_Region_getSkRegion(env, regionObj);
if (!region) {
@@ -287,7 +287,7 @@
}
}
-static void nativeSetAlpha(JNIEnv* env, jclass clazz, jint nativeObject, jfloat alpha) {
+static void nativeSetAlpha(JNIEnv* env, jclass clazz, jlong nativeObject, jfloat alpha) {
SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject);
status_t err = ctrl->setAlpha(alpha);
if (err < 0 && err != NO_INIT) {
@@ -295,7 +295,7 @@
}
}
-static void nativeSetMatrix(JNIEnv* env, jclass clazz, jint nativeObject,
+static void nativeSetMatrix(JNIEnv* env, jclass clazz, jlong nativeObject,
jfloat dsdx, jfloat dtdx, jfloat dsdy, jfloat dtdy) {
SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject);
status_t err = ctrl->setMatrix(dsdx, dtdx, dsdy, dtdy);
@@ -304,7 +304,7 @@
}
}
-static void nativeSetWindowCrop(JNIEnv* env, jclass clazz, jint nativeObject,
+static void nativeSetWindowCrop(JNIEnv* env, jclass clazz, jlong nativeObject,
jint l, jint t, jint r, jint b) {
SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject);
Rect crop(l, t, r, b);
@@ -314,7 +314,7 @@
}
}
-static void nativeSetLayerStack(JNIEnv* env, jclass clazz, jint nativeObject, jint layerStack) {
+static void nativeSetLayerStack(JNIEnv* env, jclass clazz, jlong nativeObject, jint layerStack) {
SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject);
status_t err = ctrl->setLayerStack(layerStack);
if (err < 0 && err != NO_INIT) {
@@ -342,7 +342,7 @@
}
static void nativeSetDisplaySurface(JNIEnv* env, jclass clazz,
- jobject tokenObj, jint nativeSurfaceObject) {
+ jobject tokenObj, jlong nativeSurfaceObject) {
sp<IBinder> token(ibinderForJavaObject(env, tokenObj));
if (token == NULL) return;
sp<IGraphicBufferProducer> bufferProducer;
@@ -411,11 +411,11 @@
// ----------------------------------------------------------------------------
static JNINativeMethod sSurfaceControlMethods[] = {
- {"nativeCreate", "(Landroid/view/SurfaceSession;Ljava/lang/String;IIII)I",
+ {"nativeCreate", "(Landroid/view/SurfaceSession;Ljava/lang/String;IIII)J",
(void*)nativeCreate },
- {"nativeRelease", "(I)V",
+ {"nativeRelease", "(J)V",
(void*)nativeRelease },
- {"nativeDestroy", "(I)V",
+ {"nativeDestroy", "(J)V",
(void*)nativeDestroy },
{"nativeScreenshot", "(Landroid/os/IBinder;IIIIZ)Landroid/graphics/Bitmap;",
(void*)nativeScreenshotBitmap },
@@ -427,23 +427,23 @@
(void*)nativeCloseTransaction },
{"nativeSetAnimationTransaction", "()V",
(void*)nativeSetAnimationTransaction },
- {"nativeSetLayer", "(II)V",
+ {"nativeSetLayer", "(JI)V",
(void*)nativeSetLayer },
- {"nativeSetPosition", "(IFF)V",
+ {"nativeSetPosition", "(JFF)V",
(void*)nativeSetPosition },
- {"nativeSetSize", "(III)V",
+ {"nativeSetSize", "(JII)V",
(void*)nativeSetSize },
- {"nativeSetTransparentRegionHint", "(ILandroid/graphics/Region;)V",
+ {"nativeSetTransparentRegionHint", "(JLandroid/graphics/Region;)V",
(void*)nativeSetTransparentRegionHint },
- {"nativeSetAlpha", "(IF)V",
+ {"nativeSetAlpha", "(JF)V",
(void*)nativeSetAlpha },
- {"nativeSetMatrix", "(IFFFF)V",
+ {"nativeSetMatrix", "(JFFFF)V",
(void*)nativeSetMatrix },
- {"nativeSetFlags", "(III)V",
+ {"nativeSetFlags", "(JII)V",
(void*)nativeSetFlags },
- {"nativeSetWindowCrop", "(IIIII)V",
+ {"nativeSetWindowCrop", "(JIIII)V",
(void*)nativeSetWindowCrop },
- {"nativeSetLayerStack", "(II)V",
+ {"nativeSetLayerStack", "(JI)V",
(void*)nativeSetLayerStack },
{"nativeGetBuiltInDisplay", "(I)Landroid/os/IBinder;",
(void*)nativeGetBuiltInDisplay },
@@ -451,7 +451,7 @@
(void*)nativeCreateDisplay },
{"nativeDestroyDisplay", "(Landroid/os/IBinder;)V",
(void*)nativeDestroyDisplay },
- {"nativeSetDisplaySurface", "(Landroid/os/IBinder;I)V",
+ {"nativeSetDisplaySurface", "(Landroid/os/IBinder;J)V",
(void*)nativeSetDisplaySurface },
{"nativeSetDisplayLayerStack", "(Landroid/os/IBinder;I)V",
(void*)nativeSetDisplayLayerStack },
diff --git a/core/jni/android_view_TextureView.cpp b/core/jni/android_view_TextureView.cpp
index 7a4a20a..835615e 100644
--- a/core/jni/android_view_TextureView.cpp
+++ b/core/jni/android_view_TextureView.cpp
@@ -60,9 +60,15 @@
#define GET_INT(object, field) \
env->GetIntField(object, field)
+#define GET_LONG(object, field) \
+ env->GetLongField(object, field)
+
#define SET_INT(object, field, value) \
env->SetIntField(object, field, value)
+#define SET_LONG(object, field, value) \
+ env->SetLongField(object, field, value)
+
#define INVOKEV(object, method, ...) \
env->CallVoidMethod(object, method, __VA_ARGS__)
@@ -104,18 +110,18 @@
sp<ANativeWindow> window = new Surface(producer, true);
window->incStrong((void*)android_view_TextureView_createNativeWindow);
- SET_INT(textureView, gTextureViewClassInfo.nativeWindow, jint(window.get()));
+ SET_LONG(textureView, gTextureViewClassInfo.nativeWindow, jlong(window.get()));
}
static void android_view_TextureView_destroyNativeWindow(JNIEnv* env, jobject textureView) {
ANativeWindow* nativeWindow = (ANativeWindow*)
- GET_INT(textureView, gTextureViewClassInfo.nativeWindow);
+ GET_LONG(textureView, gTextureViewClassInfo.nativeWindow);
if (nativeWindow) {
sp<ANativeWindow> window(nativeWindow);
window->decStrong((void*)android_view_TextureView_createNativeWindow);
- SET_INT(textureView, gTextureViewClassInfo.nativeWindow, 0);
+ SET_LONG(textureView, gTextureViewClassInfo.nativeWindow, 0);
}
}
@@ -123,16 +129,16 @@
jobject canvasFinalizerObj = env->GetObjectField(canvasObj, gCanvasClassInfo.mFinalizer);
SkCanvas* previousCanvas = reinterpret_cast<SkCanvas*>(
env->GetIntField(canvasObj, gCanvasClassInfo.mNativeCanvas));
- env->SetIntField(canvasObj, gCanvasClassInfo.mNativeCanvas, (int)newCanvas);
- env->SetIntField(canvasFinalizerObj, gCanvasFinalizerClassInfo.mNativeCanvas, (int)newCanvas);
+ env->SetLongField(canvasObj, gCanvasClassInfo.mNativeCanvas, (jlong)newCanvas);
+ env->SetLongField(canvasFinalizerObj, gCanvasFinalizerClassInfo.mNativeCanvas, (jlong)newCanvas);
SkSafeUnref(previousCanvas);
}
static jboolean android_view_TextureView_lockCanvas(JNIEnv* env, jobject,
- jint nativeWindow, jobject canvas, jobject dirtyRect) {
+ jlong nativeWindow, jobject canvas, jobject dirtyRect) {
if (!nativeWindow) {
- return false;
+ return JNI_FALSE;
}
ANativeWindow_Buffer buffer;
@@ -149,7 +155,7 @@
sp<ANativeWindow> window((ANativeWindow*) nativeWindow);
int32_t status = native_window_lock(window.get(), &buffer, &rect);
- if (status) return false;
+ if (status) return JNI_FALSE;
ssize_t bytesCount = buffer.stride * bytesPerPixel(buffer.format);
@@ -180,11 +186,11 @@
int(rect.left), int(rect.top), int(rect.right), int(rect.bottom));
}
- return true;
+ return JNI_TRUE;
}
static void android_view_TextureView_unlockCanvasAndPost(JNIEnv* env, jobject,
- jint nativeWindow, jobject canvas) {
+ jlong nativeWindow, jobject canvas) {
SkCanvas* nativeCanvas = SkNEW(SkCanvas);
swapCanvasPtr(env, canvas, nativeCanvas);
@@ -207,9 +213,9 @@
{ "nDestroyNativeWindow", "()V",
(void*) android_view_TextureView_destroyNativeWindow },
- { "nLockCanvas", "(ILandroid/graphics/Canvas;Landroid/graphics/Rect;)Z",
+ { "nLockCanvas", "(JLandroid/graphics/Canvas;Landroid/graphics/Rect;)Z",
(void*) android_view_TextureView_lockCanvas },
- { "nUnlockCanvasAndPost", "(ILandroid/graphics/Canvas;)V",
+ { "nUnlockCanvasAndPost", "(JLandroid/graphics/Canvas;)V",
(void*) android_view_TextureView_unlockCanvasAndPost },
};
@@ -237,14 +243,14 @@
FIND_CLASS(clazz, "android/graphics/Canvas");
GET_FIELD_ID(gCanvasClassInfo.mFinalizer, clazz, "mFinalizer",
"Landroid/graphics/Canvas$CanvasFinalizer;");
- GET_FIELD_ID(gCanvasClassInfo.mNativeCanvas, clazz, "mNativeCanvas", "I");
+ GET_FIELD_ID(gCanvasClassInfo.mNativeCanvas, clazz, "mNativeCanvas", "J");
GET_FIELD_ID(gCanvasClassInfo.mSurfaceFormat, clazz, "mSurfaceFormat", "I");
FIND_CLASS(clazz, "android/graphics/Canvas$CanvasFinalizer");
- GET_FIELD_ID(gCanvasFinalizerClassInfo.mNativeCanvas, clazz, "mNativeCanvas", "I");
+ GET_FIELD_ID(gCanvasFinalizerClassInfo.mNativeCanvas, clazz, "mNativeCanvas", "J");
FIND_CLASS(clazz, "android/view/TextureView");
- GET_FIELD_ID(gTextureViewClassInfo.nativeWindow, clazz, "mNativeWindow", "I");
+ GET_FIELD_ID(gTextureViewClassInfo.nativeWindow, clazz, "mNativeWindow", "J");
return AndroidRuntime::registerNativeMethods(env, kClassPathName, gMethods, NELEM(gMethods));
}
diff --git a/core/jni/android_view_ThreadedRenderer.cpp b/core/jni/android_view_ThreadedRenderer.cpp
index 8d77e36..8e121de 100644
--- a/core/jni/android_view_ThreadedRenderer.cpp
+++ b/core/jni/android_view_ThreadedRenderer.cpp
@@ -20,6 +20,11 @@
#include <nativehelper/JNIHelp.h>
#include <android_runtime/AndroidRuntime.h>
+#include <utils/StrongPointer.h>
+#include <android_runtime/android_view_Surface.h>
+#include <system/window.h>
+
+#include <renderthread/RenderProxy.h>
#include <renderthread/RenderTask.h>
#include <renderthread/RenderThread.h>
@@ -27,23 +32,22 @@
#ifdef USE_OPENGL_RENDERER
-namespace RT = android::uirenderer::renderthread;
+using namespace android::uirenderer;
+using namespace android::uirenderer::renderthread;
static jmethodID gRunnableMethod;
-class JavaTask : public RT::RenderTask {
+class JavaTask : public RenderTask {
public:
JavaTask(JNIEnv* env, jobject jrunnable) {
env->GetJavaVM(&mVm);
mRunnable = env->NewGlobalRef(jrunnable);
}
- virtual ~JavaTask() {
- env()->DeleteGlobalRef(mRunnable);
- }
-
virtual void run() {
env()->CallVoidMethod(mRunnable, gRunnableMethod);
+ env()->DeleteGlobalRef(mRunnable);
+ delete this;
};
private:
@@ -61,8 +65,70 @@
static void android_view_ThreadedRenderer_postToRenderThread(JNIEnv* env, jobject clazz,
jobject jrunnable) {
- RT::RenderTask* task = new JavaTask(env, jrunnable);
- RT::RenderThread::getInstance().queue(task);
+ RenderTask* task = new JavaTask(env, jrunnable);
+ RenderThread::getInstance().queue(task);
+}
+
+static jlong android_view_ThreadedRenderer_createProxy(JNIEnv* env, jobject clazz,
+ jboolean translucent) {
+ return (jlong) new RenderProxy(translucent);
+}
+
+static void android_view_ThreadedRenderer_deleteProxy(JNIEnv* env, jobject clazz,
+ jlong proxyPtr) {
+ RenderProxy* proxy = reinterpret_cast<RenderProxy*>( proxyPtr);
+ delete proxy;
+}
+
+static jboolean android_view_ThreadedRenderer_initialize(JNIEnv* env, jobject clazz,
+ jlong proxyPtr, jobject jsurface) {
+ RenderProxy* proxy = reinterpret_cast<RenderProxy*>( proxyPtr);
+ sp<ANativeWindow> window = android_view_Surface_getNativeWindow(env, jsurface);
+ return proxy->initialize(window.get());
+}
+
+static void android_view_ThreadedRenderer_updateSurface(JNIEnv* env, jobject clazz,
+ jlong proxyPtr, jobject jsurface) {
+ RenderProxy* proxy = reinterpret_cast<RenderProxy*>( proxyPtr);
+ sp<ANativeWindow> window;
+ if (jsurface) {
+ window = android_view_Surface_getNativeWindow(env, jsurface);
+ }
+ proxy->updateSurface(window.get());
+}
+
+static void android_view_ThreadedRenderer_setup(JNIEnv* env, jobject clazz,
+ jlong proxyPtr, jint width, jint height) {
+ RenderProxy* proxy = reinterpret_cast<RenderProxy*>( proxyPtr);
+ proxy->setup(width, height);
+}
+
+static void android_view_ThreadedRenderer_drawDisplayList(JNIEnv* env, jobject clazz,
+ jlong proxyPtr, jlong displayListPtr, jint dirtyLeft, jint dirtyTop,
+ jint dirtyRight, jint dirtyBottom) {
+ RenderProxy* proxy = reinterpret_cast<RenderProxy*>( proxyPtr);
+ DisplayList* displayList = reinterpret_cast<DisplayList*>( displayListPtr);
+ proxy->drawDisplayList(displayList, dirtyLeft, dirtyTop, dirtyRight, dirtyBottom);
+}
+
+static void android_view_ThreadedRenderer_destroyCanvas(JNIEnv* env, jobject clazz,
+ jlong proxyPtr) {
+ RenderProxy* proxy = reinterpret_cast<RenderProxy*>( proxyPtr);
+ proxy->destroyCanvas();
+}
+
+static void android_view_ThreadedRenderer_attachFunctor(JNIEnv* env, jobject clazz,
+ jlong proxyPtr, jlong functorPtr) {
+ RenderProxy* proxy = reinterpret_cast<RenderProxy*>( proxyPtr);
+ Functor* functor = reinterpret_cast<Functor*>(functorPtr);
+ proxy->attachFunctor(functor);
+}
+
+static void android_view_ThreadedRenderer_detachFunctor(JNIEnv* env, jobject clazz,
+ jlong proxyPtr, jlong functorPtr) {
+ RenderProxy* proxy = reinterpret_cast<RenderProxy*>( proxyPtr);
+ Functor* functor = reinterpret_cast<Functor*>(functorPtr);
+ proxy->detachFunctor(functor);
}
#endif
@@ -76,6 +142,15 @@
static JNINativeMethod gMethods[] = {
#ifdef USE_OPENGL_RENDERER
{ "postToRenderThread", "(Ljava/lang/Runnable;)V", (void*) android_view_ThreadedRenderer_postToRenderThread },
+ { "nCreateProxy", "(Z)J", (void*) android_view_ThreadedRenderer_createProxy },
+ { "nDeleteProxy", "(J)V", (void*) android_view_ThreadedRenderer_deleteProxy },
+ { "nInitialize", "(JLandroid/view/Surface;)Z", (void*) android_view_ThreadedRenderer_initialize },
+ { "nUpdateSurface", "(JLandroid/view/Surface;)V", (void*) android_view_ThreadedRenderer_updateSurface },
+ { "nSetup", "(JII)V", (void*) android_view_ThreadedRenderer_setup },
+ { "nDrawDisplayList", "(JJIIII)V", (void*) android_view_ThreadedRenderer_drawDisplayList},
+ { "nDestroyCanvas", "(J)V", (void*) android_view_ThreadedRenderer_destroyCanvas},
+ { "nAttachFunctor", "(JJ)V", (void*) android_view_ThreadedRenderer_attachFunctor},
+ { "nDetachFunctor", "(JJ)V", (void*) android_view_ThreadedRenderer_detachFunctor},
#endif
};
diff --git a/core/jni/com_google_android_gles_jni_EGLImpl.cpp b/core/jni/com_google_android_gles_jni_EGLImpl.cpp
index 50b3302..a0982bd 100644
--- a/core/jni/com_google_android_gles_jni_EGLImpl.cpp
+++ b/core/jni/com_google_android_gles_jni_EGLImpl.cpp
@@ -82,7 +82,7 @@
gSurface_NativePixelRefFieldID = _env->GetFieldID(surface_class, "mNativePixelRef", "I");
jclass bitmap_class = _env->FindClass("android/graphics/Bitmap");
- gBitmap_NativeBitmapFieldID = _env->GetFieldID(bitmap_class, "mNativeBitmap", "I");
+ gBitmap_NativeBitmapFieldID = _env->GetFieldID(bitmap_class, "mNativeBitmap", "J");
}
static const jint gNull_attrib_base[] = {EGL_NONE};
@@ -276,7 +276,7 @@
jint* base = 0;
SkBitmap const * nativeBitmap =
- (SkBitmap const *)_env->GetIntField(native_pixmap,
+ (SkBitmap const *)_env->GetLongField(native_pixmap,
gBitmap_NativeBitmapFieldID);
SkPixelRef* ref = nativeBitmap ? nativeBitmap->pixelRef() : 0;
if (ref == NULL) {
diff --git a/core/res/res/layout/time_header_label.xml b/core/res/res/layout/time_header_label.xml
index 00cb81b..f5f4a04 100644
--- a/core/res/res/layout/time_header_label.xml
+++ b/core/res/res/layout/time_header_label.xml
@@ -54,7 +54,6 @@
android:paddingRight="@dimen/timepicker_ampm_left_padding"
android:layout_toRightOf="@+id/separator"
android:layout_alignBaseline="@+id/separator"
- android:textAppearance="?android:attr/timePickerHeaderAmPmLabelTextAppearance"
- android:importantForAccessibility="no" />
+ android:textAppearance="?android:attr/timePickerHeaderAmPmLabelTextAppearance" />
</RelativeLayout>
diff --git a/graphics/java/android/graphics/AvoidXfermode.java b/graphics/java/android/graphics/AvoidXfermode.java
index 5a59e36..206c959 100644
--- a/graphics/java/android/graphics/AvoidXfermode.java
+++ b/graphics/java/android/graphics/AvoidXfermode.java
@@ -56,6 +56,6 @@
native_instance = nativeCreate(opColor, tolerance, mode.nativeInt);
}
- private static native int nativeCreate(int opColor, int tolerance,
- int nativeMode);
+ private static native long nativeCreate(int opColor, int tolerance,
+ int nativeMode);
}
diff --git a/graphics/java/android/graphics/Bitmap.java b/graphics/java/android/graphics/Bitmap.java
index 536c4b6..d6b73fd 100644
--- a/graphics/java/android/graphics/Bitmap.java
+++ b/graphics/java/android/graphics/Bitmap.java
@@ -41,7 +41,7 @@
*
* @hide
*/
- public final int mNativeBitmap;
+ public final long mNativeBitmap;
/**
* Backing buffer for the Bitmap.
@@ -113,7 +113,7 @@
* int (pointer).
*/
@SuppressWarnings({"UnusedDeclaration"}) // called from JNI
- Bitmap(int nativeBitmap, byte[] buffer, int width, int height, int density,
+ Bitmap(long nativeBitmap, byte[] buffer, int width, int height, int density,
boolean isMutable, boolean isPremultiplied,
byte[] ninePatchChunk, int[] layoutBounds) {
if (nativeBitmap == 0) {
@@ -1536,7 +1536,7 @@
*/
public Bitmap extractAlpha(Paint paint, int[] offsetXY) {
checkRecycled("Can't extractAlpha on a recycled bitmap");
- int nativePaint = paint != null ? paint.mNativePaint : 0;
+ long nativePaint = paint != null ? paint.mNativePaint : 0;
Bitmap bm = nativeExtractAlpha(mNativeBitmap, nativePaint, offsetXY);
if (bm == null) {
throw new RuntimeException("Failed to extractAlpha on Bitmap");
@@ -1570,9 +1570,9 @@
}
private static class BitmapFinalizer {
- private final int mNativeBitmap;
+ private final long mNativeBitmap;
- BitmapFinalizer(int nativeBitmap) {
+ BitmapFinalizer(long nativeBitmap) {
mNativeBitmap = nativeBitmap;
}
@@ -1593,56 +1593,57 @@
private static native Bitmap nativeCreate(int[] colors, int offset,
int stride, int width, int height,
int nativeConfig, boolean mutable);
- private static native Bitmap nativeCopy(int srcBitmap, int nativeConfig,
+ private static native Bitmap nativeCopy(long nativeSrcBitmap, int nativeConfig,
boolean isMutable);
- private static native void nativeDestructor(int nativeBitmap);
- private static native boolean nativeRecycle(int nativeBitmap);
- private static native void nativeReconfigure(int nativeBitmap, int width, int height,
+ private static native void nativeDestructor(long nativeBitmap);
+ private static native boolean nativeRecycle(long nativeBitmap);
+ private static native void nativeReconfigure(long nativeBitmap, int width, int height,
int config, int allocSize);
- private static native boolean nativeCompress(int nativeBitmap, int format,
+ private static native boolean nativeCompress(long nativeBitmap, int format,
int quality, OutputStream stream,
byte[] tempStorage);
- private static native void nativeErase(int nativeBitmap, int color);
- private static native int nativeRowBytes(int nativeBitmap);
- private static native int nativeConfig(int nativeBitmap);
+ private static native void nativeErase(long nativeBitmap, int color);
+ private static native int nativeRowBytes(long nativeBitmap);
+ private static native int nativeConfig(long nativeBitmap);
- private static native int nativeGetPixel(int nativeBitmap, int x, int y,
+ private static native int nativeGetPixel(long nativeBitmap, int x, int y,
boolean isPremultiplied);
- private static native void nativeGetPixels(int nativeBitmap, int[] pixels,
+ private static native void nativeGetPixels(long nativeBitmap, int[] pixels,
int offset, int stride, int x, int y,
int width, int height, boolean isPremultiplied);
- private static native void nativeSetPixel(int nativeBitmap, int x, int y,
+ private static native void nativeSetPixel(long nativeBitmap, int x, int y,
int color, boolean isPremultiplied);
- private static native void nativeSetPixels(int nativeBitmap, int[] colors,
+ private static native void nativeSetPixels(long nativeBitmap, int[] colors,
int offset, int stride, int x, int y,
int width, int height, boolean isPremultiplied);
- private static native void nativeCopyPixelsToBuffer(int nativeBitmap,
+ private static native void nativeCopyPixelsToBuffer(long nativeBitmap,
Buffer dst);
- private static native void nativeCopyPixelsFromBuffer(int nb, Buffer src);
- private static native int nativeGenerationId(int nativeBitmap);
+ private static native void nativeCopyPixelsFromBuffer(long nativeBitmap, Buffer src);
+ private static native int nativeGenerationId(long nativeBitmap);
private static native Bitmap nativeCreateFromParcel(Parcel p);
// returns true on success
- private static native boolean nativeWriteToParcel(int nativeBitmap,
+ private static native boolean nativeWriteToParcel(long nativeBitmap,
boolean isMutable,
int density,
Parcel p);
// returns a new bitmap built from the native bitmap's alpha, and the paint
- private static native Bitmap nativeExtractAlpha(int nativeBitmap,
- int nativePaint,
+ private static native Bitmap nativeExtractAlpha(long nativeBitmap,
+ long nativePaint,
int[] offsetXY);
- private static native void nativePrepareToDraw(int nativeBitmap);
- private static native boolean nativeHasAlpha(int nativeBitmap);
- private static native void nativeSetAlphaAndPremultiplied(int nBitmap, boolean hasAlpha,
+ private static native void nativePrepareToDraw(long nativeBitmap);
+ private static native boolean nativeHasAlpha(long nativeBitmap);
+ private static native void nativeSetAlphaAndPremultiplied(long nativeBitmap,
+ boolean hasAlpha,
boolean isPremul);
- private static native boolean nativeHasMipMap(int nativeBitmap);
- private static native void nativeSetHasMipMap(int nBitmap, boolean hasMipMap);
- private static native boolean nativeSameAs(int nb0, int nb1);
-
- /* package */ final int ni() {
+ private static native boolean nativeHasMipMap(long nativeBitmap);
+ private static native void nativeSetHasMipMap(long nativeBitmap, boolean hasMipMap);
+ private static native boolean nativeSameAs(long nativeBitmap0, long nativeBitmap1);
+
+ /* package */ final long ni() {
return mNativeBitmap;
}
}
diff --git a/graphics/java/android/graphics/BitmapFactory.java b/graphics/java/android/graphics/BitmapFactory.java
index 2b69a15..c20502f 100644
--- a/graphics/java/android/graphics/BitmapFactory.java
+++ b/graphics/java/android/graphics/BitmapFactory.java
@@ -595,7 +595,7 @@
Trace.traceBegin(Trace.TRACE_TAG_GRAPHICS, "decodeBitmap");
try {
if (is instanceof AssetManager.AssetInputStream) {
- final int asset = ((AssetManager.AssetInputStream) is).getAssetInt();
+ final long asset = ((AssetManager.AssetInputStream) is).getNativeAsset();
bm = nativeDecodeAsset(asset, outPadding, opts);
} else {
bm = decodeStreamInternal(is, outPadding, opts);
@@ -698,7 +698,7 @@
Rect padding, Options opts);
private static native Bitmap nativeDecodeFileDescriptor(FileDescriptor fd,
Rect padding, Options opts);
- private static native Bitmap nativeDecodeAsset(int asset, Rect padding, Options opts);
+ private static native Bitmap nativeDecodeAsset(long nativeAsset, Rect padding, Options opts);
private static native Bitmap nativeDecodeByteArray(byte[] data, int offset,
int length, Options opts);
private static native boolean nativeIsSeekable(FileDescriptor fd);
diff --git a/graphics/java/android/graphics/BitmapShader.java b/graphics/java/android/graphics/BitmapShader.java
index a4f75b9..b7673d8 100644
--- a/graphics/java/android/graphics/BitmapShader.java
+++ b/graphics/java/android/graphics/BitmapShader.java
@@ -42,7 +42,7 @@
mBitmap = bitmap;
mTileX = tileX;
mTileY = tileY;
- final int b = bitmap.ni();
+ final long b = bitmap.ni();
native_instance = nativeCreate(b, tileX.nativeInt, tileY.nativeInt);
native_shader = nativePostCreate(native_instance, b, tileX.nativeInt, tileY.nativeInt);
}
@@ -57,8 +57,8 @@
return copy;
}
- private static native int nativeCreate(int native_bitmap, int shaderTileModeX,
+ private static native long nativeCreate(long native_bitmap, int shaderTileModeX,
int shaderTileModeY);
- private static native int nativePostCreate(int native_shader, int native_bitmap,
+ private static native long nativePostCreate(long native_shader, long native_bitmap,
int shaderTileModeX, int shaderTileModeY);
}
diff --git a/graphics/java/android/graphics/BlurMaskFilter.java b/graphics/java/android/graphics/BlurMaskFilter.java
index 5eafe76..939af52 100644
--- a/graphics/java/android/graphics/BlurMaskFilter.java
+++ b/graphics/java/android/graphics/BlurMaskFilter.java
@@ -47,5 +47,5 @@
native_instance = nativeConstructor(radius, style.native_int);
}
- private static native int nativeConstructor(float radius, int style);
+ private static native long nativeConstructor(float radius, int style);
}
diff --git a/graphics/java/android/graphics/Camera.java b/graphics/java/android/graphics/Camera.java
index 9e07bd4..c263a84 100644
--- a/graphics/java/android/graphics/Camera.java
+++ b/graphics/java/android/graphics/Camera.java
@@ -159,7 +159,7 @@
}
public native float dotWithNormal(float dx, float dy, float dz);
-
+
protected void finalize() throws Throwable {
try {
nativeDestructor();
@@ -170,8 +170,8 @@
private native void nativeConstructor();
private native void nativeDestructor();
- private native void nativeGetMatrix(int native_matrix);
- private native void nativeApplyToCanvas(int native_canvas);
-
- int native_instance;
+ private native void nativeGetMatrix(long native_matrix);
+ private native void nativeApplyToCanvas(long native_canvas);
+
+ long native_instance;
}
diff --git a/graphics/java/android/graphics/Canvas.java b/graphics/java/android/graphics/Canvas.java
index 13f4299..2b72b93 100644
--- a/graphics/java/android/graphics/Canvas.java
+++ b/graphics/java/android/graphics/Canvas.java
@@ -40,7 +40,7 @@
// assigned in constructors or setBitmap, freed in finalizer
/** @hide */
- public int mNativeCanvas;
+ public long mNativeCanvas;
// may be null
private Bitmap mBitmap;
@@ -84,9 +84,9 @@
private final CanvasFinalizer mFinalizer;
private static final class CanvasFinalizer {
- private int mNativeCanvas;
+ private long mNativeCanvas;
- public CanvasFinalizer(int nativeCanvas) {
+ public CanvasFinalizer(long nativeCanvas) {
mNativeCanvas = nativeCanvas;
}
@@ -144,7 +144,7 @@
}
/** @hide */
- public Canvas(int nativeCanvas) {
+ public Canvas(long nativeCanvas) {
if (nativeCanvas == 0) {
throw new IllegalStateException();
}
@@ -157,8 +157,8 @@
* Replace existing canvas while ensuring that the swap has occurred before
* the previous native canvas is unreferenced.
*/
- private void safeCanvasSwap(int nativeCanvas, boolean copyState) {
- final int oldCanvas = mNativeCanvas;
+ private void safeCanvasSwap(long nativeCanvas, boolean copyState) {
+ final long oldCanvas = mNativeCanvas;
mNativeCanvas = nativeCanvas;
mFinalizer.mNativeCanvas = nativeCanvas;
if (copyState) {
@@ -174,7 +174,7 @@
*
* @hide
*/
- public int getNativeCanvas() {
+ public long getNativeCanvas() {
return mNativeCanvas;
}
@@ -712,7 +712,7 @@
}
public void setDrawFilter(DrawFilter filter) {
- int nativeFilter = 0;
+ long nativeFilter = 0;
if (filter != null) {
nativeFilter = filter.mNativeInt;
}
@@ -1387,7 +1387,7 @@
vertOffset, texs, texOffset, colors, colorOffset,
indices, indexOffset, indexCount, 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.
@@ -1713,137 +1713,155 @@
*/
public static native void freeTextLayoutCaches();
- private static native int initRaster(int nativeBitmapOrZero);
- private static native void copyNativeCanvasState(int srcCanvas, int dstCanvas);
- private static native int native_saveLayer(int nativeCanvas, RectF bounds,
- int paint, int layerFlags);
- private static native int native_saveLayer(int nativeCanvas, float l,
+ private static native long initRaster(long nativeBitmapOrZero);
+ private static native void copyNativeCanvasState(long nativeSrcCanvas,
+ long nativeDstCanvas);
+ private static native int native_saveLayer(long nativeCanvas,
+ RectF bounds,
+ long nativePaint,
+ int layerFlags);
+ private static native int native_saveLayer(long nativeCanvas, float l,
float t, float r, float b,
- int paint, int layerFlags);
- private static native int native_saveLayerAlpha(int nativeCanvas,
+ long nativePaint,
+ int layerFlags);
+ private static native int native_saveLayerAlpha(long nativeCanvas,
RectF bounds, int alpha,
int layerFlags);
- private static native int native_saveLayerAlpha(int nativeCanvas, float l,
+ private static native int native_saveLayerAlpha(long nativeCanvas, float l,
float t, float r, float b,
int alpha, int layerFlags);
- private static native void native_concat(int nCanvas, int nMatrix);
- private static native void native_setMatrix(int nCanvas, int nMatrix);
- private static native boolean native_clipRect(int nCanvas,
+ private static native void native_concat(long nativeCanvas,
+ long nativeMatrix);
+ private static native void native_setMatrix(long nativeCanvas,
+ long nativeMatrix);
+ private static native boolean native_clipRect(long nativeCanvas,
float left, float top,
float right, float bottom,
int regionOp);
- private static native boolean native_clipPath(int nativeCanvas,
- int nativePath,
+ private static native boolean native_clipPath(long nativeCanvas,
+ long nativePath,
int regionOp);
- private static native boolean native_clipRegion(int nativeCanvas,
- int nativeRegion,
+ private static native boolean native_clipRegion(long nativeCanvas,
+ long nativeRegion,
int regionOp);
- private static native void nativeSetDrawFilter(int nativeCanvas,
- int nativeFilter);
- private static native boolean native_getClipBounds(int nativeCanvas,
+ private static native void nativeSetDrawFilter(long nativeCanvas,
+ long nativeFilter);
+ private static native boolean native_getClipBounds(long nativeCanvas,
Rect bounds);
- private static native void native_getCTM(int canvas, int matrix);
- private static native boolean native_quickReject(int nativeCanvas,
+ private static native void native_getCTM(long nativeCanvas,
+ long nativeMatrix);
+ private static native boolean native_quickReject(long nativeCanvas,
RectF rect);
- private static native boolean native_quickReject(int nativeCanvas,
- int path);
- private static native boolean native_quickReject(int nativeCanvas,
+ private static native boolean native_quickReject(long nativeCanvas,
+ long nativePath);
+ private static native boolean native_quickReject(long nativeCanvas,
float left, float top,
float right, float bottom);
- private static native void native_drawRGB(int nativeCanvas, int r, int g,
+ private static native void native_drawRGB(long nativeCanvas, int r, int g,
int b);
- private static native void native_drawARGB(int nativeCanvas, int a, int r,
+ private static native void native_drawARGB(long nativeCanvas, int a, int r,
int g, int b);
- private static native void native_drawColor(int nativeCanvas, int color);
- private static native void native_drawColor(int nativeCanvas, int color,
+ private static native void native_drawColor(long nativeCanvas, int color);
+ private static native void native_drawColor(long nativeCanvas, int color,
int mode);
- private static native void native_drawPaint(int nativeCanvas, int paint);
- private static native void native_drawLine(int nativeCanvas, float startX,
+ private static native void native_drawPaint(long nativeCanvas,
+ long nativePaint);
+ private static native void native_drawLine(long nativeCanvas, float startX,
float startY, float stopX,
- float stopY, int paint);
- private static native void native_drawRect(int nativeCanvas, RectF rect,
- int paint);
- private static native void native_drawRect(int nativeCanvas, float left,
+ float stopY, long nativePaint);
+ private static native void native_drawRect(long nativeCanvas, RectF rect,
+ long nativePaint);
+ private static native void native_drawRect(long nativeCanvas, float left,
float top, float right,
- float bottom, int paint);
- private static native void native_drawOval(int nativeCanvas, RectF oval,
- int paint);
- private static native void native_drawCircle(int nativeCanvas, float cx,
+ float bottom,
+ long nativePaint);
+ private static native void native_drawOval(long nativeCanvas, RectF oval,
+ long nativePaint);
+ private static native void native_drawCircle(long nativeCanvas, float cx,
float cy, float radius,
- int paint);
- private static native void native_drawArc(int nativeCanvas, RectF oval,
+ long nativePaint);
+ private static native void native_drawArc(long nativeCanvas, RectF oval,
float startAngle, float sweep,
- boolean useCenter, int paint);
- private static native void native_drawRoundRect(int nativeCanvas,
+ boolean useCenter,
+ long nativePaint);
+ private static native void native_drawRoundRect(long nativeCanvas,
RectF rect, float rx,
- float ry, int paint);
- private static native void native_drawPath(int nativeCanvas, int path,
- int paint);
- private native void native_drawBitmap(int nativeCanvas, int bitmap,
+ float ry, long nativePaint);
+ private static native void native_drawPath(long nativeCanvas,
+ long nativePath,
+ long nativePaint);
+ private native void native_drawBitmap(long nativeCanvas, long nativeBitmap,
float left, float top,
- int nativePaintOrZero,
+ long nativePaintOrZero,
int canvasDensity,
int screenDensity,
int bitmapDensity);
- private native void native_drawBitmap(int nativeCanvas, int bitmap,
+ private native void native_drawBitmap(long nativeCanvas, long nativeBitmap,
Rect src, RectF dst,
- int nativePaintOrZero,
+ long nativePaintOrZero,
int screenDensity,
int bitmapDensity);
- private static native void native_drawBitmap(int nativeCanvas, int bitmap,
+ private static native void native_drawBitmap(long nativeCanvas,
+ long nativeBitmap,
Rect src, Rect dst,
- int nativePaintOrZero,
+ long nativePaintOrZero,
int screenDensity,
int bitmapDensity);
- private static native void native_drawBitmap(int nativeCanvas, int[] colors,
+ private static native void native_drawBitmap(long nativeCanvas, int[] colors,
int offset, int stride, float x,
float y, int width, int height,
boolean hasAlpha,
- int nativePaintOrZero);
- private static native void nativeDrawBitmapMatrix(int nCanvas, int nBitmap,
- int nMatrix, int nPaint);
- private static native void nativeDrawBitmapMesh(int nCanvas, int nBitmap,
+ long nativePaintOrZero);
+ private static native void nativeDrawBitmapMatrix(long nativeCanvas,
+ long nativeBitmap,
+ long nativeMatrix,
+ long nativePaint);
+ private static native void nativeDrawBitmapMesh(long nativeCanvas,
+ long nativeBitmap,
int meshWidth, int meshHeight,
float[] verts, int vertOffset,
- int[] colors, int colorOffset, int nPaint);
- private static native void nativeDrawVertices(int nCanvas, int mode, int n,
+ int[] colors, int colorOffset,
+ long nativePaint);
+ private static native void nativeDrawVertices(long nativeCanvas, int mode, int n,
float[] verts, int vertOffset, float[] texs, int texOffset,
int[] colors, int colorOffset, short[] indices,
- int indexOffset, int indexCount, int nPaint);
-
- private static native void native_drawText(int nativeCanvas, char[] text,
+ int indexOffset, int indexCount, long nativePaint);
+
+ private static native void native_drawText(long nativeCanvas, char[] text,
int index, int count, float x,
- float y, int flags, int paint, int typeface);
- private static native void native_drawText(int nativeCanvas, String text,
+ float y, int flags, long nativePaint,
+ long nativeTypeface);
+ private static native void native_drawText(long nativeCanvas, String text,
int start, int end, float x,
- float y, int flags, int paint, int typeface);
+ float y, int flags, long nativePaint,
+ long nativeTypeface);
- private static native void native_drawTextRun(int nativeCanvas, String text,
+ private static native void native_drawTextRun(long nativeCanvas, String text,
int start, int end, int contextStart, int contextEnd,
- float x, float y, int flags, int paint, int typeface);
+ float x, float y, int flags, long nativePaint, long nativeTypeface);
- private static native void native_drawTextRun(int nativeCanvas, char[] text,
+ private static native void native_drawTextRun(long nativeCanvas, char[] text,
int start, int count, int contextStart, int contextCount,
- float x, float y, int flags, int paint, int typeface);
+ float x, float y, int flags, long nativePaint, long nativeTypeface);
- private static native void native_drawPosText(int nativeCanvas,
+ private static native void native_drawPosText(long nativeCanvas,
char[] text, int index,
int count, float[] pos,
- int paint);
- private static native void native_drawPosText(int nativeCanvas,
+ long nativePaint);
+ private static native void native_drawPosText(long nativeCanvas,
String text, float[] pos,
- int paint);
- private static native void native_drawTextOnPath(int nativeCanvas,
+ long nativePaint);
+ private static native void native_drawTextOnPath(long nativeCanvas,
char[] text, int index,
- int count, int path,
+ int count, long nativePath,
float hOffset,
float vOffset, int bidiFlags,
- int paint);
- private static native void native_drawTextOnPath(int nativeCanvas,
- String text, int path,
- float hOffset,
- float vOffset,
- int flags, int paint);
- private static native void finalizer(int nativeCanvas);
+ long nativePaint);
+ private static native void native_drawTextOnPath(long nativeCanvas,
+ String text, long nativePath,
+ float hOffset,
+ float vOffset,
+ int flags, long nativePaint);
+ private static native void finalizer(long nativeCanvas);
}
diff --git a/graphics/java/android/graphics/ColorFilter.java b/graphics/java/android/graphics/ColorFilter.java
index 8e0af77..d3c1974 100644
--- a/graphics/java/android/graphics/ColorFilter.java
+++ b/graphics/java/android/graphics/ColorFilter.java
@@ -28,14 +28,14 @@
*/
public class ColorFilter {
// Holds the pointer to the native SkColorFilter instance
- int native_instance;
+ long native_instance;
/**
* Holds the pointer to the native SkiaColorFilter instance, from libhwui.
*
* @hide
*/
- public int nativeColorFilter;
+ public long nativeColorFilter;
@Override
protected void finalize() throws Throwable {
@@ -46,5 +46,5 @@
}
}
- static native void destroyFilter(int native_instance, int nativeColorFilter);
+ static native void destroyFilter(long native_instance, long nativeColorFilter);
}
diff --git a/graphics/java/android/graphics/ColorMatrixColorFilter.java b/graphics/java/android/graphics/ColorMatrixColorFilter.java
index 8de32ec..3f7331d 100644
--- a/graphics/java/android/graphics/ColorMatrixColorFilter.java
+++ b/graphics/java/android/graphics/ColorMatrixColorFilter.java
@@ -119,6 +119,6 @@
nativeColorFilter = nColorMatrixFilter(native_instance, colorMatrix);
}
- private static native int nativeColorMatrixFilter(float[] array);
- private static native int nColorMatrixFilter(int nativeFilter, float[] array);
+ private static native long nativeColorMatrixFilter(float[] array);
+ private static native long nColorMatrixFilter(long nativeFilter, float[] array);
}
diff --git a/graphics/java/android/graphics/ComposePathEffect.java b/graphics/java/android/graphics/ComposePathEffect.java
index beac78e..3fc9eb5 100644
--- a/graphics/java/android/graphics/ComposePathEffect.java
+++ b/graphics/java/android/graphics/ComposePathEffect.java
@@ -27,6 +27,7 @@
innerpe.native_instance);
}
- private static native int nativeCreate(int outerpe, int innerpe);
+ private static native long nativeCreate(long nativeOuterpe,
+ long nativeInnerpe);
}
diff --git a/graphics/java/android/graphics/ComposeShader.java b/graphics/java/android/graphics/ComposeShader.java
index de0d3d6..5109ffd 100644
--- a/graphics/java/android/graphics/ComposeShader.java
+++ b/graphics/java/android/graphics/ComposeShader.java
@@ -104,12 +104,12 @@
return copy;
}
- private static native int nativeCreate1(int native_shaderA, int native_shaderB,
- int native_mode);
- private static native int nativeCreate2(int native_shaderA, int native_shaderB,
+ private static native long nativeCreate1(long native_shaderA, long native_shaderB,
+ long native_mode);
+ private static native long nativeCreate2(long native_shaderA, long native_shaderB,
int porterDuffMode);
- private static native int nativePostCreate1(int native_shader, int native_skiaShaderA,
- int native_skiaShaderB, int native_mode);
- private static native int nativePostCreate2(int native_shader, int native_skiaShaderA,
- int native_skiaShaderB, int porterDuffMode);
+ private static native long nativePostCreate1(long native_shader, long native_skiaShaderA,
+ long native_skiaShaderB, long native_mode);
+ private static native long nativePostCreate2(long native_shader, long native_skiaShaderA,
+ long native_skiaShaderB, int porterDuffMode);
}
diff --git a/graphics/java/android/graphics/CornerPathEffect.java b/graphics/java/android/graphics/CornerPathEffect.java
index 400c886..8f4d7d9 100644
--- a/graphics/java/android/graphics/CornerPathEffect.java
+++ b/graphics/java/android/graphics/CornerPathEffect.java
@@ -28,6 +28,6 @@
native_instance = nativeCreate(radius);
}
- private static native int nativeCreate(float radius);
+ private static native long nativeCreate(float radius);
}
diff --git a/graphics/java/android/graphics/DashPathEffect.java b/graphics/java/android/graphics/DashPathEffect.java
index 2bdecce..ef3ebe8 100644
--- a/graphics/java/android/graphics/DashPathEffect.java
+++ b/graphics/java/android/graphics/DashPathEffect.java
@@ -38,6 +38,6 @@
native_instance = nativeCreate(intervals, phase);
}
- private static native int nativeCreate(float intervals[], float phase);
+ private static native long nativeCreate(float intervals[], float phase);
}
diff --git a/graphics/java/android/graphics/DiscretePathEffect.java b/graphics/java/android/graphics/DiscretePathEffect.java
index de8b2f0..3b3c9c9 100644
--- a/graphics/java/android/graphics/DiscretePathEffect.java
+++ b/graphics/java/android/graphics/DiscretePathEffect.java
@@ -26,6 +26,6 @@
native_instance = nativeCreate(segmentLength, deviation);
}
- private static native int nativeCreate(float length, float deviation);
+ private static native long nativeCreate(float length, float deviation);
}
diff --git a/graphics/java/android/graphics/DrawFilter.java b/graphics/java/android/graphics/DrawFilter.java
index 1f64539..ed38f37 100644
--- a/graphics/java/android/graphics/DrawFilter.java
+++ b/graphics/java/android/graphics/DrawFilter.java
@@ -25,7 +25,7 @@
public class DrawFilter {
// this is set by subclasses, but don't make it public
- /* package */ int mNativeInt; // pointer to native object
+ /* package */ long mNativeInt; // pointer to native object
protected void finalize() throws Throwable {
try {
@@ -35,6 +35,6 @@
}
}
- private static native void nativeDestructor(int nativeDrawFilter);
+ private static native void nativeDestructor(long nativeDrawFilter);
}
diff --git a/graphics/java/android/graphics/EmbossMaskFilter.java b/graphics/java/android/graphics/EmbossMaskFilter.java
index 5dd8611..a9e180f 100644
--- a/graphics/java/android/graphics/EmbossMaskFilter.java
+++ b/graphics/java/android/graphics/EmbossMaskFilter.java
@@ -33,6 +33,6 @@
native_instance = nativeConstructor(direction, ambient, specular, blurRadius);
}
- private static native int nativeConstructor(float[] direction, float ambient, float specular, float blurRadius);
+ private static native long nativeConstructor(float[] direction, float ambient, float specular, float blurRadius);
}
diff --git a/graphics/java/android/graphics/LargeBitmap.java b/graphics/java/android/graphics/LargeBitmap.java
index c70c709..936c338 100644
--- a/graphics/java/android/graphics/LargeBitmap.java
+++ b/graphics/java/android/graphics/LargeBitmap.java
@@ -27,7 +27,7 @@
* @hide
*/
public final class LargeBitmap {
- private int mNativeLargeBitmap;
+ private long mNativeLargeBitmap;
private boolean mRecycled;
/* Private constructor that must received an already allocated native
@@ -35,8 +35,8 @@
This can be called from JNI code.
*/
- private LargeBitmap(int lbm) {
- mNativeLargeBitmap = lbm;
+ private LargeBitmap(long nativeLbm) {
+ mNativeLargeBitmap = nativeLbm;
mRecycled = false;
}
@@ -109,10 +109,10 @@
recycle();
}
- private static native Bitmap nativeDecodeRegion(int lbm,
+ private static native Bitmap nativeDecodeRegion(long nativeLbm,
int start_x, int start_y, int width, int height,
BitmapFactory.Options options);
- private static native int nativeGetWidth(int lbm);
- private static native int nativeGetHeight(int lbm);
- private static native void nativeClean(int lbm);
+ private static native int nativeGetWidth(long nativeLbm);
+ private static native int nativeGetHeight(long nativeLbm);
+ private static native void nativeClean(long nativeLbm);
}
diff --git a/graphics/java/android/graphics/LayerRasterizer.java b/graphics/java/android/graphics/LayerRasterizer.java
index 9bd55a5..dc307c6 100644
--- a/graphics/java/android/graphics/LayerRasterizer.java
+++ b/graphics/java/android/graphics/LayerRasterizer.java
@@ -34,7 +34,7 @@
nativeAddLayer(native_instance, paint.mNativePaint, 0, 0);
}
- private static native int nativeConstructor();
- private static native void nativeAddLayer(int native_layer, int native_paint, float dx, float dy);
+ private static native long nativeConstructor();
+ private static native void nativeAddLayer(long native_layer, long native_paint, float dx, float dy);
}
diff --git a/graphics/java/android/graphics/LightingColorFilter.java b/graphics/java/android/graphics/LightingColorFilter.java
index 75f1827..5829edf 100644
--- a/graphics/java/android/graphics/LightingColorFilter.java
+++ b/graphics/java/android/graphics/LightingColorFilter.java
@@ -104,6 +104,6 @@
nativeColorFilter = nCreateLightingFilter(native_instance, mMul, mAdd);
}
- private static native int native_CreateLightingFilter(int mul, int add);
- private static native int nCreateLightingFilter(int nativeFilter, int mul, int add);
+ private static native long native_CreateLightingFilter(int mul, int add);
+ private static native long nCreateLightingFilter(long nativeFilter, int mul, int add);
}
diff --git a/graphics/java/android/graphics/LinearGradient.java b/graphics/java/android/graphics/LinearGradient.java
index 4c88de3..9ad3e49 100644
--- a/graphics/java/android/graphics/LinearGradient.java
+++ b/graphics/java/android/graphics/LinearGradient.java
@@ -116,12 +116,12 @@
return copy;
}
- private native int nativeCreate1(float x0, float y0, float x1, float y1,
+ private native long nativeCreate1(float x0, float y0, float x1, float y1,
int colors[], float positions[], int tileMode);
- private native int nativeCreate2(float x0, float y0, float x1, float y1,
+ private native long nativeCreate2(float x0, float y0, float x1, float y1,
int color0, int color1, int tileMode);
- private native int nativePostCreate1(int native_shader, float x0, float y0, float x1, float y1,
+ private native long nativePostCreate1(long native_shader, float x0, float y0, float x1, float y1,
int colors[], float positions[], int tileMode);
- private native int nativePostCreate2(int native_shader, float x0, float y0, float x1, float y1,
+ private native long nativePostCreate2(long native_shader, float x0, float y0, float x1, float y1,
int color0, int color1, int tileMode);
}
diff --git a/graphics/java/android/graphics/MaskFilter.java b/graphics/java/android/graphics/MaskFilter.java
index 4ebb619..27a7dda 100644
--- a/graphics/java/android/graphics/MaskFilter.java
+++ b/graphics/java/android/graphics/MaskFilter.java
@@ -27,6 +27,6 @@
nativeDestructor(native_instance);
}
- private static native void nativeDestructor(int native_filter);
- int native_instance;
+ private static native void nativeDestructor(long native_filter);
+ long native_instance;
}
diff --git a/graphics/java/android/graphics/Matrix.java b/graphics/java/android/graphics/Matrix.java
index 32e0c01..c8bcf26 100644
--- a/graphics/java/android/graphics/Matrix.java
+++ b/graphics/java/android/graphics/Matrix.java
@@ -219,7 +219,7 @@
/**
* @hide
*/
- public int native_instance;
+ public long native_instance;
/**
* Create an identity matrix
@@ -800,83 +800,86 @@
}
}
- /*package*/ final int ni() {
+ /*package*/ final long ni() {
return native_instance;
}
- private static native int native_create(int native_src_or_zero);
- private static native boolean native_isIdentity(int native_object);
- private static native boolean native_rectStaysRect(int native_object);
- private static native void native_reset(int native_object);
- private static native void native_set(int native_object, int other);
- private static native void native_setTranslate(int native_object,
+ private static native long native_create(long native_src_or_zero);
+ private static native boolean native_isIdentity(long native_object);
+ private static native boolean native_rectStaysRect(long native_object);
+ private static native void native_reset(long native_object);
+ private static native void native_set(long native_object,
+ long native_other);
+ private static native void native_setTranslate(long native_object,
float dx, float dy);
- private static native void native_setScale(int native_object,
+ private static native void native_setScale(long native_object,
float sx, float sy, float px, float py);
- private static native void native_setScale(int native_object,
+ private static native void native_setScale(long native_object,
float sx, float sy);
- private static native void native_setRotate(int native_object,
+ private static native void native_setRotate(long native_object,
float degrees, float px, float py);
- private static native void native_setRotate(int native_object,
+ private static native void native_setRotate(long native_object,
float degrees);
- private static native void native_setSinCos(int native_object,
+ private static native void native_setSinCos(long native_object,
float sinValue, float cosValue, float px, float py);
- private static native void native_setSinCos(int native_object,
+ private static native void native_setSinCos(long native_object,
float sinValue, float cosValue);
- private static native void native_setSkew(int native_object,
+ private static native void native_setSkew(long native_object,
float kx, float ky, float px, float py);
- private static native void native_setSkew(int native_object,
+ private static native void native_setSkew(long native_object,
float kx, float ky);
- private static native boolean native_setConcat(int native_object,
- int a, int b);
- private static native boolean native_preTranslate(int native_object,
+ private static native boolean native_setConcat(long native_object,
+ long native_a,
+ long native_b);
+ private static native boolean native_preTranslate(long native_object,
float dx, float dy);
- private static native boolean native_preScale(int native_object,
+ private static native boolean native_preScale(long native_object,
float sx, float sy, float px, float py);
- private static native boolean native_preScale(int native_object,
+ private static native boolean native_preScale(long native_object,
float sx, float sy);
- private static native boolean native_preRotate(int native_object,
+ private static native boolean native_preRotate(long native_object,
float degrees, float px, float py);
- private static native boolean native_preRotate(int native_object,
+ private static native boolean native_preRotate(long native_object,
float degrees);
- private static native boolean native_preSkew(int native_object,
+ private static native boolean native_preSkew(long native_object,
float kx, float ky, float px, float py);
- private static native boolean native_preSkew(int native_object,
+ private static native boolean native_preSkew(long native_object,
float kx, float ky);
- private static native boolean native_preConcat(int native_object,
- int other_matrix);
- private static native boolean native_postTranslate(int native_object,
+ private static native boolean native_preConcat(long native_object,
+ long native_other_matrix);
+ private static native boolean native_postTranslate(long native_object,
float dx, float dy);
- private static native boolean native_postScale(int native_object,
+ private static native boolean native_postScale(long native_object,
float sx, float sy, float px, float py);
- private static native boolean native_postScale(int native_object,
+ private static native boolean native_postScale(long native_object,
float sx, float sy);
- private static native boolean native_postRotate(int native_object,
+ private static native boolean native_postRotate(long native_object,
float degrees, float px, float py);
- private static native boolean native_postRotate(int native_object,
+ private static native boolean native_postRotate(long native_object,
float degrees);
- private static native boolean native_postSkew(int native_object,
+ private static native boolean native_postSkew(long native_object,
float kx, float ky, float px, float py);
- private static native boolean native_postSkew(int native_object,
+ private static native boolean native_postSkew(long native_object,
float kx, float ky);
- private static native boolean native_postConcat(int native_object,
- int other_matrix);
- private static native boolean native_setRectToRect(int native_object,
+ private static native boolean native_postConcat(long native_object,
+ long native_other_matrix);
+ private static native boolean native_setRectToRect(long native_object,
RectF src, RectF dst, int stf);
- private static native boolean native_setPolyToPoly(int native_object,
+ private static native boolean native_setPolyToPoly(long native_object,
float[] src, int srcIndex, float[] dst, int dstIndex, int pointCount);
- private static native boolean native_invert(int native_object, int inverse);
- private static native void native_mapPoints(int native_object,
+ private static native boolean native_invert(long native_object,
+ long native_inverse);
+ private static native void native_mapPoints(long native_object,
float[] dst, int dstIndex, float[] src, int srcIndex,
int ptCount, boolean isPts);
- private static native boolean native_mapRect(int native_object,
+ private static native boolean native_mapRect(long native_object,
RectF dst, RectF src);
- private static native float native_mapRadius(int native_object,
+ private static native float native_mapRadius(long native_object,
float radius);
- private static native void native_getValues(int native_object,
+ private static native void native_getValues(long native_object,
float[] values);
- private static native void native_setValues(int native_object,
+ private static native void native_setValues(long native_object,
float[] values);
- private static native boolean native_equals(int native_a, int native_b);
- private static native void finalizer(int native_instance);
+ private static native boolean native_equals(long native_a, long native_b);
+ private static native void finalizer(long native_instance);
}
diff --git a/graphics/java/android/graphics/NinePatch.java b/graphics/java/android/graphics/NinePatch.java
index 528d9de..69089b1 100644
--- a/graphics/java/android/graphics/NinePatch.java
+++ b/graphics/java/android/graphics/NinePatch.java
@@ -39,7 +39,7 @@
*
* @hide
*/
- public final int mNativeChunk;
+ public final long mNativeChunk;
private Paint mPaint;
private String mSrcName;
@@ -217,7 +217,7 @@
* that are transparent.
*/
public final Region getTransparentRegion(Rect bounds) {
- int r = nativeGetTransparentRegion(mBitmap.ni(), mNativeChunk, bounds);
+ long r = nativeGetTransparentRegion(mBitmap.ni(), mNativeChunk, bounds);
return r != 0 ? new Region(r) : null;
}
@@ -236,11 +236,11 @@
* If validation is successful, this method returns a native Res_png_9patch*
* object used by the renderers.
*/
- private static native int validateNinePatchChunk(int bitmap, byte[] chunk);
- private static native void nativeFinalize(int chunk);
- private static native void nativeDraw(int canvas_instance, RectF loc, int bitmap_instance,
- int c, int paint_instance_or_null, int destDensity, int srcDensity);
- private static native void nativeDraw(int canvas_instance, Rect loc, int bitmap_instance,
- int c, int paint_instance_or_null, int destDensity, int srcDensity);
- private static native int nativeGetTransparentRegion(int bitmap, int chunk, Rect location);
+ private static native long validateNinePatchChunk(long bitmap, byte[] chunk);
+ private static native void nativeFinalize(long chunk);
+ private static native void nativeDraw(long canvas_instance, RectF loc, long bitmap_instance,
+ long c, long paint_instance_or_null, int destDensity, int srcDensity);
+ private static native void nativeDraw(long canvas_instance, Rect loc, long bitmap_instance,
+ long c, long paint_instance_or_null, int destDensity, int srcDensity);
+ private static native long nativeGetTransparentRegion(long bitmap, long chunk, Rect location);
}
diff --git a/graphics/java/android/graphics/Paint.java b/graphics/java/android/graphics/Paint.java
index c2d4df2..916cb5a 100644
--- a/graphics/java/android/graphics/Paint.java
+++ b/graphics/java/android/graphics/Paint.java
@@ -32,11 +32,11 @@
/**
* @hide
*/
- public int mNativePaint;
+ public long mNativePaint;
/**
* @hide
*/
- public int mNativeTypeface;
+ public long mNativeTypeface;
private ColorFilter mColorFilter;
private MaskFilter mMaskFilter;
@@ -949,7 +949,7 @@
* @return shader
*/
public Shader setShader(Shader shader) {
- int shaderNative = 0;
+ long shaderNative = 0;
if (shader != null)
shaderNative = shader.native_instance;
native_setShader(mNativePaint, shaderNative);
@@ -973,7 +973,7 @@
* @return filter
*/
public ColorFilter setColorFilter(ColorFilter filter) {
- int filterNative = 0;
+ long filterNative = 0;
if (filter != null)
filterNative = filter.native_instance;
native_setColorFilter(mNativePaint, filterNative);
@@ -1000,7 +1000,7 @@
* @return xfermode
*/
public Xfermode setXfermode(Xfermode xfermode) {
- int xfermodeNative = 0;
+ long xfermodeNative = 0;
if (xfermode != null)
xfermodeNative = xfermode.native_instance;
native_setXfermode(mNativePaint, xfermodeNative);
@@ -1027,7 +1027,7 @@
* @return effect
*/
public PathEffect setPathEffect(PathEffect effect) {
- int effectNative = 0;
+ long effectNative = 0;
if (effect != null) {
effectNative = effect.native_instance;
}
@@ -1056,7 +1056,7 @@
* @return maskfilter
*/
public MaskFilter setMaskFilter(MaskFilter maskfilter) {
- int maskfilterNative = 0;
+ long maskfilterNative = 0;
if (maskfilter != null) {
maskfilterNative = maskfilter.native_instance;
}
@@ -1087,7 +1087,7 @@
* @return typeface
*/
public Typeface setTypeface(Typeface typeface) {
- int typefaceNative = 0;
+ long typefaceNative = 0;
if (typeface != null) {
typefaceNative = typeface.native_instance;
}
@@ -1119,7 +1119,7 @@
* @return rasterizer
*/
public Rasterizer setRasterizer(Rasterizer rasterizer) {
- int rasterizerNative = 0;
+ long rasterizerNative = 0;
if (rasterizer != null) {
rasterizerNative = rasterizer.native_instance;
}
@@ -2214,68 +2214,68 @@
}
}
- private static native int native_init();
- private static native int native_initWithPaint(int paint);
- private static native void native_reset(int native_object);
- private static native void native_set(int native_dst, int native_src);
- private static native int native_getStyle(int native_object);
- private static native void native_setStyle(int native_object, int style);
- private static native int native_getStrokeCap(int native_object);
- private static native void native_setStrokeCap(int native_object, int cap);
- private static native int native_getStrokeJoin(int native_object);
- private static native void native_setStrokeJoin(int native_object,
+ private static native long native_init();
+ private static native long native_initWithPaint(long paint);
+ private static native void native_reset(long native_object);
+ private static native void native_set(long native_dst, long native_src);
+ private static native int native_getStyle(long native_object);
+ private static native void native_setStyle(long native_object, int style);
+ private static native int native_getStrokeCap(long native_object);
+ private static native void native_setStrokeCap(long native_object, int cap);
+ private static native int native_getStrokeJoin(long native_object);
+ private static native void native_setStrokeJoin(long native_object,
int join);
- private static native boolean native_getFillPath(int native_object,
- int src, int dst);
- private static native int native_setShader(int native_object, int shader);
- private static native int native_setColorFilter(int native_object,
- int filter);
- private static native int native_setXfermode(int native_object,
- int xfermode);
- private static native int native_setPathEffect(int native_object,
- int effect);
- private static native int native_setMaskFilter(int native_object,
- int maskfilter);
- private static native int native_setTypeface(int native_object,
- int typeface);
- private static native int native_setRasterizer(int native_object,
- int rasterizer);
+ private static native boolean native_getFillPath(long native_object,
+ long src, long dst);
+ private static native long native_setShader(long native_object, long shader);
+ private static native long native_setColorFilter(long native_object,
+ long filter);
+ private static native long native_setXfermode(long native_object,
+ long xfermode);
+ private static native long native_setPathEffect(long native_object,
+ long effect);
+ private static native long native_setMaskFilter(long native_object,
+ long maskfilter);
+ private static native long native_setTypeface(long native_object,
+ long typeface);
+ private static native long native_setRasterizer(long native_object,
+ long rasterizer);
- private static native int native_getTextAlign(int native_object);
- private static native void native_setTextAlign(int native_object,
+ private static native int native_getTextAlign(long native_object);
+ private static native void native_setTextAlign(long native_object,
int align);
- private static native void native_setTextLocale(int native_object,
+ private static native void native_setTextLocale(long native_object,
String locale);
- private static native int native_getTextWidths(int native_object,
+ private static native int native_getTextWidths(long native_object,
char[] text, int index, int count, int bidiFlags, float[] widths);
- private static native int native_getTextWidths(int native_object,
+ private static native int native_getTextWidths(long native_object,
String text, int start, int end, int bidiFlags, float[] widths);
- private static native int native_getTextGlyphs(int native_object,
+ private static native int native_getTextGlyphs(long native_object,
String text, int start, int end, int contextStart, int contextEnd,
int flags, char[] glyphs);
- private static native float native_getTextRunAdvances(int native_object,
+ private static native float native_getTextRunAdvances(long native_object,
char[] text, int index, int count, int contextIndex, int contextCount,
int flags, float[] advances, int advancesIndex);
- private static native float native_getTextRunAdvances(int native_object,
+ private static native float native_getTextRunAdvances(long native_object,
String text, int start, int end, int contextStart, int contextEnd,
int flags, float[] advances, int advancesIndex);
- private native int native_getTextRunCursor(int native_object, char[] text,
+ private native int native_getTextRunCursor(long native_object, char[] text,
int contextStart, int contextLength, int flags, int offset, int cursorOpt);
- private native int native_getTextRunCursor(int native_object, String text,
+ private native int native_getTextRunCursor(long native_object, String text,
int contextStart, int contextEnd, int flags, int offset, int cursorOpt);
- private static native void native_getTextPath(int native_object, int bidiFlags,
- char[] text, int index, int count, float x, float y, int path);
- private static native void native_getTextPath(int native_object, int bidiFlags,
- String text, int start, int end, float x, float y, int path);
- private static native void nativeGetStringBounds(int nativePaint,
+ private static native void native_getTextPath(long native_object, int bidiFlags,
+ char[] text, int index, int count, float x, float y, long path);
+ private static native void native_getTextPath(long native_object, int bidiFlags,
+ String text, int start, int end, float x, float y, long path);
+ private static native void nativeGetStringBounds(long nativePaint,
String text, int start, int end, int bidiFlags, Rect bounds);
- private static native void nativeGetCharArrayBounds(int nativePaint,
+ private static native void nativeGetCharArrayBounds(long nativePaint,
char[] text, int index, int count, int bidiFlags, Rect bounds);
- private static native void finalizer(int nativePaint);
+ private static native void finalizer(long nativePaint);
}
diff --git a/graphics/java/android/graphics/PaintFlagsDrawFilter.java b/graphics/java/android/graphics/PaintFlagsDrawFilter.java
index c833a12..65a6218 100644
--- a/graphics/java/android/graphics/PaintFlagsDrawFilter.java
+++ b/graphics/java/android/graphics/PaintFlagsDrawFilter.java
@@ -38,6 +38,6 @@
mNativeInt = nativeConstructor(clearBits, setBits);
}
- private static native int nativeConstructor(int clearBits, int setBits);
+ private static native long nativeConstructor(int clearBits, int setBits);
}
diff --git a/graphics/java/android/graphics/Path.java b/graphics/java/android/graphics/Path.java
index 4776088..5ac3f85 100644
--- a/graphics/java/android/graphics/Path.java
+++ b/graphics/java/android/graphics/Path.java
@@ -27,8 +27,8 @@
/**
* @hide
*/
- public final int mNativePath;
- private int mNativePathMeasure;
+ public final long mNativePath;
+ private long mNativePathMeasure;
/**
* @hide
@@ -53,7 +53,7 @@
* @param src The path to copy from when initializing the new path
*/
public Path(Path src) {
- int valNative = 0;
+ long valNative = 0;
if (src != null) {
valNative = src.mNativePath;
isSimplePath = src.isSimplePath;
@@ -657,7 +657,7 @@
* the original path is modified.
*/
public void offset(float dx, float dy, Path dst) {
- int dstNative = 0;
+ long dstNative = 0;
if (dst != null) {
dstNative = dst.mNativePath;
dst.isSimplePath = false;
@@ -703,7 +703,7 @@
* then the the original path is modified
*/
public void transform(Matrix matrix, Path dst) {
- int dstNative = 0;
+ long dstNative = 0;
if (dst != null) {
dst.isSimplePath = false;
dstNative = dst.mNativePath;
@@ -738,7 +738,7 @@
}
}
- final int ni() {
+ final long ni() {
return mNativePath;
}
@@ -818,7 +818,7 @@
if (trimStart > trimEnd) {
throw new IllegalArgumentException("trim end cannot be less than start");
}
- int dstNative = 0;
+ long dstNative = 0;
if (dst != null) {
dstNative = dst.mNativePath;
dst.isSimplePath = false;
@@ -828,54 +828,54 @@
trimStart, trimEnd, trimOffset);
}
- private static native int init1();
- private static native int init2(int nPath);
- private static native void native_reset(int nPath);
- private static native void native_rewind(int nPath);
- private static native void native_set(int native_dst, int native_src);
- private static native int native_getFillType(int nPath);
- private static native void native_setFillType(int nPath, int ft);
- private static native boolean native_isEmpty(int nPath);
- private static native boolean native_isRect(int nPath, RectF rect);
- private static native void native_computeBounds(int nPath, RectF bounds);
- private static native void native_incReserve(int nPath, int extraPtCount);
- private static native void native_moveTo(int nPath, float x, float y);
- private static native void native_rMoveTo(int nPath, float dx, float dy);
- private static native void native_lineTo(int nPath, float x, float y);
- private static native void native_rLineTo(int nPath, float dx, float dy);
- private static native void native_quadTo(int nPath, float x1, float y1,
+ private static native long init1();
+ private static native long init2(long nPath);
+ private static native void native_reset(long nPath);
+ private static native void native_rewind(long nPath);
+ private static native void native_set(long native_dst, long native_src);
+ private static native int native_getFillType(long nPath);
+ private static native void native_setFillType(long nPath, int ft);
+ private static native boolean native_isEmpty(long nPath);
+ private static native boolean native_isRect(long nPath, RectF rect);
+ private static native void native_computeBounds(long nPath, RectF bounds);
+ private static native void native_incReserve(long nPath, int extraPtCount);
+ private static native void native_moveTo(long nPath, float x, float y);
+ private static native void native_rMoveTo(long nPath, float dx, float dy);
+ private static native void native_lineTo(long nPath, float x, float y);
+ private static native void native_rLineTo(long nPath, float dx, float dy);
+ private static native void native_quadTo(long nPath, float x1, float y1,
float x2, float y2);
- private static native void native_rQuadTo(int nPath, float dx1, float dy1,
+ private static native void native_rQuadTo(long nPath, float dx1, float dy1,
float dx2, float dy2);
- private static native void native_cubicTo(int nPath, float x1, float y1,
+ private static native void native_cubicTo(long nPath, float x1, float y1,
float x2, float y2, float x3, float y3);
- private static native void native_rCubicTo(int nPath, float x1, float y1,
+ private static native void native_rCubicTo(long nPath, float x1, float y1,
float x2, float y2, float x3, float y3);
- private static native void native_arcTo(int nPath, RectF oval,
+ private static native void native_arcTo(long nPath, RectF oval,
float startAngle, float sweepAngle, boolean forceMoveTo);
- private static native void native_close(int nPath);
- private static native void native_addRect(int nPath, RectF rect, int dir);
- private static native void native_addRect(int nPath, float left, float top,
+ private static native void native_close(long nPath);
+ private static native void native_addRect(long nPath, RectF rect, int dir);
+ private static native void native_addRect(long nPath, float left, float top,
float right, float bottom, int dir);
- private static native void native_addOval(int nPath, RectF oval, int dir);
- private static native void native_addCircle(int nPath, float x, float y, float radius, int dir);
- private static native void native_addArc(int nPath, RectF oval,
+ private static native void native_addOval(long nPath, RectF oval, int dir);
+ private static native void native_addCircle(long nPath, float x, float y, float radius, int dir);
+ private static native void native_addArc(long nPath, RectF oval,
float startAngle, float sweepAngle);
- private static native void native_addRoundRect(int nPath, RectF rect,
+ private static native void native_addRoundRect(long nPath, RectF rect,
float rx, float ry, int dir);
- private static native void native_addRoundRect(int nPath, RectF r, float[] radii, int dir);
- private static native void native_addPath(int nPath, int src, float dx, float dy);
- private static native void native_addPath(int nPath, int src);
- private static native void native_addPath(int nPath, int src, int matrix);
- private static native void native_offset(int nPath, float dx, float dy, int dst_path);
- private static native void native_offset(int nPath, float dx, float dy);
- private static native void native_setLastPoint(int nPath, float dx, float dy);
- private static native void native_transform(int nPath, int matrix, int dst_path);
- private static native void native_transform(int nPath, int matrix);
- private static native boolean native_op(int path1, int path2, int op, int result);
- private static native void finalizer(int nPath);
- private static native float[] native_approximate(int nPath, float error);
- private static native int native_trim(int nPath, int nTargetPath, int nPathMeasure,
+ private static native void native_addRoundRect(long nPath, RectF r, float[] radii, int dir);
+ private static native void native_addPath(long nPath, long src, float dx, float dy);
+ private static native void native_addPath(long nPath, long src);
+ private static native void native_addPath(long nPath, long src, long matrix);
+ private static native void native_offset(long nPath, float dx, float dy, long dst_path);
+ private static native void native_offset(long nPath, float dx, float dy);
+ private static native void native_setLastPoint(long nPath, float dx, float dy);
+ private static native void native_transform(long nPath, long matrix, long dst_path);
+ private static native void native_transform(long nPath, long matrix);
+ private static native boolean native_op(long path1, long path2, int op, long result);
+ private static native void finalizer(long nPath);
+ private static native float[] native_approximate(long nPath, float error);
+ private static native int native_trim(long nPath, long nTargetPath, long nPathMeasure,
float trimStart, float trimEnd, float trimOffset);
- private static native void native_destroyMeasure(int nPathMeasure);
+ private static native void native_destroyMeasure(long nPathMeasure);
}
diff --git a/graphics/java/android/graphics/PathDashPathEffect.java b/graphics/java/android/graphics/PathDashPathEffect.java
index e8ad5fd8..4f43f68 100644
--- a/graphics/java/android/graphics/PathDashPathEffect.java
+++ b/graphics/java/android/graphics/PathDashPathEffect.java
@@ -45,7 +45,7 @@
style.native_style);
}
- private static native int nativeCreate(int native_path, float advance,
+ private static native long nativeCreate(long native_path, float advance,
float phase, int native_style);
}
diff --git a/graphics/java/android/graphics/PathEffect.java b/graphics/java/android/graphics/PathEffect.java
index 9b2cd66..617dfca 100644
--- a/graphics/java/android/graphics/PathEffect.java
+++ b/graphics/java/android/graphics/PathEffect.java
@@ -27,6 +27,6 @@
nativeDestructor(native_instance);
}
- private static native void nativeDestructor(int native_patheffect);
- int native_instance;
+ private static native void nativeDestructor(long native_patheffect);
+ long native_instance;
}
diff --git a/graphics/java/android/graphics/Picture.java b/graphics/java/android/graphics/Picture.java
index 71e02f6..25188e0 100644
--- a/graphics/java/android/graphics/Picture.java
+++ b/graphics/java/android/graphics/Picture.java
@@ -29,7 +29,7 @@
*/
public class Picture {
private Canvas mRecordingCanvas;
- private final int mNativePicture;
+ private final long mNativePicture;
/**
* @hide
@@ -63,7 +63,7 @@
* into it.
*/
public Canvas beginRecording(int width, int height) {
- int ni = nativeBeginRecording(mNativePicture, width, height);
+ long ni = nativeBeginRecording(mNativePicture, width, height);
mRecordingCanvas = new RecordingCanvas(this, ni);
return mRecordingCanvas;
}
@@ -164,11 +164,11 @@
}
}
- final int ni() {
+ final long ni() {
return mNativePicture;
}
- private Picture(int nativePicture, boolean fromStream) {
+ private Picture(long nativePicture, boolean fromStream) {
if (nativePicture == 0) {
throw new RuntimeException();
}
@@ -177,21 +177,21 @@
}
// return empty picture if src is 0, or a copy of the native src
- private static native int nativeConstructor(int nativeSrcOr0);
- private static native int nativeCreateFromStream(InputStream stream,
+ private static native long nativeConstructor(long nativeSrcOr0);
+ private static native long nativeCreateFromStream(InputStream stream,
byte[] storage);
- private static native int nativeBeginRecording(int nativeCanvas,
+ private static native long nativeBeginRecording(long nativeCanvas,
int w, int h);
- private static native void nativeEndRecording(int nativeCanvas);
- private static native void nativeDraw(int nativeCanvas, int nativePicture);
- private static native boolean nativeWriteToStream(int nativePicture,
+ private static native void nativeEndRecording(long nativeCanvas);
+ private static native void nativeDraw(long nativeCanvas, long nativePicture);
+ private static native boolean nativeWriteToStream(long nativePicture,
OutputStream stream, byte[] storage);
- private static native void nativeDestructor(int nativePicture);
+ private static native void nativeDestructor(long nativePicture);
private static class RecordingCanvas extends Canvas {
private final Picture mPicture;
- public RecordingCanvas(Picture pict, int nativeCanvas) {
+ public RecordingCanvas(Picture pict, long nativeCanvas) {
super(nativeCanvas);
mPicture = pict;
}
diff --git a/graphics/java/android/graphics/PixelXorXfermode.java b/graphics/java/android/graphics/PixelXorXfermode.java
index 6075ec3..0080e65 100644
--- a/graphics/java/android/graphics/PixelXorXfermode.java
+++ b/graphics/java/android/graphics/PixelXorXfermode.java
@@ -29,5 +29,5 @@
native_instance = nativeCreate(opColor);
}
- private static native int nativeCreate(int opColor);
+ private static native long nativeCreate(int opColor);
}
diff --git a/graphics/java/android/graphics/PorterDuffColorFilter.java b/graphics/java/android/graphics/PorterDuffColorFilter.java
index 9870ad2..93fc1c7 100644
--- a/graphics/java/android/graphics/PorterDuffColorFilter.java
+++ b/graphics/java/android/graphics/PorterDuffColorFilter.java
@@ -96,7 +96,7 @@
nativeColorFilter = nCreatePorterDuffFilter(native_instance, mColor, mMode.nativeInt);
}
- private static native int native_CreatePorterDuffFilter(int srcColor, int porterDuffMode);
- private static native int nCreatePorterDuffFilter(int nativeFilter, int srcColor,
+ private static native long native_CreatePorterDuffFilter(int srcColor, int porterDuffMode);
+ private static native long nCreatePorterDuffFilter(long nativeFilter, int srcColor,
int porterDuffMode);
}
diff --git a/graphics/java/android/graphics/PorterDuffXfermode.java b/graphics/java/android/graphics/PorterDuffXfermode.java
index 6ba064c..d9d7689 100644
--- a/graphics/java/android/graphics/PorterDuffXfermode.java
+++ b/graphics/java/android/graphics/PorterDuffXfermode.java
@@ -32,5 +32,5 @@
native_instance = nativeCreateXfermode(mode.nativeInt);
}
- private static native int nativeCreateXfermode(int mode);
+ private static native long nativeCreateXfermode(int mode);
}
diff --git a/graphics/java/android/graphics/RadialGradient.java b/graphics/java/android/graphics/RadialGradient.java
index f011e5c..f10e5d6 100644
--- a/graphics/java/android/graphics/RadialGradient.java
+++ b/graphics/java/android/graphics/RadialGradient.java
@@ -117,14 +117,14 @@
return copy;
}
- private static native int nativeCreate1(float x, float y, float radius,
+ private static native long nativeCreate1(float x, float y, float radius,
int colors[], float positions[], int tileMode);
- private static native int nativeCreate2(float x, float y, float radius,
+ private static native long nativeCreate2(float x, float y, float radius,
int color0, int color1, int tileMode);
- private static native int nativePostCreate1(int native_shader, float x, float y, float radius,
+ private static native long nativePostCreate1(long native_shader, float x, float y, float radius,
int colors[], float positions[], int tileMode);
- private static native int nativePostCreate2(int native_shader, float x, float y, float radius,
+ private static native long nativePostCreate2(long native_shader, float x, float y, float radius,
int color0, int color1, int tileMode);
}
diff --git a/graphics/java/android/graphics/Rasterizer.java b/graphics/java/android/graphics/Rasterizer.java
index feb5f0c..817814c 100644
--- a/graphics/java/android/graphics/Rasterizer.java
+++ b/graphics/java/android/graphics/Rasterizer.java
@@ -27,7 +27,7 @@
finalizer(native_instance);
}
- private static native void finalizer(int native_instance);
+ private static native void finalizer(long native_instance);
- int native_instance;
+ long native_instance;
}
diff --git a/graphics/java/android/graphics/Region.java b/graphics/java/android/graphics/Region.java
index 72d0c43..727723d 100644
--- a/graphics/java/android/graphics/Region.java
+++ b/graphics/java/android/graphics/Region.java
@@ -30,7 +30,7 @@
/**
* @hide
*/
- public final int mNativeRegion;
+ public final long mNativeRegion;
// the native values for these must match up with the enum in SkRegion.h
public enum Op {
@@ -342,7 +342,7 @@
* @return a new region created from the data in the parcel
*/
public Region createFromParcel(Parcel p) {
- int ni = nativeCreateFromParcel(p);
+ long ni = nativeCreateFromParcel(p);
if (ni == 0) {
throw new RuntimeException();
}
@@ -385,7 +385,7 @@
}
}
- Region(int ni) {
+ Region(long ni) {
if (ni == 0) {
throw new RuntimeException();
}
@@ -394,38 +394,38 @@
/* add dummy parameter so constructor can be called from jni without
triggering 'not cloneable' exception */
- private Region(int ni, int dummy) {
+ private Region(long ni, int dummy) {
this(ni);
}
- final int ni() {
+ final long ni() {
return mNativeRegion;
}
- private static native boolean nativeEquals(int native_r1, int native_r2);
+ private static native boolean nativeEquals(long native_r1, long native_r2);
- private static native int nativeConstructor();
- private static native void nativeDestructor(int native_region);
+ private static native long nativeConstructor();
+ private static native void nativeDestructor(long native_region);
- private static native void nativeSetRegion(int native_dst, int native_src);
- private static native boolean nativeSetRect(int native_dst, int left,
+ private static native void nativeSetRegion(long native_dst, long native_src);
+ private static native boolean nativeSetRect(long native_dst, int left,
int top, int right, int bottom);
- private static native boolean nativeSetPath(int native_dst, int native_path,
- int native_clip);
- private static native boolean nativeGetBounds(int native_region, Rect rect);
- private static native boolean nativeGetBoundaryPath(int native_region,
- int native_path);
+ private static native boolean nativeSetPath(long native_dst, long native_path,
+ long native_clip);
+ private static native boolean nativeGetBounds(long native_region, Rect rect);
+ private static native boolean nativeGetBoundaryPath(long native_region,
+ long native_path);
- private static native boolean nativeOp(int native_dst, int left, int top,
+ private static native boolean nativeOp(long native_dst, int left, int top,
int right, int bottom, int op);
- private static native boolean nativeOp(int native_dst, Rect rect,
- int native_region, int op);
- private static native boolean nativeOp(int native_dst, int native_region1,
- int native_region2, int op);
+ private static native boolean nativeOp(long native_dst, Rect rect,
+ long native_region, int op);
+ private static native boolean nativeOp(long native_dst, long native_region1,
+ long native_region2, int op);
- private static native int nativeCreateFromParcel(Parcel p);
- private static native boolean nativeWriteToParcel(int native_region,
+ private static native long nativeCreateFromParcel(Parcel p);
+ private static native boolean nativeWriteToParcel(long native_region,
Parcel p);
- private static native String nativeToString(int native_region);
+ private static native String nativeToString(long native_region);
}
diff --git a/graphics/java/android/graphics/RegionIterator.java b/graphics/java/android/graphics/RegionIterator.java
index 817f853..8401adb 100644
--- a/graphics/java/android/graphics/RegionIterator.java
+++ b/graphics/java/android/graphics/RegionIterator.java
@@ -45,10 +45,10 @@
nativeDestructor(mNativeIter);
}
- private static native int nativeConstructor(int native_region);
- private static native void nativeDestructor(int native_iter);
- private static native boolean nativeNext(int native_iter, Rect r);
-
- private final int mNativeIter;
+ private static native long nativeConstructor(long native_region);
+ private static native void nativeDestructor(long native_iter);
+ private static native boolean nativeNext(long native_iter, Rect r);
+
+ private final long mNativeIter;
}
diff --git a/graphics/java/android/graphics/Shader.java b/graphics/java/android/graphics/Shader.java
index afc68d8..94b4c4a 100644
--- a/graphics/java/android/graphics/Shader.java
+++ b/graphics/java/android/graphics/Shader.java
@@ -28,11 +28,11 @@
*
* @hide
*/
- public int native_instance;
+ public long native_instance;
/**
* @hide
*/
- public int native_shader;
+ public long native_shader;
private Matrix mLocalMatrix;
@@ -112,7 +112,7 @@
}
}
- private static native void nativeDestructor(int native_shader, int native_skiaShader);
- private static native void nativeSetLocalMatrix(int native_shader,
- int native_skiaShader, int matrix_instance);
+ private static native void nativeDestructor(long native_shader, long native_skiaShader);
+ private static native void nativeSetLocalMatrix(long native_shader,
+ long native_skiaShader, long matrix_instance);
}
diff --git a/graphics/java/android/graphics/SumPathEffect.java b/graphics/java/android/graphics/SumPathEffect.java
index cc7c778..8fedc31 100644
--- a/graphics/java/android/graphics/SumPathEffect.java
+++ b/graphics/java/android/graphics/SumPathEffect.java
@@ -27,6 +27,6 @@
second.native_instance);
}
- private static native int nativeCreate(int first, int second);
+ private static native long nativeCreate(long first, long second);
}
diff --git a/graphics/java/android/graphics/SweepGradient.java b/graphics/java/android/graphics/SweepGradient.java
index e9cda39..21239f7 100644
--- a/graphics/java/android/graphics/SweepGradient.java
+++ b/graphics/java/android/graphics/SweepGradient.java
@@ -106,12 +106,12 @@
return copy;
}
- private static native int nativeCreate1(float x, float y, int colors[], float positions[]);
- private static native int nativeCreate2(float x, float y, int color0, int color1);
+ private static native long nativeCreate1(float x, float y, int colors[], float positions[]);
+ private static native long nativeCreate2(float x, float y, int color0, int color1);
- private static native int nativePostCreate1(int native_shader, float cx, float cy,
+ private static native long nativePostCreate1(long native_shader, float cx, float cy,
int[] colors, float[] positions);
- private static native int nativePostCreate2(int native_shader, float cx, float cy,
+ private static native long nativePostCreate2(long native_shader, float cx, float cy,
int color0, int color1);
}
diff --git a/graphics/java/android/graphics/TableMaskFilter.java b/graphics/java/android/graphics/TableMaskFilter.java
index a8a7ff0..d0c1438 100644
--- a/graphics/java/android/graphics/TableMaskFilter.java
+++ b/graphics/java/android/graphics/TableMaskFilter.java
@@ -28,7 +28,7 @@
native_instance = nativeNewTable(table);
}
- private TableMaskFilter(int ni) {
+ private TableMaskFilter(long ni) {
native_instance = ni;
}
@@ -40,7 +40,7 @@
return new TableMaskFilter(nativeNewGamma(gamma));
}
- private static native int nativeNewTable(byte[] table);
- private static native int nativeNewClip(int min, int max);
- private static native int nativeNewGamma(float gamma);
+ private static native long nativeNewTable(byte[] table);
+ private static native long nativeNewClip(int min, int max);
+ private static native long nativeNewGamma(float gamma);
}
diff --git a/graphics/java/android/graphics/Typeface.java b/graphics/java/android/graphics/Typeface.java
index aea3ee5..73e0e8d 100644
--- a/graphics/java/android/graphics/Typeface.java
+++ b/graphics/java/android/graphics/Typeface.java
@@ -18,6 +18,7 @@
import android.content.res.AssetManager;
import android.util.SparseArray;
+import android.util.LongSparseArray;
import java.io.File;
@@ -45,13 +46,13 @@
public static final Typeface MONOSPACE;
static Typeface[] sDefaults;
- private static final SparseArray<SparseArray<Typeface>> sTypefaceCache =
- new SparseArray<SparseArray<Typeface>>(3);
+ private static final LongSparseArray<SparseArray<Typeface>> sTypefaceCache =
+ new LongSparseArray<SparseArray<Typeface>>(3);
/**
* @hide
*/
- public int native_instance;
+ public long native_instance;
// Style
public static final int NORMAL = 0;
@@ -103,7 +104,7 @@
* @return The best matching typeface.
*/
public static Typeface create(Typeface family, int style) {
- int ni = 0;
+ long ni = 0;
if (family != null) {
// Return early if we're asked for the same face/style
if (family.mStyle == style) {
@@ -173,7 +174,7 @@
}
// don't allow clients to call this directly
- private Typeface(int ni) {
+ private Typeface(long ni) {
if (ni == 0) {
throw new RuntimeException("native typeface cannot be made");
}
@@ -217,15 +218,20 @@
@Override
public int hashCode() {
- int result = native_instance;
+ /*
+ * Modified method for hashCode with long native_instance derived from
+ * http://developer.android.com/reference/java/lang/Object.html
+ */
+ int result = 17;
+ result = 31 * result + (int) (native_instance ^ (native_instance >>> 32));
result = 31 * result + mStyle;
return result;
}
- private static native int nativeCreate(String familyName, int style);
- private static native int nativeCreateFromTypeface(int native_instance, int style);
- private static native void nativeUnref(int native_instance);
- private static native int nativeGetStyle(int native_instance);
- private static native int nativeCreateFromAsset(AssetManager mgr, String path);
- private static native int nativeCreateFromFile(String path);
+ private static native long nativeCreate(String familyName, int style);
+ private static native long nativeCreateFromTypeface(long native_instance, int style);
+ private static native void nativeUnref(long native_instance);
+ private static native int nativeGetStyle(long native_instance);
+ private static native long nativeCreateFromAsset(AssetManager mgr, String path);
+ private static native long nativeCreateFromFile(String path);
}
diff --git a/graphics/java/android/graphics/Xfermode.java b/graphics/java/android/graphics/Xfermode.java
index 2467bdc..883350d 100644
--- a/graphics/java/android/graphics/Xfermode.java
+++ b/graphics/java/android/graphics/Xfermode.java
@@ -38,7 +38,7 @@
}
}
- private static native void finalizer(int native_instance);
+ private static native void finalizer(long native_instance);
- int native_instance;
+ long native_instance;
}
diff --git a/graphics/java/android/graphics/drawable/Drawable.java b/graphics/java/android/graphics/drawable/Drawable.java
index cfb1983..2ec4284 100644
--- a/graphics/java/android/graphics/drawable/Drawable.java
+++ b/graphics/java/android/graphics/drawable/Drawable.java
@@ -156,7 +156,7 @@
* @param canvas The canvas to draw into
*/
public void draw(Canvas canvas) {
- if (canvas != null && canvas.isHardwareAccelerated()) {
+ if (canvas != null && canvas.isHardwareAccelerated() && false) { // temporarily disabled
final HardwareCanvas hardwareCanvas = (HardwareCanvas) canvas;
final DisplayList displayList = getDisplayList(hardwareCanvas);
if (displayList != null) {
diff --git a/libs/hwui/Android.mk b/libs/hwui/Android.mk
index 88f11db..e4648f6 100644
--- a/libs/hwui/Android.mk
+++ b/libs/hwui/Android.mk
@@ -52,6 +52,7 @@
# RenderThread stuff
LOCAL_SRC_FILES += \
renderthread/CanvasContext.cpp \
+ renderthread/RenderProxy.cpp \
renderthread/RenderTask.cpp \
renderthread/RenderThread.cpp
diff --git a/libs/hwui/DisplayListOp.h b/libs/hwui/DisplayListOp.h
index e3d4e2d..5024880 100644
--- a/libs/hwui/DisplayListOp.h
+++ b/libs/hwui/DisplayListOp.h
@@ -1589,7 +1589,9 @@
mWidth(width), mHeight(height) {}
virtual status_t applyDraw(OpenGLRenderer& renderer, Rect& dirty) {
- return renderer.drawShadow(mCasterTransform, mCasterAlpha, mWidth, mHeight);
+ SkPath casterOutline; // TODO: drive with path from view
+ casterOutline.addRect(0, 0, mWidth, mHeight);
+ return renderer.drawShadow(mCasterTransform, mCasterAlpha, &casterOutline);
}
virtual void output(int level, uint32_t logFlags) const {
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 7ee803f..7a11948 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -3183,28 +3183,43 @@
}
status_t OpenGLRenderer::drawShadow(const mat4& casterTransform, float casterAlpha,
- float width, float height) {
+ const SkPath* casterOutline) {
if (currentSnapshot()->isIgnored()) return DrawGlInfo::kStatusDone;
- // For now, always and scissor
- // TODO: use quickReject
+ // TODO: use quickRejectWithScissor. For now, always force enable scissor.
mCaches.enableScissor();
SkPaint paint;
- paint.setColor(mCaches.propertyShadowStrength << 24);
+ paint.setARGB(mCaches.propertyShadowStrength, 0, 0, 0);
paint.setAntiAlias(true); // want to use AlphaVertex
+ // tessellate caster outline into a 2d polygon
+ Vector<Vertex> casterVertices2d;
+ const float casterRefinementThresholdSquared = 20.0f; // TODO: experiment with this value
+ PathTessellator::approximatePathOutlineVertices(*casterOutline,
+ casterRefinementThresholdSquared, casterVertices2d);
+
+ // map 2d caster poly into 3d
+ const int casterVertexCount = casterVertices2d.size();
+ Vector3 casterPolygon[casterVertexCount];
+ for (int i = 0; i < casterVertexCount; i++) {
+ const Vertex& point2d = casterVertices2d[i];
+ casterPolygon[i] = Vector3(point2d.x, point2d.y, 0);
+ casterTransform.mapPoint3d(casterPolygon[i]);
+ }
+
+ // draw caster's shadows
VertexBuffer ambientShadowVertexBuffer;
- ShadowTessellator::tessellateAmbientShadow(width, height, casterTransform,
+ ShadowTessellator::tessellateAmbientShadow(casterPolygon, casterVertexCount,
ambientShadowVertexBuffer);
drawVertexBuffer(ambientShadowVertexBuffer, &paint);
VertexBuffer spotShadowVertexBuffer;
Vector3 lightPosScale(mCaches.propertyLightPosXScale,
mCaches.propertyLightPosYScale, mCaches.propertyLightPosZScale);
- ShadowTessellator::tessellateSpotShadow(width, height, lightPosScale,
- *currentTransform(), getWidth(), getHeight(),
- casterTransform, spotShadowVertexBuffer);
+ ShadowTessellator::tessellateSpotShadow(casterPolygon, casterVertexCount,
+ lightPosScale, *currentTransform(), getWidth(), getHeight(),
+ spotShadowVertexBuffer);
drawVertexBuffer(spotShadowVertexBuffer, &paint);
diff --git a/libs/hwui/OpenGLRenderer.h b/libs/hwui/OpenGLRenderer.h
index fb780ce..c8ecdda 100644
--- a/libs/hwui/OpenGLRenderer.h
+++ b/libs/hwui/OpenGLRenderer.h
@@ -170,7 +170,7 @@
int saveLayerDeferred(float left, float top, float right, float bottom,
int alpha, SkXfermode::Mode mode, int flags);
- virtual status_t drawDisplayList(DisplayList* displayList, Rect& dirty, int32_t replayFlags);
+ virtual status_t drawDisplayList(DisplayList* displayList, Rect& dirty, int32_t replayFlags = 1);
virtual status_t drawLayer(Layer* layer, float x, float y);
virtual status_t drawBitmap(const SkBitmap* bitmap, float left, float top,
const SkPaint* paint);
@@ -214,7 +214,7 @@
virtual status_t drawRects(const float* rects, int count, const SkPaint* paint);
status_t drawShadow(const mat4& casterTransform, float casterAlpha,
- float width, float height);
+ const SkPath* casterOutline);
virtual void resetShader();
virtual void setupShader(SkiaShader* shader);
diff --git a/libs/hwui/PathTessellator.cpp b/libs/hwui/PathTessellator.cpp
index c6ce67c..cc56333 100644
--- a/libs/hwui/PathTessellator.cpp
+++ b/libs/hwui/PathTessellator.cpp
@@ -53,7 +53,7 @@
namespace android {
namespace uirenderer {
-#define THRESHOLD 0.5f
+#define OUTLINE_REFINE_THRESHOLD_SQUARED (0.5f * 0.5f)
#define ROUND_CAP_THRESH 0.25f
#define PI 3.1415926535897932f
@@ -739,7 +739,8 @@
// force close if we're filling the path, since fill path expects closed perimeter.
bool forceClose = paintInfo.style != SkPaint::kStroke_Style;
bool wasClosed = approximatePathOutlineVertices(path, forceClose,
- threshInvScaleX * threshInvScaleX, threshInvScaleY * threshInvScaleY, tempVertices);
+ threshInvScaleX * threshInvScaleX, threshInvScaleY * threshInvScaleY,
+ OUTLINE_REFINE_THRESHOLD_SQUARED, tempVertices);
if (!tempVertices.size()) {
// path was empty, return without allocating vertex buffer
@@ -824,7 +825,8 @@
Vector<Vertex> outlineVertices;
approximatePathOutlineVertices(path, true,
paintInfo.inverseScaleX * paintInfo.inverseScaleX,
- paintInfo.inverseScaleY * paintInfo.inverseScaleY, outlineVertices);
+ paintInfo.inverseScaleY * paintInfo.inverseScaleY,
+ OUTLINE_REFINE_THRESHOLD_SQUARED, outlineVertices);
if (!outlineVertices.size()) return;
@@ -897,6 +899,11 @@
// Simple path line approximation
///////////////////////////////////////////////////////////////////////////////
+bool PathTessellator::approximatePathOutlineVertices(const SkPath& path, float thresholdSquared,
+ Vector<Vertex>& outputVertices) {
+ return approximatePathOutlineVertices(path, true, 1.0f, 1.0f, thresholdSquared, outputVertices);
+}
+
void pushToVector(Vector<Vertex>& vertices, float x, float y) {
// TODO: make this not yuck
vertices.push();
@@ -905,7 +912,8 @@
}
bool PathTessellator::approximatePathOutlineVertices(const SkPath& path, bool forceClose,
- float sqrInvScaleX, float sqrInvScaleY, Vector<Vertex>& outputVertices) {
+ float sqrInvScaleX, float sqrInvScaleY, float thresholdSquared,
+ Vector<Vertex>& outputVertices) {
ATRACE_CALL();
// TODO: to support joins other than sharp miter, join vertices should be labelled in the
@@ -932,7 +940,7 @@
pts[0].x(), pts[0].y(),
pts[2].x(), pts[2].y(),
pts[1].x(), pts[1].y(),
- sqrInvScaleX, sqrInvScaleY, outputVertices);
+ sqrInvScaleX, sqrInvScaleY, thresholdSquared, outputVertices);
break;
case SkPath::kCubic_Verb:
ALOGV("kCubic_Verb");
@@ -941,7 +949,7 @@
pts[1].x(), pts[1].y(),
pts[3].x(), pts[3].y(),
pts[2].x(), pts[2].y(),
- sqrInvScaleX, sqrInvScaleY, outputVertices);
+ sqrInvScaleX, sqrInvScaleY, thresholdSquared, outputVertices);
break;
default:
break;
@@ -964,7 +972,8 @@
void PathTessellator::recursiveCubicBezierVertices(
float p1x, float p1y, float c1x, float c1y,
float p2x, float p2y, float c2x, float c2y,
- float sqrInvScaleX, float sqrInvScaleY, Vector<Vertex>& outputVertices) {
+ float sqrInvScaleX, float sqrInvScaleY, float thresholdSquared,
+ Vector<Vertex>& outputVertices) {
float dx = p2x - p1x;
float dy = p2y - p1y;
float d1 = fabs((c1x - p2x) * dy - (c1y - p2y) * dx);
@@ -973,7 +982,7 @@
// multiplying by sqrInvScaleY/X equivalent to multiplying in dimensional scale factors
- if (d * d < THRESHOLD * THRESHOLD * (dx * dx * sqrInvScaleY + dy * dy * sqrInvScaleX)) {
+ if (d * d < thresholdSquared * (dx * dx * sqrInvScaleY + dy * dy * sqrInvScaleX)) {
// below thresh, draw line by adding endpoint
pushToVector(outputVertices, p2x, p2y);
} else {
@@ -997,11 +1006,11 @@
recursiveCubicBezierVertices(
p1x, p1y, p1c1x, p1c1y,
mx, my, p1c1c2x, p1c1c2y,
- sqrInvScaleX, sqrInvScaleY, outputVertices);
+ sqrInvScaleX, sqrInvScaleY, thresholdSquared, outputVertices);
recursiveCubicBezierVertices(
mx, my, p2c1c2x, p2c1c2y,
p2x, p2y, p2c2x, p2c2y,
- sqrInvScaleX, sqrInvScaleY, outputVertices);
+ sqrInvScaleX, sqrInvScaleY, thresholdSquared, outputVertices);
}
}
@@ -1009,12 +1018,13 @@
float ax, float ay,
float bx, float by,
float cx, float cy,
- float sqrInvScaleX, float sqrInvScaleY, Vector<Vertex>& outputVertices) {
+ float sqrInvScaleX, float sqrInvScaleY, float thresholdSquared,
+ Vector<Vertex>& outputVertices) {
float dx = bx - ax;
float dy = by - ay;
float d = (cx - bx) * dy - (cy - by) * dx;
- if (d * d < THRESHOLD * THRESHOLD * (dx * dx * sqrInvScaleY + dy * dy * sqrInvScaleX)) {
+ if (d * d < thresholdSquared * (dx * dx * sqrInvScaleY + dy * dy * sqrInvScaleX)) {
// below thresh, draw line by adding endpoint
pushToVector(outputVertices, bx, by);
} else {
@@ -1028,9 +1038,9 @@
float my = (acy + bcy) * 0.5f;
recursiveQuadraticBezierVertices(ax, ay, mx, my, acx, acy,
- sqrInvScaleX, sqrInvScaleY, outputVertices);
+ sqrInvScaleX, sqrInvScaleY, thresholdSquared, outputVertices);
recursiveQuadraticBezierVertices(mx, my, bx, by, bcx, bcy,
- sqrInvScaleX, sqrInvScaleY, outputVertices);
+ sqrInvScaleX, sqrInvScaleY, thresholdSquared, outputVertices);
}
}
diff --git a/libs/hwui/PathTessellator.h b/libs/hwui/PathTessellator.h
index e43b101..a215b7a 100644
--- a/libs/hwui/PathTessellator.h
+++ b/libs/hwui/PathTessellator.h
@@ -31,18 +31,64 @@
public:
static void expandBoundsForStroke(SkRect& bounds, const SkPaint* paint);
+ /**
+ * Populates a VertexBuffer with a tessellated approximation of the input convex path, as a single
+ * triangle strip. Note: joins are not currently supported.
+ *
+ * @param path The path to be approximated
+ * @param paint The paint the path will be drawn with, indicating AA, painting style
+ * (stroke vs fill), stroke width, stroke cap & join style, etc.
+ * @param transform The transform the path is to be drawn with, used to drive stretch-aware path
+ * vertex approximation, and correct AA ramp offsetting.
+ * @param vertexBuffer The output buffer
+ */
static void tessellatePath(const SkPath& path, const SkPaint* paint,
const mat4& transform, VertexBuffer& vertexBuffer);
+ /**
+ * Populates a VertexBuffer with a tessellated approximation of points as a single triangle
+ * strip (with degenerate tris separating), respecting the shape defined by the paint cap.
+ *
+ * @param points The center vertices of the points to be drawn
+ * @param count The number of floats making up the point vertices
+ * @param paint The paint the points will be drawn with indicating AA, stroke width & cap
+ * @param transform The transform the points will be drawn with, used to drive stretch-aware path
+ * vertex approximation, and correct AA ramp offsetting
+ * @param bounds An output rectangle, which returns the total area covered by the output buffer
+ * @param vertexBuffer The output buffer
+ */
static void tessellatePoints(const float* points, int count, const SkPaint* paint,
const mat4& transform, SkRect& bounds, VertexBuffer& vertexBuffer);
+ /**
+ * Populates a VertexBuffer with a tessellated approximation of lines as a single triangle
+ * strip (with degenerate tris separating).
+ *
+ * @param points Pairs of endpoints defining the lines to be drawn
+ * @param count The number of floats making up the line vertices
+ * @param paint The paint the lines will be drawn with indicating AA, stroke width & cap
+ * @param transform The transform the points will be drawn with, used to drive stretch-aware path
+ * vertex approximation, and correct AA ramp offsetting
+ * @param bounds An output rectangle, which returns the total area covered by the output buffer
+ * @param vertexBuffer The output buffer
+ */
static void tessellateLines(const float* points, int count, const SkPaint* paint,
const mat4& transform, SkRect& bounds, VertexBuffer& vertexBuffer);
+ /**
+ * Approximates a convex, CW outline into a Vector of 2d vertices.
+ *
+ * @param path The outline to be approximated
+ * @param thresholdSquared The threshold of acceptable error (in pixels) when approximating
+ * @param outputVertices An empty Vector which will be populated with the output
+ */
+ static bool approximatePathOutlineVertices(const SkPath &path, float thresholdSquared,
+ Vector<Vertex> &outputVertices);
+
private:
static bool approximatePathOutlineVertices(const SkPath &path, bool forceClose,
- float sqrInvScaleX, float sqrInvScaleY, Vector<Vertex> &outputVertices);
+ float sqrInvScaleX, float sqrInvScaleY, float thresholdSquared,
+ Vector<Vertex> &outputVertices);
/*
endpoints a & b,
@@ -52,7 +98,7 @@
float ax, float ay,
float bx, float by,
float cx, float cy,
- float sqrInvScaleX, float sqrInvScaleY,
+ float sqrInvScaleX, float sqrInvScaleY, float thresholdSquared,
Vector<Vertex> &outputVertices);
/*
@@ -64,7 +110,7 @@
float c1x, float c1y,
float p2x, float p2y,
float c2x, float c2y,
- float sqrInvScaleX, float sqrInvScaleY,
+ float sqrInvScaleX, float sqrInvScaleY, float thresholdSquared,
Vector<Vertex> &outputVertices);
};
diff --git a/libs/hwui/Renderer.h b/libs/hwui/Renderer.h
index 9d4e83e..4799b32 100644
--- a/libs/hwui/Renderer.h
+++ b/libs/hwui/Renderer.h
@@ -247,8 +247,6 @@
// TODO: rename for consistency
virtual status_t callDrawGLFunction(Functor* functor, Rect& dirty) = 0;
-
-private:
}; // class Renderer
}; // namespace uirenderer
diff --git a/libs/hwui/ShadowTessellator.cpp b/libs/hwui/ShadowTessellator.cpp
index 6dfd925..7700ea0 100644
--- a/libs/hwui/ShadowTessellator.cpp
+++ b/libs/hwui/ShadowTessellator.cpp
@@ -31,46 +31,8 @@
return a > b ? a : b;
}
-// TODO: Support path as the input of the polygon instead of the rect's width
-// and height. And the z values need to be computed according to the
-// transformation for each vertex.
-/**
- * Generate the polygon for the caster.
- *
- * @param width the width of the caster
- * @param height the height of the caster
- * @param casterTransform transformation info of the caster
- * @param polygon return the caster's polygon
- *
- */
-void ShadowTessellator::generateCasterPolygon(float width, float height,
- const mat4& casterTransform, int vertexCount, Vector3* polygon) {
- Rect blockRect(0, 0, width, height);
- polygon[0].x = blockRect.left;
- polygon[0].y = blockRect.top;
- polygon[0].z = 0;
- polygon[1].x = blockRect.right;
- polygon[1].y = blockRect.top;
- polygon[1].z = 0;
- polygon[2].x = blockRect.right;
- polygon[2].y = blockRect.bottom;
- polygon[2].z = 0;
- polygon[3].x = blockRect.left;
- polygon[3].y = blockRect.bottom;
- polygon[3].z = 0;
- casterTransform.mapPoint3d(polygon[0]);
- casterTransform.mapPoint3d(polygon[1]);
- casterTransform.mapPoint3d(polygon[2]);
- casterTransform.mapPoint3d(polygon[3]);
-}
-
-void ShadowTessellator::tessellateAmbientShadow(float width, float height,
- const mat4& casterTransform, VertexBuffer& shadowVertexBuffer) {
-
- const int vertexCount = 4;
- Vector3 polygon[vertexCount];
- generateCasterPolygon(width, height, casterTransform, vertexCount, polygon);
-
+void ShadowTessellator::tessellateAmbientShadow(const Vector3* casterPolygon, int casterVertexCount,
+ VertexBuffer& shadowVertexBuffer) {
// A bunch of parameters to tweak the shadow.
// TODO: Allow some of these changable by debug settings or APIs.
const int rays = 128;
@@ -79,19 +41,14 @@
const float heightFactor = 128;
const float geomFactor = 64;
- AmbientShadow::createAmbientShadow(polygon, vertexCount, rays, layers, strength,
+ AmbientShadow::createAmbientShadow(casterPolygon, casterVertexCount, rays, layers, strength,
heightFactor, geomFactor, shadowVertexBuffer);
}
-void ShadowTessellator::tessellateSpotShadow(float width, float height,
+void ShadowTessellator::tessellateSpotShadow(const Vector3* casterPolygon, int casterVertexCount,
const Vector3& lightPosScale, const mat4& receiverTransform,
- int screenWidth, int screenHeight, const mat4& casterTransform,
- VertexBuffer& shadowVertexBuffer) {
- const int vertexCount = 4;
- Vector3 polygon[vertexCount];
- generateCasterPolygon(width, height, casterTransform, vertexCount, polygon);
-
+ int screenWidth, int screenHeight, VertexBuffer& shadowVertexBuffer) {
// A bunch of parameters to tweak the shadow.
// TODO: Allow some of these changable by debug settings or APIs.
const int rays = 256;
@@ -113,7 +70,7 @@
const float lightSize = maximal / 4;
const int lightVertexCount = 16;
- SpotShadow::createSpotShadow(polygon, vertexCount, lightCenter, lightSize,
+ SpotShadow::createSpotShadow(casterPolygon, casterVertexCount, lightCenter, lightSize,
lightVertexCount, rays, layers, strength, shadowVertexBuffer);
}
diff --git a/libs/hwui/ShadowTessellator.h b/libs/hwui/ShadowTessellator.h
index 2399f8f..ef95609 100644
--- a/libs/hwui/ShadowTessellator.h
+++ b/libs/hwui/ShadowTessellator.h
@@ -26,18 +26,12 @@
class ShadowTessellator {
public:
- static void tessellateAmbientShadow(float width, float height,
- const mat4& casterTransform, VertexBuffer& shadowVertexBuffer);
-
- static void tessellateSpotShadow(float width, float height,
- const Vector3& lightPosScale, const mat4& receiverTransform,
- int screenWidth, int screenHeight, const mat4& casterTransform,
+ static void tessellateAmbientShadow(const Vector3* casterPolygon, int casterVertexCount,
VertexBuffer& shadowVertexBuffer);
-private:
- static void generateCasterPolygon(float width, float height,
- const mat4& casterTransform, int vertexCount, Vector3* polygon);
-
+ static void tessellateSpotShadow(const Vector3* casterPolygon, int casterVertexCount,
+ const Vector3& lightPosScale, const mat4& receiverTransform,
+ int screenWidth, int screenHeight, VertexBuffer& shadowVertexBuffer);
}; // ShadowTessellator
}; // namespace uirenderer
diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp
index ffb8a32..a848c8f 100644
--- a/libs/hwui/renderthread/CanvasContext.cpp
+++ b/libs/hwui/renderthread/CanvasContext.cpp
@@ -19,14 +19,22 @@
#include "CanvasContext.h"
#include <cutils/properties.h>
+#include <private/hwui/DrawGlInfo.h>
#include <strings.h>
+#include "RenderThread.h"
#include "../Caches.h"
+#include "../OpenGLRenderer.h"
#include "../Stencil.h"
#define PROPERTY_RENDER_DIRTY_REGIONS "debug.hwui.render_dirty_regions"
#define GLES_VERSION 2
+#ifdef USE_OPENGL_RENDERER
+// Android-specific addition that is used to show when frames began in systrace
+EGLAPI void EGLAPIENTRY eglBeginFrame(EGLDisplay dpy, EGLSurface surface);
+#endif
+
namespace android {
namespace uirenderer {
namespace renderthread {
@@ -69,19 +77,19 @@
public:
static GlobalContext* get();
- // Returns true if EGL was initialized,
- // false if it was already initialized
- bool initialize();
+ // Returns true on success, false on failure
+ void initialize();
- bool usePBufferSurface();
+ void usePBufferSurface();
EGLSurface createSurface(EGLNativeWindowType window);
void destroySurface(EGLSurface surface);
void destroy();
bool isCurrent(EGLSurface surface) { return mCurrentSurface == surface; }
- bool makeCurrent(EGLSurface surface);
- bool swapBuffers(EGLSurface surface);
+ void makeCurrent(EGLSurface surface);
+ void beginFrame(EGLSurface surface, EGLint* width, EGLint* height);
+ void swapBuffers(EGLSurface surface);
bool enableDirtyRegions(EGLSurface surface);
@@ -90,8 +98,9 @@
// GlobalContext is never destroyed, method is purposely not implemented
~GlobalContext();
- bool loadConfig();
- bool createContext();
+ void loadConfig();
+ void createContext();
+ void initAtlas();
static GlobalContext* sContext;
@@ -126,33 +135,27 @@
ALOGD("Render dirty regions requested: %s", mRequestDirtyRegions ? "true" : "false");
}
-bool GlobalContext::initialize() {
- if (mEglDisplay != EGL_NO_DISPLAY) return false;
+void GlobalContext::initialize() {
+ if (mEglDisplay != EGL_NO_DISPLAY) return;
mEglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
- if (mEglDisplay == EGL_NO_DISPLAY) {
- ALOGE("Failed to get EGL_DEFAULT_DISPLAY! err=%s", egl_error_str());
- return false;
- }
+ LOG_ALWAYS_FATAL_IF(mEglDisplay == EGL_NO_DISPLAY,
+ "Failed to get EGL_DEFAULT_DISPLAY! err=%s", egl_error_str());
EGLint major, minor;
- if (eglInitialize(mEglDisplay, &major, &minor) == EGL_FALSE) {
- ALOGE("Failed to initialize display %p! err=%s", mEglDisplay, egl_error_str());
- return false;
- }
+ LOG_ALWAYS_FATAL_IF(eglInitialize(mEglDisplay, &major, &minor) == EGL_FALSE,
+ "Failed to initialize display %p! err=%s", mEglDisplay, egl_error_str());
+
ALOGI("Initialized EGL, version %d.%d", (int)major, (int)minor);
- if (!loadConfig()) {
- return false;
- }
- if (!createContext()) {
- return false;
- }
-
- return true;
+ loadConfig();
+ createContext();
+ usePBufferSurface();
+ Caches::getInstance().init();
+ initAtlas();
}
-bool GlobalContext::loadConfig() {
+void GlobalContext::loadConfig() {
EGLint swapBehavior = mCanSetDirtyRegions ? EGL_SWAP_BEHAVIOR_PRESERVED_BIT : 0;
EGLint attribs[] = {
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
@@ -177,31 +180,32 @@
mCanSetDirtyRegions = false;
loadConfig();
} else {
- ALOGE("Failed to choose config, error = %s", egl_error_str());
- return false;
+ LOG_ALWAYS_FATAL("Failed to choose config, error = %s", egl_error_str());
}
}
- return true;
}
-bool GlobalContext::createContext() {
+void GlobalContext::createContext() {
EGLint attribs[] = { EGL_CONTEXT_CLIENT_VERSION, GLES_VERSION, EGL_NONE };
mEglContext = eglCreateContext(mEglDisplay, mEglConfig, EGL_NO_CONTEXT, attribs);
- if (mEglContext == EGL_NO_CONTEXT) {
- ALOGE("Failed to create context, error = %s", egl_error_str());
- return false;
- }
- return true;
+ LOG_ALWAYS_FATAL_IF(mEglContext == EGL_NO_CONTEXT,
+ "Failed to create context, error = %s", egl_error_str());
}
-bool GlobalContext::usePBufferSurface() {
- if (mEglDisplay == EGL_NO_DISPLAY) return false;
+void GlobalContext::initAtlas() {
+ // TODO implement
+ // For now just run without an atlas
+}
+
+void GlobalContext::usePBufferSurface() {
+ LOG_ALWAYS_FATAL_IF(mEglDisplay == EGL_NO_DISPLAY,
+ "usePBufferSurface() called on uninitialized GlobalContext!");
if (mPBufferSurface == EGL_NO_SURFACE) {
EGLint attribs[] = { EGL_WIDTH, 1, EGL_HEIGHT, 1, EGL_NONE };
mPBufferSurface = eglCreatePbufferSurface(mEglDisplay, mEglConfig, attribs);
}
- return makeCurrent(mPBufferSurface);
+ makeCurrent(mPBufferSurface);
}
EGLSurface GlobalContext::createSurface(EGLNativeWindowType window) {
@@ -238,8 +242,8 @@
mCurrentSurface = EGL_NO_SURFACE;
}
-bool GlobalContext::makeCurrent(EGLSurface surface) {
- if (isCurrent(surface)) return true;
+void GlobalContext::makeCurrent(EGLSurface surface) {
+ if (isCurrent(surface)) return;
if (surface == EGL_NO_SURFACE) {
// If we are setting EGL_NO_SURFACE we don't care about any of the potential
@@ -247,19 +251,31 @@
// destroyed in which case the current context is already NO_CONTEXT
eglMakeCurrent(mEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
} else if (!eglMakeCurrent(mEglDisplay, surface, surface, mEglContext)) {
- ALOGE("Failed to make current on surface %p, error=%s", (void*)surface, egl_error_str());
- return false;
+ LOG_ALWAYS_FATAL("Failed to make current on surface %p, error=%s",
+ (void*)surface, egl_error_str());
}
mCurrentSurface = surface;
- return true;
}
-bool GlobalContext::swapBuffers(EGLSurface surface) {
- if (!eglSwapBuffers(mEglDisplay, surface)) {
- ALOGW("eglSwapBuffers failed on surface %p, error=%s", (void*)surface, egl_error_str());
- return false;
+void GlobalContext::beginFrame(EGLSurface surface, EGLint* width, EGLint* height) {
+ LOG_ALWAYS_FATAL_IF(surface == EGL_NO_SURFACE,
+ "Tried to beginFrame on EGL_NO_SURFACE!");
+ makeCurrent(surface);
+ if (width) {
+ eglQuerySurface(mEglDisplay, surface, EGL_WIDTH, width);
}
- return true;
+ if (height) {
+ eglQuerySurface(mEglDisplay, surface, EGL_HEIGHT, height);
+ }
+ eglBeginFrame(mEglDisplay, surface);
+}
+
+void GlobalContext::swapBuffers(EGLSurface surface) {
+ eglSwapBuffers(mEglDisplay, surface);
+ EGLint err = eglGetError();
+ // TODO: Check whether we need to special case EGL_CONTEXT_LOST
+ LOG_ALWAYS_FATAL_IF(err != EGL_SUCCESS,
+ "Encountered EGL error %d %s during rendering", err, egl_error_str(err));
}
bool GlobalContext::enableDirtyRegions(EGLSurface surface) {
@@ -283,17 +299,32 @@
return value == EGL_BUFFER_PRESERVED;
}
-CanvasContext::CanvasContext()
- : mEglSurface(EGL_NO_SURFACE)
- , mDirtyRegionsEnabled(false) {
+CanvasContext::CanvasContext(bool translucent)
+ : mRenderThread(RenderThread::getInstance())
+ , mEglSurface(EGL_NO_SURFACE)
+ , mDirtyRegionsEnabled(false)
+ , mOpaque(!translucent)
+ , mCanvas(0)
+ , mHaveNewSurface(false)
+ , mInvokeFunctorsPending(false)
+ , mInvokeFunctorsTask(this) {
mGlobalContext = GlobalContext::get();
}
CanvasContext::~CanvasContext() {
+ removeFunctorsTask();
+ destroyCanvas();
+}
+
+void CanvasContext::destroyCanvas() {
+ if (mCanvas) {
+ delete mCanvas;
+ mCanvas = 0;
+ }
setSurface(NULL);
}
-bool CanvasContext::setSurface(EGLNativeWindowType window) {
+void CanvasContext::setSurface(EGLNativeWindowType window) {
if (mEglSurface != EGL_NO_SURFACE) {
mGlobalContext->destroySurface(mEglSurface);
mEglSurface = EGL_NO_SURFACE;
@@ -301,24 +332,134 @@
if (window) {
mEglSurface = mGlobalContext->createSurface(window);
+ LOG_ALWAYS_FATAL_IF(mEglSurface == EGL_NO_SURFACE,
+ "Failed to create EGLSurface for window %p, eglErr = %s",
+ (void*) window, egl_error_str());
}
if (mEglSurface != EGL_NO_SURFACE) {
mDirtyRegionsEnabled = mGlobalContext->enableDirtyRegions(mEglSurface);
+ mHaveNewSurface = true;
}
- return !window || mEglSurface != EGL_NO_SURFACE;
}
-bool CanvasContext::swapBuffers() {
- return mGlobalContext->swapBuffers(mEglSurface);
+void CanvasContext::swapBuffers() {
+ mGlobalContext->swapBuffers(mEglSurface);
+ mHaveNewSurface = false;
}
-bool CanvasContext::makeCurrent() {
- return mGlobalContext->makeCurrent(mEglSurface);
+void CanvasContext::makeCurrent() {
+ mGlobalContext->makeCurrent(mEglSurface);
}
-bool CanvasContext::useGlobalPBufferSurface() {
- return GlobalContext::get()->usePBufferSurface();
+bool CanvasContext::initialize(EGLNativeWindowType window) {
+ if (mCanvas) return false;
+ setSurface(window);
+ makeCurrent();
+ mCanvas = new OpenGLRenderer();
+ mCanvas->initProperties();
+ return true;
+}
+
+void CanvasContext::updateSurface(EGLNativeWindowType window) {
+ setSurface(window);
+ makeCurrent();
+}
+
+void CanvasContext::setup(int width, int height) {
+ if (!mCanvas) return;
+ mCanvas->setViewport(width, height);
+}
+
+void CanvasContext::drawDisplayList(DisplayList* displayList, Rect* dirty) {
+ LOG_ALWAYS_FATAL_IF(!mCanvas || mEglSurface == EGL_NO_SURFACE,
+ "drawDisplayList called on a context with no canvas or surface!");
+
+ EGLint width, height;
+ mGlobalContext->beginFrame(mEglSurface, &width, &height);
+ if (width != mCanvas->getViewportWidth() || height != mCanvas->getViewportHeight()) {
+ mCanvas->setViewport(width, height);
+ dirty = NULL;
+ } else if (!mDirtyRegionsEnabled || mHaveNewSurface) {
+ dirty = NULL;
+ }
+
+ status_t status;
+ if (dirty) {
+ status = mCanvas->prepareDirty(dirty->left, dirty->top,
+ dirty->right, dirty->bottom, mOpaque);
+ } else {
+ status = mCanvas->prepare(mOpaque);
+ }
+
+ Rect outBounds;
+ status |= mCanvas->drawDisplayList(displayList, outBounds);
+ handleFunctorStatus(status, outBounds);
+
+ // TODO: Draw debug info
+ // TODO: Performance tracking
+
+ mCanvas->finish();
+
+ if (status & DrawGlInfo::kStatusDrew) {
+ swapBuffers();
+ }
+}
+
+void InvokeFunctorsTask::run() {
+ mContext->invokeFunctors();
+}
+
+void CanvasContext::attachFunctor(Functor* functor) {
+ if (!mCanvas) return;
+
+ mCanvas->attachFunctor(functor);
+ removeFunctorsTask();
+ queueFunctorsTask(0);
+}
+
+void CanvasContext::detachFunctor(Functor* functor) {
+ if (!mCanvas) return;
+
+ mCanvas->detachFunctor(functor);
+}
+
+void CanvasContext::invokeFunctors() {
+ mInvokeFunctorsPending = false;
+
+ if (!mCanvas) return;
+
+ makeCurrent();
+ Rect dirty;
+ int status = mCanvas->invokeFunctors(dirty);
+ handleFunctorStatus(status, dirty);
+}
+
+void CanvasContext::handleFunctorStatus(int status, const Rect& redrawClip) {
+ if (status & DrawGlInfo::kStatusDraw) {
+ // TODO: Invalidate the redrawClip
+ // Do we need to post to ViewRootImpl like the current renderer?
+ // Can we just enqueue ourselves to re-invoke the same display list?
+ // Something else entirely? Does ChromiumView still want this in a
+ // RenderThread world?
+ }
+
+ if (status & DrawGlInfo::kStatusInvoke) {
+ queueFunctorsTask();
+ }
+}
+
+void CanvasContext::removeFunctorsTask() {
+ if (!mInvokeFunctorsPending) return;
+
+ mRenderThread.remove(&mInvokeFunctorsTask);
+}
+
+void CanvasContext::queueFunctorsTask(int delayMs) {
+ if (mInvokeFunctorsPending) return;
+
+ mInvokeFunctorsPending = true;
+ mRenderThread.queueDelayed(&mInvokeFunctorsTask, delayMs);
}
} /* namespace renderthread */
diff --git a/libs/hwui/renderthread/CanvasContext.h b/libs/hwui/renderthread/CanvasContext.h
index 77ae737..2daa905 100644
--- a/libs/hwui/renderthread/CanvasContext.h
+++ b/libs/hwui/renderthread/CanvasContext.h
@@ -19,31 +19,75 @@
#include <cutils/compiler.h>
#include <EGL/egl.h>
+#include <utils/Functor.h>
+
+#include "RenderTask.h"
+
+#define FUNCTOR_PROCESS_DELAY 4
namespace android {
namespace uirenderer {
+
+class DisplayList;
+class OpenGLRenderer;
+class Rect;
+
namespace renderthread {
class GlobalContext;
+class CanvasContext;
+class RenderThread;
+
+class InvokeFunctorsTask : public RenderTask {
+public:
+ InvokeFunctorsTask(CanvasContext* context)
+ : mContext(context) {}
+
+ virtual void run();
+
+private:
+ CanvasContext* mContext;
+};
// This per-renderer class manages the bridge between the global EGL context
// and the render surface.
class CanvasContext {
public:
- ANDROID_API CanvasContext();
- ANDROID_API ~CanvasContext();
+ CanvasContext(bool translucent);
+ ~CanvasContext();
- ANDROID_API bool setSurface(EGLNativeWindowType window);
- ANDROID_API bool swapBuffers();
- ANDROID_API bool makeCurrent();
+ bool initialize(EGLNativeWindowType window);
+ void updateSurface(EGLNativeWindowType window);
+ void setup(int width, int height);
+ void drawDisplayList(DisplayList* displayList, Rect* dirty);
+ void destroyCanvas();
- ANDROID_API static bool useGlobalPBufferSurface();
+ void attachFunctor(Functor* functor);
+ void detachFunctor(Functor* functor);
private:
+ void setSurface(EGLNativeWindowType window);
+ void swapBuffers();
+ void makeCurrent();
+
+ friend class InvokeFunctorsTask;
+ void invokeFunctors();
+ void handleFunctorStatus(int status, const Rect& redrawClip);
+ void removeFunctorsTask();
+ void queueFunctorsTask(int delayMs = FUNCTOR_PROCESS_DELAY);
GlobalContext* mGlobalContext;
+ RenderThread& mRenderThread;
EGLSurface mEglSurface;
bool mDirtyRegionsEnabled;
+
+ bool mOpaque;
+ OpenGLRenderer* mCanvas;
+ bool mHaveNewSurface;
+
+ bool mInvokeFunctorsPending;
+ InvokeFunctorsTask mInvokeFunctorsTask;
+
};
} /* namespace renderthread */
diff --git a/libs/hwui/renderthread/RenderProxy.cpp b/libs/hwui/renderthread/RenderProxy.cpp
new file mode 100644
index 0000000..25badac
--- /dev/null
+++ b/libs/hwui/renderthread/RenderProxy.cpp
@@ -0,0 +1,194 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "RenderProxy"
+
+#include "RenderProxy.h"
+
+#include "CanvasContext.h"
+#include "RenderTask.h"
+#include "RenderThread.h"
+
+#include "../DisplayList.h"
+#include "../Rect.h"
+
+namespace android {
+namespace uirenderer {
+namespace renderthread {
+
+#define ARGS(method) method ## Args
+
+#define CREATE_BRIDGE1(name, a1) CREATE_BRIDGE(name, a1,,,,,,,)
+#define CREATE_BRIDGE2(name, a1, a2) CREATE_BRIDGE(name, a1,a2,,,,,,)
+#define CREATE_BRIDGE3(name, a1, a2, a3) CREATE_BRIDGE(name, a1,a2,a3,,,,,)
+#define CREATE_BRIDGE4(name, a1, a2, a3, a4) CREATE_BRIDGE(name, a1,a2,a3,a4,,,,)
+#define CREATE_BRIDGE(name, a1, a2, a3, a4, a5, a6, a7, a8) \
+ typedef struct { \
+ a1; a2; a3; a4; a5; a6; a7; a8; \
+ } ARGS(name); \
+ static void* Bridge_ ## name(ARGS(name)* args)
+
+#define SETUP_TASK(method) \
+ LOG_ALWAYS_FATAL_IF( METHOD_INVOKE_PAYLOAD_SIZE < sizeof(ARGS(method)), \
+ "METHOD_INVOKE_PAYLOAD_SIZE %d is smaller than sizeof(" #method "Args) %d", \
+ METHOD_INVOKE_PAYLOAD_SIZE, sizeof(ARGS(method))); \
+ MethodInvokeRenderTask* task = createTask((RunnableMethod) Bridge_ ## method); \
+ ARGS(method) *args = (ARGS(method) *) task->payload()
+
+CREATE_BRIDGE1(createContext, bool translucent) {
+ return new CanvasContext(args->translucent);
+}
+
+RenderProxy::RenderProxy(bool translucent)
+ : mRenderThread(RenderThread::getInstance())
+ , mContext(0) {
+ SETUP_TASK(createContext);
+ args->translucent = translucent;
+ mContext = (CanvasContext*) postAndWait(task);
+}
+
+RenderProxy::~RenderProxy() {
+ destroyContext();
+}
+
+CREATE_BRIDGE1(destroyContext, CanvasContext* context) {
+ delete args->context;
+ return NULL;
+}
+
+void RenderProxy::destroyContext() {
+ if (mContext) {
+ SETUP_TASK(destroyContext);
+ args->context = mContext;
+ mContext = 0;
+ post(task);
+ }
+}
+
+CREATE_BRIDGE2(initialize, CanvasContext* context, EGLNativeWindowType window) {
+ return (void*) args->context->initialize(args->window);
+}
+
+bool RenderProxy::initialize(EGLNativeWindowType window) {
+ SETUP_TASK(initialize);
+ args->context = mContext;
+ args->window = window;
+ return (bool) postAndWait(task);
+}
+
+CREATE_BRIDGE2(updateSurface, CanvasContext* context, EGLNativeWindowType window) {
+ args->context->updateSurface(args->window);
+ return NULL;
+}
+
+void RenderProxy::updateSurface(EGLNativeWindowType window) {
+ SETUP_TASK(updateSurface);
+ args->context = mContext;
+ args->window = window;
+ post(task);
+}
+
+CREATE_BRIDGE3(setup, CanvasContext* context, int width, int height) {
+ args->context->setup(args->width, args->height);
+ return NULL;
+}
+
+void RenderProxy::setup(int width, int height) {
+ SETUP_TASK(setup);
+ args->context = mContext;
+ args->width = width;
+ args->height = height;
+ post(task);
+}
+
+CREATE_BRIDGE3(drawDisplayList, CanvasContext* context, DisplayList* displayList,
+ Rect dirty) {
+ Rect* dirty = &args->dirty;
+ if (dirty->bottom == -1 && dirty->left == -1 &&
+ dirty->top == -1 && dirty->right == -1) {
+ dirty = 0;
+ }
+ args->context->drawDisplayList(args->displayList, dirty);
+ return NULL;
+}
+
+void RenderProxy::drawDisplayList(DisplayList* displayList,
+ int dirtyLeft, int dirtyTop, int dirtyRight, int dirtyBottom) {
+ SETUP_TASK(drawDisplayList);
+ args->context = mContext;
+ args->displayList = displayList;
+ args->dirty.set(dirtyLeft, dirtyTop, dirtyRight, dirtyBottom);
+ // TODO: Switch to post() once some form of thread safety strategy is in place
+ postAndWait(task);
+}
+
+CREATE_BRIDGE1(destroyCanvas, CanvasContext* context) {
+ args->context->destroyCanvas();
+ return NULL;
+}
+
+void RenderProxy::destroyCanvas() {
+ SETUP_TASK(destroyCanvas);
+ args->context = mContext;
+ post(task);
+}
+
+CREATE_BRIDGE2(attachFunctor, CanvasContext* context, Functor* functor) {
+ args->context->attachFunctor(args->functor);
+ return NULL;
+}
+
+void RenderProxy::attachFunctor(Functor* functor) {
+ SETUP_TASK(attachFunctor);
+ args->context = mContext;
+ args->functor = functor;
+ post(task);
+}
+
+CREATE_BRIDGE2(detachFunctor, CanvasContext* context, Functor* functor) {
+ args->context->detachFunctor(args->functor);
+ return NULL;
+}
+
+void RenderProxy::detachFunctor(Functor* functor) {
+ SETUP_TASK(detachFunctor);
+ args->context = mContext;
+ args->functor = functor;
+ post(task);
+}
+
+MethodInvokeRenderTask* RenderProxy::createTask(RunnableMethod method) {
+ // TODO: Consider having a small pool of these to avoid alloc churn
+ return new MethodInvokeRenderTask(method);
+}
+
+void RenderProxy::post(RenderTask* task) {
+ mRenderThread.queue(task);
+}
+
+void* RenderProxy::postAndWait(MethodInvokeRenderTask* task) {
+ void* retval;
+ task->setReturnPtr(&retval);
+ SignalingRenderTask syncTask(task, &mSyncMutex, &mSyncCondition);
+ AutoMutex _lock(mSyncMutex);
+ mRenderThread.queue(&syncTask);
+ mSyncCondition.wait(mSyncMutex);
+ return retval;
+}
+
+} /* namespace renderthread */
+} /* namespace uirenderer */
+} /* namespace android */
diff --git a/libs/hwui/renderthread/RenderProxy.h b/libs/hwui/renderthread/RenderProxy.h
new file mode 100644
index 0000000..113c5a8
--- /dev/null
+++ b/libs/hwui/renderthread/RenderProxy.h
@@ -0,0 +1,85 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef RENDERPROXY_H_
+#define RENDERPROXY_H_
+
+#include "RenderTask.h"
+
+#include <cutils/compiler.h>
+#include <EGL/egl.h>
+#include <utils/Condition.h>
+#include <utils/Functor.h>
+#include <utils/Mutex.h>
+#include <utils/StrongPointer.h>
+
+namespace android {
+namespace uirenderer {
+
+class DisplayList;
+class Rect;
+
+namespace renderthread {
+
+class CanvasContext;
+class ErrorChannel;
+class RenderThread;
+class RenderProxyBridge;
+
+/*
+ * RenderProxy is strictly single threaded. All methods must be invoked on the owning
+ * thread. It is important to note that RenderProxy may be deleted while it has
+ * tasks post()'d as a result. Therefore any RenderTask that is post()'d must not
+ * reference RenderProxy or any of its fields. The exception here is that postAndWait()
+ * references RenderProxy fields. This is safe as RenderProxy cannot
+ * be deleted if it is blocked inside a call.
+ */
+class ANDROID_API RenderProxy {
+public:
+ ANDROID_API RenderProxy(bool translucent);
+ ANDROID_API virtual ~RenderProxy();
+
+ ANDROID_API bool initialize(EGLNativeWindowType window);
+ ANDROID_API void updateSurface(EGLNativeWindowType window);
+ ANDROID_API void setup(int width, int height);
+ ANDROID_API void drawDisplayList(DisplayList* displayList,
+ int dirtyLeft, int dirtyTop, int dirtyRight, int dirtyBottom);
+ ANDROID_API void destroyCanvas();
+
+ ANDROID_API void attachFunctor(Functor* functor);
+ ANDROID_API void detachFunctor(Functor* functor);
+
+private:
+ RenderThread& mRenderThread;
+ CanvasContext* mContext;
+
+ Mutex mSyncMutex;
+ Condition mSyncCondition;
+
+ void destroyContext();
+
+ MethodInvokeRenderTask* createTask(RunnableMethod method);
+ void post(RenderTask* task);
+ void* postAndWait(MethodInvokeRenderTask* task);
+
+ // Friend class to help with bridging
+ friend class RenderProxyBridge;
+};
+
+} /* namespace renderthread */
+} /* namespace uirenderer */
+} /* namespace android */
+#endif /* RENDERPROXY_H_ */
diff --git a/libs/hwui/renderthread/RenderTask.cpp b/libs/hwui/renderthread/RenderTask.cpp
index 2da91c5..7ca61e4 100644
--- a/libs/hwui/renderthread/RenderTask.cpp
+++ b/libs/hwui/renderthread/RenderTask.cpp
@@ -19,15 +19,18 @@
#include "RenderTask.h"
#include <utils/Log.h>
+#include <utils/Condition.h>
+#include <utils/Mutex.h>
namespace android {
namespace uirenderer {
namespace renderthread {
-RenderTask::RenderTask() : mNext(0) {
-}
-
-RenderTask::~RenderTask() {
+void SignalingRenderTask::run() {
+ mTask->run();
+ mLock->lock();
+ mSignal->signal();
+ mLock->unlock();
}
} /* namespace renderthread */
diff --git a/libs/hwui/renderthread/RenderTask.h b/libs/hwui/renderthread/RenderTask.h
index 865b1e6..9fe7573 100644
--- a/libs/hwui/renderthread/RenderTask.h
+++ b/libs/hwui/renderthread/RenderTask.h
@@ -18,19 +18,79 @@
#define RENDERTASK_H_
#include <cutils/compiler.h>
+#include <utils/Timers.h>
namespace android {
+class Mutex;
+class Condition;
namespace uirenderer {
namespace renderthread {
+#define METHOD_INVOKE_PAYLOAD_SIZE (8 * sizeof(void*))
+
+/*
+ * Notes about memory management
+ *
+ * RenderThread will only invoke RenderTask::run(). It is the responsibility
+ * of the RenderTask to know if it needs to suicide at the end of run() or
+ * if some other lifecycle is being used. As such, it is not valid to reference
+ * anything on RenderTask after the first call to run().
+ *
+ * For example SignalingRenderTask
+ * is expected to be stack allocated by the calling thread, so it does not
+ * suicide in run() but instead relies on the caller to destroy it.
+ *
+ * MethodInvokeRenderTask however is currently allocated with new, so it will
+ * suicide at the end of run(). TODO: Replace this with a small pool to avoid
+ * malloc/free churn of small objects?
+ */
+
class ANDROID_API RenderTask {
public:
- ANDROID_API RenderTask();
- ANDROID_API virtual ~RenderTask();
+ ANDROID_API RenderTask() : mNext(0), mRunAt(0) {}
+ ANDROID_API virtual ~RenderTask() {}
ANDROID_API virtual void run() = 0;
RenderTask* mNext;
+ nsecs_t mRunAt;
+};
+
+class SignalingRenderTask : public RenderTask {
+public:
+ // Takes ownership of task, caller owns lock and signal
+ SignalingRenderTask(RenderTask* task, Mutex* lock, Condition* signal)
+ : mTask(task), mLock(lock), mSignal(signal) {}
+ virtual void run();
+
+private:
+ RenderTask* mTask;
+ Mutex* mLock;
+ Condition* mSignal;
+};
+
+typedef void* (*RunnableMethod)(void* data);
+
+class MethodInvokeRenderTask : public RenderTask {
+public:
+ MethodInvokeRenderTask(RunnableMethod method)
+ : mMethod(method), mReturnPtr(0) {}
+
+ void* payload() { return mData; }
+ void setReturnPtr(void** retptr) { mReturnPtr = retptr; }
+
+ virtual void run() {
+ void* retval = mMethod(mData);
+ if (mReturnPtr) {
+ *mReturnPtr = retval;
+ }
+ // Commit suicide
+ delete this;
+ }
+private:
+ RunnableMethod mMethod;
+ char mData[METHOD_INVOKE_PAYLOAD_SIZE];
+ void** mReturnPtr;
};
} /* namespace renderthread */
diff --git a/libs/hwui/renderthread/RenderThread.cpp b/libs/hwui/renderthread/RenderThread.cpp
index bccd6e6..e4ec164 100644
--- a/libs/hwui/renderthread/RenderThread.cpp
+++ b/libs/hwui/renderthread/RenderThread.cpp
@@ -18,6 +18,8 @@
#include "RenderThread.h"
+#include "CanvasContext.h"
+#include "RenderProxy.h"
#include <utils/Log.h>
namespace android {
@@ -27,8 +29,82 @@
namespace uirenderer {
namespace renderthread {
+TaskQueue::TaskQueue() : mHead(0), mTail(0) {}
+
+RenderTask* TaskQueue::next() {
+ RenderTask* ret = mHead;
+ if (ret) {
+ mHead = ret->mNext;
+ if (!mHead) {
+ mTail = 0;
+ }
+ ret->mNext = 0;
+ }
+ return ret;
+}
+
+RenderTask* TaskQueue::peek() {
+ return mHead;
+}
+
+void TaskQueue::queue(RenderTask* task) {
+ // Since the RenderTask itself forms the linked list it is not allowed
+ // to have the same task queued twice
+ LOG_ALWAYS_FATAL_IF(task->mNext || mTail == task, "Task is already in the queue!");
+ if (mTail) {
+ // Fast path if we can just append
+ if (mTail->mRunAt <= task->mRunAt) {
+ mTail->mNext = task;
+ mTail = task;
+ } else {
+ // Need to find the proper insertion point
+ RenderTask* previous = 0;
+ RenderTask* next = mHead;
+ while (next && next->mRunAt <= task->mRunAt) {
+ previous = next;
+ next = next->mNext;
+ }
+ if (!previous) {
+ task->mNext = mHead;
+ mHead = task;
+ } else {
+ previous->mNext = task;
+ if (next) {
+ task->mNext = next;
+ } else {
+ mTail = task;
+ }
+ }
+ }
+ } else {
+ mTail = mHead = task;
+ }
+}
+
+void TaskQueue::remove(RenderTask* task) {
+ // TaskQueue is strict here to enforce that users are keeping track of
+ // their RenderTasks due to how their memory is managed
+ LOG_ALWAYS_FATAL_IF(!task->mNext && mTail != task,
+ "Cannot remove a task that isn't in the queue!");
+
+ // If task is the head we can just call next() to pop it off
+ // Otherwise we need to scan through to find the task before it
+ if (peek() == task) {
+ next();
+ } else {
+ RenderTask* previous = mHead;
+ while (previous->mNext != task) {
+ previous = previous->mNext;
+ }
+ previous->mNext = task->mNext;
+ if (mTail == task) {
+ mTail = previous;
+ }
+ }
+}
+
RenderThread::RenderThread() : Thread(true), Singleton<RenderThread>()
- , mQueueHead(0), mQueueTail(0) {
+ , mNextWakeup(LLONG_MAX) {
mLooper = new Looper(false);
run("RenderThread");
}
@@ -37,16 +113,25 @@
}
bool RenderThread::threadLoop() {
+ int timeoutMillis = -1;
for (;;) {
- int result = mLooper->pollAll(-1);
- if (result == Looper::POLL_ERROR) {
- // TODO Something?
- break;
- }
+ int result = mLooper->pollAll(timeoutMillis);
+ LOG_ALWAYS_FATAL_IF(result == Looper::POLL_ERROR,
+ "RenderThread Looper POLL_ERROR!");
+
+ nsecs_t nextWakeup;
// Process our queue, if we have anything
- while (RenderTask* task = nextTask()) {
+ while (RenderTask* task = nextTask(&nextWakeup)) {
task->run();
- delete task;
+ // task may have deleted itself, do not reference it again
+ }
+ if (nextWakeup == LLONG_MAX) {
+ timeoutMillis = -1;
+ } else {
+ timeoutMillis = nextWakeup - systemTime(SYSTEM_TIME_MONOTONIC);
+ if (timeoutMillis < 0) {
+ timeoutMillis = 0;
+ }
}
}
@@ -55,30 +140,40 @@
void RenderThread::queue(RenderTask* task) {
AutoMutex _lock(mLock);
- if (mQueueTail) {
- mQueueTail->mNext = task;
- } else {
- mQueueHead = task;
- }
- mQueueTail = task;
- if (mQueueHead == task) {
- // Only wake if this is the first task
+ mQueue.queue(task);
+ if (mNextWakeup && task->mRunAt < mNextWakeup) {
+ mNextWakeup = 0;
mLooper->wake();
}
}
-RenderTask* RenderThread::nextTask() {
+void RenderThread::queueDelayed(RenderTask* task, int delayMs) {
+ nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC);
+ task->mRunAt = now + delayMs;
+ queue(task);
+}
+
+void RenderThread::remove(RenderTask* task) {
AutoMutex _lock(mLock);
- RenderTask* ret = mQueueHead;
- if (ret) {
- if (mQueueTail == mQueueHead) {
- mQueueTail = mQueueHead = 0;
- } else {
- mQueueHead = ret->mNext;
+ mQueue.remove(task);
+}
+
+RenderTask* RenderThread::nextTask(nsecs_t* nextWakeup) {
+ AutoMutex _lock(mLock);
+ RenderTask* next = mQueue.peek();
+ if (!next) {
+ mNextWakeup = LLONG_MAX;
+ } else {
+ // Most tasks won't be delayed, so avoid unnecessary systemTime() calls
+ if (next->mRunAt <= 0 || next->mRunAt <= systemTime(SYSTEM_TIME_MONOTONIC)) {
+ next = mQueue.next();
}
- ret->mNext = 0;
+ mNextWakeup = next->mRunAt;
}
- return ret;
+ if (nextWakeup) {
+ *nextWakeup = mNextWakeup;
+ }
+ return next;
}
} /* namespace renderthread */
diff --git a/libs/hwui/renderthread/RenderThread.h b/libs/hwui/renderthread/RenderThread.h
index 4edd575..e444aa0 100644
--- a/libs/hwui/renderthread/RenderThread.h
+++ b/libs/hwui/renderthread/RenderThread.h
@@ -28,11 +28,27 @@
namespace uirenderer {
namespace renderthread {
+class TaskQueue {
+public:
+ TaskQueue();
+
+ RenderTask* next();
+ void queue(RenderTask* task);
+ RenderTask* peek();
+ void remove(RenderTask* task);
+
+private:
+ RenderTask* mHead;
+ RenderTask* mTail;
+};
+
class ANDROID_API RenderThread : public Thread, public Singleton<RenderThread> {
public:
// RenderThread takes complete ownership of tasks that are queued
// and will delete them after they are run
ANDROID_API void queue(RenderTask* task);
+ void queueDelayed(RenderTask* task, int delayMs);
+ void remove(RenderTask* task);
protected:
virtual bool threadLoop();
@@ -43,13 +59,16 @@
RenderThread();
virtual ~RenderThread();
- RenderTask* nextTask();
+ // Returns the next task to be run. If this returns NULL nextWakeup is set
+ // to the time to requery for the nextTask to run. mNextWakeup is also
+ // set to this time
+ RenderTask* nextTask(nsecs_t* nextWakeup);
sp<Looper> mLooper;
Mutex mLock;
- RenderTask* mQueueHead;
- RenderTask* mQueueTail;
+ nsecs_t mNextWakeup;
+ TaskQueue mQueue;
};
} /* namespace renderthread */
diff --git a/media/java/android/media/MediaCodec.java b/media/java/android/media/MediaCodec.java
index 1dcb459..9fe3ac1 100644
--- a/media/java/android/media/MediaCodec.java
+++ b/media/java/android/media/MediaCodec.java
@@ -177,7 +177,7 @@
public static final int BUFFER_FLAG_END_OF_STREAM = 4;
private EventHandler mEventHandler;
- private NotificationCallback mNotificationCallback;
+ private volatile NotificationCallback mNotificationCallback;
static final int EVENT_NOTIFY = 1;
@@ -194,8 +194,9 @@
switch (msg.what) {
case EVENT_NOTIFY:
{
- if (mNotificationCallback != null) {
- mNotificationCallback.onCodecNotify(mCodec);
+ NotificationCallback cb = mNotificationCallback;
+ if (cb != null) {
+ cb.onCodecNotify(mCodec);
}
break;
}
diff --git a/media/jni/android_media_MediaMetadataRetriever.cpp b/media/jni/android_media_MediaMetadataRetriever.cpp
index fe69819..a52b24d 100644
--- a/media/jni/android_media_MediaMetadataRetriever.cpp
+++ b/media/jni/android_media_MediaMetadataRetriever.cpp
@@ -264,7 +264,7 @@
config);
SkBitmap *bitmap =
- (SkBitmap *) env->GetIntField(jBitmap, fields.nativeBitmap);
+ (SkBitmap *) env->GetLongField(jBitmap, fields.nativeBitmap);
bitmap->lockPixels();
rotate((uint16_t*)bitmap->getPixels(),
@@ -406,7 +406,7 @@
if (fields.createScaledBitmapMethod == NULL) {
return;
}
- fields.nativeBitmap = env->GetFieldID(fields.bitmapClazz, "mNativeBitmap", "I");
+ fields.nativeBitmap = env->GetFieldID(fields.bitmapClazz, "mNativeBitmap", "J");
if (fields.nativeBitmap == NULL) {
return;
}
diff --git a/packages/Keyguard/src/com/android/keyguard/FaceUnlock.java b/packages/Keyguard/src/com/android/keyguard/FaceUnlock.java
index 689366b..de839c6 100644
--- a/packages/Keyguard/src/com/android/keyguard/FaceUnlock.java
+++ b/packages/Keyguard/src/com/android/keyguard/FaceUnlock.java
@@ -304,7 +304,7 @@
int currentUserId = mLockPatternUtils.getCurrentUser();
if (authenticatedUserId == currentUserId) {
if (DEBUG) Log.d(TAG, "Unlocking for user " + authenticatedUserId);
- mKeyguardScreenCallback.reportSuccessfulUnlockAttempt();
+ mKeyguardScreenCallback.reportUnlockAttempt(true);
mKeyguardScreenCallback.dismiss(true);
} else {
Log.d(TAG, "Ignoring unlock for authenticated user (" + authenticatedUserId +
@@ -335,7 +335,7 @@
// next time the user visits keyguard.
KeyguardUpdateMonitor.getInstance(mContext).setAlternateUnlockEnabled(false);
- mKeyguardScreenCallback.reportFailedUnlockAttempt();
+ mKeyguardScreenCallback.reportUnlockAttempt(false);
}
/**
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardAbsKeyInputView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardAbsKeyInputView.java
index 461fd77..3950159 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardAbsKeyInputView.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardAbsKeyInputView.java
@@ -154,14 +154,14 @@
protected void verifyPasswordAndUnlock() {
String entry = mPasswordEntry.getText().toString();
if (mLockPatternUtils.checkPassword(entry)) {
- mCallback.reportSuccessfulUnlockAttempt();
+ mCallback.reportUnlockAttempt(true);
mCallback.dismiss(true);
} else if (entry.length() > MINIMUM_PASSWORD_LENGTH_BEFORE_REPORT ) {
// to avoid accidental lockout, only count attempts that are long enough to be a
// real password. This may require some tweaking.
- mCallback.reportFailedUnlockAttempt();
- if (0 == (mCallback.getFailedAttempts()
- % LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT)) {
+ mCallback.reportUnlockAttempt(false);
+ int attempts = KeyguardUpdateMonitor.getInstance(mContext).getFailedUnlockAttempts();
+ if (0 == (attempts % LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT)) {
long deadline = mLockPatternUtils.setLockoutAttemptDeadline();
handleAttemptLockout(deadline);
}
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardAccountView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardAccountView.java
index 6b8be69..f69fa5f 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardAccountView.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardAccountView.java
@@ -177,14 +177,14 @@
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
mContext.startActivityAsUser(intent,
new UserHandle(mLockPatternUtils.getCurrentUser()));
- mCallback.reportSuccessfulUnlockAttempt();
+ mCallback.reportUnlockAttempt(true);
// dismiss keyguard
mCallback.dismiss(true);
} else {
mSecurityMessageDisplay.setMessage(R.string.kg_login_invalid_input, true);
mPassword.setText("");
- mCallback.reportFailedUnlockAttempt();
+ mCallback.reportUnlockAttempt(false);
}
}
});
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardActivityLauncher.java b/packages/Keyguard/src/com/android/keyguard/KeyguardActivityLauncher.java
index 0a915ea..368a97a 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardActivityLauncher.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardActivityLauncher.java
@@ -53,10 +53,12 @@
abstract Context getContext();
- abstract KeyguardSecurityCallback getCallback();
-
abstract LockPatternUtils getLockPatternUtils();
+ abstract void setOnDismissAction(OnDismissAction action);
+
+ abstract void requestDismissKeyguard();
+
public static class CameraWidgetInfo {
public String contextPackage;
public int layoutId;
@@ -190,8 +192,7 @@
} else {
// Create a runnable to start the activity and ask the user to enter their
// credentials.
- KeyguardSecurityCallback callback = getCallback();
- callback.setOnDismissAction(new OnDismissAction() {
+ setOnDismissAction(new OnDismissAction() {
@Override
public boolean onDismiss() {
dismissKeyguardOnNextActivity();
@@ -199,7 +200,7 @@
return true;
}
});
- callback.dismiss(false);
+ requestDismissKeyguard();
}
}
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java
index dfcd8a8..1548dee 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardHostView.java
@@ -18,6 +18,7 @@
import android.nfc.NfcUnlock;
import com.android.internal.widget.LockPatternUtils;
+import com.android.keyguard.KeyguardSecurityContainer.SecurityCallback;
import com.android.keyguard.KeyguardSecurityModel.SecurityMode;
import com.android.keyguard.KeyguardUpdateMonitor.DisplayClientState;
@@ -84,20 +85,12 @@
private AppWidgetHost mAppWidgetHost;
private AppWidgetManager mAppWidgetManager;
private KeyguardWidgetPager mAppWidgetContainer;
- private KeyguardSecurityViewFlipper mSecurityViewContainer;
- private KeyguardSelectorView mKeyguardSelectorView;
private KeyguardTransportControlView mTransportControl;
- private boolean mIsVerifyUnlockOnly;
- private boolean mEnableFallback; // TODO: This should get the value from KeyguardPatternView
- private SecurityMode mCurrentSecuritySelection = SecurityMode.Invalid;
private int mAppWidgetToShow;
- protected OnDismissAction mDismissAction;
-
protected int mFailedAttempts;
private LockPatternUtils mLockPatternUtils;
- private KeyguardSecurityModel mSecurityModel;
private KeyguardViewStateManager mViewStateManager;
private Rect mTempRect = new Rect();
@@ -126,6 +119,8 @@
private Runnable mPostBootCompletedRunnable;
+ private OnDismissAction mDismissAction;
+
/*package*/ interface UserSwitcherCallback {
void hideSecurityView(int duration);
void showSecurityView();
@@ -186,8 +181,6 @@
mAppWidgetManager = AppWidgetManager.getInstance(userContext);
- mSecurityModel = new KeyguardSecurityModel(context);
-
mViewStateManager = new KeyguardViewStateManager(this);
mUserSetupCompleted = Settings.Secure.getIntForUser(mContext.getContentResolver(),
@@ -207,13 +200,6 @@
}
}
- public void announceCurrentSecurityMethod() {
- View v = (View) getSecurityView(mCurrentSecuritySelection);
- if (v != null) {
- v.announceForAccessibility(v.getContentDescription());
- }
- }
-
private void getInitialTransportState() {
DisplayClientState dcs = KeyguardUpdateMonitor.getInstance(mContext)
.getCachedDisplayClientState();
@@ -300,9 +286,10 @@
}
@Override
public void onNfcUnlock() {
- if (NfcUnlock.getPropertyEnabled()) mCallback.dismiss(true);
+ if (NfcUnlock.getPropertyEnabled()) {
+ dismiss(true);
+ }
}
-
};
private static final boolean isMusicPlaying(int playbackState) {
@@ -322,14 +309,15 @@
private SlidingChallengeLayout mSlidingChallengeLayout;
private MultiPaneChallengeLayout mMultiPaneChallengeLayout;
+ private KeyguardSecurityContainer mSecurityContainer;
@Override
public boolean onTouchEvent(MotionEvent ev) {
boolean result = super.onTouchEvent(ev);
mTempRect.set(0, 0, 0, 0);
- offsetRectIntoDescendantCoords(mSecurityViewContainer, mTempRect);
+ offsetRectIntoDescendantCoords(mSecurityContainer, mTempRect);
ev.offsetLocation(mTempRect.left, mTempRect.top);
- result = mSecurityViewContainer.dispatchTouchEvent(ev) || result;
+ result = mSecurityContainer.dispatchTouchEvent(ev) || result;
ev.offsetLocation(-mTempRect.left, -mTempRect.top);
return result;
}
@@ -383,9 +371,48 @@
mAppWidgetContainer.setBouncerAnimationDuration(challenge.getBouncerAnimationDuration());
mViewStateManager.setPagedView(mAppWidgetContainer);
mViewStateManager.setChallengeLayout(challenge);
- mSecurityViewContainer = (KeyguardSecurityViewFlipper) findViewById(R.id.view_flipper);
- mKeyguardSelectorView = (KeyguardSelectorView) findViewById(R.id.keyguard_selector_view);
- mViewStateManager.setSecurityViewContainer(mSecurityViewContainer);
+
+ mSecurityContainer =
+ (KeyguardSecurityContainer) findViewById(R.id.keyguard_security_container);
+ mSecurityContainer.setLockPatternUtils(mLockPatternUtils);
+ mSecurityContainer.setSecurityCallback(new SecurityCallback() {
+ @Override
+ public void userActivity(long timeout) {
+ if (mViewMediatorCallback != null) {
+ mViewMediatorCallback.userActivity(timeout);
+ }
+ }
+
+ @Override
+ public void dismiss(boolean authenticated) {
+ KeyguardHostView.this.dismiss(authenticated);
+ }
+
+ @Override
+ public void finish() {
+
+ // If the alternate unlock was suppressed, it can now be safely
+ // enabled because the user has left keyguard.
+ KeyguardUpdateMonitor.getInstance(mContext).setAlternateUnlockEnabled(true);
+
+ // If there's a pending runnable because the user interacted with a widget
+ // and we're leaving keyguard, then run it.
+ boolean deferKeyguardDone = false;
+ if (mDismissAction != null) {
+ deferKeyguardDone = mDismissAction.onDismiss();
+ mDismissAction = null;
+ }
+ if (mViewMediatorCallback != null) {
+ if (deferKeyguardDone) {
+ mViewMediatorCallback.keyguardDonePending();
+ } else {
+ mViewMediatorCallback.keyguardDone(true);
+ }
+ }
+ }
+ });
+
+ mViewStateManager.setSecurityViewContainer(mSecurityContainer);
setBackButtonEnabled(false);
@@ -402,8 +429,8 @@
};
}
- showPrimarySecurityScreen(false);
- updateSecurityViews();
+ mSecurityContainer.showPrimarySecurityScreen(false);
+ mSecurityContainer.updateSecurityViews(mViewStateManager.isBouncing());
enableUserSelectorIfNecessary();
}
@@ -465,32 +492,10 @@
|| (mDisabledFeatures & DevicePolicyManager.KEYGUARD_DISABLE_SECURE_CAMERA) != 0;
}
- private void updateSecurityViews() {
- int children = mSecurityViewContainer.getChildCount();
- for (int i = 0; i < children; i++) {
- updateSecurityView(mSecurityViewContainer.getChildAt(i));
- }
- }
-
- private void updateSecurityView(View view) {
- if (view instanceof KeyguardSecurityView) {
- KeyguardSecurityView ksv = (KeyguardSecurityView) view;
- ksv.setKeyguardCallback(mCallback);
- ksv.setLockPatternUtils(mLockPatternUtils);
- if (mViewStateManager.isBouncing()) {
- ksv.showBouncer(0);
- } else {
- ksv.hideBouncer(0);
- }
- } else {
- Log.w(TAG, "View " + view + " is not a KeyguardSecurityView");
- }
- }
-
void setLockPatternUtils(LockPatternUtils utils) {
- mSecurityModel.setLockPatternUtils(utils);
mLockPatternUtils = utils;
- updateSecurityViews();
+ mSecurityContainer.setLockPatternUtils(utils);
+ mSecurityContainer.updateSecurityViews(mViewStateManager.isBouncing());
}
@Override
@@ -577,265 +582,7 @@
return -1;
}
- private KeyguardSecurityCallback mCallback = new KeyguardSecurityCallback() {
- public void userActivity(long timeout) {
- if (mViewMediatorCallback != null) {
- mViewMediatorCallback.userActivity(timeout);
- }
- }
-
- public void dismiss(boolean authenticated) {
- showNextSecurityScreenOrFinish(authenticated);
- }
-
- public boolean isVerifyUnlockOnly() {
- return mIsVerifyUnlockOnly;
- }
-
- public void reportSuccessfulUnlockAttempt() {
- KeyguardUpdateMonitor.getInstance(mContext).clearFailedUnlockAttempts();
- mLockPatternUtils.reportSuccessfulPasswordAttempt();
- }
-
- public void reportFailedUnlockAttempt() {
- if (mCurrentSecuritySelection == SecurityMode.Biometric) {
- KeyguardUpdateMonitor.getInstance(mContext).reportFailedBiometricUnlockAttempt();
- } else {
- KeyguardHostView.this.reportFailedUnlockAttempt();
- }
- }
-
- public int getFailedAttempts() {
- return KeyguardUpdateMonitor.getInstance(mContext).getFailedUnlockAttempts();
- }
-
- @Override
- public void showBackupSecurity() {
- KeyguardHostView.this.showBackupSecurityScreen();
- }
-
- @Override
- public void setOnDismissAction(OnDismissAction action) {
- KeyguardHostView.this.setOnDismissAction(action);
- }
-
- };
-
- private void showDialog(String title, String message) {
- final AlertDialog dialog = new AlertDialog.Builder(mContext)
- .setTitle(title)
- .setMessage(message)
- .setNeutralButton(R.string.ok, null)
- .create();
- if (!(mContext instanceof Activity)) {
- dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
- }
- dialog.show();
- }
-
- private void showTimeoutDialog() {
- int timeoutInSeconds = (int) LockPatternUtils.FAILED_ATTEMPT_TIMEOUT_MS / 1000;
- int messageId = 0;
-
- switch (mSecurityModel.getSecurityMode()) {
- case Pattern:
- messageId = R.string.kg_too_many_failed_pattern_attempts_dialog_message;
- break;
- case PIN:
- messageId = R.string.kg_too_many_failed_pin_attempts_dialog_message;
- break;
- case Password:
- messageId = R.string.kg_too_many_failed_password_attempts_dialog_message;
- break;
- }
-
- if (messageId != 0) {
- final String message = mContext.getString(messageId,
- KeyguardUpdateMonitor.getInstance(mContext).getFailedUnlockAttempts(),
- timeoutInSeconds);
- showDialog(null, message);
- }
- }
-
- private void showAlmostAtWipeDialog(int attempts, int remaining) {
- String message = mContext.getString(R.string.kg_failed_attempts_almost_at_wipe,
- attempts, remaining);
- showDialog(null, message);
- }
-
- private void showWipeDialog(int attempts) {
- String message = mContext.getString(R.string.kg_failed_attempts_now_wiping, attempts);
- showDialog(null, message);
- }
-
- private void showAlmostAtAccountLoginDialog() {
- final int timeoutInSeconds = (int) LockPatternUtils.FAILED_ATTEMPT_TIMEOUT_MS / 1000;
- final int count = LockPatternUtils.FAILED_ATTEMPTS_BEFORE_RESET
- - LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT;
- String message = mContext.getString(R.string.kg_failed_attempts_almost_at_login,
- count, LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT, timeoutInSeconds);
- showDialog(null, message);
- }
-
- private void reportFailedUnlockAttempt() {
- final KeyguardUpdateMonitor monitor = KeyguardUpdateMonitor.getInstance(mContext);
- final int failedAttempts = monitor.getFailedUnlockAttempts() + 1; // +1 for this time
-
- if (DEBUG) Log.d(TAG, "reportFailedPatternAttempt: #" + failedAttempts);
-
- SecurityMode mode = mSecurityModel.getSecurityMode();
- final boolean usingPattern = mode == KeyguardSecurityModel.SecurityMode.Pattern;
-
- final int failedAttemptsBeforeWipe = mLockPatternUtils.getDevicePolicyManager()
- .getMaximumFailedPasswordsForWipe(null, mLockPatternUtils.getCurrentUser());
-
- final int failedAttemptWarning = LockPatternUtils.FAILED_ATTEMPTS_BEFORE_RESET
- - LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT;
-
- final int remainingBeforeWipe = failedAttemptsBeforeWipe > 0 ?
- (failedAttemptsBeforeWipe - failedAttempts)
- : Integer.MAX_VALUE; // because DPM returns 0 if no restriction
-
- boolean showTimeout = false;
- if (remainingBeforeWipe < LockPatternUtils.FAILED_ATTEMPTS_BEFORE_WIPE_GRACE) {
- // If we reach this code, it means the user has installed a DevicePolicyManager
- // that requests device wipe after N attempts. Once we get below the grace
- // period, we'll post this dialog every time as a clear warning until the
- // bombshell hits and the device is wiped.
- if (remainingBeforeWipe > 0) {
- showAlmostAtWipeDialog(failedAttempts, remainingBeforeWipe);
- } else {
- // Too many attempts. The device will be wiped shortly.
- Slog.i(TAG, "Too many unlock attempts; device will be wiped!");
- showWipeDialog(failedAttempts);
- }
- } else {
- showTimeout =
- (failedAttempts % LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT) == 0;
- if (usingPattern && mEnableFallback) {
- if (failedAttempts == failedAttemptWarning) {
- showAlmostAtAccountLoginDialog();
- showTimeout = false; // don't show both dialogs
- } else if (failedAttempts >= LockPatternUtils.FAILED_ATTEMPTS_BEFORE_RESET) {
- mLockPatternUtils.setPermanentlyLocked(true);
- showSecurityScreen(SecurityMode.Account);
- // don't show timeout dialog because we show account unlock screen next
- showTimeout = false;
- }
- }
- }
- monitor.reportFailedUnlockAttempt();
- mLockPatternUtils.reportFailedPasswordAttempt();
- if (showTimeout) {
- showTimeoutDialog();
- }
- }
-
- /**
- * Shows the primary security screen for the user. This will be either the multi-selector
- * or the user's security method.
- * @param turningOff true if the device is being turned off
- */
- void showPrimarySecurityScreen(boolean turningOff) {
- SecurityMode securityMode = mSecurityModel.getSecurityMode();
- if (DEBUG) Log.v(TAG, "showPrimarySecurityScreen(turningOff=" + turningOff + ")");
- if (!turningOff &&
- KeyguardUpdateMonitor.getInstance(mContext).isAlternateUnlockEnabled()) {
- // If we're not turning off, then allow biometric alternate.
- // We'll reload it when the device comes back on.
- securityMode = mSecurityModel.getAlternateFor(securityMode);
- }
- showSecurityScreen(securityMode);
- }
-
- /**
- * Shows the backup security screen for the current security mode. This could be used for
- * password recovery screens but is currently only used for pattern unlock to show the
- * account unlock screen and biometric unlock to show the user's normal unlock.
- */
- private void showBackupSecurityScreen() {
- if (DEBUG) Log.d(TAG, "showBackupSecurity()");
- SecurityMode backup = mSecurityModel.getBackupSecurityMode(mCurrentSecuritySelection);
- showSecurityScreen(backup);
- }
-
- public boolean showNextSecurityScreenIfPresent() {
- SecurityMode securityMode = mSecurityModel.getSecurityMode();
- // Allow an alternate, such as biometric unlock
- securityMode = mSecurityModel.getAlternateFor(securityMode);
- if (SecurityMode.None == securityMode) {
- return false;
- } else {
- showSecurityScreen(securityMode); // switch to the alternate security view
- return true;
- }
- }
-
- private void showNextSecurityScreenOrFinish(boolean authenticated) {
- if (DEBUG) Log.d(TAG, "showNextSecurityScreenOrFinish(" + authenticated + ")");
- boolean finish = false;
- if (SecurityMode.None == mCurrentSecuritySelection) {
- SecurityMode securityMode = mSecurityModel.getSecurityMode();
- // Allow an alternate, such as biometric unlock
- securityMode = mSecurityModel.getAlternateFor(securityMode);
- if (SecurityMode.None == securityMode) {
- finish = true; // no security required
- } else {
- showSecurityScreen(securityMode); // switch to the alternate security view
- }
- } else if (authenticated) {
- switch (mCurrentSecuritySelection) {
- case Pattern:
- case Password:
- case PIN:
- case Account:
- case Biometric:
- finish = true;
- break;
-
- case SimPin:
- case SimPuk:
- // Shortcut for SIM PIN/PUK to go to directly to user's security screen or home
- SecurityMode securityMode = mSecurityModel.getSecurityMode();
- if (securityMode != SecurityMode.None) {
- showSecurityScreen(securityMode);
- } else {
- finish = true;
- }
- break;
-
- default:
- Log.v(TAG, "Bad security screen " + mCurrentSecuritySelection + ", fail safe");
- showPrimarySecurityScreen(false);
- break;
- }
- } else {
- showPrimarySecurityScreen(false);
- }
- if (finish) {
- // If the alternate unlock was suppressed, it can now be safely
- // enabled because the user has left keyguard.
- KeyguardUpdateMonitor.getInstance(mContext).setAlternateUnlockEnabled(true);
-
- // If there's a pending runnable because the user interacted with a widget
- // and we're leaving keyguard, then run it.
- boolean deferKeyguardDone = false;
- if (mDismissAction != null) {
- deferKeyguardDone = mDismissAction.onDismiss();
- mDismissAction = null;
- }
- if (mViewMediatorCallback != null) {
- if (deferKeyguardDone) {
- mViewMediatorCallback.keyguardDonePending();
- } else {
- mViewMediatorCallback.keyguardDone(true);
- }
- }
- } else {
- mViewStateManager.showBouncer(true);
- }
- }
private static class MyOnClickHandler extends OnClickHandler {
@@ -843,17 +590,17 @@
// due to Binder GC linkages to AppWidgetHost. By the same token,
// this click handler should not keep references to any large
// objects.
- WeakReference<KeyguardHostView> mThis;
+ WeakReference<KeyguardHostView> mKeyguardHostView;
MyOnClickHandler(KeyguardHostView hostView) {
- mThis = new WeakReference<KeyguardHostView>(hostView);
+ mKeyguardHostView = new WeakReference<KeyguardHostView>(hostView);
}
@Override
public boolean onClickHandler(final View view,
final android.app.PendingIntent pendingIntent,
final Intent fillInIntent) {
- KeyguardHostView hostView = mThis.get();
+ KeyguardHostView hostView = mKeyguardHostView.get();
if (hostView == null) {
return false;
}
@@ -883,7 +630,7 @@
if (hostView.mViewStateManager.isChallengeShowing()) {
hostView.mViewStateManager.showBouncer(true);
} else {
- hostView.mCallback.dismiss(false);
+ hostView.dismiss();
}
return true;
} else {
@@ -892,153 +639,11 @@
};
};
- // Used to ignore callbacks from methods that are no longer current (e.g. face unlock).
- // This avoids unwanted asynchronous events from messing with the state.
- private KeyguardSecurityCallback mNullCallback = new KeyguardSecurityCallback() {
-
- @Override
- public void userActivity(long timeout) {
- }
-
- @Override
- public void showBackupSecurity() {
- }
-
- @Override
- public void setOnDismissAction(OnDismissAction action) {
- }
-
- @Override
- public void reportSuccessfulUnlockAttempt() {
- }
-
- @Override
- public void reportFailedUnlockAttempt() {
- }
-
- @Override
- public boolean isVerifyUnlockOnly() {
- return false;
- }
-
- @Override
- public int getFailedAttempts() {
- return 0;
- }
-
- @Override
- public void dismiss(boolean securityVerified) {
- }
- };
-
- /**
- * Sets an action to perform when keyguard is dismissed.
- * @param action
- */
- protected void setOnDismissAction(OnDismissAction action) {
- mDismissAction = action;
- }
-
- private KeyguardSecurityView getSecurityView(SecurityMode securityMode) {
- final int securityViewIdForMode = getSecurityViewIdForMode(securityMode);
- KeyguardSecurityView view = null;
- final int children = mSecurityViewContainer.getChildCount();
- for (int child = 0; child < children; child++) {
- if (mSecurityViewContainer.getChildAt(child).getId() == securityViewIdForMode) {
- view = ((KeyguardSecurityView)mSecurityViewContainer.getChildAt(child));
- break;
- }
- }
- int layoutId = getLayoutIdFor(securityMode);
- if (view == null && layoutId != 0) {
- final LayoutInflater inflater = LayoutInflater.from(mContext);
- if (DEBUG) Log.v(TAG, "inflating id = " + layoutId);
- View v = inflater.inflate(layoutId, mSecurityViewContainer, false);
- mSecurityViewContainer.addView(v);
- updateSecurityView(v);
- view = (KeyguardSecurityView)v;
- }
-
- if (view instanceof KeyguardSelectorView) {
- KeyguardSelectorView selectorView = (KeyguardSelectorView) view;
- View carrierText = selectorView.findViewById(R.id.keyguard_selector_fade_container);
- selectorView.setCarrierArea(carrierText);
- }
-
- return view;
- }
-
- /**
- * Switches to the given security view unless it's already being shown, in which case
- * this is a no-op.
- *
- * @param securityMode
- */
- private void showSecurityScreen(SecurityMode securityMode) {
- if (DEBUG) Log.d(TAG, "showSecurityScreen(" + securityMode + ")");
-
- if (securityMode == mCurrentSecuritySelection) return;
-
- KeyguardSecurityView oldView = getSecurityView(mCurrentSecuritySelection);
- KeyguardSecurityView newView = getSecurityView(securityMode);
-
- // Enter full screen mode if we're in SIM or Account screen
- boolean fullScreenEnabled = getResources().getBoolean(R.bool.kg_sim_puk_account_full_screen);
- boolean isSimOrAccount = securityMode == SecurityMode.SimPin
- || securityMode == SecurityMode.SimPuk
- || securityMode == SecurityMode.Account;
- mAppWidgetContainer.setVisibility(
- isSimOrAccount && fullScreenEnabled ? View.GONE : View.VISIBLE);
-
- // Don't show camera or search in navbar when SIM or Account screen is showing
- setSystemUiVisibility(isSimOrAccount ?
- (getSystemUiVisibility() | View.STATUS_BAR_DISABLE_SEARCH)
- : (getSystemUiVisibility() & ~View.STATUS_BAR_DISABLE_SEARCH));
-
- if (mSlidingChallengeLayout != null) {
- mSlidingChallengeLayout.setChallengeInteractive(!fullScreenEnabled);
- }
-
- // Emulate Activity life cycle
- if (oldView != null) {
- oldView.onPause();
- oldView.setKeyguardCallback(mNullCallback); // ignore requests from old view
- }
- newView.onResume(KeyguardSecurityView.VIEW_REVEALED);
- newView.setKeyguardCallback(mCallback);
-
- final boolean needsInput = newView.needsInput();
- if (mViewMediatorCallback != null) {
- mViewMediatorCallback.setNeedsInput(needsInput);
- }
-
- // Find and show this child.
- final int childCount = mSecurityViewContainer.getChildCount();
-
- final int securityViewIdForMode = getSecurityViewIdForMode(securityMode);
- for (int i = 0; i < childCount; i++) {
- if (mSecurityViewContainer.getChildAt(i).getId() == securityViewIdForMode) {
- mSecurityViewContainer.setDisplayedChild(i);
- break;
- }
- }
-
- if (securityMode == SecurityMode.None) {
- // Discard current runnable if we're switching back to the selector view
- setOnDismissAction(null);
- }
- if (securityMode == SecurityMode.Account && !mLockPatternUtils.isPermanentlyLocked()) {
- // we're showing account as a backup, provide a way to get back to primary
- setBackButtonEnabled(true);
- }
- mCurrentSecuritySelection = securityMode;
- }
-
@Override
public void onScreenTurnedOn() {
if (DEBUG) Log.d(TAG, "screen on, instance " + Integer.toHexString(hashCode()));
- showPrimarySecurityScreen(false);
- getSecurityView(mCurrentSecuritySelection).onResume(KeyguardSecurityView.SCREEN_ON);
+ mSecurityContainer.showPrimarySecurityScreen(false);
+ mSecurityContainer.onResume(KeyguardSecurityView.SCREEN_ON);
// This is a an attempt to fix bug 7137389 where the device comes back on but the entire
// layout is blank but forcing a layout causes it to reappear (e.g. with with
@@ -1065,8 +670,8 @@
if (KeyguardUpdateMonitor.getInstance(mContext).hasBootCompleted()) {
checkAppWidgetConsistency();
}
- showPrimarySecurityScreen(true);
- getSecurityView(mCurrentSecuritySelection).onPause();
+ mSecurityContainer.showPrimarySecurityScreen(true);
+ mSecurityContainer.onPause();
CameraWidgetFrame cameraPage = findCameraPage();
if (cameraPage != null) {
cameraPage.onScreenTurnedOff();
@@ -1082,12 +687,12 @@
@Override
public void show() {
if (DEBUG) Log.d(TAG, "show()");
- showPrimarySecurityScreen(false);
+ mSecurityContainer.showPrimarySecurityScreen(false);
}
@Override
public void verifyUnlock() {
- SecurityMode securityMode = mSecurityModel.getSecurityMode();
+ SecurityMode securityMode = mSecurityContainer.getSecurityMode();
if (securityMode == KeyguardSecurityModel.SecurityMode.None) {
if (mViewMediatorCallback != null) {
mViewMediatorCallback.keyguardDone(true);
@@ -1101,37 +706,7 @@
}
} else {
// otherwise, go to the unlock screen, see if they can verify it
- mIsVerifyUnlockOnly = true;
- showSecurityScreen(securityMode);
- }
- }
-
- private int getSecurityViewIdForMode(SecurityMode securityMode) {
- switch (securityMode) {
- case None: return R.id.keyguard_selector_view;
- case Pattern: return R.id.keyguard_pattern_view;
- case PIN: return R.id.keyguard_pin_view;
- case Password: return R.id.keyguard_password_view;
- case Biometric: return R.id.keyguard_face_unlock_view;
- case Account: return R.id.keyguard_account_view;
- case SimPin: return R.id.keyguard_sim_pin_view;
- case SimPuk: return R.id.keyguard_sim_puk_view;
- }
- return 0;
- }
-
- private int getLayoutIdFor(SecurityMode securityMode) {
- switch (securityMode) {
- case None: return R.layout.keyguard_selector_view;
- case Pattern: return R.layout.keyguard_pattern_view;
- case PIN: return R.layout.keyguard_pin_view;
- case Password: return R.layout.keyguard_password_view;
- case Biometric: return R.layout.keyguard_face_unlock_view;
- case Account: return R.layout.keyguard_account_view;
- case SimPin: return R.layout.keyguard_sim_pin_view;
- case SimPuk: return R.layout.keyguard_sim_puk_view;
- default:
- return 0;
+ mSecurityContainer.verifyUnlock();
}
}
@@ -1189,14 +764,19 @@
}
@Override
- KeyguardSecurityCallback getCallback() {
- return mCallback;
+ void setOnDismissAction(OnDismissAction action) {
+ mDismissAction = action;
}
@Override
LockPatternUtils getLockPatternUtils() {
return mLockPatternUtils;
}
+
+ @Override
+ void requestDismissKeyguard() {
+ KeyguardHostView.this.dismiss(false);
+ }
};
private int numWidgets() {
@@ -1618,18 +1198,18 @@
UserSwitcherCallback callback = new UserSwitcherCallback() {
@Override
public void hideSecurityView(int duration) {
- mSecurityViewContainer.animate().alpha(0).setDuration(duration);
+ mSecurityContainer.animate().alpha(0).setDuration(duration);
}
@Override
public void showSecurityView() {
- mSecurityViewContainer.setAlpha(1.0f);
+ mSecurityContainer.setAlpha(1.0f);
}
@Override
public void showUnlockHint() {
- if (mKeyguardSelectorView != null) {
- mKeyguardSelectorView.showUsabilityHint();
+ if (mSecurityContainer != null) {
+ mSecurityContainer.showUsabilityHint();
}
}
@@ -1688,21 +1268,21 @@
public boolean handleMenuKey() {
// The following enables the MENU key to work for testing automation
if (shouldEnableMenuKey()) {
- showNextSecurityScreenOrFinish(false);
+ dismiss();
return true;
}
return false;
}
public boolean handleBackKey() {
- if (mCurrentSecuritySelection == SecurityMode.Account) {
+ if (mSecurityContainer.getCurrentSecuritySelection() == SecurityMode.Account) {
// go back to primary screen and re-disable back
setBackButtonEnabled(false);
- showPrimarySecurityScreen(false /*turningOff*/);
+ mSecurityContainer.showPrimarySecurityScreen(false /*turningOff*/);
return true;
}
- if (mCurrentSecuritySelection != SecurityMode.None) {
- mCallback.dismiss(false);
+ if (mSecurityContainer.getCurrentSecuritySelection() != SecurityMode.None) {
+ mSecurityContainer.dismiss(false);
return true;
}
return false;
@@ -1712,7 +1292,54 @@
* Dismisses the keyguard by going to the next screen or making it gone.
*/
public void dismiss() {
- showNextSecurityScreenOrFinish(false);
+ dismiss(false);
+ }
+
+ private void dismiss(boolean authenticated) {
+ boolean finished = mSecurityContainer.showNextSecurityScreenOrFinish(authenticated);
+ if (!finished) {
+ updateAfterSecuritySelection();
+ mViewStateManager.showBouncer(true);
+ }
+ }
+
+ void setOnDismissAction(OnDismissAction action) {
+ mDismissAction = action;
+ }
+
+ public void announceCurrentSecurityMethod() {
+ mSecurityContainer.announceCurrentSecurityMethod();
+ }
+
+ private void updateAfterSecuritySelection() {
+ // Enable or disable the back button based on security mode
+ if (mSecurityContainer.getSecurityMode() == SecurityMode.Account
+ && !mLockPatternUtils.isPermanentlyLocked()) {
+ // we're showing account as a backup, provide a way to get back to primary
+ setBackButtonEnabled(true);
+ }
+
+ // Enter full screen mode if we're in SIM or Account screen
+ SecurityMode securityMode = mSecurityContainer.getSecurityMode();
+ boolean isFullScreen = getResources().getBoolean(R.bool.kg_sim_puk_account_full_screen);
+ boolean isSimOrAccount = securityMode == SecurityMode.SimPin
+ || securityMode == SecurityMode.SimPuk
+ || securityMode == SecurityMode.Account;
+ mAppWidgetContainer.setVisibility(
+ isSimOrAccount && isFullScreen ? View.GONE : View.VISIBLE);
+
+ // Don't show camera or search in navbar when SIM or Account screen is showing
+ setSystemUiVisibility(isSimOrAccount ?
+ (getSystemUiVisibility() | View.STATUS_BAR_DISABLE_SEARCH)
+ : (getSystemUiVisibility() & ~View.STATUS_BAR_DISABLE_SEARCH));
+
+ if (mSlidingChallengeLayout != null) {
+ mSlidingChallengeLayout.setChallengeInteractive(!isFullScreen);
+ }
+
+ if (mViewMediatorCallback != null) {
+ mViewMediatorCallback.setNeedsInput(mSecurityContainer.needsInput());
+ }
}
public void showAssistant() {
@@ -1726,9 +1353,7 @@
getHandler(), null);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-
- mActivityLauncher.launchActivityWithAnimation(
- intent, false, opts.toBundle(), null, null);
+ mActivityLauncher.launchActivityWithAnimation(intent, false, opts.toBundle(), null, null);
}
public void dispatch(MotionEvent event) {
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java
index e7f1259..0fa27c1 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java
@@ -260,7 +260,7 @@
public void onPatternDetected(List<LockPatternView.Cell> pattern) {
if (mLockPatternUtils.checkPattern(pattern)) {
- mCallback.reportSuccessfulUnlockAttempt();
+ mCallback.reportUnlockAttempt(true);
mLockPatternView.setDisplayMode(LockPatternView.DisplayMode.Correct);
mTotalFailedPatternAttempts = 0;
mCallback.dismiss(true);
@@ -272,7 +272,7 @@
if (pattern.size() >= LockPatternUtils.MIN_PATTERN_REGISTER_FAIL) {
mTotalFailedPatternAttempts++;
mFailedPatternAttemptsSinceLastTimeout++;
- mCallback.reportFailedUnlockAttempt();
+ mCallback.reportUnlockAttempt(false);
}
if (mFailedPatternAttemptsSinceLastTimeout
>= LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT) {
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityCallback.java b/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityCallback.java
index 4f139ad..957098c 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityCallback.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityCallback.java
@@ -15,8 +15,6 @@
*/
package com.android.keyguard;
-import com.android.keyguard.KeyguardHostView.OnDismissAction;
-
public interface KeyguardSecurityCallback {
/**
@@ -40,29 +38,13 @@
/**
* Call when user correctly enters their credentials
+ * @param success
*/
- void reportSuccessfulUnlockAttempt();
-
- /**
- * Call when the user incorrectly enters their credentials
- */
- void reportFailedUnlockAttempt();
-
- /**
- * Gets the number of attempts thus far as reported by {@link #reportFailedUnlockAttempt()}
- * @return number of failed attempts
- */
- int getFailedAttempts();
+ void reportUnlockAttempt(boolean success);
/**
* Shows the backup security for the current method. If none available, this call is a no-op.
*/
void showBackupSecurity();
- /**
- * Sets an action to perform after the user successfully enters their credentials.
- * @param action
- */
- void setOnDismissAction(OnDismissAction action);
-
}
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java b/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java
index 9d03c6a..7606689 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardSecurityContainer.java
@@ -1,11 +1,39 @@
package com.android.keyguard;
+import android.app.Activity;
+import android.app.AlertDialog;
import android.content.Context;
import android.util.AttributeSet;
+import android.util.Log;
+import android.util.Slog;
+import android.view.LayoutInflater;
import android.view.View;
+import android.view.WindowManager;
import android.widget.FrameLayout;
-public class KeyguardSecurityContainer extends FrameLayout {
+import com.android.internal.widget.LockPatternUtils;
+import com.android.keyguard.KeyguardSecurityModel.SecurityMode;
+
+public class KeyguardSecurityContainer extends FrameLayout implements KeyguardSecurityView {
+ private static final boolean DEBUG = KeyguardViewMediator.DEBUG;
+ private static final String TAG = "KeyguardSecurityView";
+ private KeyguardSecurityModel mSecurityModel;
+ private boolean mEnableFallback; // TODO: This should get the value from KeyguardPatternView
+ private LockPatternUtils mLockPatternUtils;
+
+ private KeyguardSecurityViewFlipper mSecurityViewFlipper;
+ private boolean mIsVerifyUnlockOnly;
+ private SecurityMode mCurrentSecuritySelection = SecurityMode.Invalid;
+ private boolean mIsBouncing;
+ private SecurityCallback mSecurityCallback;
+
+ // Used to notify the container when something interesting happens.
+ public interface SecurityCallback {
+ public void dismiss(boolean authenticated);
+ public void userActivity(long timeout);
+ public void finish();
+ }
+
public KeyguardSecurityContainer(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
@@ -16,9 +44,336 @@
public KeyguardSecurityContainer(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
+ mSecurityModel = new KeyguardSecurityModel(context);
+ mLockPatternUtils = new LockPatternUtils(context);
}
- KeyguardSecurityViewFlipper getFlipper() {
+ public void setSecurityCallback(SecurityCallback callback) {
+ mSecurityCallback = callback;
+ }
+
+ @Override
+ public void onResume(int reason) {
+ getSecurityView(mCurrentSecuritySelection).onResume(reason);
+ }
+
+ @Override
+ public void onPause() {
+ getSecurityView(mCurrentSecuritySelection).onPause();
+ }
+
+ void updateSecurityViews(boolean isBouncing) {
+ int children = mSecurityViewFlipper.getChildCount();
+ for (int i = 0; i < children; i++) {
+ updateSecurityView(mSecurityViewFlipper.getChildAt(i), isBouncing);
+ }
+ }
+
+ public void announceCurrentSecurityMethod() {
+ View v = (View) getSecurityView(mCurrentSecuritySelection);
+ if (v != null) {
+ v.announceForAccessibility(v.getContentDescription());
+ }
+ }
+
+ private KeyguardSecurityView getSecurityView(SecurityMode securityMode) {
+ final int securityViewIdForMode = getSecurityViewIdForMode(securityMode);
+ KeyguardSecurityView view = null;
+ final int children = mSecurityViewFlipper.getChildCount();
+ for (int child = 0; child < children; child++) {
+ if (mSecurityViewFlipper.getChildAt(child).getId() == securityViewIdForMode) {
+ view = ((KeyguardSecurityView)mSecurityViewFlipper.getChildAt(child));
+ break;
+ }
+ }
+ int layoutId = getLayoutIdFor(securityMode);
+ if (view == null && layoutId != 0) {
+ final LayoutInflater inflater = LayoutInflater.from(mContext);
+ if (DEBUG) Log.v(TAG, "inflating id = " + layoutId);
+ View v = inflater.inflate(layoutId, mSecurityViewFlipper, false);
+ mSecurityViewFlipper.addView(v);
+ updateSecurityView(v, mIsBouncing);
+ view = (KeyguardSecurityView)v;
+ }
+
+ if (view instanceof KeyguardSelectorView) {
+ KeyguardSelectorView selectorView = (KeyguardSelectorView) view;
+ View carrierText = selectorView.findViewById(R.id.keyguard_selector_fade_container);
+ selectorView.setCarrierArea(carrierText);
+ }
+
+ return view;
+ }
+
+ private void updateSecurityView(View view, boolean isBouncing) {
+ mIsBouncing = isBouncing;
+ if (view instanceof KeyguardSecurityView) {
+ KeyguardSecurityView ksv = (KeyguardSecurityView) view;
+ ksv.setKeyguardCallback(mCallback);
+ ksv.setLockPatternUtils(mLockPatternUtils);
+ if (isBouncing) {
+ ksv.showBouncer(0);
+ } else {
+ ksv.hideBouncer(0);
+ }
+ } else {
+ Log.w(TAG, "View " + view + " is not a KeyguardSecurityView");
+ }
+ }
+
+ protected void onFinishInflate() {
+ mSecurityViewFlipper = (KeyguardSecurityViewFlipper) findViewById(R.id.view_flipper);
+ mSecurityViewFlipper.setLockPatternUtils(mLockPatternUtils);
+ }
+
+ public void setLockPatternUtils(LockPatternUtils utils) {
+ mLockPatternUtils = utils;
+ mSecurityModel.setLockPatternUtils(utils);
+ mSecurityViewFlipper.setLockPatternUtils(mLockPatternUtils);
+ }
+
+ private void showDialog(String title, String message) {
+ final AlertDialog dialog = new AlertDialog.Builder(mContext)
+ .setTitle(title)
+ .setMessage(message)
+ .setNeutralButton(R.string.ok, null)
+ .create();
+ if (!(mContext instanceof Activity)) {
+ dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
+ }
+ dialog.show();
+ }
+
+ private void showTimeoutDialog() {
+ int timeoutInSeconds = (int) LockPatternUtils.FAILED_ATTEMPT_TIMEOUT_MS / 1000;
+ int messageId = 0;
+
+ switch (mSecurityModel.getSecurityMode()) {
+ case Pattern:
+ messageId = R.string.kg_too_many_failed_pattern_attempts_dialog_message;
+ break;
+ case PIN:
+ messageId = R.string.kg_too_many_failed_pin_attempts_dialog_message;
+ break;
+ case Password:
+ messageId = R.string.kg_too_many_failed_password_attempts_dialog_message;
+ break;
+ // These don't have timeout dialogs.
+ case Account:
+ case Biometric:
+ case Invalid:
+ case None:
+ case SimPin:
+ case SimPuk:
+ break;
+ }
+
+ if (messageId != 0) {
+ final String message = mContext.getString(messageId,
+ KeyguardUpdateMonitor.getInstance(mContext).getFailedUnlockAttempts(),
+ timeoutInSeconds);
+ showDialog(null, message);
+ }
+ }
+
+ private void showAlmostAtWipeDialog(int attempts, int remaining) {
+ String message = mContext.getString(R.string.kg_failed_attempts_almost_at_wipe,
+ attempts, remaining);
+ showDialog(null, message);
+ }
+
+ private void showWipeDialog(int attempts) {
+ String message = mContext.getString(R.string.kg_failed_attempts_now_wiping, attempts);
+ showDialog(null, message);
+ }
+
+ private void showAlmostAtAccountLoginDialog() {
+ final int timeoutInSeconds = (int) LockPatternUtils.FAILED_ATTEMPT_TIMEOUT_MS / 1000;
+ final int count = LockPatternUtils.FAILED_ATTEMPTS_BEFORE_RESET
+ - LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT;
+ String message = mContext.getString(R.string.kg_failed_attempts_almost_at_login,
+ count, LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT, timeoutInSeconds);
+ showDialog(null, message);
+ }
+
+ private void reportFailedUnlockAttempt() {
+ final KeyguardUpdateMonitor monitor = KeyguardUpdateMonitor.getInstance(mContext);
+ final int failedAttempts = monitor.getFailedUnlockAttempts() + 1; // +1 for this time
+
+ if (DEBUG) Log.d(TAG, "reportFailedPatternAttempt: #" + failedAttempts);
+
+ SecurityMode mode = mSecurityModel.getSecurityMode();
+ final boolean usingPattern = mode == KeyguardSecurityModel.SecurityMode.Pattern;
+
+ final int failedAttemptsBeforeWipe = mLockPatternUtils.getDevicePolicyManager()
+ .getMaximumFailedPasswordsForWipe(null, mLockPatternUtils.getCurrentUser());
+
+ final int failedAttemptWarning = LockPatternUtils.FAILED_ATTEMPTS_BEFORE_RESET
+ - LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT;
+
+ final int remainingBeforeWipe = failedAttemptsBeforeWipe > 0 ?
+ (failedAttemptsBeforeWipe - failedAttempts)
+ : Integer.MAX_VALUE; // because DPM returns 0 if no restriction
+
+ boolean showTimeout = false;
+ if (remainingBeforeWipe < LockPatternUtils.FAILED_ATTEMPTS_BEFORE_WIPE_GRACE) {
+ // If we reach this code, it means the user has installed a DevicePolicyManager
+ // that requests device wipe after N attempts. Once we get below the grace
+ // period, we'll post this dialog every time as a clear warning until the
+ // bombshell hits and the device is wiped.
+ if (remainingBeforeWipe > 0) {
+ showAlmostAtWipeDialog(failedAttempts, remainingBeforeWipe);
+ } else {
+ // Too many attempts. The device will be wiped shortly.
+ Slog.i(TAG, "Too many unlock attempts; device will be wiped!");
+ showWipeDialog(failedAttempts);
+ }
+ } else {
+ showTimeout =
+ (failedAttempts % LockPatternUtils.FAILED_ATTEMPTS_BEFORE_TIMEOUT) == 0;
+ if (usingPattern && mEnableFallback) {
+ if (failedAttempts == failedAttemptWarning) {
+ showAlmostAtAccountLoginDialog();
+ showTimeout = false; // don't show both dialogs
+ } else if (failedAttempts >= LockPatternUtils.FAILED_ATTEMPTS_BEFORE_RESET) {
+ mLockPatternUtils.setPermanentlyLocked(true);
+ showSecurityScreen(SecurityMode.Account);
+ // don't show timeout dialog because we show account unlock screen next
+ showTimeout = false;
+ }
+ }
+ }
+ monitor.reportFailedUnlockAttempt();
+ mLockPatternUtils.reportFailedPasswordAttempt();
+ if (showTimeout) {
+ showTimeoutDialog();
+ }
+ }
+
+ /**
+ * Shows the primary security screen for the user. This will be either the multi-selector
+ * or the user's security method.
+ * @param turningOff true if the device is being turned off
+ */
+ void showPrimarySecurityScreen(boolean turningOff) {
+ SecurityMode securityMode = mSecurityModel.getSecurityMode();
+ if (DEBUG) Log.v(TAG, "showPrimarySecurityScreen(turningOff=" + turningOff + ")");
+ if (!turningOff &&
+ KeyguardUpdateMonitor.getInstance(mContext).isAlternateUnlockEnabled()) {
+ // If we're not turning off, then allow biometric alternate.
+ // We'll reload it when the device comes back on.
+ securityMode = mSecurityModel.getAlternateFor(securityMode);
+ }
+ showSecurityScreen(securityMode);
+ }
+
+ /**
+ * Shows the backup security screen for the current security mode. This could be used for
+ * password recovery screens but is currently only used for pattern unlock to show the
+ * account unlock screen and biometric unlock to show the user's normal unlock.
+ */
+ private void showBackupSecurityScreen() {
+ if (DEBUG) Log.d(TAG, "showBackupSecurity()");
+ SecurityMode backup = mSecurityModel.getBackupSecurityMode(mCurrentSecuritySelection);
+ showSecurityScreen(backup);
+ }
+
+ private boolean showNextSecurityScreenIfPresent() {
+ SecurityMode securityMode = mSecurityModel.getSecurityMode();
+ // Allow an alternate, such as biometric unlock
+ securityMode = mSecurityModel.getAlternateFor(securityMode);
+ if (SecurityMode.None == securityMode) {
+ return false;
+ } else {
+ showSecurityScreen(securityMode); // switch to the alternate security view
+ return true;
+ }
+ }
+
+ boolean showNextSecurityScreenOrFinish(boolean authenticated) {
+ if (DEBUG) Log.d(TAG, "showNextSecurityScreenOrFinish(" + authenticated + ")");
+ boolean finish = false;
+ if (SecurityMode.None == mCurrentSecuritySelection) {
+ SecurityMode securityMode = mSecurityModel.getSecurityMode();
+ // Allow an alternate, such as biometric unlock
+ securityMode = mSecurityModel.getAlternateFor(securityMode);
+ if (SecurityMode.None == securityMode) {
+ finish = true; // no security required
+ } else {
+ showSecurityScreen(securityMode); // switch to the alternate security view
+ }
+ } else if (authenticated) {
+ switch (mCurrentSecuritySelection) {
+ case Pattern:
+ case Password:
+ case PIN:
+ case Account:
+ case Biometric:
+ finish = true;
+ break;
+
+ case SimPin:
+ case SimPuk:
+ // Shortcut for SIM PIN/PUK to go to directly to user's security screen or home
+ SecurityMode securityMode = mSecurityModel.getSecurityMode();
+ if (securityMode != SecurityMode.None) {
+ showSecurityScreen(securityMode);
+ } else {
+ finish = true;
+ }
+ break;
+
+ default:
+ Log.v(TAG, "Bad security screen " + mCurrentSecuritySelection + ", fail safe");
+ showPrimarySecurityScreen(false);
+ break;
+ }
+ } else {
+ showPrimarySecurityScreen(false);
+ }
+ if (finish) {
+ mSecurityCallback.finish();
+ }
+ return finish;
+ }
+
+ /**
+ * Switches to the given security view unless it's already being shown, in which case
+ * this is a no-op.
+ *
+ * @param securityMode
+ */
+ private void showSecurityScreen(SecurityMode securityMode) {
+ if (DEBUG) Log.d(TAG, "showSecurityScreen(" + securityMode + ")");
+
+ if (securityMode == mCurrentSecuritySelection) return;
+
+ KeyguardSecurityView oldView = getSecurityView(mCurrentSecuritySelection);
+ KeyguardSecurityView newView = getSecurityView(securityMode);
+
+ // Emulate Activity life cycle
+ if (oldView != null) {
+ oldView.onPause();
+ oldView.setKeyguardCallback(mNullCallback); // ignore requests from old view
+ }
+ newView.onResume(KeyguardSecurityView.VIEW_REVEALED);
+ newView.setKeyguardCallback(mCallback);
+
+ // Find and show this child.
+ final int childCount = mSecurityViewFlipper.getChildCount();
+
+ final int securityViewIdForMode = getSecurityViewIdForMode(securityMode);
+ for (int i = 0; i < childCount; i++) {
+ if (mSecurityViewFlipper.getChildAt(i).getId() == securityViewIdForMode) {
+ mSecurityViewFlipper.setDisplayedChild(i);
+ break;
+ }
+ }
+
+ mCurrentSecuritySelection = securityMode;
+ }
+
+ private KeyguardSecurityViewFlipper getFlipper() {
for (int i = 0; i < getChildCount(); i++) {
View child = getChildAt(i);
if (child instanceof KeyguardSecurityViewFlipper) {
@@ -41,5 +396,129 @@
flipper.hideBouncer(duration);
}
}
+
+ private KeyguardSecurityCallback mCallback = new KeyguardSecurityCallback() {
+
+ public void userActivity(long timeout) {
+ if (mSecurityCallback != null) {
+ mSecurityCallback.userActivity(timeout);
+ }
+ }
+
+ public void dismiss(boolean authenticated) {
+ mSecurityCallback.dismiss(authenticated);
+ }
+
+ public boolean isVerifyUnlockOnly() {
+ return mIsVerifyUnlockOnly;
+ }
+
+ public void reportUnlockAttempt(boolean success) {
+ KeyguardUpdateMonitor monitor = KeyguardUpdateMonitor.getInstance(mContext);
+ if (success) {
+ monitor.clearFailedUnlockAttempts();
+ mLockPatternUtils.reportSuccessfulPasswordAttempt();
+ } else {
+ if (mCurrentSecuritySelection == SecurityMode.Biometric) {
+ monitor.reportFailedBiometricUnlockAttempt();
+ } else {
+ KeyguardSecurityContainer.this.reportFailedUnlockAttempt();
+ }
+ }
+ }
+
+ @Override
+ public void showBackupSecurity() {
+ KeyguardSecurityContainer.this.showBackupSecurityScreen();
+ }
+
+ };
+
+ // The following is used to ignore callbacks from SecurityViews that are no longer current
+ // (e.g. face unlock). This avoids unwanted asynchronous events from messing with the
+ // state for the current security method.
+ private KeyguardSecurityCallback mNullCallback = new KeyguardSecurityCallback() {
+ @Override
+ public void userActivity(long timeout) { }
+ @Override
+ public void showBackupSecurity() { }
+ @Override
+ public void reportUnlockAttempt(boolean success) { }
+ @Override
+ public boolean isVerifyUnlockOnly() { return false; }
+ @Override
+ public void dismiss(boolean securityVerified) { }
+ };
+
+ private int getSecurityViewIdForMode(SecurityMode securityMode) {
+ switch (securityMode) {
+ case None: return R.id.keyguard_selector_view;
+ case Pattern: return R.id.keyguard_pattern_view;
+ case PIN: return R.id.keyguard_pin_view;
+ case Password: return R.id.keyguard_password_view;
+ case Biometric: return R.id.keyguard_face_unlock_view;
+ case Account: return R.id.keyguard_account_view;
+ case SimPin: return R.id.keyguard_sim_pin_view;
+ case SimPuk: return R.id.keyguard_sim_puk_view;
+ }
+ return 0;
+ }
+
+ private int getLayoutIdFor(SecurityMode securityMode) {
+ switch (securityMode) {
+ case None: return R.layout.keyguard_selector_view;
+ case Pattern: return R.layout.keyguard_pattern_view;
+ case PIN: return R.layout.keyguard_pin_view;
+ case Password: return R.layout.keyguard_password_view;
+ case Biometric: return R.layout.keyguard_face_unlock_view;
+ case Account: return R.layout.keyguard_account_view;
+ case SimPin: return R.layout.keyguard_sim_pin_view;
+ case SimPuk: return R.layout.keyguard_sim_puk_view;
+ default:
+ return 0;
+ }
+ }
+
+ public SecurityMode getSecurityMode() {
+ return mSecurityModel.getSecurityMode();
+ }
+
+ public void verifyUnlock() {
+ mIsVerifyUnlockOnly = true;
+ showSecurityScreen(getSecurityMode());
+ }
+
+ public SecurityMode getCurrentSecuritySelection() {
+ return mCurrentSecuritySelection;
+ }
+
+ public void dismiss(boolean authenticated) {
+ mCallback.dismiss(authenticated);
+ }
+
+ public boolean needsInput() {
+ return mSecurityViewFlipper.needsInput();
+ }
+
+ @Override
+ public void setKeyguardCallback(KeyguardSecurityCallback callback) {
+ mSecurityViewFlipper.setKeyguardCallback(callback);
+ }
+
+ @Override
+ public void reset() {
+ mSecurityViewFlipper.reset();
+ }
+
+ @Override
+ public KeyguardSecurityCallback getCallback() {
+ return mSecurityViewFlipper.getCallback();
+ }
+
+ @Override
+ public void showUsabilityHint() {
+ mSecurityViewFlipper.showUsabilityHint();
+ }
+
}
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardSelectorView.java b/packages/Keyguard/src/com/android/keyguard/KeyguardSelectorView.java
index 718b06e..97aec68 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardSelectorView.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardSelectorView.java
@@ -58,23 +58,6 @@
final int resId = mGlowPadView.getResourceIdForTarget(target);
switch (resId) {
- case R.drawable.ic_action_assist_generic:
- Intent assistIntent =
- ((SearchManager) mContext.getSystemService(Context.SEARCH_SERVICE))
- .getAssistIntent(mContext, true, UserHandle.USER_CURRENT);
- if (assistIntent != null) {
- mActivityLauncher.launchActivity(assistIntent, false, true, null, null);
- } else {
- Log.w(TAG, "Failed to get intent for assist activity");
- }
- mCallback.userActivity(0);
- break;
-
- case R.drawable.ic_lockscreen_camera:
- mActivityLauncher.launchCamera(null, null);
- mCallback.userActivity(0);
- break;
-
case R.drawable.ic_lockscreen_unlock_phantom:
case R.drawable.ic_lockscreen_unlock:
mCallback.userActivity(0);
@@ -117,23 +100,6 @@
}
};
- private final KeyguardActivityLauncher mActivityLauncher = new KeyguardActivityLauncher() {
-
- @Override
- KeyguardSecurityCallback getCallback() {
- return mCallback;
- }
-
- @Override
- LockPatternUtils getLockPatternUtils() {
- return mLockPatternUtils;
- }
-
- @Override
- Context getContext() {
- return mContext;
- }};
-
public KeyguardSelectorView(Context context) {
this(context, null);
}
diff --git a/rs/jni/android_renderscript_RenderScript.cpp b/rs/jni/android_renderscript_RenderScript.cpp
index 5cf3a83..024d0c3 100644
--- a/rs/jni/android_renderscript_RenderScript.cpp
+++ b/rs/jni/android_renderscript_RenderScript.cpp
@@ -173,7 +173,7 @@
gContextId = _env->GetFieldID(_this, "mContext", "J");
jclass bitmapClass = _env->FindClass("android/graphics/Bitmap");
- gNativeBitmapID = _env->GetFieldID(bitmapClass, "mNativeBitmap", "I");
+ gNativeBitmapID = _env->GetFieldID(bitmapClass, "mNativeBitmap", "J");
}
// ---------------------------------------------------------------------------
@@ -578,7 +578,7 @@
nAllocationCreateFromBitmap(JNIEnv *_env, jobject _this, jlong con, jlong type, jint mip, jobject jbitmap, jint usage)
{
SkBitmap const * nativeBitmap =
- (SkBitmap const *)_env->GetIntField(jbitmap, gNativeBitmapID);
+ (SkBitmap const *)_env->GetLongField(jbitmap, gNativeBitmapID);
const SkBitmap& bitmap(*nativeBitmap);
bitmap.lockPixels();
@@ -594,7 +594,7 @@
nAllocationCreateBitmapBackedAllocation(JNIEnv *_env, jobject _this, jlong con, jlong type, jint mip, jobject jbitmap, jint usage)
{
SkBitmap const * nativeBitmap =
- (SkBitmap const *)_env->GetIntField(jbitmap, gNativeBitmapID);
+ (SkBitmap const *)_env->GetLongField(jbitmap, gNativeBitmapID);
const SkBitmap& bitmap(*nativeBitmap);
bitmap.lockPixels();
@@ -610,7 +610,7 @@
nAllocationCubeCreateFromBitmap(JNIEnv *_env, jobject _this, jlong con, jlong type, jint mip, jobject jbitmap, jint usage)
{
SkBitmap const * nativeBitmap =
- (SkBitmap const *)_env->GetIntField(jbitmap, gNativeBitmapID);
+ (SkBitmap const *)_env->GetLongField(jbitmap, gNativeBitmapID);
const SkBitmap& bitmap(*nativeBitmap);
bitmap.lockPixels();
@@ -626,7 +626,7 @@
nAllocationCopyFromBitmap(JNIEnv *_env, jobject _this, jlong con, jlong alloc, jobject jbitmap)
{
SkBitmap const * nativeBitmap =
- (SkBitmap const *)_env->GetIntField(jbitmap, gNativeBitmapID);
+ (SkBitmap const *)_env->GetLongField(jbitmap, gNativeBitmapID);
const SkBitmap& bitmap(*nativeBitmap);
int w = bitmap.width();
int h = bitmap.height();
@@ -643,7 +643,7 @@
nAllocationCopyToBitmap(JNIEnv *_env, jobject _this, jlong con, jlong alloc, jobject jbitmap)
{
SkBitmap const * nativeBitmap =
- (SkBitmap const *)_env->GetIntField(jbitmap, gNativeBitmapID);
+ (SkBitmap const *)_env->GetLongField(jbitmap, gNativeBitmapID);
const SkBitmap& bitmap(*nativeBitmap);
bitmap.lockPixels();
diff --git a/services/core/java/com/android/server/AssetAtlasService.java b/services/core/java/com/android/server/AssetAtlasService.java
index 26b4652..3fb006b 100644
--- a/services/core/java/com/android/server/AssetAtlasService.java
+++ b/services/core/java/com/android/server/AssetAtlasService.java
@@ -288,8 +288,8 @@
}
canvas.drawBitmap(bitmap, 0.0f, 0.0f, null);
canvas.restore();
-
- atlasMap[mapIndex++] = bitmap.mNativeBitmap;
+ // TODO: Change mAtlasMap to long[] to support 64-bit systems
+ atlasMap[mapIndex++] = (int) bitmap.mNativeBitmap;
atlasMap[mapIndex++] = entry.x;
atlasMap[mapIndex++] = entry.y;
atlasMap[mapIndex++] = entry.rotated ? 1 : 0;
diff --git a/services/core/java/com/android/server/am/ActivityStack.java b/services/core/java/com/android/server/am/ActivityStack.java
index 4d863dc..70d85fc 100755
--- a/services/core/java/com/android/server/am/ActivityStack.java
+++ b/services/core/java/com/android/server/am/ActivityStack.java
@@ -1099,6 +1099,7 @@
if (!r.visible) {
if (DEBUG_VISBILITY) Slog.v(
TAG, "Starting and making visible: " + r);
+ r.visible = true;
mWindowManager.setAppVisibility(r.appToken, true);
}
if (r != starting) {
diff --git a/services/core/jni/com_android_server_AssetAtlasService.cpp b/services/core/jni/com_android_server_AssetAtlasService.cpp
index 885d21e..4a1b55d 100644
--- a/services/core/jni/com_android_server_AssetAtlasService.cpp
+++ b/services/core/jni/com_android_server_AssetAtlasService.cpp
@@ -54,11 +54,11 @@
jfieldID mNativeCanvas;
} gCanvasFinalizerClassInfo;
-#define GET_INT(object, field) \
- env->GetIntField(object, field)
+#define GET_LONG(object, field) \
+ env->GetLongField(object, field)
-#define SET_INT(object, field, value) \
- env->SetIntField(object, field, value)
+#define SET_LONG(object, field, value) \
+ env->SetLongField(object, field, value)
// ----------------------------------------------------------------------------
// Canvas management
@@ -67,9 +67,9 @@
static inline void swapCanvasPtr(JNIEnv* env, jobject canvasObj, SkCanvas* newCanvas) {
jobject canvasFinalizerObj = env->GetObjectField(canvasObj, gCanvasClassInfo.mFinalizer);
SkCanvas* previousCanvas = reinterpret_cast<SkCanvas*>(
- GET_INT(canvasObj, gCanvasClassInfo.mNativeCanvas));
- SET_INT(canvasObj, gCanvasClassInfo.mNativeCanvas, (int) newCanvas);
- SET_INT(canvasFinalizerObj, gCanvasFinalizerClassInfo.mNativeCanvas, (int) newCanvas);
+ GET_LONG(canvasObj, gCanvasClassInfo.mNativeCanvas));
+ SET_LONG(canvasObj, gCanvasClassInfo.mNativeCanvas, (long) newCanvas);
+ SET_LONG(canvasFinalizerObj, gCanvasFinalizerClassInfo.mNativeCanvas, (long) newCanvas);
SkSafeUnref(previousCanvas);
}
@@ -261,10 +261,10 @@
FIND_CLASS(clazz, "android/graphics/Canvas");
GET_FIELD_ID(gCanvasClassInfo.mFinalizer, clazz, "mFinalizer",
"Landroid/graphics/Canvas$CanvasFinalizer;");
- GET_FIELD_ID(gCanvasClassInfo.mNativeCanvas, clazz, "mNativeCanvas", "I");
+ GET_FIELD_ID(gCanvasClassInfo.mNativeCanvas, clazz, "mNativeCanvas", "J");
FIND_CLASS(clazz, "android/graphics/Canvas$CanvasFinalizer");
- GET_FIELD_ID(gCanvasFinalizerClassInfo.mNativeCanvas, clazz, "mNativeCanvas", "I");
+ GET_FIELD_ID(gCanvasFinalizerClassInfo.mNativeCanvas, clazz, "mNativeCanvas", "J");
return jniRegisterNativeMethods(env, kClassPathName, gMethods, NELEM(gMethods));
}
diff --git a/tools/layoutlib/bridge/src/android/graphics/AvoidXfermode_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/AvoidXfermode_Delegate.java
index a50a2bd..34ae825 100644
--- a/tools/layoutlib/bridge/src/android/graphics/AvoidXfermode_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/AvoidXfermode_Delegate.java
@@ -61,7 +61,7 @@
// ---- native methods ----
@LayoutlibDelegate
- /*package*/ static int nativeCreate(int opColor, int tolerance, int nativeMode) {
+ /*package*/ static long nativeCreate(int opColor, int tolerance, int nativeMode) {
AvoidXfermode_Delegate newDelegate = new AvoidXfermode_Delegate();
return sManager.addNewDelegate(newDelegate);
}
diff --git a/tools/layoutlib/bridge/src/android/graphics/BitmapShader_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/BitmapShader_Delegate.java
index 65a75b0..cdbbe46 100644
--- a/tools/layoutlib/bridge/src/android/graphics/BitmapShader_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/BitmapShader_Delegate.java
@@ -65,7 +65,7 @@
// ---- native methods ----
@LayoutlibDelegate
- /*package*/ static int nativeCreate(int native_bitmap, int shaderTileModeX,
+ /*package*/ static long nativeCreate(long native_bitmap, int shaderTileModeX,
int shaderTileModeY) {
Bitmap_Delegate bitmap = Bitmap_Delegate.getDelegate(native_bitmap);
if (bitmap == null) {
@@ -80,7 +80,7 @@
}
@LayoutlibDelegate
- /*package*/ static int nativePostCreate(int native_shader, int native_bitmap,
+ /*package*/ static long nativePostCreate(long native_shader, long native_bitmap,
int shaderTileModeX, int shaderTileModeY) {
// pass, not needed.
return 0;
diff --git a/tools/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java
index 2787eca..0bdc28d 100644
--- a/tools/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java
@@ -83,7 +83,7 @@
/**
* Returns the native delegate associated to a given an int referencing a {@link Bitmap} object.
*/
- public static Bitmap_Delegate getDelegate(int native_bitmap) {
+ public static Bitmap_Delegate getDelegate(long native_bitmap) {
return sManager.getDelegate(native_bitmap);
}
@@ -272,7 +272,7 @@
}
@LayoutlibDelegate
- /*package*/ static Bitmap nativeCopy(int srcBitmap, int nativeConfig, boolean isMutable) {
+ /*package*/ static Bitmap nativeCopy(long srcBitmap, int nativeConfig, boolean isMutable) {
Bitmap_Delegate srcBmpDelegate = sManager.getDelegate(srcBitmap);
if (srcBmpDelegate == null) {
return null;
@@ -301,17 +301,17 @@
}
@LayoutlibDelegate
- /*package*/ static void nativeDestructor(int nativeBitmap) {
+ /*package*/ static void nativeDestructor(long nativeBitmap) {
sManager.removeJavaReferenceFor(nativeBitmap);
}
@LayoutlibDelegate
- /*package*/ static void nativeRecycle(int nativeBitmap) {
+ /*package*/ static void nativeRecycle(long nativeBitmap) {
sManager.removeJavaReferenceFor(nativeBitmap);
}
@LayoutlibDelegate
- /*package*/ static boolean nativeCompress(int nativeBitmap, int format, int quality,
+ /*package*/ static boolean nativeCompress(long nativeBitmap, int format, int quality,
OutputStream stream, byte[] tempStorage) {
Bridge.getLog().error(LayoutLog.TAG_UNSUPPORTED,
"Bitmap.compress() is not supported", null /*data*/);
@@ -319,7 +319,7 @@
}
@LayoutlibDelegate
- /*package*/ static void nativeErase(int nativeBitmap, int color) {
+ /*package*/ static void nativeErase(long nativeBitmap, int color) {
// get the delegate from the native int.
Bitmap_Delegate delegate = sManager.getDelegate(nativeBitmap);
if (delegate == null) {
@@ -339,7 +339,7 @@
}
@LayoutlibDelegate
- /*package*/ static int nativeWidth(int nativeBitmap) {
+ /*package*/ static int nativeWidth(long nativeBitmap) {
// get the delegate from the native int.
Bitmap_Delegate delegate = sManager.getDelegate(nativeBitmap);
if (delegate == null) {
@@ -350,7 +350,7 @@
}
@LayoutlibDelegate
- /*package*/ static int nativeHeight(int nativeBitmap) {
+ /*package*/ static int nativeHeight(long nativeBitmap) {
// get the delegate from the native int.
Bitmap_Delegate delegate = sManager.getDelegate(nativeBitmap);
if (delegate == null) {
@@ -361,7 +361,7 @@
}
@LayoutlibDelegate
- /*package*/ static int nativeRowBytes(int nativeBitmap) {
+ /*package*/ static int nativeRowBytes(long nativeBitmap) {
// get the delegate from the native int.
Bitmap_Delegate delegate = sManager.getDelegate(nativeBitmap);
if (delegate == null) {
@@ -372,7 +372,7 @@
}
@LayoutlibDelegate
- /*package*/ static int nativeConfig(int nativeBitmap) {
+ /*package*/ static int nativeConfig(long nativeBitmap) {
// get the delegate from the native int.
Bitmap_Delegate delegate = sManager.getDelegate(nativeBitmap);
if (delegate == null) {
@@ -383,7 +383,7 @@
}
@LayoutlibDelegate
- /*package*/ static boolean nativeHasAlpha(int nativeBitmap) {
+ /*package*/ static boolean nativeHasAlpha(long nativeBitmap) {
// get the delegate from the native int.
Bitmap_Delegate delegate = sManager.getDelegate(nativeBitmap);
if (delegate == null) {
@@ -394,7 +394,7 @@
}
@LayoutlibDelegate
- /*package*/ static boolean nativeHasMipMap(int nativeBitmap) {
+ /*package*/ static boolean nativeHasMipMap(long nativeBitmap) {
// get the delegate from the native int.
Bitmap_Delegate delegate = sManager.getDelegate(nativeBitmap);
if (delegate == null) {
@@ -405,7 +405,7 @@
}
@LayoutlibDelegate
- /*package*/ static int nativeGetPixel(int nativeBitmap, int x, int y) {
+ /*package*/ static int nativeGetPixel(long nativeBitmap, int x, int y) {
// get the delegate from the native int.
Bitmap_Delegate delegate = sManager.getDelegate(nativeBitmap);
if (delegate == null) {
@@ -416,7 +416,7 @@
}
@LayoutlibDelegate
- /*package*/ static void nativeGetPixels(int nativeBitmap, int[] pixels, int offset,
+ /*package*/ static void nativeGetPixels(long nativeBitmap, int[] pixels, int offset,
int stride, int x, int y, int width, int height) {
Bitmap_Delegate delegate = sManager.getDelegate(nativeBitmap);
if (delegate == null) {
@@ -428,7 +428,7 @@
@LayoutlibDelegate
- /*package*/ static void nativeSetPixel(int nativeBitmap, int x, int y, int color) {
+ /*package*/ static void nativeSetPixel(long nativeBitmap, int x, int y, int color) {
Bitmap_Delegate delegate = sManager.getDelegate(nativeBitmap);
if (delegate == null) {
return;
@@ -438,7 +438,7 @@
}
@LayoutlibDelegate
- /*package*/ static void nativeSetPixels(int nativeBitmap, int[] colors, int offset,
+ /*package*/ static void nativeSetPixels(long nativeBitmap, int[] colors, int offset,
int stride, int x, int y, int width, int height) {
Bitmap_Delegate delegate = sManager.getDelegate(nativeBitmap);
if (delegate == null) {
@@ -449,21 +449,21 @@
}
@LayoutlibDelegate
- /*package*/ static void nativeCopyPixelsToBuffer(int nativeBitmap, Buffer dst) {
+ /*package*/ static void nativeCopyPixelsToBuffer(long nativeBitmap, Buffer dst) {
// FIXME implement native delegate
Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
"Bitmap.copyPixelsToBuffer is not supported.", null, null /*data*/);
}
@LayoutlibDelegate
- /*package*/ static void nativeCopyPixelsFromBuffer(int nb, Buffer src) {
+ /*package*/ static void nativeCopyPixelsFromBuffer(long nb, Buffer src) {
// FIXME implement native delegate
Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
"Bitmap.copyPixelsFromBuffer is not supported.", null, null /*data*/);
}
@LayoutlibDelegate
- /*package*/ static int nativeGenerationId(int nativeBitmap) {
+ /*package*/ static int nativeGenerationId(long nativeBitmap) {
Bitmap_Delegate delegate = sManager.getDelegate(nativeBitmap);
if (delegate == null) {
return 0;
@@ -483,7 +483,7 @@
}
@LayoutlibDelegate
- /*package*/ static boolean nativeWriteToParcel(int nativeBitmap, boolean isMutable,
+ /*package*/ static boolean nativeWriteToParcel(long nativeBitmap, boolean isMutable,
int density, Parcel p) {
// This is only called when sending a bitmap through aidl, so really this should not
// be called.
@@ -494,7 +494,7 @@
}
@LayoutlibDelegate
- /*package*/ static Bitmap nativeExtractAlpha(int nativeBitmap, int nativePaint,
+ /*package*/ static Bitmap nativeExtractAlpha(long nativeBitmap, long nativePaint,
int[] offsetXY) {
Bitmap_Delegate bitmap = sManager.getDelegate(nativeBitmap);
if (bitmap == null) {
@@ -522,12 +522,12 @@
}
@LayoutlibDelegate
- /*package*/ static void nativePrepareToDraw(int nativeBitmap) {
+ /*package*/ static void nativePrepareToDraw(long nativeBitmap) {
// nothing to be done here.
}
@LayoutlibDelegate
- /*package*/ static void nativeSetHasAlpha(int nativeBitmap, boolean hasAlpha) {
+ /*package*/ static void nativeSetHasAlpha(long nativeBitmap, boolean hasAlpha) {
// get the delegate from the native int.
Bitmap_Delegate delegate = sManager.getDelegate(nativeBitmap);
if (delegate == null) {
@@ -538,7 +538,7 @@
}
@LayoutlibDelegate
- /*package*/ static void nativeSetHasMipMap(int nativeBitmap, boolean hasMipMap) {
+ /*package*/ static void nativeSetHasMipMap(long nativeBitmap, boolean hasMipMap) {
// get the delegate from the native int.
Bitmap_Delegate delegate = sManager.getDelegate(nativeBitmap);
if (delegate == null) {
@@ -549,7 +549,7 @@
}
@LayoutlibDelegate
- /*package*/ static boolean nativeSameAs(int nb0, int nb1) {
+ /*package*/ static boolean nativeSameAs(long nb0, long nb1) {
Bitmap_Delegate delegate1 = sManager.getDelegate(nb0);
if (delegate1 == null) {
return false;
@@ -602,7 +602,7 @@
private static Bitmap createBitmap(Bitmap_Delegate delegate,
Set<BitmapCreateFlags> createFlags, int density) {
// get its native_int
- int nativeInt = sManager.addNewDelegate(delegate);
+ long nativeInt = sManager.addNewDelegate(delegate);
int width = delegate.mImage.getWidth();
int height = delegate.mImage.getHeight();
diff --git a/tools/layoutlib/bridge/src/android/graphics/BlurMaskFilter_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/BlurMaskFilter_Delegate.java
index 4becba1..d2569c7 100644
--- a/tools/layoutlib/bridge/src/android/graphics/BlurMaskFilter_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/BlurMaskFilter_Delegate.java
@@ -55,7 +55,7 @@
// ---- native methods ----
@LayoutlibDelegate
- /*package*/ static int nativeConstructor(float radius, int style) {
+ /*package*/ static long nativeConstructor(float radius, int style) {
BlurMaskFilter_Delegate newDelegate = new BlurMaskFilter_Delegate();
return sManager.addNewDelegate(newDelegate);
}
diff --git a/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
index 62b47bd..ba771dd 100644
--- a/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/Canvas_Delegate.java
@@ -77,7 +77,7 @@
/**
* Returns the native delegate associated to a given an int referencing a {@link Canvas} object.
*/
- public static Canvas_Delegate getDelegate(int native_canvas) {
+ public static Canvas_Delegate getDelegate(long native_canvas) {
return sManager.getDelegate(native_canvas);
}
@@ -310,7 +310,7 @@
}
@LayoutlibDelegate
- /*package*/ static int initRaster(int nativeBitmapOrZero) {
+ /*package*/ static long initRaster(long nativeBitmapOrZero) {
if (nativeBitmapOrZero > 0) {
// get the Bitmap from the int
Bitmap_Delegate bitmapDelegate = Bitmap_Delegate.getDelegate(nativeBitmapOrZero);
@@ -328,7 +328,7 @@
}
@LayoutlibDelegate
- /*package*/ static void copyNativeCanvasState(int srcCanvas, int dstCanvas) {
+ /*package*/ static void copyNativeCanvasState(long srcCanvas, long dstCanvas) {
// get the delegate from the native int.
Canvas_Delegate srcCanvasDelegate = sManager.getDelegate(srcCanvas);
if (srcCanvasDelegate == null) {
@@ -344,8 +344,8 @@
}
@LayoutlibDelegate
- /*package*/ static int native_saveLayer(int nativeCanvas, RectF bounds,
- int paint, int layerFlags) {
+ /*package*/ static long native_saveLayer(long nativeCanvas, RectF bounds,
+ long paint, int layerFlags) {
// get the delegate from the native int.
Canvas_Delegate canvasDelegate = sManager.getDelegate(nativeCanvas);
if (canvasDelegate == null) {
@@ -361,9 +361,9 @@
}
@LayoutlibDelegate
- /*package*/ static int native_saveLayer(int nativeCanvas, float l,
+ /*package*/ static long native_saveLayer(long nativeCanvas, float l,
float t, float r, float b,
- int paint, int layerFlags) {
+ long paint, int layerFlags) {
// get the delegate from the native int.
Canvas_Delegate canvasDelegate = sManager.getDelegate(nativeCanvas);
if (canvasDelegate == null) {
@@ -380,7 +380,7 @@
}
@LayoutlibDelegate
- /*package*/ static int native_saveLayerAlpha(int nativeCanvas,
+ /*package*/ static long native_saveLayerAlpha(long nativeCanvas,
RectF bounds, int alpha,
int layerFlags) {
// get the delegate from the native int.
@@ -393,7 +393,7 @@
}
@LayoutlibDelegate
- /*package*/ static int native_saveLayerAlpha(int nativeCanvas, float l,
+ /*package*/ static long native_saveLayerAlpha(long nativeCanvas, float l,
float t, float r, float b,
int alpha, int layerFlags) {
// get the delegate from the native int.
@@ -407,7 +407,7 @@
@LayoutlibDelegate
- /*package*/ static void native_concat(int nCanvas, int nMatrix) {
+ /*package*/ static void native_concat(long nCanvas, long nMatrix) {
// get the delegate from the native int.
Canvas_Delegate canvasDelegate = sManager.getDelegate(nCanvas);
if (canvasDelegate == null) {
@@ -435,7 +435,7 @@
}
@LayoutlibDelegate
- /*package*/ static void native_setMatrix(int nCanvas, int nMatrix) {
+ /*package*/ static void native_setMatrix(long nCanvas, long nMatrix) {
// get the delegate from the native int.
Canvas_Delegate canvasDelegate = sManager.getDelegate(nCanvas);
if (canvasDelegate == null) {
@@ -465,7 +465,7 @@
}
@LayoutlibDelegate
- /*package*/ static boolean native_clipRect(int nCanvas,
+ /*package*/ static boolean native_clipRect(long nCanvas,
float left, float top,
float right, float bottom,
int regionOp) {
@@ -480,8 +480,8 @@
}
@LayoutlibDelegate
- /*package*/ static boolean native_clipPath(int nativeCanvas,
- int nativePath,
+ /*package*/ static boolean native_clipPath(long nativeCanvas,
+ long nativePath,
int regionOp) {
Canvas_Delegate canvasDelegate = sManager.getDelegate(nativeCanvas);
if (canvasDelegate == null) {
@@ -497,8 +497,8 @@
}
@LayoutlibDelegate
- /*package*/ static boolean native_clipRegion(int nativeCanvas,
- int nativeRegion,
+ /*package*/ static boolean native_clipRegion(long nativeCanvas,
+ long nativeRegion,
int regionOp) {
Canvas_Delegate canvasDelegate = sManager.getDelegate(nativeCanvas);
if (canvasDelegate == null) {
@@ -514,7 +514,7 @@
}
@LayoutlibDelegate
- /*package*/ static void nativeSetDrawFilter(int nativeCanvas, int nativeFilter) {
+ /*package*/ static void nativeSetDrawFilter(long nativeCanvas, long nativeFilter) {
Canvas_Delegate canvasDelegate = sManager.getDelegate(nativeCanvas);
if (canvasDelegate == null) {
return;
@@ -530,7 +530,7 @@
}
@LayoutlibDelegate
- /*package*/ static boolean native_getClipBounds(int nativeCanvas,
+ /*package*/ static boolean native_getClipBounds(long nativeCanvas,
Rect bounds) {
// get the delegate from the native int.
Canvas_Delegate canvasDelegate = sManager.getDelegate(nativeCanvas);
@@ -551,7 +551,7 @@
}
@LayoutlibDelegate
- /*package*/ static void native_getCTM(int canvas, int matrix) {
+ /*package*/ static void native_getCTM(long canvas, long matrix) {
// get the delegate from the native int.
Canvas_Delegate canvasDelegate = sManager.getDelegate(canvas);
if (canvasDelegate == null) {
@@ -568,21 +568,21 @@
}
@LayoutlibDelegate
- /*package*/ static boolean native_quickReject(int nativeCanvas,
+ /*package*/ static boolean native_quickReject(long nativeCanvas,
RectF rect) {
// FIXME properly implement quickReject
return false;
}
@LayoutlibDelegate
- /*package*/ static boolean native_quickReject(int nativeCanvas,
- int path) {
+ /*package*/ static boolean native_quickReject(long nativeCanvas,
+ long path) {
// FIXME properly implement quickReject
return false;
}
@LayoutlibDelegate
- /*package*/ static boolean native_quickReject(int nativeCanvas,
+ /*package*/ static boolean native_quickReject(long nativeCanvas,
float left, float top,
float right, float bottom) {
// FIXME properly implement quickReject
@@ -590,25 +590,25 @@
}
@LayoutlibDelegate
- /*package*/ static void native_drawRGB(int nativeCanvas, int r, int g, int b) {
+ /*package*/ static void native_drawRGB(long nativeCanvas, int r, int g, int b) {
native_drawColor(nativeCanvas, 0xFF000000 | r << 16 | (g&0xFF) << 8 | (b&0xFF),
PorterDuff.Mode.SRC_OVER.nativeInt);
}
@LayoutlibDelegate
- /*package*/ static void native_drawARGB(int nativeCanvas, int a, int r, int g, int b) {
+ /*package*/ static void native_drawARGB(long nativeCanvas, int a, int r, int g, int b) {
native_drawColor(nativeCanvas, a << 24 | (r&0xFF) << 16 | (g&0xFF) << 8 | (b&0xFF),
PorterDuff.Mode.SRC_OVER.nativeInt);
}
@LayoutlibDelegate
- /*package*/ static void native_drawColor(int nativeCanvas, int color) {
+ /*package*/ static void native_drawColor(long nativeCanvas, int color) {
native_drawColor(nativeCanvas, color, PorterDuff.Mode.SRC_OVER.nativeInt);
}
@LayoutlibDelegate
- /*package*/ static void native_drawColor(int nativeCanvas, final int color, final int mode) {
+ /*package*/ static void native_drawColor(long nativeCanvas, final int color, final int mode) {
// get the delegate from the native int.
Canvas_Delegate canvasDelegate = sManager.getDelegate(nativeCanvas);
if (canvasDelegate == null) {
@@ -639,16 +639,16 @@
}
@LayoutlibDelegate
- /*package*/ static void native_drawPaint(int nativeCanvas, int paint) {
+ /*package*/ static void native_drawPaint(long nativeCanvas, long paint) {
// FIXME
Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
"Canvas.drawPaint is not supported.", null, null /*data*/);
}
@LayoutlibDelegate
- /*package*/ static void native_drawLine(int nativeCanvas,
+ /*package*/ static void native_drawLine(long nativeCanvas,
final float startX, final float startY, final float stopX, final float stopY,
- int paint) {
+ long paint) {
draw(nativeCanvas, paint, false /*compositeOnly*/, false /*forceSrcMode*/,
new GcSnapshot.Drawable() {
@@ -660,14 +660,13 @@
}
@LayoutlibDelegate
- /*package*/ static void native_drawRect(int nativeCanvas, RectF rect,
- int paint) {
+ /*package*/ static void native_drawRect(long nativeCanvas, RectF rect, long paint) {
native_drawRect(nativeCanvas, rect.left, rect.top, rect.right, rect.bottom, paint);
}
@LayoutlibDelegate
- /*package*/ static void native_drawRect(int nativeCanvas,
- final float left, final float top, final float right, final float bottom, int paint) {
+ /*package*/ static void native_drawRect(long nativeCanvas,
+ final float left, final float top, final float right, final float bottom, long paint) {
draw(nativeCanvas, paint, false /*compositeOnly*/, false /*forceSrcMode*/,
new GcSnapshot.Drawable() {
@@ -692,7 +691,7 @@
}
@LayoutlibDelegate
- /*package*/ static void native_drawOval(int nativeCanvas, final RectF oval, int paint) {
+ /*package*/ static void native_drawOval(long nativeCanvas, final RectF oval, long paint) {
if (oval.right > oval.left && oval.bottom > oval.top) {
draw(nativeCanvas, paint, false /*compositeOnly*/, false /*forceSrcMode*/,
new GcSnapshot.Drawable() {
@@ -718,17 +717,17 @@
}
@LayoutlibDelegate
- /*package*/ static void native_drawCircle(int nativeCanvas,
- float cx, float cy, float radius, int paint) {
+ /*package*/ static void native_drawCircle(long nativeCanvas,
+ float cx, float cy, float radius, long paint) {
native_drawOval(nativeCanvas,
new RectF(cx - radius, cy - radius, cx + radius, cy + radius),
paint);
}
@LayoutlibDelegate
- /*package*/ static void native_drawArc(int nativeCanvas,
+ /*package*/ static void native_drawArc(long nativeCanvas,
final RectF oval, final float startAngle, final float sweep,
- final boolean useCenter, int paint) {
+ final boolean useCenter, long paint) {
if (oval.right > oval.left && oval.bottom > oval.top) {
draw(nativeCanvas, paint, false /*compositeOnly*/, false /*forceSrcMode*/,
new GcSnapshot.Drawable() {
@@ -757,8 +756,8 @@
}
@LayoutlibDelegate
- /*package*/ static void native_drawRoundRect(int nativeCanvas,
- final RectF rect, final float rx, final float ry, int paint) {
+ /*package*/ static void native_drawRoundRect(long nativeCanvas,
+ final RectF rect, final float rx, final float ry, long paint) {
draw(nativeCanvas, paint, false /*compositeOnly*/, false /*forceSrcMode*/,
new GcSnapshot.Drawable() {
@@ -787,7 +786,7 @@
}
@LayoutlibDelegate
- /*package*/ static void native_drawPath(int nativeCanvas, int path, int paint) {
+ /*package*/ static void native_drawPath(long nativeCanvas, int path, long paint) {
final Path_Delegate pathDelegate = Path_Delegate.getDelegate(path);
if (pathDelegate == null) {
return;
@@ -814,9 +813,9 @@
}
@LayoutlibDelegate
- /*package*/ static void native_drawBitmap(Canvas thisCanvas, int nativeCanvas, int bitmap,
+ /*package*/ static void native_drawBitmap(Canvas thisCanvas, long nativeCanvas, long bitmap,
float left, float top,
- int nativePaintOrZero,
+ long nativePaintOrZero,
int canvasDensity,
int screenDensity,
int bitmapDensity) {
@@ -836,9 +835,9 @@
}
@LayoutlibDelegate
- /*package*/ static void native_drawBitmap(Canvas thisCanvas, int nativeCanvas, int bitmap,
+ /*package*/ static void native_drawBitmap(Canvas thisCanvas, long nativeCanvas, long bitmap,
Rect src, RectF dst,
- int nativePaintOrZero,
+ long nativePaintOrZero,
int screenDensity,
int bitmapDensity) {
// get the delegate from the native int.
@@ -861,9 +860,9 @@
}
@LayoutlibDelegate
- /*package*/ static void native_drawBitmap(int nativeCanvas, int bitmap,
+ /*package*/ static void native_drawBitmap(long nativeCanvas, long bitmap,
Rect src, Rect dst,
- int nativePaintOrZero,
+ long nativePaintOrZero,
int screenDensity,
int bitmapDensity) {
// get the delegate from the native int.
@@ -886,11 +885,11 @@
}
@LayoutlibDelegate
- /*package*/ static void native_drawBitmap(int nativeCanvas, int[] colors,
+ /*package*/ static void native_drawBitmap(long nativeCanvas, int[] colors,
int offset, int stride, final float x,
final float y, int width, int height,
boolean hasAlpha,
- int nativePaintOrZero) {
+ long nativePaintOrZero) {
// create a temp BufferedImage containing the content.
final BufferedImage image = new BufferedImage(width, height,
@@ -912,8 +911,8 @@
}
@LayoutlibDelegate
- /*package*/ static void nativeDrawBitmapMatrix(int nCanvas, int nBitmap,
- int nMatrix, int nPaint) {
+ /*package*/ static void nativeDrawBitmapMatrix(long nCanvas, long nBitmap,
+ long nMatrix, long nPaint) {
// get the delegate from the native int.
Canvas_Delegate canvasDelegate = sManager.getDelegate(nCanvas);
if (canvasDelegate == null) {
@@ -953,30 +952,30 @@
}
@LayoutlibDelegate
- /*package*/ static void nativeDrawBitmapMesh(int nCanvas, int nBitmap,
+ /*package*/ static void nativeDrawBitmapMesh(long nCanvas, long nBitmap,
int meshWidth, int meshHeight, float[] verts, int vertOffset, int[] colors,
- int colorOffset, int nPaint) {
+ int colorOffset, long nPaint) {
// FIXME
Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
"Canvas.drawBitmapMesh is not supported.", null, null /*data*/);
}
@LayoutlibDelegate
- /*package*/ static void nativeDrawVertices(int nCanvas, int mode, int n,
+ /*package*/ static void nativeDrawVertices(long nCanvas, int mode, int n,
float[] verts, int vertOffset,
float[] texs, int texOffset,
int[] colors, int colorOffset,
short[] indices, int indexOffset,
- int indexCount, int nPaint) {
+ int indexCount, long nPaint) {
// FIXME
Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
"Canvas.drawVertices is not supported.", null, null /*data*/);
}
@LayoutlibDelegate
- /*package*/ static void native_drawText(int nativeCanvas,
+ /*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, int paint) {
+ final float startX, final float startY, final int flags, long paint) {
draw(nativeCanvas, paint, false /*compositeOnly*/, false /*forceSrcMode*/,
new GcSnapshot.Drawable() {
@@ -1005,8 +1004,8 @@
}
@LayoutlibDelegate
- /*package*/ static void native_drawText(int nativeCanvas, String text,
- int start, int end, float x, float y, final int flags, int paint) {
+ /*package*/ static void native_drawText(long nativeCanvas, String text,
+ int start, int end, float x, float y, final int flags, long paint) {
int count = end - start;
char[] buffer = TemporaryBuffer.obtain(count);
TextUtils.getChars(text, start, end, buffer, 0);
@@ -1015,9 +1014,9 @@
}
@LayoutlibDelegate
- /*package*/ static void native_drawTextRun(int nativeCanvas, String text,
+ /*package*/ static void native_drawTextRun(long 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, long paint) {
int count = end - start;
char[] buffer = TemporaryBuffer.obtain(count);
TextUtils.getChars(text, start, end, buffer, 0);
@@ -1026,56 +1025,56 @@
}
@LayoutlibDelegate
- /*package*/ static void native_drawTextRun(int nativeCanvas, char[] text,
+ /*package*/ static void native_drawTextRun(long 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, long paint) {
native_drawText(nativeCanvas, text, start, count, x, y, flags, paint);
}
@LayoutlibDelegate
- /*package*/ static void native_drawPosText(int nativeCanvas,
+ /*package*/ static void native_drawPosText(long nativeCanvas,
char[] text, int index,
int count, float[] pos,
- int paint) {
+ long paint) {
// FIXME
Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
"Canvas.drawPosText is not supported.", null, null /*data*/);
}
@LayoutlibDelegate
- /*package*/ static void native_drawPosText(int nativeCanvas,
+ /*package*/ static void native_drawPosText(long nativeCanvas,
String text, float[] pos,
- int paint) {
+ long paint) {
// FIXME
Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
"Canvas.drawPosText is not supported.", null, null /*data*/);
}
@LayoutlibDelegate
- /*package*/ static void native_drawTextOnPath(int nativeCanvas,
+ /*package*/ static void native_drawTextOnPath(long nativeCanvas,
char[] text, int index,
- int count, int path,
+ int count, long path,
float hOffset,
float vOffset, int bidiFlags,
- int paint) {
+ long paint) {
// FIXME
Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
"Canvas.drawTextOnPath is not supported.", null, null /*data*/);
}
@LayoutlibDelegate
- /*package*/ static void native_drawTextOnPath(int nativeCanvas,
- String text, int path,
+ /*package*/ static void native_drawTextOnPath(long nativeCanvas,
+ String text, long path,
float hOffset,
float vOffset,
- int flags, int paint) {
+ int flags, long paint) {
// FIXME
Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
"Canvas.drawTextOnPath is not supported.", null, null /*data*/);
}
@LayoutlibDelegate
- /*package*/ static void finalizer(int nativeCanvas) {
+ /*package*/ static void finalizer(long nativeCanvas) {
// get the delegate from the native int so that it can be disposed.
Canvas_Delegate canvasDelegate = sManager.getDelegate(nativeCanvas);
if (canvasDelegate == null) {
@@ -1095,7 +1094,7 @@
* <p>Note that the drawable may actually be executed several times if there are
* layers involved (see {@link #saveLayer(RectF, int, int)}.
*/
- private static void draw(int nCanvas, int nPaint, boolean compositeOnly, boolean forceSrcMode,
+ private static void draw(long nCanvas, long nPaint, boolean compositeOnly, boolean forceSrcMode,
GcSnapshot.Drawable drawable) {
// get the delegate from the native int.
Canvas_Delegate canvasDelegate = sManager.getDelegate(nCanvas);
@@ -1115,7 +1114,7 @@
* <p>Note that the drawable may actually be executed several times if there are
* layers involved (see {@link #saveLayer(RectF, int, int)}.
*/
- private static void draw(int nCanvas, GcSnapshot.Drawable drawable) {
+ private static void draw(long nCanvas, GcSnapshot.Drawable drawable) {
// get the delegate from the native int.
Canvas_Delegate canvasDelegate = sManager.getDelegate(nCanvas);
if (canvasDelegate == null) {
@@ -1193,9 +1192,9 @@
}
private static void drawBitmap(
- int nativeCanvas,
+ long nativeCanvas,
Bitmap_Delegate bitmap,
- int nativePaintOrZero,
+ long nativePaintOrZero,
final int sleft, final int stop, final int sright, final int sbottom,
final int dleft, final int dtop, final int dright, final int dbottom) {
// get the delegate from the native int.
diff --git a/tools/layoutlib/bridge/src/android/graphics/ColorFilter_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/ColorFilter_Delegate.java
index e5a7ab6..d6b3da1 100644
--- a/tools/layoutlib/bridge/src/android/graphics/ColorFilter_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/ColorFilter_Delegate.java
@@ -46,7 +46,7 @@
// ---- Public Helper methods ----
- public static ColorFilter_Delegate getDelegate(int nativeShader) {
+ public static ColorFilter_Delegate getDelegate(long nativeShader) {
return sManager.getDelegate(nativeShader);
}
@@ -56,7 +56,7 @@
// ---- native methods ----
@LayoutlibDelegate
- /*package*/ static void finalizer(int native_instance, int nativeColorFilter) {
+ /*package*/ static void finalizer(long native_instance, long nativeColorFilter) {
sManager.removeJavaReferenceFor(native_instance);
}
diff --git a/tools/layoutlib/bridge/src/android/graphics/ColorMatrixColorFilter_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/ColorMatrixColorFilter_Delegate.java
index 2de344b..ca8f450 100644
--- a/tools/layoutlib/bridge/src/android/graphics/ColorMatrixColorFilter_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/ColorMatrixColorFilter_Delegate.java
@@ -55,13 +55,13 @@
// ---- native methods ----
@LayoutlibDelegate
- /*package*/ static int nativeColorMatrixFilter(float[] array) {
+ /*package*/ static long nativeColorMatrixFilter(float[] array) {
ColorMatrixColorFilter_Delegate newDelegate = new ColorMatrixColorFilter_Delegate();
return sManager.addNewDelegate(newDelegate);
}
@LayoutlibDelegate
- /*package*/ static int nColorMatrixFilter(int nativeFilter, float[] array) {
+ /*package*/ static long nColorMatrixFilter(long nativeFilter, float[] array) {
// pass
return 0;
}
diff --git a/tools/layoutlib/bridge/src/android/graphics/ComposePathEffect_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/ComposePathEffect_Delegate.java
index 7c04a87..bc3df7d 100644
--- a/tools/layoutlib/bridge/src/android/graphics/ComposePathEffect_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/ComposePathEffect_Delegate.java
@@ -62,7 +62,7 @@
// ---- native methods ----
@LayoutlibDelegate
- /*package*/ static int nativeCreate(int outerpe, int innerpe) {
+ /*package*/ static long nativeCreate(long outerpe, long innerpe) {
ComposePathEffect_Delegate newDelegate = new ComposePathEffect_Delegate();
return sManager.addNewDelegate(newDelegate);
}
diff --git a/tools/layoutlib/bridge/src/android/graphics/ComposeShader_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/ComposeShader_Delegate.java
index f6e1d00..fae8aef 100644
--- a/tools/layoutlib/bridge/src/android/graphics/ComposeShader_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/ComposeShader_Delegate.java
@@ -63,15 +63,15 @@
// ---- native methods ----
@LayoutlibDelegate
- /*package*/ static int nativeCreate1(int native_shaderA, int native_shaderB,
- int native_mode) {
+ /*package*/ static long nativeCreate1(long native_shaderA, long native_shaderB,
+ long native_mode) {
// FIXME not supported yet.
ComposeShader_Delegate newDelegate = new ComposeShader_Delegate();
return sManager.addNewDelegate(newDelegate);
}
@LayoutlibDelegate
- /*package*/ static int nativeCreate2(int native_shaderA, int native_shaderB,
+ /*package*/ static long nativeCreate2(long native_shaderA, long native_shaderB,
int porterDuffMode) {
// FIXME not supported yet.
ComposeShader_Delegate newDelegate = new ComposeShader_Delegate();
@@ -79,15 +79,15 @@
}
@LayoutlibDelegate
- /*package*/ static int nativePostCreate1(int native_shader, int native_skiaShaderA,
- int native_skiaShaderB, int native_mode) {
+ /*package*/ static long nativePostCreate1(long native_shader, long native_skiaShaderA,
+ long native_skiaShaderB, long native_mode) {
// pass, not needed.
return 0;
}
@LayoutlibDelegate
- /*package*/ static int nativePostCreate2(int native_shader, int native_skiaShaderA,
- int native_skiaShaderB, int porterDuffMode) {
+ /*package*/ static long nativePostCreate2(long native_shader, long native_skiaShaderA,
+ long native_skiaShaderB, int porterDuffMode) {
// pass, not needed.
return 0;
}
diff --git a/tools/layoutlib/bridge/src/android/graphics/CornerPathEffect_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/CornerPathEffect_Delegate.java
index b0f8168..73745c3 100644
--- a/tools/layoutlib/bridge/src/android/graphics/CornerPathEffect_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/CornerPathEffect_Delegate.java
@@ -62,7 +62,7 @@
// ---- native methods ----
@LayoutlibDelegate
- /*package*/ static int nativeCreate(float radius) {
+ /*package*/ static long nativeCreate(float radius) {
CornerPathEffect_Delegate newDelegate = new CornerPathEffect_Delegate();
return sManager.addNewDelegate(newDelegate);
}
diff --git a/tools/layoutlib/bridge/src/android/graphics/DashPathEffect_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/DashPathEffect_Delegate.java
index d97c2ec..881afde 100644
--- a/tools/layoutlib/bridge/src/android/graphics/DashPathEffect_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/DashPathEffect_Delegate.java
@@ -73,7 +73,7 @@
// ---- native methods ----
@LayoutlibDelegate
- /*package*/ static int nativeCreate(float intervals[], float phase) {
+ /*package*/ static long nativeCreate(float intervals[], float phase) {
DashPathEffect_Delegate newDelegate = new DashPathEffect_Delegate(intervals, phase);
return sManager.addNewDelegate(newDelegate);
}
diff --git a/tools/layoutlib/bridge/src/android/graphics/DiscretePathEffect_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/DiscretePathEffect_Delegate.java
index ec4a810..46109f3 100644
--- a/tools/layoutlib/bridge/src/android/graphics/DiscretePathEffect_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/DiscretePathEffect_Delegate.java
@@ -62,7 +62,7 @@
// ---- native methods ----
@LayoutlibDelegate
- /*package*/ static int nativeCreate(float length, float deviation) {
+ /*package*/ static long nativeCreate(float length, float deviation) {
DiscretePathEffect_Delegate newDelegate = new DiscretePathEffect_Delegate();
return sManager.addNewDelegate(newDelegate);
}
diff --git a/tools/layoutlib/bridge/src/android/graphics/DrawFilter_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/DrawFilter_Delegate.java
index 870c46b..2e10740 100644
--- a/tools/layoutlib/bridge/src/android/graphics/DrawFilter_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/DrawFilter_Delegate.java
@@ -46,7 +46,7 @@
// ---- Public Helper methods ----
- public static DrawFilter_Delegate getDelegate(int nativeDrawFilter) {
+ public static DrawFilter_Delegate getDelegate(long nativeDrawFilter) {
return sManager.getDelegate(nativeDrawFilter);
}
@@ -56,7 +56,7 @@
// ---- native methods ----
@LayoutlibDelegate
- /*package*/ static void nativeDestructor(int nativeDrawFilter) {
+ /*package*/ static void nativeDestructor(long nativeDrawFilter) {
sManager.removeJavaReferenceFor(nativeDrawFilter);
}
diff --git a/tools/layoutlib/bridge/src/android/graphics/EmbossMaskFilter_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/EmbossMaskFilter_Delegate.java
index ebc1c1d..e5040cc 100644
--- a/tools/layoutlib/bridge/src/android/graphics/EmbossMaskFilter_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/EmbossMaskFilter_Delegate.java
@@ -55,7 +55,7 @@
// ---- native methods ----
@LayoutlibDelegate
- /*package*/ static int nativeConstructor(float[] direction, float ambient,
+ /*package*/ static long nativeConstructor(float[] direction, float ambient,
float specular, float blurRadius) {
EmbossMaskFilter_Delegate newDelegate = new EmbossMaskFilter_Delegate();
return sManager.addNewDelegate(newDelegate);
diff --git a/tools/layoutlib/bridge/src/android/graphics/LayerRasterizer_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/LayerRasterizer_Delegate.java
index 51e0576..10cc572 100644
--- a/tools/layoutlib/bridge/src/android/graphics/LayerRasterizer_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/LayerRasterizer_Delegate.java
@@ -55,13 +55,13 @@
// ---- native methods ----
@LayoutlibDelegate
- /*package*/ static int nativeConstructor() {
+ /*package*/ static long nativeConstructor() {
LayerRasterizer_Delegate newDelegate = new LayerRasterizer_Delegate();
return sManager.addNewDelegate(newDelegate);
}
@LayoutlibDelegate
- /*package*/ static void nativeAddLayer(int native_layer, int native_paint, float dx, float dy) {
+ /*package*/ static void nativeAddLayer(long native_layer, long native_paint, float dx, float dy) {
}
diff --git a/tools/layoutlib/bridge/src/android/graphics/LightingColorFilter_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/LightingColorFilter_Delegate.java
index 0ee883d..defaac3 100644
--- a/tools/layoutlib/bridge/src/android/graphics/LightingColorFilter_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/LightingColorFilter_Delegate.java
@@ -55,13 +55,13 @@
// ---- native methods ----
@LayoutlibDelegate
- /*package*/ static int native_CreateLightingFilter(int mul, int add) {
+ /*package*/ static long native_CreateLightingFilter(int mul, int add) {
LightingColorFilter_Delegate newDelegate = new LightingColorFilter_Delegate();
return sManager.addNewDelegate(newDelegate);
}
@LayoutlibDelegate
- /*package*/ static int nCreateLightingFilter(int nativeFilter, int mul, int add) {
+ /*package*/ static int nCreateLightingFilter(long nativeFilter, int mul, int add) {
// pass
return 0;
}
diff --git a/tools/layoutlib/bridge/src/android/graphics/LinearGradient_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/LinearGradient_Delegate.java
index f117fca..ac77377 100644
--- a/tools/layoutlib/bridge/src/android/graphics/LinearGradient_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/LinearGradient_Delegate.java
@@ -54,7 +54,7 @@
// ---- native methods ----
@LayoutlibDelegate
- /*package*/ static int nativeCreate1(LinearGradient thisGradient,
+ /*package*/ static long nativeCreate1(LinearGradient thisGradient,
float x0, float y0, float x1, float y1,
int colors[], float positions[], int tileMode) {
LinearGradient_Delegate newDelegate = new LinearGradient_Delegate(x0, y0, x1, y1,
@@ -63,7 +63,7 @@
}
@LayoutlibDelegate
- /*package*/ static int nativeCreate2(LinearGradient thisGradient,
+ /*package*/ static long nativeCreate2(LinearGradient thisGradient,
float x0, float y0, float x1, float y1,
int color0, int color1, int tileMode) {
return nativeCreate1(thisGradient,
@@ -72,16 +72,16 @@
}
@LayoutlibDelegate
- /*package*/ static int nativePostCreate1(LinearGradient thisGradient,
- int native_shader, float x0, float y0, float x1, float y1,
+ /*package*/ static long nativePostCreate1(LinearGradient thisGradient,
+ long native_shader, float x0, float y0, float x1, float y1,
int colors[], float positions[], int tileMode) {
// nothing to be done here.
return 0;
}
@LayoutlibDelegate
- /*package*/ static int nativePostCreate2(LinearGradient thisGradient,
- int native_shader, float x0, float y0, float x1, float y1,
+ /*package*/ static long nativePostCreate2(LinearGradient thisGradient,
+ long native_shader, float x0, float y0, float x1, float y1,
int color0, int color1, int tileMode) {
// nothing to be done here.
return 0;
diff --git a/tools/layoutlib/bridge/src/android/graphics/MaskFilter_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/MaskFilter_Delegate.java
index c2f27e4..e726c59 100644
--- a/tools/layoutlib/bridge/src/android/graphics/MaskFilter_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/MaskFilter_Delegate.java
@@ -46,7 +46,7 @@
// ---- Public Helper methods ----
- public static MaskFilter_Delegate getDelegate(int nativeShader) {
+ public static MaskFilter_Delegate getDelegate(long nativeShader) {
return sManager.getDelegate(nativeShader);
}
@@ -56,7 +56,7 @@
// ---- native methods ----
@LayoutlibDelegate
- /*package*/ static void nativeDestructor(int native_filter) {
+ /*package*/ static void nativeDestructor(long native_filter) {
sManager.removeJavaReferenceFor(native_filter);
}
diff --git a/tools/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java
index 5df2a21..1d66586 100644
--- a/tools/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java
@@ -53,7 +53,7 @@
// ---- Public Helper methods ----
- public static Matrix_Delegate getDelegate(int native_instance) {
+ public static Matrix_Delegate getDelegate(long native_instance) {
return sManager.getDelegate(native_instance);
}
@@ -174,7 +174,7 @@
// ---- native methods ----
@LayoutlibDelegate
- /*package*/ static int native_create(int native_src_or_zero) {
+ /*package*/ static long native_create(long native_src_or_zero) {
// create the delegate
Matrix_Delegate newDelegate = new Matrix_Delegate();
@@ -193,7 +193,7 @@
}
@LayoutlibDelegate
- /*package*/ static boolean native_isIdentity(int native_object) {
+ /*package*/ static boolean native_isIdentity(long native_object) {
Matrix_Delegate d = sManager.getDelegate(native_object);
if (d == null) {
return false;
@@ -203,7 +203,7 @@
}
@LayoutlibDelegate
- /*package*/ static boolean native_rectStaysRect(int native_object) {
+ /*package*/ static boolean native_rectStaysRect(long native_object) {
Matrix_Delegate d = sManager.getDelegate(native_object);
if (d == null) {
return true;
@@ -213,7 +213,7 @@
}
@LayoutlibDelegate
- /*package*/ static void native_reset(int native_object) {
+ /*package*/ static void native_reset(long native_object) {
Matrix_Delegate d = sManager.getDelegate(native_object);
if (d == null) {
return;
@@ -223,7 +223,7 @@
}
@LayoutlibDelegate
- /*package*/ static void native_set(int native_object, int other) {
+ /*package*/ static void native_set(long native_object, long other) {
Matrix_Delegate d = sManager.getDelegate(native_object);
if (d == null) {
return;
@@ -238,7 +238,7 @@
}
@LayoutlibDelegate
- /*package*/ static void native_setTranslate(int native_object, float dx, float dy) {
+ /*package*/ static void native_setTranslate(long native_object, float dx, float dy) {
Matrix_Delegate d = sManager.getDelegate(native_object);
if (d == null) {
return;
@@ -248,7 +248,7 @@
}
@LayoutlibDelegate
- /*package*/ static void native_setScale(int native_object, float sx, float sy,
+ /*package*/ static void native_setScale(long native_object, float sx, float sy,
float px, float py) {
Matrix_Delegate d = sManager.getDelegate(native_object);
if (d == null) {
@@ -259,7 +259,7 @@
}
@LayoutlibDelegate
- /*package*/ static void native_setScale(int native_object, float sx, float sy) {
+ /*package*/ static void native_setScale(long native_object, float sx, float sy) {
Matrix_Delegate d = sManager.getDelegate(native_object);
if (d == null) {
return;
@@ -277,7 +277,7 @@
}
@LayoutlibDelegate
- /*package*/ static void native_setRotate(int native_object, float degrees, float px, float py) {
+ /*package*/ static void native_setRotate(long native_object, float degrees, float px, float py) {
Matrix_Delegate d = sManager.getDelegate(native_object);
if (d == null) {
return;
@@ -287,7 +287,7 @@
}
@LayoutlibDelegate
- /*package*/ static void native_setRotate(int native_object, float degrees) {
+ /*package*/ static void native_setRotate(long native_object, float degrees) {
Matrix_Delegate d = sManager.getDelegate(native_object);
if (d == null) {
return;
@@ -297,7 +297,7 @@
}
@LayoutlibDelegate
- /*package*/ static void native_setSinCos(int native_object, float sinValue, float cosValue,
+ /*package*/ static void native_setSinCos(long native_object, float sinValue, float cosValue,
float px, float py) {
Matrix_Delegate d = sManager.getDelegate(native_object);
if (d == null) {
@@ -316,7 +316,7 @@
}
@LayoutlibDelegate
- /*package*/ static void native_setSinCos(int native_object, float sinValue, float cosValue) {
+ /*package*/ static void native_setSinCos(long native_object, float sinValue, float cosValue) {
Matrix_Delegate d = sManager.getDelegate(native_object);
if (d == null) {
return;
@@ -326,7 +326,7 @@
}
@LayoutlibDelegate
- /*package*/ static void native_setSkew(int native_object, float kx, float ky,
+ /*package*/ static void native_setSkew(long native_object, float kx, float ky,
float px, float py) {
Matrix_Delegate d = sManager.getDelegate(native_object);
if (d == null) {
@@ -337,7 +337,7 @@
}
@LayoutlibDelegate
- /*package*/ static void native_setSkew(int native_object, float kx, float ky) {
+ /*package*/ static void native_setSkew(long native_object, float kx, float ky) {
Matrix_Delegate d = sManager.getDelegate(native_object);
if (d == null) {
return;
@@ -355,7 +355,7 @@
}
@LayoutlibDelegate
- /*package*/ static boolean native_setConcat(int native_object, int a, int b) {
+ /*package*/ static boolean native_setConcat(long native_object, long a, long b) {
if (a == native_object) {
return native_preConcat(native_object, b);
} else if (b == native_object) {
@@ -383,7 +383,7 @@
}
@LayoutlibDelegate
- /*package*/ static boolean native_preTranslate(int native_object, float dx, float dy) {
+ /*package*/ static boolean native_preTranslate(long native_object, float dx, float dy) {
Matrix_Delegate d = sManager.getDelegate(native_object);
if (d == null) {
return false;
@@ -394,7 +394,7 @@
}
@LayoutlibDelegate
- /*package*/ static boolean native_preScale(int native_object, float sx, float sy,
+ /*package*/ static boolean native_preScale(long native_object, float sx, float sy,
float px, float py) {
Matrix_Delegate d = sManager.getDelegate(native_object);
if (d == null) {
@@ -406,7 +406,7 @@
}
@LayoutlibDelegate
- /*package*/ static boolean native_preScale(int native_object, float sx, float sy) {
+ /*package*/ static boolean native_preScale(long native_object, float sx, float sy) {
Matrix_Delegate d = sManager.getDelegate(native_object);
if (d == null) {
return false;
@@ -417,7 +417,7 @@
}
@LayoutlibDelegate
- /*package*/ static boolean native_preRotate(int native_object, float degrees,
+ /*package*/ static boolean native_preRotate(long native_object, float degrees,
float px, float py) {
Matrix_Delegate d = sManager.getDelegate(native_object);
if (d == null) {
@@ -429,7 +429,7 @@
}
@LayoutlibDelegate
- /*package*/ static boolean native_preRotate(int native_object, float degrees) {
+ /*package*/ static boolean native_preRotate(long native_object, float degrees) {
Matrix_Delegate d = sManager.getDelegate(native_object);
if (d == null) {
return false;
@@ -444,7 +444,7 @@
}
@LayoutlibDelegate
- /*package*/ static boolean native_preSkew(int native_object, float kx, float ky,
+ /*package*/ static boolean native_preSkew(long native_object, float kx, float ky,
float px, float py) {
Matrix_Delegate d = sManager.getDelegate(native_object);
if (d == null) {
@@ -456,7 +456,7 @@
}
@LayoutlibDelegate
- /*package*/ static boolean native_preSkew(int native_object, float kx, float ky) {
+ /*package*/ static boolean native_preSkew(long native_object, float kx, float ky) {
Matrix_Delegate d = sManager.getDelegate(native_object);
if (d == null) {
return false;
@@ -467,7 +467,7 @@
}
@LayoutlibDelegate
- /*package*/ static boolean native_preConcat(int native_object, int other_matrix) {
+ /*package*/ static boolean native_preConcat(long native_object, long other_matrix) {
Matrix_Delegate d = sManager.getDelegate(native_object);
if (d == null) {
return false;
@@ -483,7 +483,7 @@
}
@LayoutlibDelegate
- /*package*/ static boolean native_postTranslate(int native_object, float dx, float dy) {
+ /*package*/ static boolean native_postTranslate(long native_object, float dx, float dy) {
Matrix_Delegate d = sManager.getDelegate(native_object);
if (d == null) {
return false;
@@ -494,7 +494,7 @@
}
@LayoutlibDelegate
- /*package*/ static boolean native_postScale(int native_object, float sx, float sy,
+ /*package*/ static boolean native_postScale(long native_object, float sx, float sy,
float px, float py) {
Matrix_Delegate d = sManager.getDelegate(native_object);
if (d == null) {
@@ -506,7 +506,7 @@
}
@LayoutlibDelegate
- /*package*/ static boolean native_postScale(int native_object, float sx, float sy) {
+ /*package*/ static boolean native_postScale(long native_object, float sx, float sy) {
Matrix_Delegate d = sManager.getDelegate(native_object);
if (d == null) {
return false;
@@ -517,7 +517,7 @@
}
@LayoutlibDelegate
- /*package*/ static boolean native_postRotate(int native_object, float degrees,
+ /*package*/ static boolean native_postRotate(long native_object, float degrees,
float px, float py) {
Matrix_Delegate d = sManager.getDelegate(native_object);
if (d == null) {
@@ -529,7 +529,7 @@
}
@LayoutlibDelegate
- /*package*/ static boolean native_postRotate(int native_object, float degrees) {
+ /*package*/ static boolean native_postRotate(long native_object, float degrees) {
Matrix_Delegate d = sManager.getDelegate(native_object);
if (d == null) {
return false;
@@ -540,7 +540,7 @@
}
@LayoutlibDelegate
- /*package*/ static boolean native_postSkew(int native_object, float kx, float ky,
+ /*package*/ static boolean native_postSkew(long native_object, float kx, float ky,
float px, float py) {
Matrix_Delegate d = sManager.getDelegate(native_object);
if (d == null) {
@@ -552,7 +552,7 @@
}
@LayoutlibDelegate
- /*package*/ static boolean native_postSkew(int native_object, float kx, float ky) {
+ /*package*/ static boolean native_postSkew(long native_object, float kx, float ky) {
Matrix_Delegate d = sManager.getDelegate(native_object);
if (d == null) {
return false;
@@ -563,7 +563,7 @@
}
@LayoutlibDelegate
- /*package*/ static boolean native_postConcat(int native_object, int other_matrix) {
+ /*package*/ static boolean native_postConcat(long native_object, long other_matrix) {
Matrix_Delegate d = sManager.getDelegate(native_object);
if (d == null) {
return false;
@@ -579,7 +579,7 @@
}
@LayoutlibDelegate
- /*package*/ static boolean native_setRectToRect(int native_object, RectF src,
+ /*package*/ static boolean native_setRectToRect(long native_object, RectF src,
RectF dst, int stf) {
Matrix_Delegate d = sManager.getDelegate(native_object);
if (d == null) {
@@ -644,7 +644,7 @@
}
@LayoutlibDelegate
- /*package*/ static boolean native_setPolyToPoly(int native_object, float[] src, int srcIndex,
+ /*package*/ static boolean native_setPolyToPoly(long native_object, float[] src, int srcIndex,
float[] dst, int dstIndex, int pointCount) {
// FIXME
Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
@@ -654,7 +654,7 @@
}
@LayoutlibDelegate
- /*package*/ static boolean native_invert(int native_object, int inverse) {
+ /*package*/ static boolean native_invert(long native_object, int inverse) {
Matrix_Delegate d = sManager.getDelegate(native_object);
if (d == null) {
return false;
@@ -682,7 +682,7 @@
}
@LayoutlibDelegate
- /*package*/ static void native_mapPoints(int native_object, float[] dst, int dstIndex,
+ /*package*/ static void native_mapPoints(long native_object, float[] dst, int dstIndex,
float[] src, int srcIndex, int ptCount, boolean isPts) {
Matrix_Delegate d = sManager.getDelegate(native_object);
if (d == null) {
@@ -697,7 +697,7 @@
}
@LayoutlibDelegate
- /*package*/ static boolean native_mapRect(int native_object, RectF dst, RectF src) {
+ /*package*/ static boolean native_mapRect(long native_object, RectF dst, RectF src) {
Matrix_Delegate d = sManager.getDelegate(native_object);
if (d == null) {
return false;
@@ -707,7 +707,7 @@
}
@LayoutlibDelegate
- /*package*/ static float native_mapRadius(int native_object, float radius) {
+ /*package*/ static float native_mapRadius(long native_object, float radius) {
Matrix_Delegate d = sManager.getDelegate(native_object);
if (d == null) {
return 0.f;
@@ -723,7 +723,7 @@
}
@LayoutlibDelegate
- /*package*/ static void native_getValues(int native_object, float[] values) {
+ /*package*/ static void native_getValues(long native_object, float[] values) {
Matrix_Delegate d = sManager.getDelegate(native_object);
if (d == null) {
return;
@@ -733,7 +733,7 @@
}
@LayoutlibDelegate
- /*package*/ static void native_setValues(int native_object, float[] values) {
+ /*package*/ static void native_setValues(long native_object, float[] values) {
Matrix_Delegate d = sManager.getDelegate(native_object);
if (d == null) {
return;
@@ -743,7 +743,7 @@
}
@LayoutlibDelegate
- /*package*/ static boolean native_equals(int native_a, int native_b) {
+ /*package*/ static boolean native_equals(long native_a, long native_b) {
Matrix_Delegate a = sManager.getDelegate(native_a);
if (a == null) {
return false;
@@ -764,7 +764,7 @@
}
@LayoutlibDelegate
- /*package*/ static void finalizer(int native_instance) {
+ /*package*/ static void finalizer(long native_instance) {
sManager.removeJavaReferenceFor(native_instance);
}
diff --git a/tools/layoutlib/bridge/src/android/graphics/NinePatch_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/NinePatch_Delegate.java
index fa68796..a5c52e55 100644
--- a/tools/layoutlib/bridge/src/android/graphics/NinePatch_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/NinePatch_Delegate.java
@@ -158,7 +158,7 @@
}
@LayoutlibDelegate
- /*package*/ static int validateNinePatchChunk(int bitmap, byte[] chunk) {
+ /*package*/ static long validateNinePatchChunk(long bitmap, byte[] chunk) {
// the default JNI implementation only checks that the byte[] has the same
// size as the C struct it represent. Since we cannot do the same check (serialization
// will return different size depending on content), we do nothing.
@@ -167,13 +167,13 @@
return sManager.addNewDelegate(newDelegate);
}
- /*package*/ static void nativeFinalize(int chunk) {
+ /*package*/ static void nativeFinalize(long chunk) {
sManager.removeJavaReferenceFor(chunk);
}
@LayoutlibDelegate
- /*package*/ static void nativeDraw(int canvas_instance, RectF loc, int bitmap_instance,
- int chunk, int paint_instance_or_null, int destDensity, int srcDensity) {
+ /*package*/ static void nativeDraw(long canvas_instance, RectF loc, long bitmap_instance,
+ long chunk, long paint_instance_or_null, int destDensity, int srcDensity) {
draw(canvas_instance,
(int) loc.left, (int) loc.top, (int) loc.width(), (int) loc.height(),
bitmap_instance, chunk, paint_instance_or_null,
@@ -181,8 +181,8 @@
}
@LayoutlibDelegate
- /*package*/ static void nativeDraw(int canvas_instance, Rect loc, int bitmap_instance,
- int chunk, int paint_instance_or_null, int destDensity, int srcDensity) {
+ /*package*/ static void nativeDraw(long canvas_instance, Rect loc, long bitmap_instance,
+ long chunk, long paint_instance_or_null, int destDensity, int srcDensity) {
draw(canvas_instance,
loc.left, loc.top, loc.width(), loc.height(),
bitmap_instance, chunk, paint_instance_or_null,
@@ -190,15 +190,15 @@
}
@LayoutlibDelegate
- /*package*/ static int nativeGetTransparentRegion(int bitmap, int chunk, Rect location) {
+ /*package*/ static long nativeGetTransparentRegion(long bitmap, long chunk, Rect location) {
return 0;
}
// ---- Private Helper methods ----
- private static void draw(int canvas_instance,
+ private static void draw(long canvas_instance,
final int left, final int top, final int right, final int bottom,
- int bitmap_instance, int chunk, int paint_instance_or_null,
+ long bitmap_instance, long chunk, long paint_instance_or_null,
final int destDensity, final int srcDensity) {
// get the delegate from the native int.
final Bitmap_Delegate bitmap_delegate = Bitmap_Delegate.getDelegate(bitmap_instance);
diff --git a/tools/layoutlib/bridge/src/android/graphics/PaintFlagsDrawFilter_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/PaintFlagsDrawFilter_Delegate.java
index 71d346a..fa20746 100644
--- a/tools/layoutlib/bridge/src/android/graphics/PaintFlagsDrawFilter_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/PaintFlagsDrawFilter_Delegate.java
@@ -55,7 +55,7 @@
// ---- native methods ----
@LayoutlibDelegate
- /*package*/ static int nativeConstructor(int clearBits, int setBits) {
+ /*package*/ static long nativeConstructor(int clearBits, int setBits) {
PaintFlagsDrawFilter_Delegate newDelegate = new PaintFlagsDrawFilter_Delegate();
return sManager.addNewDelegate(newDelegate);
}
diff --git a/tools/layoutlib/bridge/src/android/graphics/Paint_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Paint_Delegate.java
index 41953ed..ca8e8aa 100644
--- a/tools/layoutlib/bridge/src/android/graphics/Paint_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/Paint_Delegate.java
@@ -96,7 +96,7 @@
// ---- Public Helper methods ----
- public static Paint_Delegate getDelegate(int native_paint) {
+ public static Paint_Delegate getDelegate(long native_paint) {
return sManager.getDelegate(native_paint);
}
@@ -640,13 +640,13 @@
}
@LayoutlibDelegate
- /*package*/ static int native_init() {
+ /*package*/ static long native_init() {
Paint_Delegate newDelegate = new Paint_Delegate();
return sManager.addNewDelegate(newDelegate);
}
@LayoutlibDelegate
- /*package*/ static int native_initWithPaint(int paint) {
+ /*package*/ static long native_initWithPaint(long paint) {
// get the delegate from the native int.
Paint_Delegate delegate = sManager.getDelegate(paint);
if (delegate == null) {
@@ -658,7 +658,7 @@
}
@LayoutlibDelegate
- /*package*/ static void native_reset(int native_object) {
+ /*package*/ static void native_reset(long native_object) {
// get the delegate from the native int.
Paint_Delegate delegate = sManager.getDelegate(native_object);
if (delegate == null) {
@@ -669,7 +669,7 @@
}
@LayoutlibDelegate
- /*package*/ static void native_set(int native_dst, int native_src) {
+ /*package*/ static void native_set(long native_dst, long native_src) {
// get the delegate from the native int.
Paint_Delegate delegate_dst = sManager.getDelegate(native_dst);
if (delegate_dst == null) {
@@ -686,7 +686,7 @@
}
@LayoutlibDelegate
- /*package*/ static int native_getStyle(int native_object) {
+ /*package*/ static long native_getStyle(long native_object) {
// get the delegate from the native int.
Paint_Delegate delegate = sManager.getDelegate(native_object);
if (delegate == null) {
@@ -697,7 +697,7 @@
}
@LayoutlibDelegate
- /*package*/ static void native_setStyle(int native_object, int style) {
+ /*package*/ static void native_setStyle(long native_object, int style) {
// get the delegate from the native int.
Paint_Delegate delegate = sManager.getDelegate(native_object);
if (delegate == null) {
@@ -708,7 +708,7 @@
}
@LayoutlibDelegate
- /*package*/ static int native_getStrokeCap(int native_object) {
+ /*package*/ static long native_getStrokeCap(long native_object) {
// get the delegate from the native int.
Paint_Delegate delegate = sManager.getDelegate(native_object);
if (delegate == null) {
@@ -719,7 +719,7 @@
}
@LayoutlibDelegate
- /*package*/ static void native_setStrokeCap(int native_object, int cap) {
+ /*package*/ static void native_setStrokeCap(long native_object, int cap) {
// get the delegate from the native int.
Paint_Delegate delegate = sManager.getDelegate(native_object);
if (delegate == null) {
@@ -730,7 +730,7 @@
}
@LayoutlibDelegate
- /*package*/ static int native_getStrokeJoin(int native_object) {
+ /*package*/ static long native_getStrokeJoin(long native_object) {
// get the delegate from the native int.
Paint_Delegate delegate = sManager.getDelegate(native_object);
if (delegate == null) {
@@ -741,7 +741,7 @@
}
@LayoutlibDelegate
- /*package*/ static void native_setStrokeJoin(int native_object, int join) {
+ /*package*/ static void native_setStrokeJoin(long native_object, int join) {
// get the delegate from the native int.
Paint_Delegate delegate = sManager.getDelegate(native_object);
if (delegate == null) {
@@ -752,7 +752,7 @@
}
@LayoutlibDelegate
- /*package*/ static boolean native_getFillPath(int native_object, int src, int dst) {
+ /*package*/ static boolean native_getFillPath(long native_object, long src, long dst) {
Paint_Delegate paint = sManager.getDelegate(native_object);
if (paint == null) {
return false;
@@ -778,7 +778,7 @@
}
@LayoutlibDelegate
- /*package*/ static int native_setShader(int native_object, int shader) {
+ /*package*/ static long native_setShader(long native_object, long shader) {
// get the delegate from the native int.
Paint_Delegate delegate = sManager.getDelegate(native_object);
if (delegate == null) {
@@ -791,7 +791,7 @@
}
@LayoutlibDelegate
- /*package*/ static int native_setColorFilter(int native_object, int filter) {
+ /*package*/ static long native_setColorFilter(long native_object, long filter) {
// get the delegate from the native int.
Paint_Delegate delegate = sManager.getDelegate(native_object);
if (delegate == null) {
@@ -810,7 +810,7 @@
}
@LayoutlibDelegate
- /*package*/ static int native_setXfermode(int native_object, int xfermode) {
+ /*package*/ static long native_setXfermode(long native_object, long xfermode) {
// get the delegate from the native int.
Paint_Delegate delegate = sManager.getDelegate(native_object);
if (delegate == null) {
@@ -823,7 +823,7 @@
}
@LayoutlibDelegate
- /*package*/ static int native_setPathEffect(int native_object, int effect) {
+ /*package*/ static long native_setPathEffect(long native_object, long effect) {
// get the delegate from the native int.
Paint_Delegate delegate = sManager.getDelegate(native_object);
if (delegate == null) {
@@ -836,7 +836,7 @@
}
@LayoutlibDelegate
- /*package*/ static int native_setMaskFilter(int native_object, int maskfilter) {
+ /*package*/ static long native_setMaskFilter(long native_object, long maskfilter) {
// get the delegate from the native int.
Paint_Delegate delegate = sManager.getDelegate(native_object);
if (delegate == null) {
@@ -855,7 +855,7 @@
}
@LayoutlibDelegate
- /*package*/ static int native_setTypeface(int native_object, int typeface) {
+ /*package*/ static long native_setTypeface(long native_object, long typeface) {
// get the delegate from the native int.
Paint_Delegate delegate = sManager.getDelegate(native_object);
if (delegate == null) {
@@ -868,7 +868,7 @@
}
@LayoutlibDelegate
- /*package*/ static int native_setRasterizer(int native_object, int rasterizer) {
+ /*package*/ static long native_setRasterizer(long native_object, long rasterizer) {
// get the delegate from the native int.
Paint_Delegate delegate = sManager.getDelegate(native_object);
if (delegate == null) {
@@ -887,7 +887,7 @@
}
@LayoutlibDelegate
- /*package*/ static int native_getTextAlign(int native_object) {
+ /*package*/ static long native_getTextAlign(long native_object) {
// get the delegate from the native int.
Paint_Delegate delegate = sManager.getDelegate(native_object);
if (delegate == null) {
@@ -898,7 +898,7 @@
}
@LayoutlibDelegate
- /*package*/ static void native_setTextAlign(int native_object, int align) {
+ /*package*/ static void native_setTextAlign(long native_object, int align) {
// get the delegate from the native int.
Paint_Delegate delegate = sManager.getDelegate(native_object);
if (delegate == null) {
@@ -909,7 +909,7 @@
}
@LayoutlibDelegate
- /*package*/ static void native_setTextLocale(int native_object, String locale) {
+ /*package*/ static void native_setTextLocale(long native_object, String locale) {
// get the delegate from the native int.
Paint_Delegate delegate = sManager.getDelegate(native_object);
if (delegate == null) {
@@ -920,7 +920,7 @@
}
@LayoutlibDelegate
- /*package*/ static int native_getTextWidths(int native_object, char[] text, int index,
+ /*package*/ static long native_getTextWidths(long native_object, char[] text, int index,
int count, int bidiFlags, float[] widths) {
// get the delegate from the native int.
Paint_Delegate delegate = sManager.getDelegate(native_object);
@@ -962,21 +962,21 @@
}
@LayoutlibDelegate
- /*package*/ static int native_getTextWidths(int native_object, String text, int start,
+ /*package*/ static long native_getTextWidths(long native_object, String text, int start,
int end, int bidiFlags, float[] widths) {
return native_getTextWidths(native_object, text.toCharArray(), start, end - start,
bidiFlags, widths);
}
@LayoutlibDelegate
- /* package */static int native_getTextGlyphs(int native_object, String text, int start,
+ /* package */static long native_getTextGlyphs(long native_object, String text, int start,
int end, int contextStart, int contextEnd, int flags, char[] glyphs) {
// FIXME
return 0;
}
@LayoutlibDelegate
- /*package*/ static float native_getTextRunAdvances(int native_object,
+ /*package*/ static float native_getTextRunAdvances(long native_object,
char[] text, int index, int count, int contextIndex, int contextCount,
int flags, float[] advances, int advancesIndex) {
@@ -996,7 +996,7 @@
}
@LayoutlibDelegate
- /*package*/ static float native_getTextRunAdvances(int native_object,
+ /*package*/ static float native_getTextRunAdvances(long native_object,
String text, int start, int end, int contextStart, int contextEnd,
int flags, float[] advances, int advancesIndex) {
// FIXME: support contextStart and contextEnd
@@ -1009,7 +1009,7 @@
}
@LayoutlibDelegate
- /*package*/ static int native_getTextRunCursor(Paint thisPaint, int native_object, char[] text,
+ /*package*/ static long native_getTextRunCursor(Paint thisPaint, long native_object, char[] text,
int contextStart, int contextLength, int flags, int offset, int cursorOpt) {
// FIXME
Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
@@ -1018,7 +1018,7 @@
}
@LayoutlibDelegate
- /*package*/ static int native_getTextRunCursor(Paint thisPaint, int native_object, String text,
+ /*package*/ static long native_getTextRunCursor(Paint thisPaint, long native_object, String text,
int contextStart, int contextEnd, int flags, int offset, int cursorOpt) {
// FIXME
Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
@@ -1027,30 +1027,30 @@
}
@LayoutlibDelegate
- /*package*/ static void native_getTextPath(int native_object, int bidiFlags,
- char[] text, int index, int count, float x, float y, int path) {
+ /*package*/ static void native_getTextPath(long native_object, int bidiFlags,
+ char[] text, int index, int count, float x, float y, long path) {
// FIXME
Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
"Paint.getTextPath is not supported.", null, null /*data*/);
}
@LayoutlibDelegate
- /*package*/ static void native_getTextPath(int native_object, int bidiFlags,
- String text, int start, int end, float x, float y, int path) {
+ /*package*/ static void native_getTextPath(long native_object, int bidiFlags,
+ String text, int start, int end, float x, float y, long path) {
// FIXME
Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
"Paint.getTextPath is not supported.", null, null /*data*/);
}
@LayoutlibDelegate
- /*package*/ static void nativeGetStringBounds(int nativePaint, String text, int start,
+ /*package*/ static void nativeGetStringBounds(long nativePaint, String text, int start,
int end, int bidiFlags, Rect bounds) {
nativeGetCharArrayBounds(nativePaint, text.toCharArray(), start, end - start, bidiFlags,
bounds);
}
@LayoutlibDelegate
- /*package*/ static void nativeGetCharArrayBounds(int nativePaint, char[] text, int index,
+ /*package*/ static void nativeGetCharArrayBounds(long nativePaint, char[] text, int index,
int count, int bidiFlags, Rect bounds) {
// get the delegate from the native int.
@@ -1064,7 +1064,7 @@
}
@LayoutlibDelegate
- /*package*/ static void finalizer(int nativePaint) {
+ /*package*/ static void finalizer(long nativePaint) {
sManager.removeJavaReferenceFor(nativePaint);
}
diff --git a/tools/layoutlib/bridge/src/android/graphics/PathDashPathEffect_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/PathDashPathEffect_Delegate.java
index c448f0e..fd9ba62e 100644
--- a/tools/layoutlib/bridge/src/android/graphics/PathDashPathEffect_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/PathDashPathEffect_Delegate.java
@@ -62,7 +62,7 @@
// ---- native methods ----
@LayoutlibDelegate
- /*package*/ static int nativeCreate(int native_path, float advance, float phase,
+ /*package*/ static long nativeCreate(long native_path, float advance, float phase,
int native_style) {
PathDashPathEffect_Delegate newDelegate = new PathDashPathEffect_Delegate();
return sManager.addNewDelegate(newDelegate);
diff --git a/tools/layoutlib/bridge/src/android/graphics/PathEffect_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/PathEffect_Delegate.java
index bd2b6de..000481e 100644
--- a/tools/layoutlib/bridge/src/android/graphics/PathEffect_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/PathEffect_Delegate.java
@@ -48,7 +48,7 @@
// ---- Public Helper methods ----
- public static PathEffect_Delegate getDelegate(int nativeShader) {
+ public static PathEffect_Delegate getDelegate(long nativeShader) {
return sManager.getDelegate(nativeShader);
}
@@ -60,7 +60,7 @@
// ---- native methods ----
@LayoutlibDelegate
- /*package*/ static void nativeDestructor(int native_patheffect) {
+ /*package*/ static void nativeDestructor(long native_patheffect) {
sManager.removeJavaReferenceFor(native_patheffect);
}
diff --git a/tools/layoutlib/bridge/src/android/graphics/Path_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Path_Delegate.java
index 64f19d3..f3b56d9 100644
--- a/tools/layoutlib/bridge/src/android/graphics/Path_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/Path_Delegate.java
@@ -63,7 +63,7 @@
// ---- Public Helper methods ----
- public static Path_Delegate getDelegate(int nPath) {
+ public static Path_Delegate getDelegate(long nPath) {
return sManager.getDelegate(nPath);
}
@@ -88,7 +88,7 @@
// ---- native methods ----
@LayoutlibDelegate
- /*package*/ static int init1() {
+ /*package*/ static long init1() {
// create the delegate
Path_Delegate newDelegate = new Path_Delegate();
@@ -96,7 +96,7 @@
}
@LayoutlibDelegate
- /*package*/ static int init2(int nPath) {
+ /*package*/ static long init2(long nPath) {
// create the delegate
Path_Delegate newDelegate = new Path_Delegate();
@@ -110,7 +110,7 @@
}
@LayoutlibDelegate
- /*package*/ static void native_reset(int nPath) {
+ /*package*/ static void native_reset(long nPath) {
Path_Delegate pathDelegate = sManager.getDelegate(nPath);
if (pathDelegate == null) {
return;
@@ -120,14 +120,14 @@
}
@LayoutlibDelegate
- /*package*/ static void native_rewind(int nPath) {
+ /*package*/ static void native_rewind(long nPath) {
// call out to reset since there's nothing to optimize in
// terms of data structs.
native_reset(nPath);
}
@LayoutlibDelegate
- /*package*/ static void native_set(int native_dst, int native_src) {
+ /*package*/ static void native_set(long native_dst, long native_src) {
Path_Delegate pathDstDelegate = sManager.getDelegate(native_dst);
if (pathDstDelegate == null) {
return;
@@ -142,7 +142,7 @@
}
@LayoutlibDelegate
- /*package*/ static int native_getFillType(int nPath) {
+ /*package*/ static long native_getFillType(long nPath) {
Path_Delegate pathDelegate = sManager.getDelegate(nPath);
if (pathDelegate == null) {
return 0;
@@ -152,7 +152,7 @@
}
@LayoutlibDelegate
- /*package*/ static void native_setFillType(int nPath, int ft) {
+ /*package*/ static void native_setFillType(long nPath, int ft) {
Path_Delegate pathDelegate = sManager.getDelegate(nPath);
if (pathDelegate == null) {
return;
@@ -162,7 +162,7 @@
}
@LayoutlibDelegate
- /*package*/ static boolean native_isEmpty(int nPath) {
+ /*package*/ static boolean native_isEmpty(long nPath) {
Path_Delegate pathDelegate = sManager.getDelegate(nPath);
if (pathDelegate == null) {
return true;
@@ -172,7 +172,7 @@
}
@LayoutlibDelegate
- /*package*/ static boolean native_isRect(int nPath, RectF rect) {
+ /*package*/ static boolean native_isRect(long nPath, RectF rect) {
Path_Delegate pathDelegate = sManager.getDelegate(nPath);
if (pathDelegate == null) {
return false;
@@ -192,7 +192,7 @@
}
@LayoutlibDelegate
- /*package*/ static void native_computeBounds(int nPath, RectF bounds) {
+ /*package*/ static void native_computeBounds(long nPath, RectF bounds) {
Path_Delegate pathDelegate = sManager.getDelegate(nPath);
if (pathDelegate == null) {
return;
@@ -202,13 +202,13 @@
}
@LayoutlibDelegate
- /*package*/ static void native_incReserve(int nPath, int extraPtCount) {
+ /*package*/ static void native_incReserve(long nPath, int extraPtCount) {
// since we use a java2D path, there's no way to pre-allocate new points,
// so we do nothing.
}
@LayoutlibDelegate
- /*package*/ static void native_moveTo(int nPath, float x, float y) {
+ /*package*/ static void native_moveTo(long nPath, float x, float y) {
Path_Delegate pathDelegate = sManager.getDelegate(nPath);
if (pathDelegate == null) {
return;
@@ -218,7 +218,7 @@
}
@LayoutlibDelegate
- /*package*/ static void native_rMoveTo(int nPath, float dx, float dy) {
+ /*package*/ static void native_rMoveTo(long nPath, float dx, float dy) {
Path_Delegate pathDelegate = sManager.getDelegate(nPath);
if (pathDelegate == null) {
return;
@@ -228,7 +228,7 @@
}
@LayoutlibDelegate
- /*package*/ static void native_lineTo(int nPath, float x, float y) {
+ /*package*/ static void native_lineTo(long nPath, float x, float y) {
Path_Delegate pathDelegate = sManager.getDelegate(nPath);
if (pathDelegate == null) {
return;
@@ -238,7 +238,7 @@
}
@LayoutlibDelegate
- /*package*/ static void native_rLineTo(int nPath, float dx, float dy) {
+ /*package*/ static void native_rLineTo(long nPath, float dx, float dy) {
Path_Delegate pathDelegate = sManager.getDelegate(nPath);
if (pathDelegate == null) {
return;
@@ -248,7 +248,7 @@
}
@LayoutlibDelegate
- /*package*/ static void native_quadTo(int nPath, float x1, float y1, float x2, float y2) {
+ /*package*/ static void native_quadTo(long nPath, float x1, float y1, float x2, float y2) {
Path_Delegate pathDelegate = sManager.getDelegate(nPath);
if (pathDelegate == null) {
return;
@@ -258,7 +258,7 @@
}
@LayoutlibDelegate
- /*package*/ static void native_rQuadTo(int nPath, float dx1, float dy1, float dx2, float dy2) {
+ /*package*/ static void native_rQuadTo(long nPath, float dx1, float dy1, float dx2, float dy2) {
Path_Delegate pathDelegate = sManager.getDelegate(nPath);
if (pathDelegate == null) {
return;
@@ -268,7 +268,7 @@
}
@LayoutlibDelegate
- /*package*/ static void native_cubicTo(int nPath, float x1, float y1,
+ /*package*/ static void native_cubicTo(long nPath, float x1, float y1,
float x2, float y2, float x3, float y3) {
Path_Delegate pathDelegate = sManager.getDelegate(nPath);
if (pathDelegate == null) {
@@ -279,7 +279,7 @@
}
@LayoutlibDelegate
- /*package*/ static void native_rCubicTo(int nPath, float x1, float y1,
+ /*package*/ static void native_rCubicTo(long nPath, float x1, float y1,
float x2, float y2, float x3, float y3) {
Path_Delegate pathDelegate = sManager.getDelegate(nPath);
if (pathDelegate == null) {
@@ -290,7 +290,7 @@
}
@LayoutlibDelegate
- /*package*/ static void native_arcTo(int nPath, RectF oval,
+ /*package*/ static void native_arcTo(long nPath, RectF oval,
float startAngle, float sweepAngle, boolean forceMoveTo) {
Path_Delegate pathDelegate = sManager.getDelegate(nPath);
if (pathDelegate == null) {
@@ -301,7 +301,7 @@
}
@LayoutlibDelegate
- /*package*/ static void native_close(int nPath) {
+ /*package*/ static void native_close(long nPath) {
Path_Delegate pathDelegate = sManager.getDelegate(nPath);
if (pathDelegate == null) {
return;
@@ -311,7 +311,7 @@
}
@LayoutlibDelegate
- /*package*/ static void native_addRect(int nPath, RectF rect, int dir) {
+ /*package*/ static void native_addRect(long nPath, RectF rect, int dir) {
Path_Delegate pathDelegate = sManager.getDelegate(nPath);
if (pathDelegate == null) {
return;
@@ -321,7 +321,7 @@
}
@LayoutlibDelegate
- /*package*/ static void native_addRect(int nPath,
+ /*package*/ static void native_addRect(long nPath,
float left, float top, float right, float bottom, int dir) {
Path_Delegate pathDelegate = sManager.getDelegate(nPath);
if (pathDelegate == null) {
@@ -332,7 +332,7 @@
}
@LayoutlibDelegate
- /*package*/ static void native_addOval(int nPath, RectF oval, int dir) {
+ /*package*/ static void native_addOval(long nPath, RectF oval, int dir) {
Path_Delegate pathDelegate = sManager.getDelegate(nPath);
if (pathDelegate == null) {
return;
@@ -343,7 +343,7 @@
}
@LayoutlibDelegate
- /*package*/ static void native_addCircle(int nPath, float x, float y, float radius, int dir) {
+ /*package*/ static void native_addCircle(long nPath, float x, float y, float radius, int dir) {
Path_Delegate pathDelegate = sManager.getDelegate(nPath);
if (pathDelegate == null) {
return;
@@ -355,7 +355,7 @@
}
@LayoutlibDelegate
- /*package*/ static void native_addArc(int nPath, RectF oval,
+ /*package*/ static void native_addArc(long nPath, RectF oval,
float startAngle, float sweepAngle) {
Path_Delegate pathDelegate = sManager.getDelegate(nPath);
if (pathDelegate == null) {
@@ -370,7 +370,7 @@
@LayoutlibDelegate
/*package*/ static void native_addRoundRect(
- int nPath, RectF rect, float rx, float ry, int dir) {
+ long nPath, RectF rect, float rx, float ry, int dir) {
Path_Delegate pathDelegate = sManager.getDelegate(nPath);
if (pathDelegate == null) {
@@ -382,7 +382,7 @@
}
@LayoutlibDelegate
- /*package*/ static void native_addRoundRect(int nPath, RectF rect, float[] radii, int dir) {
+ /*package*/ static void native_addRoundRect(long nPath, RectF rect, float[] radii, int dir) {
// Java2D doesn't support different rounded corners in each corner, so just use the
// first value.
native_addRoundRect(nPath, rect, radii[0], radii[1], dir);
@@ -401,17 +401,17 @@
}
@LayoutlibDelegate
- /*package*/ static void native_addPath(int nPath, int src, float dx, float dy) {
+ /*package*/ static void native_addPath(long nPath, int src, float dx, float dy) {
addPath(nPath, src, AffineTransform.getTranslateInstance(dx, dy));
}
@LayoutlibDelegate
- /*package*/ static void native_addPath(int nPath, int src) {
+ /*package*/ static void native_addPath(long nPath, int src) {
addPath(nPath, src, null /*transform*/);
}
@LayoutlibDelegate
- /*package*/ static void native_addPath(int nPath, int src, int matrix) {
+ /*package*/ static void native_addPath(long nPath, int src, long matrix) {
Matrix_Delegate matrixDelegate = Matrix_Delegate.getDelegate(matrix);
if (matrixDelegate == null) {
return;
@@ -421,7 +421,7 @@
}
@LayoutlibDelegate
- /*package*/ static void native_offset(int nPath, float dx, float dy, int dst_path) {
+ /*package*/ static void native_offset(long nPath, float dx, float dy, long dst_path) {
Path_Delegate pathDelegate = sManager.getDelegate(nPath);
if (pathDelegate == null) {
return;
@@ -434,12 +434,12 @@
}
@LayoutlibDelegate
- /*package*/ static void native_offset(int nPath, float dx, float dy) {
+ /*package*/ static void native_offset(long nPath, float dx, float dy) {
native_offset(nPath, dx, dy, 0);
}
@LayoutlibDelegate
- /*package*/ static void native_setLastPoint(int nPath, float dx, float dy) {
+ /*package*/ static void native_setLastPoint(long nPath, float dx, float dy) {
Path_Delegate pathDelegate = sManager.getDelegate(nPath);
if (pathDelegate == null) {
return;
@@ -450,8 +450,8 @@
}
@LayoutlibDelegate
- /*package*/ static void native_transform(int nPath, int matrix,
- int dst_path) {
+ /*package*/ static void native_transform(long nPath, long matrix,
+ long dst_path) {
Path_Delegate pathDelegate = sManager.getDelegate(nPath);
if (pathDelegate == null) {
return;
@@ -469,12 +469,12 @@
}
@LayoutlibDelegate
- /*package*/ static void native_transform(int nPath, int matrix) {
+ /*package*/ static void native_transform(long nPath, long matrix) {
native_transform(nPath, matrix, 0);
}
@LayoutlibDelegate
- /*package*/ static void finalizer(int nPath) {
+ /*package*/ static void finalizer(long nPath) {
sManager.removeJavaReferenceFor(nPath);
}
@@ -522,7 +522,7 @@
return null;
}
- private static void addPath(int destPath, int srcPath, AffineTransform transform) {
+ private static void addPath(long destPath, long srcPath, AffineTransform transform) {
Path_Delegate destPathDelegate = sManager.getDelegate(destPath);
if (destPathDelegate == null) {
return;
diff --git a/tools/layoutlib/bridge/src/android/graphics/PixelXorXfermode_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/PixelXorXfermode_Delegate.java
index 4ab044b..f27144f 100644
--- a/tools/layoutlib/bridge/src/android/graphics/PixelXorXfermode_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/PixelXorXfermode_Delegate.java
@@ -61,7 +61,7 @@
// ---- native methods ----
@LayoutlibDelegate
- /*package*/ static int nativeCreate(int opColor) {
+ /*package*/ static long nativeCreate(int opColor) {
PixelXorXfermode_Delegate newDelegate = new PixelXorXfermode_Delegate();
return sManager.addNewDelegate(newDelegate);
}
diff --git a/tools/layoutlib/bridge/src/android/graphics/PorterDuffColorFilter_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/PorterDuffColorFilter_Delegate.java
index c45dbaa..6049919 100644
--- a/tools/layoutlib/bridge/src/android/graphics/PorterDuffColorFilter_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/PorterDuffColorFilter_Delegate.java
@@ -55,13 +55,13 @@
// ---- native methods ----
@LayoutlibDelegate
- /*package*/ static int native_CreatePorterDuffFilter(int srcColor, int porterDuffMode) {
+ /*package*/ static long native_CreatePorterDuffFilter(int srcColor, int porterDuffMode) {
PorterDuffColorFilter_Delegate newDelegate = new PorterDuffColorFilter_Delegate();
return sManager.addNewDelegate(newDelegate);
}
@LayoutlibDelegate
- /*package*/ static int nCreatePorterDuffFilter(int nativeFilter, int srcColor,
+ /*package*/ static long nCreatePorterDuffFilter(long nativeFilter, int srcColor,
int porterDuffMode) {
// pass
return 0;
diff --git a/tools/layoutlib/bridge/src/android/graphics/PorterDuffXfermode_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/PorterDuffXfermode_Delegate.java
index 4301c1a..a89fd57 100644
--- a/tools/layoutlib/bridge/src/android/graphics/PorterDuffXfermode_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/PorterDuffXfermode_Delegate.java
@@ -127,7 +127,7 @@
// ---- native methods ----
@LayoutlibDelegate
- /*package*/ static int nativeCreateXfermode(int mode) {
+ /*package*/ static long nativeCreateXfermode(int mode) {
PorterDuffXfermode_Delegate newDelegate = new PorterDuffXfermode_Delegate(mode);
return sManager.addNewDelegate(newDelegate);
}
diff --git a/tools/layoutlib/bridge/src/android/graphics/RadialGradient_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/RadialGradient_Delegate.java
index 3fe45fa..4f16dcf 100644
--- a/tools/layoutlib/bridge/src/android/graphics/RadialGradient_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/RadialGradient_Delegate.java
@@ -54,7 +54,7 @@
// ---- native methods ----
@LayoutlibDelegate
- /*package*/ static int nativeCreate1(float x, float y, float radius,
+ /*package*/ static long nativeCreate1(float x, float y, float radius,
int colors[], float positions[], int tileMode) {
RadialGradient_Delegate newDelegate = new RadialGradient_Delegate(x, y, radius,
colors, positions, Shader_Delegate.getTileMode(tileMode));
@@ -62,21 +62,21 @@
}
@LayoutlibDelegate
- /*package*/ static int nativeCreate2(float x, float y, float radius,
+ /*package*/ static long nativeCreate2(float x, float y, float radius,
int color0, int color1, int tileMode) {
return nativeCreate1(x, y, radius, new int[] { color0, color1 }, null /*positions*/,
tileMode);
}
@LayoutlibDelegate
- /*package*/ static int nativePostCreate1(int native_shader, float x, float y, float radius,
+ /*package*/ static long nativePostCreate1(long native_shader, float x, float y, float radius,
int colors[], float positions[], int tileMode) {
// nothing to be done here.
return 0;
}
@LayoutlibDelegate
- /*package*/ static int nativePostCreate2(int native_shader, float x, float y, float radius,
+ /*package*/ static long nativePostCreate2(long native_shader, float x, float y, float radius,
int color0, int color1, int tileMode) {
// nothing to be done here.
return 0;
diff --git a/tools/layoutlib/bridge/src/android/graphics/Rasterizer_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Rasterizer_Delegate.java
index 2812b6b..a742840 100644
--- a/tools/layoutlib/bridge/src/android/graphics/Rasterizer_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/Rasterizer_Delegate.java
@@ -46,7 +46,7 @@
// ---- Public Helper methods ----
- public static Rasterizer_Delegate getDelegate(int nativeShader) {
+ public static Rasterizer_Delegate getDelegate(long nativeShader) {
return sManager.getDelegate(nativeShader);
}
@@ -56,7 +56,7 @@
// ---- native methods ----
@LayoutlibDelegate
- /*package*/ static void finalizer(int native_instance) {
+ /*package*/ static void finalizer(long native_instance) {
sManager.removeJavaReferenceFor(native_instance);
}
diff --git a/tools/layoutlib/bridge/src/android/graphics/Region_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Region_Delegate.java
index cb31b8f..ea23649 100644
--- a/tools/layoutlib/bridge/src/android/graphics/Region_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/Region_Delegate.java
@@ -57,7 +57,7 @@
// ---- Public Helper methods ----
- public static Region_Delegate getDelegate(int nativeShader) {
+ public static Region_Delegate getDelegate(long nativeShader) {
return sManager.getDelegate(nativeShader);
}
@@ -264,18 +264,18 @@
}
@LayoutlibDelegate
- /*package*/ static int nativeConstructor() {
+ /*package*/ static long nativeConstructor() {
Region_Delegate newDelegate = new Region_Delegate();
return sManager.addNewDelegate(newDelegate);
}
@LayoutlibDelegate
- /*package*/ static void nativeDestructor(int native_region) {
+ /*package*/ static void nativeDestructor(long native_region) {
sManager.removeJavaReferenceFor(native_region);
}
@LayoutlibDelegate
- /*package*/ static boolean nativeSetRegion(int native_dst, int native_src) {
+ /*package*/ static boolean nativeSetRegion(long native_dst, long native_src) {
Region_Delegate dstRegion = sManager.getDelegate(native_dst);
if (dstRegion == null) {
return true;
@@ -293,7 +293,7 @@
}
@LayoutlibDelegate
- /*package*/ static boolean nativeSetRect(int native_dst,
+ /*package*/ static boolean nativeSetRect(long native_dst,
int left, int top, int right, int bottom) {
Region_Delegate dstRegion = sManager.getDelegate(native_dst);
if (dstRegion == null) {
@@ -305,7 +305,7 @@
}
@LayoutlibDelegate
- /*package*/ static boolean nativeSetPath(int native_dst, int native_path, int native_clip) {
+ /*package*/ static boolean nativeSetPath(long native_dst, long native_path, long native_clip) {
Region_Delegate dstRegion = sManager.getDelegate(native_dst);
if (dstRegion == null) {
return true;
@@ -327,7 +327,7 @@
}
@LayoutlibDelegate
- /*package*/ static boolean nativeGetBounds(int native_region, Rect rect) {
+ /*package*/ static boolean nativeGetBounds(long native_region, Rect rect) {
Region_Delegate region = sManager.getDelegate(native_region);
if (region == null) {
return true;
@@ -347,7 +347,7 @@
}
@LayoutlibDelegate
- /*package*/ static boolean nativeGetBoundaryPath(int native_region, int native_path) {
+ /*package*/ static boolean nativeGetBoundaryPath(long native_region, long native_path) {
Region_Delegate region = sManager.getDelegate(native_region);
if (region == null) {
return false;
@@ -368,7 +368,7 @@
}
@LayoutlibDelegate
- /*package*/ static boolean nativeOp(int native_dst,
+ /*package*/ static boolean nativeOp(long native_dst,
int left, int top, int right, int bottom, int op) {
Region_Delegate region = sManager.getDelegate(native_dst);
if (region == null) {
@@ -387,7 +387,7 @@
}
@LayoutlibDelegate
- /*package*/ static boolean nativeOp(int native_dst, Rect rect, int native_region, int op) {
+ /*package*/ static boolean nativeOp(long native_dst, Rect rect, long native_region, int op) {
Region_Delegate region = sManager.getDelegate(native_dst);
if (region == null) {
return false;
@@ -405,8 +405,8 @@
}
@LayoutlibDelegate
- /*package*/ static boolean nativeOp(int native_dst,
- int native_region1, int native_region2, int op) {
+ /*package*/ static boolean nativeOp(long native_dst,
+ long native_region1, long native_region2, int op) {
Region_Delegate dstRegion = sManager.getDelegate(native_dst);
if (dstRegion == null) {
return true;
@@ -434,7 +434,7 @@
}
@LayoutlibDelegate
- /*package*/ static int nativeCreateFromParcel(Parcel p) {
+ /*package*/ static long nativeCreateFromParcel(Parcel p) {
// This is only called by Region.CREATOR (Parcelable.Creator<Region>), which is only
// used during aidl call so really this should not be called.
Bridge.getLog().error(LayoutLog.TAG_UNSUPPORTED,
@@ -444,7 +444,7 @@
}
@LayoutlibDelegate
- /*package*/ static boolean nativeWriteToParcel(int native_region,
+ /*package*/ static boolean nativeWriteToParcel(long native_region,
Parcel p) {
// This is only called when sending a region through aidl, so really this should not
// be called.
@@ -455,7 +455,7 @@
}
@LayoutlibDelegate
- /*package*/ static boolean nativeEquals(int native_r1, int native_r2) {
+ /*package*/ static boolean nativeEquals(long native_r1, long native_r2) {
Region_Delegate region1 = sManager.getDelegate(native_r1);
if (region1 == null) {
return false;
@@ -470,7 +470,7 @@
}
@LayoutlibDelegate
- /*package*/ static String nativeToString(int native_region) {
+ /*package*/ static String nativeToString(long native_region) {
Region_Delegate region = sManager.getDelegate(native_region);
if (region == null) {
return "not found";
diff --git a/tools/layoutlib/bridge/src/android/graphics/Shader_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Shader_Delegate.java
index 368c0384..70a0a43 100644
--- a/tools/layoutlib/bridge/src/android/graphics/Shader_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/Shader_Delegate.java
@@ -49,7 +49,7 @@
// ---- Public Helper methods ----
- public static Shader_Delegate getDelegate(int nativeShader) {
+ public static Shader_Delegate getDelegate(long nativeShader) {
return sManager.getDelegate(nativeShader);
}
@@ -76,13 +76,13 @@
// ---- native methods ----
@LayoutlibDelegate
- /*package*/ static void nativeDestructor(int native_shader, int native_skiaShader) {
+ /*package*/ static void nativeDestructor(long native_shader, long native_skiaShader) {
sManager.removeJavaReferenceFor(native_shader);
}
@LayoutlibDelegate
- /*package*/ static void nativeSetLocalMatrix(int native_shader, int native_skiaShader,
- int matrix_instance) {
+ /*package*/ static void nativeSetLocalMatrix(long native_shader, long native_skiaShader,
+ long matrix_instance) {
// get the delegate from the native int.
Shader_Delegate shaderDelegate = sManager.getDelegate(native_shader);
if (shaderDelegate == null) {
diff --git a/tools/layoutlib/bridge/src/android/graphics/SumPathEffect_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/SumPathEffect_Delegate.java
index 410df0c..6d2e9b4 100644
--- a/tools/layoutlib/bridge/src/android/graphics/SumPathEffect_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/SumPathEffect_Delegate.java
@@ -62,7 +62,7 @@
// ---- native methods ----
@LayoutlibDelegate
- /*package*/ static int nativeCreate(int first, int second) {
+ /*package*/ static long nativeCreate(long first, long second) {
SumPathEffect_Delegate newDelegate = new SumPathEffect_Delegate();
return sManager.addNewDelegate(newDelegate);
}
diff --git a/tools/layoutlib/bridge/src/android/graphics/SweepGradient_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/SweepGradient_Delegate.java
index 13ae12e..f2b3e8d 100644
--- a/tools/layoutlib/bridge/src/android/graphics/SweepGradient_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/SweepGradient_Delegate.java
@@ -52,25 +52,25 @@
// ---- native methods ----
@LayoutlibDelegate
- /*package*/ static int nativeCreate1(float x, float y, int colors[], float positions[]) {
+ /*package*/ static long nativeCreate1(float x, float y, int colors[], float positions[]) {
SweepGradient_Delegate newDelegate = new SweepGradient_Delegate(x, y, colors, positions);
return sManager.addNewDelegate(newDelegate);
}
@LayoutlibDelegate
- /*package*/ static int nativeCreate2(float x, float y, int color0, int color1) {
+ /*package*/ static long nativeCreate2(float x, float y, int color0, int color1) {
return nativeCreate1(x, y, new int[] { color0, color1 }, null /*positions*/);
}
@LayoutlibDelegate
- /*package*/ static int nativePostCreate1(int native_shader, float cx, float cy,
+ /*package*/ static long nativePostCreate1(long native_shader, float cx, float cy,
int[] colors, float[] positions) {
// nothing to be done here.
return 0;
}
@LayoutlibDelegate
- /*package*/ static int nativePostCreate2(int native_shader, float cx, float cy,
+ /*package*/ static long nativePostCreate2(long native_shader, float cx, float cy,
int color0, int color1) {
// nothing to be done here.
return 0;
diff --git a/tools/layoutlib/bridge/src/android/graphics/Typeface_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Typeface_Delegate.java
index 8701cc8..a25fb59 100644
--- a/tools/layoutlib/bridge/src/android/graphics/Typeface_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/Typeface_Delegate.java
@@ -75,7 +75,7 @@
sPostInitDelegate.clear();
}
- public static Typeface_Delegate getDelegate(int nativeTypeface) {
+ public static Typeface_Delegate getDelegate(long nativeTypeface) {
return sManager.getDelegate(nativeTypeface);
}
@@ -83,7 +83,7 @@
return getFonts(typeface.native_instance);
}
- public static List<Font> getFonts(int native_int) {
+ public static List<Font> getFonts(long native_int) {
Typeface_Delegate delegate = sManager.getDelegate(native_int);
if (delegate == null) {
return null;
@@ -99,7 +99,7 @@
// ---- native methods ----
@LayoutlibDelegate
- /*package*/ static synchronized int nativeCreate(String familyName, int style) {
+ /*package*/ static synchronized long nativeCreate(String familyName, int style) {
if (familyName == null) {
familyName = DEFAULT_FAMILY;
}
@@ -118,7 +118,7 @@
}
@LayoutlibDelegate
- /*package*/ static synchronized int nativeCreateFromTypeface(int native_instance, int style) {
+ /*package*/ static synchronized long nativeCreateFromTypeface(long native_instance, int style) {
Typeface_Delegate delegate = sManager.getDelegate(native_instance);
if (delegate == null) {
return 0;
@@ -138,14 +138,14 @@
}
@LayoutlibDelegate
- /*package*/ static synchronized int nativeCreateFromAsset(AssetManager mgr, String path) {
+ /*package*/ static synchronized long nativeCreateFromAsset(AssetManager mgr, String path) {
Bridge.getLog().fidelityWarning(LayoutLog.TAG_UNSUPPORTED,
"Typeface.createFromAsset() is not supported.", null /*throwable*/, null /*data*/);
return 0;
}
@LayoutlibDelegate
- /*package*/ static synchronized int nativeCreateFromFile(String path) {
+ /*package*/ static synchronized long nativeCreateFromFile(String path) {
if (path.startsWith(SYSTEM_FONTS) ) {
String relativePath = path.substring(SYSTEM_FONTS.length());
File f = new File(sFontLoader.getOsFontsLocation(), relativePath);
@@ -174,12 +174,12 @@
}
@LayoutlibDelegate
- /*package*/ static void nativeUnref(int native_instance) {
+ /*package*/ static void nativeUnref(long native_instance) {
sManager.removeJavaReferenceFor(native_instance);
}
@LayoutlibDelegate
- /*package*/ static int nativeGetStyle(int native_instance) {
+ /*package*/ static int nativeGetStyle(long native_instance) {
Typeface_Delegate delegate = sManager.getDelegate(native_instance);
if (delegate == null) {
return 0;
diff --git a/tools/layoutlib/bridge/src/android/graphics/Xfermode_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Xfermode_Delegate.java
index 962d69c..94a6d76 100644
--- a/tools/layoutlib/bridge/src/android/graphics/Xfermode_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/Xfermode_Delegate.java
@@ -48,7 +48,7 @@
// ---- Public Helper methods ----
- public static Xfermode_Delegate getDelegate(int native_instance) {
+ public static Xfermode_Delegate getDelegate(long native_instance) {
return sManager.getDelegate(native_instance);
}
@@ -60,7 +60,7 @@
// ---- native methods ----
@LayoutlibDelegate
- /*package*/ static void finalizer(int native_instance) {
+ /*package*/ static void finalizer(long native_instance) {
sManager.removeJavaReferenceFor(native_instance);
}
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/DelegateManager.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/DelegateManager.java
index ae1217d..261cc98 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/DelegateManager.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/DelegateManager.java
@@ -94,7 +94,7 @@
* @param native_object the native int.
* @return the delegate or null if not found.
*/
- public T getDelegate(int native_object) {
+ public T getDelegate(long native_object) {
if (native_object > 0) {
T delegate = mDelegates.get(native_object);
@@ -116,8 +116,8 @@
* @param newDelegate the delegate to add
* @return a unique native int to identify the delegate
*/
- public int addNewDelegate(T newDelegate) {
- int native_object = ++mDelegateCounter;
+ public long addNewDelegate(T newDelegate) {
+ long native_object = ++mDelegateCounter;
mDelegates.put(native_object, newDelegate);
assert !mJavaReferences.contains(newDelegate);
mJavaReferences.add(newDelegate);
@@ -133,7 +133,7 @@
* Removes the main reference on the given delegate.
* @param native_object the native integer representing the delegate.
*/
- public void removeJavaReferenceFor(int native_object) {
+ public void removeJavaReferenceFor(long native_object) {
T delegate = getDelegate(native_object);
if (Debug.DEBUG) {
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/util/SparseWeakArray.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/util/SparseWeakArray.java
index 4d0c9ce..53e1640 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/util/SparseWeakArray.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/util/SparseWeakArray.java
@@ -30,13 +30,14 @@
*
* The code is taken from {@link SparseArray} directly and adapted to use weak references.
*
- * Because our usage means that we never actually call {@link #remove(int)} or {@link #delete(int)},
- * we must manually check if there are reclaimed references to trigger an internal compact step
- * (which is normally only triggered when an item is manually removed).
+ * Because our usage means that we never actually call {@link #remove(long)} or
+ * {@link #delete(long)}, we must manually check if there are reclaimed references to
+ * trigger an internal compact step (which is normally only triggered when an item is manually
+ * removed).
*
- * SparseArrays map integers to Objects. Unlike a normal array of Objects,
+ * SparseArrays map integral values to Objects. Unlike a normal array of Objects,
* there can be gaps in the indices. It is intended to be more efficient
- * than using a HashMap to map Integers to Objects.
+ * than using a HashMap to map Integers (or Longs) to Objects.
*/
@SuppressWarnings("unchecked")
public class SparseWeakArray<E> {
@@ -58,9 +59,9 @@
* number of mappings.
*/
public SparseWeakArray(int initialCapacity) {
- initialCapacity = ArrayUtils.idealIntArraySize(initialCapacity);
+ initialCapacity = ArrayUtils.idealLongArraySize(initialCapacity);
- mKeys = new int[initialCapacity];
+ mKeys = new long[initialCapacity];
mValues = new WeakReference[initialCapacity];
mSize = 0;
}
@@ -69,7 +70,7 @@
* Gets the Object mapped from the specified key, or <code>null</code>
* if no such mapping has been made.
*/
- public E get(int key) {
+ public E get(long key) {
return get(key, null);
}
@@ -77,7 +78,7 @@
* Gets the Object mapped from the specified key, or the specified Object
* if no such mapping has been made.
*/
- public E get(int key, E valueIfKeyNotFound) {
+ public E get(long key, E valueIfKeyNotFound) {
int i = binarySearch(mKeys, 0, mSize, key);
if (i < 0 || mValues[i] == DELETED || mValues[i].get() == null) {
@@ -90,7 +91,7 @@
/**
* Removes the mapping from the specified key, if there was any.
*/
- public void delete(int key) {
+ public void delete(long key) {
int i = binarySearch(mKeys, 0, mSize, key);
if (i >= 0) {
@@ -102,9 +103,9 @@
}
/**
- * Alias for {@link #delete(int)}.
+ * Alias for {@link #delete(long)}.
*/
- public void remove(int key) {
+ public void remove(long key) {
delete(key);
}
@@ -121,7 +122,7 @@
private void gc() {
int n = mSize;
int o = 0;
- int[] keys = mKeys;
+ long[] keys = mKeys;
WeakReference<?>[] values = mValues;
for (int i = 0; i < n; i++) {
@@ -142,9 +143,9 @@
mGarbage = false;
mSize = o;
- int newSize = ArrayUtils.idealIntArraySize(mSize);
+ int newSize = ArrayUtils.idealLongArraySize(mSize);
if (newSize < mKeys.length) {
- int[] nkeys = new int[newSize];
+ long[] nkeys = new long[newSize];
WeakReference<?>[] nvalues = new WeakReference[newSize];
System.arraycopy(mKeys, 0, nkeys, 0, newSize);
@@ -160,7 +161,7 @@
* replacing the previous mapping from the specified key if there
* was one.
*/
- public void put(int key, E value) {
+ public void put(long key, E value) {
int i = binarySearch(mKeys, 0, mSize, key);
if (i >= 0) {
@@ -182,9 +183,9 @@
}
if (mSize >= mKeys.length) {
- int n = ArrayUtils.idealIntArraySize(mSize + 1);
+ int n = ArrayUtils.idealLongArraySize(mSize + 1);
- int[] nkeys = new int[n];
+ long[] nkeys = new long[n];
WeakReference<?>[] nvalues = new WeakReference[n];
// Log.e("SparseArray", "grow " + mKeys.length + " to " + n);
@@ -224,7 +225,7 @@
* the key from the <code>index</code>th key-value mapping that this
* SparseArray stores.
*/
- public int keyAt(int index) {
+ public long keyAt(int index) {
if (mGarbage) {
gc();
}
@@ -263,7 +264,7 @@
* specified key, or a negative number if the specified
* key is not mapped.
*/
- public int indexOfKey(int key) {
+ public int indexOfKey(long key) {
if (mGarbage) {
gc();
}
@@ -310,7 +311,7 @@
* Puts a key/value pair into the array, optimizing for the case where
* the key is greater than all existing keys in the array.
*/
- public void append(int key, E value) {
+ public void append(long key, E value) {
if (mSize != 0 && key <= mKeys[mSize - 1]) {
put(key, value);
return;
@@ -322,9 +323,9 @@
int pos = mSize;
if (pos >= mKeys.length) {
- int n = ArrayUtils.idealIntArraySize(pos + 1);
+ int n = ArrayUtils.idealLongArraySize(pos + 1);
- int[] nkeys = new int[n];
+ long[] nkeys = new long[n];
WeakReference<?>[] nvalues = new WeakReference[n];
// Log.e("SparseArray", "grow " + mKeys.length + " to " + n);
@@ -350,7 +351,7 @@
return false;
}
- private static int binarySearch(int[] a, int start, int len, int key) {
+ private static int binarySearch(long[] a, int start, int len, long key) {
int high = start + len, low = start - 1, guess;
while (high - low > 1) {
@@ -370,7 +371,7 @@
return ~high;
}
- private int[] mKeys;
+ private long[] mKeys;
private WeakReference<?>[] mValues;
private int mSize;
}