* commit '7ae1726d0b962878cce4c1fe6c814a315f253293': AArch64: Make graphics classes 64-bit compatible
This commit is contained in:
@@ -49,7 +49,7 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
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 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
/**
|
||||
* 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 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
nSetName(mRenderer, name);
|
||||
}
|
||||
|
||||
private static native void nSetName(int renderer, String name);
|
||||
private static native void nSetName(long renderer, String name);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Hardware layers
|
||||
@@ -177,26 +177,26 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
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
|
||||
@@ -233,7 +233,7 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
/**
|
||||
* Returns the native OpenGLRenderer object.
|
||||
*/
|
||||
int getRenderer() {
|
||||
long getRenderer() {
|
||||
return mRenderer;
|
||||
}
|
||||
|
||||
@@ -249,7 +249,7 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
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) {
|
||||
@@ -261,8 +261,8 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
@@ -270,7 +270,7 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
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
|
||||
@@ -290,45 +290,45 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
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
|
||||
@@ -402,18 +402,18 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
// 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
|
||||
void outputDisplayList(DisplayList displayList) {
|
||||
nOutputDisplayList(mRenderer, ((GLES20DisplayList) displayList).getNativeDisplayList());
|
||||
}
|
||||
|
||||
private static native void nOutputDisplayList(int renderer, int displayList);
|
||||
private static native void nOutputDisplayList(long renderer, long displayList);
|
||||
|
||||
@Override
|
||||
public int drawDisplayList(DisplayList displayList, Rect dirty, int flags) {
|
||||
@@ -421,7 +421,7 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
dirty, flags);
|
||||
}
|
||||
|
||||
private static native int nDrawDisplayList(int renderer, int displayList,
|
||||
private static native int nDrawDisplayList(long renderer, long displayList,
|
||||
Rect dirty, int flags);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@@ -435,7 +435,7 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
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);
|
||||
@@ -445,8 +445,8 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
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
|
||||
@@ -487,14 +487,14 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
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
|
||||
@@ -507,7 +507,7 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
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
|
||||
@@ -542,21 +542,21 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
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
|
||||
@@ -581,35 +581,35 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
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
|
||||
@@ -617,14 +617,14 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
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
|
||||
@@ -640,7 +640,7 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
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) {
|
||||
@@ -651,7 +651,7 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
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);
|
||||
@@ -659,7 +659,7 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
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,
|
||||
@@ -668,7 +668,7 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
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);
|
||||
@@ -678,8 +678,8 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
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) {
|
||||
@@ -690,7 +690,7 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
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,
|
||||
@@ -701,7 +701,7 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
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
|
||||
@@ -709,21 +709,21 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
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
|
||||
@@ -740,8 +740,8 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
}
|
||||
}
|
||||
|
||||
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() {
|
||||
@@ -764,9 +764,9 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
@@ -780,7 +780,7 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
// 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 {
|
||||
@@ -795,7 +795,7 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
// 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 {
|
||||
@@ -803,8 +803,8 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
@@ -812,15 +812,15 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
// 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) {
|
||||
@@ -828,7 +828,7 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
// 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 {
|
||||
@@ -836,8 +836,8 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
@@ -845,7 +845,7 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
// 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) {
|
||||
@@ -872,7 +872,7 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
// 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) {
|
||||
@@ -893,9 +893,9 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
}
|
||||
}
|
||||
|
||||
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,
|
||||
@@ -923,7 +923,7 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
// 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 {
|
||||
@@ -931,8 +931,8 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
}
|
||||
}
|
||||
|
||||
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,
|
||||
@@ -962,7 +962,7 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
|
||||
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 {
|
||||
@@ -970,9 +970,9 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
@@ -984,8 +984,8 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
@@ -997,7 +997,7 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
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) {
|
||||
@@ -1024,8 +1024,8 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
@@ -1042,8 +1042,8 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
@@ -1068,8 +1068,8 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
@@ -1080,7 +1080,7 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
@@ -1147,8 +1147,8 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
@@ -1165,8 +1165,8 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
@@ -1183,8 +1183,8 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
@@ -1197,8 +1197,8 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
@@ -1226,8 +1226,8 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
@@ -1243,8 +1243,8 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
@@ -1283,8 +1283,8 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
@@ -1313,8 +1313,8 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
@@ -1329,8 +1329,8 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
}
|
||||
}
|
||||
|
||||
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,
|
||||
@@ -1351,8 +1351,8 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
}
|
||||
}
|
||||
|
||||
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,
|
||||
@@ -1385,8 +1385,8 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
}
|
||||
}
|
||||
|
||||
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,
|
||||
@@ -1466,10 +1466,10 @@ class GLES20Canvas extends HardwareCanvas {
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ class GLES20DisplayList extends DisplayList {
|
||||
return mValid && mFinalizer != null;
|
||||
}
|
||||
|
||||
int getNativeDisplayList() {
|
||||
long getNativeDisplayList() {
|
||||
if (!mValid || mFinalizer == null) {
|
||||
throw new IllegalStateException("The display list is not valid.");
|
||||
}
|
||||
@@ -124,9 +124,9 @@ class GLES20DisplayList extends DisplayList {
|
||||
return nGetDisplayListSize(mFinalizer.mNativeDisplayList);
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Native View Properties
|
||||
@@ -440,62 +440,62 @@ class GLES20DisplayList extends DisplayList {
|
||||
}
|
||||
}
|
||||
|
||||
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 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 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 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 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 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 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 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 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);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Finalization
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private static class DisplayListFinalizer {
|
||||
final int mNativeDisplayList;
|
||||
final long mNativeDisplayList;
|
||||
|
||||
public DisplayListFinalizer(int nativeDisplayList) {
|
||||
public DisplayListFinalizer(long nativeDisplayList) {
|
||||
mNativeDisplayList = nativeDisplayList;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ import android.graphics.Paint;
|
||||
* 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 @@ abstract class GLES20Layer extends HardwareLayer {
|
||||
*
|
||||
* @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 @@ abstract class GLES20Layer extends HardwareLayer {
|
||||
}
|
||||
|
||||
static class Finalizer {
|
||||
private int mLayerId;
|
||||
private long mLayerId;
|
||||
|
||||
public Finalizer(int layerId) {
|
||||
public Finalizer(long layerId) {
|
||||
mLayerId = layerId;
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ class GLES20RecordingCanvas extends GLES20Canvas {
|
||||
mDisplayList.clearReferences();
|
||||
}
|
||||
|
||||
int end(int nativeDisplayList) {
|
||||
long end(long nativeDisplayList) {
|
||||
return getDisplayList(nativeDisplayList);
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ public class GraphicBuffer implements Parcelable {
|
||||
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 @@ public class GraphicBuffer implements Parcelable {
|
||||
* @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 @@ public class GraphicBuffer implements Parcelable {
|
||||
/**
|
||||
* 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 @@ public class GraphicBuffer implements Parcelable {
|
||||
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 @@ public class GraphicBuffer implements Parcelable {
|
||||
}
|
||||
};
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ public abstract class HardwareCanvas extends Canvas {
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
@@ -170,12 +170,12 @@ public abstract class HardwareCanvas extends Canvas {
|
||||
* @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.
|
||||
@@ -183,12 +183,12 @@ public abstract class HardwareCanvas extends Canvas {
|
||||
* @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.
|
||||
|
||||
@@ -568,7 +568,7 @@ public abstract class HardwareRenderer {
|
||||
* @see HardwareCanvas#callDrawGLFunction(int)
|
||||
* @see #attachFunctor(android.view.View.AttachInfo, int)
|
||||
*/
|
||||
abstract void detachFunctor(int functor);
|
||||
abstract void detachFunctor(long functor);
|
||||
|
||||
/**
|
||||
* Schedules the specified functor in the functors execution queue.
|
||||
@@ -581,7 +581,7 @@ public abstract class HardwareRenderer {
|
||||
*
|
||||
* @return true if the functor was attached successfully
|
||||
*/
|
||||
abstract boolean attachFunctor(View.AttachInfo attachInfo, int functor);
|
||||
abstract boolean attachFunctor(View.AttachInfo attachInfo, long functor);
|
||||
|
||||
/**
|
||||
* Initializes the hardware renderer for the specified surface and setup the
|
||||
@@ -1712,14 +1712,14 @@ public abstract class HardwareRenderer {
|
||||
}
|
||||
|
||||
@Override
|
||||
void detachFunctor(int functor) {
|
||||
void detachFunctor(long functor) {
|
||||
if (mCanvas != null) {
|
||||
mCanvas.detachFunctor(functor);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean attachFunctor(View.AttachInfo attachInfo, int functor) {
|
||||
boolean attachFunctor(View.AttachInfo attachInfo, long functor) {
|
||||
if (mCanvas != null) {
|
||||
mCanvas.attachFunctor(functor);
|
||||
mFunctorsRunnable.attachInfo = attachInfo;
|
||||
|
||||
@@ -32,19 +32,19 @@ import dalvik.system.CloseGuard;
|
||||
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>() {
|
||||
@@ -71,8 +71,8 @@ public class Surface implements Parcelable {
|
||||
// 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();
|
||||
|
||||
@@ -130,7 +130,7 @@ public class Surface implements Parcelable {
|
||||
}
|
||||
|
||||
/* called from android_view_Surface_createFromIGraphicBufferProducer() */
|
||||
private Surface(int nativeObject) {
|
||||
private Surface(long nativeObject) {
|
||||
synchronized (mLock) {
|
||||
setNativeObjectLocked(nativeObject);
|
||||
}
|
||||
@@ -261,8 +261,8 @@ public class Surface implements Parcelable {
|
||||
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");
|
||||
@@ -307,12 +307,12 @@ public class Surface implements Parcelable {
|
||||
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) {
|
||||
@@ -334,7 +334,7 @@ public class Surface implements Parcelable {
|
||||
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);
|
||||
@@ -391,7 +391,7 @@ public class Surface implements Parcelable {
|
||||
}
|
||||
}
|
||||
|
||||
private void setNativeObjectLocked(int ptr) {
|
||||
private void setNativeObjectLocked(long ptr) {
|
||||
if (mNativeObject != ptr) {
|
||||
if (mNativeObject == 0 && ptr != 0) {
|
||||
mCloseGuard.open("release");
|
||||
|
||||
@@ -33,11 +33,11 @@ import android.view.Surface.OutOfResourcesException;
|
||||
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);
|
||||
@@ -48,21 +48,21 @@ public class SurfaceControl {
|
||||
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(
|
||||
@@ -77,7 +77,7 @@ public class SurfaceControl {
|
||||
|
||||
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
|
||||
|
||||
private static final boolean HEADLESS = "1".equals(
|
||||
SystemProperties.get("ro.config.headless", "0"));
|
||||
|
||||
@@ -127,7 +127,7 @@ public class TextureView extends View {
|
||||
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.
|
||||
@@ -816,6 +816,6 @@ public class TextureView extends View {
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -289,8 +289,9 @@ static int getPremulBitmapCreateFlags(bool isMutable) {
|
||||
}
|
||||
|
||||
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 @@ static jobject Bitmap_creator(JNIEnv* env, jobject, jintArray jColors,
|
||||
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 @@ static jobject Bitmap_copy(JNIEnv* env, jobject, const SkBitmap* src,
|
||||
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 @@ static void Bitmap_destructor(JNIEnv* env, jobject, SkBitmap* bitmap) {
|
||||
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 @@ enum JavaEncodeFormat {
|
||||
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 @@ static bool Bitmap_compress(JNIEnv* env, jobject clazz, SkBitmap* bitmap,
|
||||
fm = SkImageEncoder::kWEBP_Type;
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
return JNI_FALSE;
|
||||
}
|
||||
|
||||
bool success = false;
|
||||
@@ -404,12 +413,12 @@ static bool Bitmap_compress(JNIEnv* env, jobject clazz, SkBitmap* bitmap,
|
||||
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,40 +428,48 @@ static bool Bitmap_compress(JNIEnv* env, jobject clazz, SkBitmap* bitmap,
|
||||
}
|
||||
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_setHasAlpha(JNIEnv* env, jobject, SkBitmap* bitmap,
|
||||
static void Bitmap_setHasAlpha(JNIEnv* env, jobject, jlong bitmapHandle,
|
||||
jboolean hasAlpha) {
|
||||
SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle);
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -526,12 +543,13 @@ static jobject Bitmap_createFromParcel(JNIEnv* env, jobject, jobject parcel) {
|
||||
}
|
||||
|
||||
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);
|
||||
@@ -562,7 +580,7 @@ static jboolean Bitmap_writeToParcel(JNIEnv* env, jobject,
|
||||
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();
|
||||
@@ -575,12 +593,14 @@ static jboolean Bitmap_writeToParcel(JNIEnv* env, jobject,
|
||||
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);
|
||||
@@ -606,8 +626,9 @@ static jobject Bitmap_extractAlpha(JNIEnv* env, jobject clazz,
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
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);
|
||||
@@ -621,12 +642,13 @@ static int Bitmap_getPixel(JNIEnv* env, jobject, const SkBitmap* bitmap,
|
||||
|
||||
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);
|
||||
@@ -651,8 +673,10 @@ static void Bitmap_getPixels(JNIEnv* env, jobject, const SkBitmap* bitmap,
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
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;
|
||||
@@ -667,15 +691,17 @@ static void Bitmap_setPixel(JNIEnv* env, jobject, const SkBitmap* bitmap,
|
||||
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();
|
||||
|
||||
@@ -688,7 +714,8 @@ static void Bitmap_copyPixelsToBuffer(JNIEnv* env, jobject,
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
@@ -700,12 +727,14 @@ static void Bitmap_copyPixelsFromBuffer(JNIEnv* env, jobject,
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
@@ -713,24 +742,24 @@ static bool Bitmap_sameAs(JNIEnv* env, jobject, const SkBitmap* bm0,
|
||||
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -741,13 +770,14 @@ static bool Bitmap_sameAs(JNIEnv* env, jobject, const SkBitmap* bm0,
|
||||
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();
|
||||
}
|
||||
@@ -759,38 +789,38 @@ static void Bitmap_prepareToDraw(JNIEnv* env, jobject, SkBitmap* bitmap) {
|
||||
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 },
|
||||
{ "nativeSetHasAlpha", "(IZ)V", (void*)Bitmap_setHasAlpha },
|
||||
{ "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 },
|
||||
{ "nativeSetHasAlpha", "(JZ)V", (void*)Bitmap_setHasAlpha },
|
||||
{ "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"
|
||||
|
||||
@@ -272,7 +272,7 @@ static jobject doDecode(JNIEnv* env, SkStreamRewindable* stream, jobject padding
|
||||
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;
|
||||
@@ -525,7 +525,7 @@ static jobject nativeDecodeFileDescriptor(JNIEnv* env, jobject clazz, jobject fi
|
||||
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;
|
||||
@@ -548,7 +548,7 @@ static jobject nativeDecodeAsset(JNIEnv* env, jobject clazz, jint native_asset,
|
||||
}
|
||||
|
||||
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
|
||||
@@ -585,7 +585,7 @@ static JNINativeMethod gMethods[] = {
|
||||
},
|
||||
|
||||
{ "nativeDecodeAsset",
|
||||
"(ILandroid/graphics/Rect;Landroid/graphics/BitmapFactory$Options;)Landroid/graphics/Bitmap;",
|
||||
"(JLandroid/graphics/Rect;Landroid/graphics/BitmapFactory$Options;)Landroid/graphics/Bitmap;",
|
||||
(void*)nativeDecodeAsset
|
||||
},
|
||||
|
||||
@@ -638,7 +638,7 @@ int register_android_graphics_BitmapFactory(JNIEnv* env) {
|
||||
|
||||
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",
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -32,7 +32,9 @@ using namespace uirenderer;
|
||||
|
||||
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);
|
||||
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 @@ public:
|
||||
#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 @@ public:
|
||||
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 @@ public:
|
||||
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[] = {
|
||||
{"finalizer", "(II)V", (void*) SkColorFilterGlue::finalizer}
|
||||
{"finalizer", "(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) \
|
||||
|
||||
@@ -33,18 +33,20 @@ namespace android {
|
||||
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 @@ public:
|
||||
};
|
||||
|
||||
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) \
|
||||
|
||||
@@ -293,7 +293,8 @@ SkBitmap* GraphicsJNI::getNativeBitmap(JNIEnv* env, jobject bitmap) {
|
||||
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 @@ SkCanvas* GraphicsJNI::getNativeCanvas(JNIEnv* env, jobject canvas) {
|
||||
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 @@ SkPaint* GraphicsJNI::getNativePaint(JNIEnv* env, jobject paint) {
|
||||
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 @@ SkPicture* GraphicsJNI::getNativePicture(JNIEnv* env, jobject picture)
|
||||
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 @@ SkRegion* GraphicsJNI::getNativeRegion(JNIEnv* env, jobject region)
|
||||
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;
|
||||
}
|
||||
@@ -361,7 +366,7 @@ jobject GraphicsJNI::createBitmap(JNIEnv* env, SkBitmap* bitmap, jbyteArray buff
|
||||
bool isPremultiplied = bitmapCreateFlags & kBitmapCreateFlag_Premultiplied;
|
||||
|
||||
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.
|
||||
@@ -401,7 +406,7 @@ jobject GraphicsJNI::createRegion(JNIEnv* env, SkRegion* region)
|
||||
{
|
||||
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;
|
||||
}
|
||||
@@ -646,8 +651,8 @@ int register_android_graphics_Graphics(JNIEnv* env)
|
||||
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");
|
||||
@@ -658,18 +663,18 @@ int register_android_graphics_Graphics(JNIEnv* env)
|
||||
"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(
|
||||
|
||||
@@ -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 @@ public:
|
||||
#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)
|
||||
|
||||
@@ -13,18 +13,19 @@ static void ThrowIAE_IfNull(JNIEnv* env, void* ptr) {
|
||||
|
||||
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 @@ public:
|
||||
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>
|
||||
|
||||
@@ -31,210 +31,237 @@ namespace android {
|
||||
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 @@ public:
|
||||
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 @@ public:
|
||||
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,25 @@ public:
|
||||
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 +371,9 @@ public:
|
||||
}
|
||||
#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 +391,55 @@ public:
|
||||
#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 +449,13 @@ int register_android_graphics_Matrix(JNIEnv* env) {
|
||||
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));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -46,22 +46,22 @@ class SkNinePatchGlue {
|
||||
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 @@ public:
|
||||
// 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 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
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 @@ public:
|
||||
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 @@ public:
|
||||
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 @@ public:
|
||||
SkRegion* region = NULL;
|
||||
NinePatch_Draw(NULL, bounds, *bitmap, *chunk, NULL, ®ion);
|
||||
|
||||
return (jint) region;
|
||||
return reinterpret_cast<jlong>(region);
|
||||
}
|
||||
|
||||
};
|
||||
@@ -167,11 +178,11 @@ public:
|
||||
|
||||
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 }
|
||||
};
|
||||
|
||||
|
||||
@@ -70,33 +70,40 @@ public:
|
||||
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 @@ public:
|
||||
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,59 +218,85 @@ public:
|
||||
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) {
|
||||
return obj->setTypeface(typeface);
|
||||
static jlong setTypeface(JNIEnv* env, jobject clazz, jlong objHandle, jlong typefaceHandle) {
|
||||
SkPaint* obj = reinterpret_cast<SkPaint*>(objHandle);
|
||||
SkTypeface* typeface = reinterpret_cast<SkTypeface*>(typefaceHandle);
|
||||
return reinterpret_cast<jlong>(obj->setTypeface(typeface));
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -300,7 +340,8 @@ public:
|
||||
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());
|
||||
@@ -390,7 +431,7 @@ public:
|
||||
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);
|
||||
@@ -415,7 +456,7 @@ public:
|
||||
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);
|
||||
@@ -488,8 +529,9 @@ public:
|
||||
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),
|
||||
@@ -497,8 +539,9 @@ public:
|
||||
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);
|
||||
@@ -535,9 +578,10 @@ public:
|
||||
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);
|
||||
@@ -577,9 +621,10 @@ public:
|
||||
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);
|
||||
@@ -587,9 +632,10 @@ public:
|
||||
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,
|
||||
@@ -642,8 +688,9 @@ public:
|
||||
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);
|
||||
@@ -651,8 +698,9 @@ public:
|
||||
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);
|
||||
@@ -665,22 +713,26 @@ public:
|
||||
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);
|
||||
@@ -716,8 +768,8 @@ public:
|
||||
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);
|
||||
|
||||
@@ -744,8 +796,8 @@ public:
|
||||
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);
|
||||
|
||||
@@ -776,15 +828,17 @@ public:
|
||||
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),
|
||||
@@ -794,11 +848,11 @@ public:
|
||||
};
|
||||
|
||||
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},
|
||||
@@ -811,8 +865,8 @@ static JNINativeMethod methods[] = {
|
||||
{"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},
|
||||
@@ -821,21 +875,21 @@ static JNINativeMethod methods[] = {
|
||||
{"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},
|
||||
@@ -851,24 +905,24 @@ static JNINativeMethod methods[] = {
|
||||
{"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}
|
||||
};
|
||||
|
||||
@@ -34,7 +34,8 @@ namespace android {
|
||||
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);
|
||||
@@ -44,79 +45,96 @@ public:
|
||||
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);
|
||||
@@ -124,7 +142,8 @@ public:
|
||||
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);
|
||||
@@ -132,7 +151,8 @@ public:
|
||||
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);
|
||||
@@ -142,7 +162,8 @@ public:
|
||||
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);
|
||||
@@ -152,7 +173,8 @@ public:
|
||||
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);
|
||||
@@ -160,17 +182,22 @@ public:
|
||||
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);
|
||||
@@ -178,39 +205,48 @@ public:
|
||||
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();
|
||||
@@ -222,90 +258,110 @@ public:
|
||||
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);
|
||||
}
|
||||
};
|
||||
|
||||
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}
|
||||
{"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}
|
||||
};
|
||||
|
||||
int register_android_graphics_Path(JNIEnv* env) {
|
||||
|
||||
@@ -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 @@ public:
|
||||
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 @@ public:
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
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>
|
||||
|
||||
@@ -28,71 +28,80 @@ namespace android {
|
||||
|
||||
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 @@ public:
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -31,15 +31,15 @@ namespace android {
|
||||
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) {
|
||||
|
||||
@@ -31,14 +31,15 @@ namespace android {
|
||||
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) {
|
||||
|
||||
@@ -29,95 +29,131 @@ namespace android {
|
||||
|
||||
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 @@ static void Region_scale(JNIEnv* env, jobject region, jfloat scale, jobject dst)
|
||||
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 jstring Region_toString(JNIEnv* env, jobject clazz, SkRegion* region) {
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
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 @@ static SkRegion* Region_createFromParcel(JNIEnv* env, jobject clazz, jobject par
|
||||
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 @@ static jboolean Region_writeToParcel(JNIEnv* env, jobject clazz, const SkRegion*
|
||||
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 @@ struct RgnIterPair {
|
||||
}
|
||||
};
|
||||
|
||||
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 @@ static jboolean RegionIter_next(JNIEnv* env, jobject, RgnIterPair* pair, jobject
|
||||
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 @@ static JNINativeMethod gRegionMethods[] = {
|
||||
{ "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 @@ int register_android_graphics_Region(JNIEnv* env)
|
||||
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",
|
||||
|
||||
@@ -24,7 +24,7 @@ static void ThrowIAE_IfNull(JNIEnv* env, void* ptr) {
|
||||
}
|
||||
}
|
||||
|
||||
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 void Color_RGBToHSV(JNIEnv* env, jobject, int red, int green, int blue, j
|
||||
}
|
||||
}
|
||||
|
||||
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 @@ static int Color_HSVToColor(JNIEnv* env, jobject, int alpha, jfloatArray hsvArra
|
||||
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 @@ static void Shader_destructor(JNIEnv* env, jobject o, SkShader* shader, SkiaShad
|
||||
#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 void Shader_setLocalMatrix(JNIEnv* env, jobject o, SkShader* shader, Skia
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
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 SkiaShader* BitmapShader_postConstructor(JNIEnv* env, jobject o, SkShader
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
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 @@ static SkShader* LinearGradient_create1(JNIEnv* env, jobject o,
|
||||
|
||||
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 @@ static SkiaShader* LinearGradient_postCreate1(JNIEnv* env, jobject o, SkShader*
|
||||
(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 @@ static SkiaShader* LinearGradient_postCreate2(JNIEnv* env, jobject o, SkShader*
|
||||
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 @@ static SkShader* LinearGradient_create2(JNIEnv* env, jobject o,
|
||||
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 @@ static SkShader* RadialGradient_create1(JNIEnv* env, jobject, float x, float y,
|
||||
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 @@ static SkShader* RadialGradient_create2(JNIEnv* env, jobject, float x, float y,
|
||||
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 @@ static SkiaShader* RadialGradient_postCreate1(JNIEnv* env, jobject o, SkShader*
|
||||
(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 @@ static SkiaShader* RadialGradient_postCreate2(JNIEnv* env, jobject o, SkShader*
|
||||
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 SkiaShader* RadialGradient_postCreate2(JNIEnv* env, jobject o, SkShader*
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
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 @@ static SkShader* SweepGradient_create1(JNIEnv* env, jobject, float x, float y,
|
||||
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 @@ static SkShader* SweepGradient_create2(JNIEnv* env, jobject, float x, float y,
|
||||
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 @@ static SkiaShader* SweepGradient_postCreate1(JNIEnv* env, jobject o, SkShader* s
|
||||
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 @@ static SkiaShader* SweepGradient_postCreate2(JNIEnv* env, jobject o, SkShader* s
|
||||
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 SkiaShader* SweepGradient_postCreate2(JNIEnv* env, jobject o, SkShader* s
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
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 gColorMethods[] = {
|
||||
};
|
||||
|
||||
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>
|
||||
|
||||
@@ -27,8 +27,9 @@ private:
|
||||
const char* fCStr;
|
||||
};
|
||||
|
||||
static SkTypeface* 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);
|
||||
SkTypeface* face = NULL;
|
||||
|
||||
if (NULL != name) {
|
||||
@@ -47,10 +48,11 @@ static SkTypeface* Typeface_create(JNIEnv* env, jobject, jstring name,
|
||||
if (NULL == face) {
|
||||
face = SkTypeface::CreateFromName(NULL, style);
|
||||
}
|
||||
return face;
|
||||
return reinterpret_cast<jlong>(face);
|
||||
}
|
||||
|
||||
static SkTypeface* Typeface_createFromTypeface(JNIEnv* env, jobject, SkTypeface* family, int style) {
|
||||
static jlong Typeface_createFromTypeface(JNIEnv* env, jobject, jlong familyHandle, jint style) {
|
||||
SkTypeface* family = reinterpret_cast<SkTypeface*>(familyHandle);
|
||||
SkTypeface* face = SkTypeface::CreateFromTypeface(family, (SkTypeface::Style)style);
|
||||
// Try to find the closest matching font, using the standard heuristic
|
||||
if (NULL == face) {
|
||||
@@ -62,15 +64,17 @@ static SkTypeface* Typeface_createFromTypeface(JNIEnv* env, jobject, SkTypeface*
|
||||
if (NULL == face) {
|
||||
face = SkTypeface::CreateFromName(NULL, (SkTypeface::Style)style);
|
||||
}
|
||||
return face;
|
||||
return reinterpret_cast<jlong>(face);
|
||||
}
|
||||
|
||||
static void Typeface_unref(JNIEnv* env, jobject obj, SkTypeface* face) {
|
||||
static void Typeface_unref(JNIEnv* env, jobject obj, jlong faceHandle) {
|
||||
SkTypeface* face = reinterpret_cast<SkTypeface*>(faceHandle);
|
||||
SkSafeUnref(face);
|
||||
}
|
||||
|
||||
static int Typeface_getStyle(JNIEnv* env, jobject obj, SkTypeface* face) {
|
||||
return face->style();
|
||||
static jint Typeface_getStyle(JNIEnv* env, jobject obj, jlong faceHandle) {
|
||||
SkTypeface* face = reinterpret_cast<SkTypeface*>(faceHandle);
|
||||
return static_cast<jint>(face->style());
|
||||
}
|
||||
|
||||
class AssetStream : public SkStream {
|
||||
@@ -132,9 +136,9 @@ private:
|
||||
const void* fMemoryBase;
|
||||
};
|
||||
|
||||
static SkTypeface* 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);
|
||||
@@ -156,27 +160,27 @@ static SkTypeface* Typeface_createFromAsset(JNIEnv* env, jobject,
|
||||
// need to unref it here or it won't be freed later on
|
||||
stream->unref();
|
||||
|
||||
return face;
|
||||
return reinterpret_cast<jlong>(face);
|
||||
}
|
||||
|
||||
static SkTypeface* 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 SkTypeface::CreateFromFile(str.c_str());
|
||||
return reinterpret_cast<jlong>(SkTypeface::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 },
|
||||
};
|
||||
|
||||
|
||||
@@ -26,35 +26,37 @@ namespace android {
|
||||
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>
|
||||
|
||||
@@ -389,7 +389,7 @@ static void computeFrustum(const float* m, float* f) {
|
||||
}
|
||||
|
||||
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 @@ int util_frustumCullSpheres(JNIEnv *env, jclass clazz,
|
||||
*/
|
||||
|
||||
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 @@ static jfieldID nativeBitmapID = 0;
|
||||
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 @@ static jint util_getInternalFormat(JNIEnv *env, jclass clazz,
|
||||
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.getConfig();
|
||||
return getInternalFormat(config);
|
||||
@@ -640,7 +640,7 @@ static jint util_getType(JNIEnv *env, jclass clazz,
|
||||
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.getConfig();
|
||||
return getType(config);
|
||||
@@ -651,7 +651,7 @@ static jint util_texImage2D(JNIEnv *env, jclass clazz,
|
||||
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.getConfig();
|
||||
if (internalformat < 0) {
|
||||
@@ -700,7 +700,7 @@ static jint util_texSubImage2D(JNIEnv *env, jclass clazz,
|
||||
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.getConfig();
|
||||
if (format < 0) {
|
||||
@@ -773,7 +773,7 @@ getPointer(JNIEnv *_env, jobject buffer, jint *remaining)
|
||||
pointer = _env->CallStaticLongMethod(nioAccessClass,
|
||||
getBasePointerID, buffer);
|
||||
if (pointer != 0L) {
|
||||
return (void *) (jint) pointer;
|
||||
return reinterpret_cast<void *>(pointer);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@@ -974,7 +974,7 @@ static jboolean etc1_isValid(JNIEnv *env, jclass clazz,
|
||||
result = etc1_pkm_is_valid((etc1_byte*) headerB.getData());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
return result ? JNI_TRUE : JNI_FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -997,7 +997,7 @@ static jint etc1_getWidth(JNIEnv *env, jclass clazz,
|
||||
/**
|
||||
* 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);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -42,17 +42,20 @@ using namespace uirenderer;
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
static void android_view_GLES20DisplayList_reset(JNIEnv* env,
|
||||
jobject clazz, DisplayList* displayList) {
|
||||
jobject clazz, jlong displayListHandle) {
|
||||
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListHandle);
|
||||
displayList->reset();
|
||||
}
|
||||
|
||||
static jint android_view_GLES20DisplayList_getDisplayListSize(JNIEnv* env,
|
||||
jobject clazz, DisplayList* displayList) {
|
||||
jobject clazz, jlong displayListHandle) {
|
||||
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListHandle);
|
||||
return displayList->getSize();
|
||||
}
|
||||
|
||||
static void android_view_GLES20DisplayList_setDisplayListName(JNIEnv* env,
|
||||
jobject clazz, DisplayList* displayList, jstring name) {
|
||||
jobject clazz, jlong displayListHandle, jstring name) {
|
||||
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListHandle);
|
||||
if (name != NULL) {
|
||||
const char* textArray = env->GetStringUTFChars(name, NULL);
|
||||
displayList->setName(textArray);
|
||||
@@ -61,7 +64,8 @@ static void android_view_GLES20DisplayList_setDisplayListName(JNIEnv* env,
|
||||
}
|
||||
|
||||
static void android_view_GLES20DisplayList_destroyDisplayList(JNIEnv* env,
|
||||
jobject clazz, DisplayList* displayList) {
|
||||
jobject clazz, jlong displayListHandle) {
|
||||
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListHandle);
|
||||
DisplayList::destroyDisplayListDeferred(displayList);
|
||||
}
|
||||
|
||||
@@ -70,74 +74,91 @@ static void android_view_GLES20DisplayList_destroyDisplayList(JNIEnv* env,
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
static void android_view_GLES20DisplayList_setCaching(JNIEnv* env,
|
||||
jobject clazz, DisplayList* displayList, jboolean caching) {
|
||||
jobject clazz, jlong displayListHandle, jboolean caching) {
|
||||
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListHandle);
|
||||
displayList->setCaching(caching);
|
||||
}
|
||||
|
||||
//serban
|
||||
static void android_view_GLES20DisplayList_setStaticMatrix(JNIEnv* env,
|
||||
jobject clazz, DisplayList* displayList, SkMatrix* matrix) {
|
||||
jobject clazz, jlong displayListHandle, jlong matrixHandle) {
|
||||
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListHandle);
|
||||
SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixHandle);
|
||||
displayList->setStaticMatrix(matrix);
|
||||
}
|
||||
|
||||
static void android_view_GLES20DisplayList_setAnimationMatrix(JNIEnv* env,
|
||||
jobject clazz, DisplayList* displayList, SkMatrix* matrix) {
|
||||
jobject clazz, jlong displayListHandle, jlong matrixHandle) {
|
||||
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListHandle);
|
||||
SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixHandle);
|
||||
displayList->setAnimationMatrix(matrix);
|
||||
}
|
||||
|
||||
static void android_view_GLES20DisplayList_setClipToBounds(JNIEnv* env,
|
||||
jobject clazz, DisplayList* displayList, jboolean clipToBounds) {
|
||||
jobject clazz, jlong displayListHandle, jboolean clipToBounds) {
|
||||
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListHandle);
|
||||
displayList->setClipToBounds(clipToBounds);
|
||||
}
|
||||
|
||||
static void android_view_GLES20DisplayList_setAlpha(JNIEnv* env,
|
||||
jobject clazz, DisplayList* displayList, float alpha) {
|
||||
jobject clazz, jlong displayListHandle, jfloat alpha) {
|
||||
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListHandle);
|
||||
displayList->setAlpha(alpha);
|
||||
}
|
||||
|
||||
static void android_view_GLES20DisplayList_setHasOverlappingRendering(JNIEnv* env,
|
||||
jobject clazz, DisplayList* displayList, bool hasOverlappingRendering) {
|
||||
jobject clazz, jlong displayListHandle, jboolean hasOverlappingRendering) {
|
||||
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListHandle);
|
||||
displayList->setHasOverlappingRendering(hasOverlappingRendering);
|
||||
}
|
||||
|
||||
static void android_view_GLES20DisplayList_setTranslationX(JNIEnv* env,
|
||||
jobject clazz, DisplayList* displayList, float tx) {
|
||||
jobject clazz, jlong displayListHandle, jfloat tx) {
|
||||
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListHandle);
|
||||
displayList->setTranslationX(tx);
|
||||
}
|
||||
|
||||
static void android_view_GLES20DisplayList_setTranslationY(JNIEnv* env,
|
||||
jobject clazz, DisplayList* displayList, float ty) {
|
||||
jobject clazz, jlong displayListHandle, jfloat ty) {
|
||||
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListHandle);
|
||||
displayList->setTranslationY(ty);
|
||||
}
|
||||
|
||||
static void android_view_GLES20DisplayList_setRotation(JNIEnv* env,
|
||||
jobject clazz, DisplayList* displayList, float rotation) {
|
||||
jobject clazz, jlong displayListHandle, jfloat rotation) {
|
||||
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListHandle);
|
||||
displayList->setRotation(rotation);
|
||||
}
|
||||
|
||||
static void android_view_GLES20DisplayList_setRotationX(JNIEnv* env,
|
||||
jobject clazz, DisplayList* displayList, float rx) {
|
||||
jobject clazz, jlong displayListHandle, jfloat rx) {
|
||||
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListHandle);
|
||||
displayList->setRotationX(rx);
|
||||
}
|
||||
|
||||
static void android_view_GLES20DisplayList_setRotationY(JNIEnv* env,
|
||||
jobject clazz, DisplayList* displayList, float ry) {
|
||||
jobject clazz, jlong displayListHandle, jfloat ry) {
|
||||
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListHandle);
|
||||
displayList->setRotationY(ry);
|
||||
}
|
||||
|
||||
static void android_view_GLES20DisplayList_setScaleX(JNIEnv* env,
|
||||
jobject clazz, DisplayList* displayList, float sx) {
|
||||
jobject clazz, jlong displayListHandle, jfloat sx) {
|
||||
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListHandle);
|
||||
displayList->setScaleX(sx);
|
||||
}
|
||||
|
||||
static void android_view_GLES20DisplayList_setScaleY(JNIEnv* env,
|
||||
jobject clazz, DisplayList* displayList, float sy) {
|
||||
jobject clazz, jlong displayListHandle, jfloat sy) {
|
||||
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListHandle);
|
||||
displayList->setScaleY(sy);
|
||||
}
|
||||
|
||||
static void android_view_GLES20DisplayList_setTransformationInfo(JNIEnv* env,
|
||||
jobject clazz, DisplayList* displayList, float alpha,
|
||||
float translationX, float translationY, float rotation, float rotationX, float rotationY,
|
||||
float scaleX, float scaleY) {
|
||||
jobject clazz, jlong displayListHandle, jfloat alpha,
|
||||
jfloat translationX, jfloat translationY, jfloat rotation, jfloat rotationX, jfloat rotationY,
|
||||
jfloat scaleX, jfloat scaleY) {
|
||||
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListHandle);
|
||||
displayList->setAlpha(alpha);
|
||||
displayList->setTranslationX(translationX);
|
||||
displayList->setTranslationY(translationY);
|
||||
@@ -149,58 +170,70 @@ static void android_view_GLES20DisplayList_setTransformationInfo(JNIEnv* env,
|
||||
}
|
||||
|
||||
static void android_view_GLES20DisplayList_setPivotX(JNIEnv* env,
|
||||
jobject clazz, DisplayList* displayList, float px) {
|
||||
jobject clazz, jlong displayListHandle, jfloat px) {
|
||||
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListHandle);
|
||||
displayList->setPivotX(px);
|
||||
}
|
||||
|
||||
static void android_view_GLES20DisplayList_setPivotY(JNIEnv* env,
|
||||
jobject clazz, DisplayList* displayList, float py) {
|
||||
jobject clazz, jlong displayListHandle, jfloat py) {
|
||||
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListHandle);
|
||||
displayList->setPivotY(py);
|
||||
}
|
||||
|
||||
static void android_view_GLES20DisplayList_setCameraDistance(JNIEnv* env,
|
||||
jobject clazz, DisplayList* displayList, float distance) {
|
||||
jobject clazz, jlong displayListHandle, jfloat distance) {
|
||||
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListHandle);
|
||||
displayList->setCameraDistance(distance);
|
||||
}
|
||||
|
||||
static void android_view_GLES20DisplayList_setLeft(JNIEnv* env,
|
||||
jobject clazz, DisplayList* displayList, int left) {
|
||||
jobject clazz, jlong displayListHandle, jint left) {
|
||||
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListHandle);
|
||||
displayList->setLeft(left);
|
||||
}
|
||||
|
||||
static void android_view_GLES20DisplayList_setTop(JNIEnv* env,
|
||||
jobject clazz, DisplayList* displayList, int top) {
|
||||
jobject clazz, jlong displayListHandle, jint top) {
|
||||
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListHandle);
|
||||
displayList->setTop(top);
|
||||
}
|
||||
|
||||
static void android_view_GLES20DisplayList_setRight(JNIEnv* env,
|
||||
jobject clazz, DisplayList* displayList, int right) {
|
||||
jobject clazz, jlong displayListHandle, jint right) {
|
||||
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListHandle);
|
||||
displayList->setRight(right);
|
||||
}
|
||||
|
||||
static void android_view_GLES20DisplayList_setBottom(JNIEnv* env,
|
||||
jobject clazz, DisplayList* displayList, int bottom) {
|
||||
jobject clazz, jlong displayListHandle, jint bottom) {
|
||||
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListHandle);
|
||||
displayList->setBottom(bottom);
|
||||
}
|
||||
|
||||
static void android_view_GLES20DisplayList_setLeftTopRightBottom(JNIEnv* env,
|
||||
jobject clazz, DisplayList* displayList, int left, int top,
|
||||
jobject clazz, jlong displayListHandle, jint left, jint top,
|
||||
int right, int bottom) {
|
||||
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListHandle);
|
||||
displayList->setLeftTopRightBottom(left, top, right, bottom);
|
||||
}
|
||||
|
||||
static void android_view_GLES20DisplayList_offsetLeftAndRight(JNIEnv* env,
|
||||
jobject clazz, DisplayList* displayList, float offset) {
|
||||
jobject clazz, jlong displayListHandle, jfloat offset) {
|
||||
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListHandle);
|
||||
displayList->offsetLeftRight(offset);
|
||||
}
|
||||
|
||||
static void android_view_GLES20DisplayList_offsetTopAndBottom(JNIEnv* env,
|
||||
jobject clazz, DisplayList* displayList, float offset) {
|
||||
jobject clazz, jlong displayListHandle, jfloat offset) {
|
||||
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListHandle);
|
||||
displayList->offsetTopBottom(offset);
|
||||
}
|
||||
|
||||
static void android_view_GLES20DisplayList_getMatrix(JNIEnv* env,
|
||||
jobject clazz, DisplayList* displayList, SkMatrix* matrix) {
|
||||
jobject clazz, jlong displayListHandle, jlong matrixHandle) {
|
||||
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListHandle);
|
||||
SkMatrix* matrix = reinterpret_cast<SkMatrix*>(matrixHandle);
|
||||
SkMatrix* source = displayList->getStaticMatrix();
|
||||
if (source) {
|
||||
matrix->setConcat(SkMatrix::I(), *source);
|
||||
@@ -210,82 +243,98 @@ static void android_view_GLES20DisplayList_getMatrix(JNIEnv* env,
|
||||
}
|
||||
|
||||
static jboolean android_view_GLES20DisplayList_hasOverlappingRendering(JNIEnv* env,
|
||||
jobject clazz, DisplayList* displayList) {
|
||||
jobject clazz, jlong displayListHandle) {
|
||||
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListHandle);
|
||||
return displayList->hasOverlappingRendering();
|
||||
}
|
||||
|
||||
static jfloat android_view_GLES20DisplayList_getAlpha(JNIEnv* env,
|
||||
jobject clazz, DisplayList* displayList) {
|
||||
jobject clazz, jlong displayListHandle) {
|
||||
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListHandle);
|
||||
return displayList->getAlpha();
|
||||
}
|
||||
|
||||
static jfloat android_view_GLES20DisplayList_getLeft(JNIEnv* env,
|
||||
jobject clazz, DisplayList* displayList) {
|
||||
jobject clazz, jlong displayListHandle) {
|
||||
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListHandle);
|
||||
return displayList->getLeft();
|
||||
}
|
||||
|
||||
static jfloat android_view_GLES20DisplayList_getTop(JNIEnv* env,
|
||||
jobject clazz, DisplayList* displayList) {
|
||||
jobject clazz, jlong displayListHandle) {
|
||||
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListHandle);
|
||||
return displayList->getTop();
|
||||
}
|
||||
|
||||
static jfloat android_view_GLES20DisplayList_getRight(JNIEnv* env,
|
||||
jobject clazz, DisplayList* displayList) {
|
||||
jobject clazz, jlong displayListHandle) {
|
||||
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListHandle);
|
||||
return displayList->getRight();
|
||||
}
|
||||
|
||||
static jfloat android_view_GLES20DisplayList_getBottom(JNIEnv* env,
|
||||
jobject clazz, DisplayList* displayList) {
|
||||
jobject clazz, jlong displayListHandle) {
|
||||
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListHandle);
|
||||
return displayList->getBottom();
|
||||
}
|
||||
|
||||
static jfloat android_view_GLES20DisplayList_getCameraDistance(JNIEnv* env,
|
||||
jobject clazz, DisplayList* displayList) {
|
||||
jobject clazz, jlong displayListHandle) {
|
||||
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListHandle);
|
||||
return displayList->getCameraDistance();
|
||||
}
|
||||
|
||||
static jfloat android_view_GLES20DisplayList_getScaleX(JNIEnv* env,
|
||||
jobject clazz, DisplayList* displayList) {
|
||||
jobject clazz, jlong displayListHandle) {
|
||||
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListHandle);
|
||||
return displayList->getScaleX();
|
||||
}
|
||||
|
||||
static jfloat android_view_GLES20DisplayList_getScaleY(JNIEnv* env,
|
||||
jobject clazz, DisplayList* displayList) {
|
||||
jobject clazz, jlong displayListHandle) {
|
||||
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListHandle);
|
||||
return displayList->getScaleY();
|
||||
}
|
||||
|
||||
static jfloat android_view_GLES20DisplayList_getTranslationX(JNIEnv* env,
|
||||
jobject clazz, DisplayList* displayList) {
|
||||
jobject clazz, jlong displayListHandle) {
|
||||
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListHandle);
|
||||
return displayList->getTranslationX();
|
||||
}
|
||||
|
||||
static jfloat android_view_GLES20DisplayList_getTranslationY(JNIEnv* env,
|
||||
jobject clazz, DisplayList* displayList) {
|
||||
jobject clazz, jlong displayListHandle) {
|
||||
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListHandle);
|
||||
return displayList->getTranslationY();
|
||||
}
|
||||
|
||||
static jfloat android_view_GLES20DisplayList_getRotation(JNIEnv* env,
|
||||
jobject clazz, DisplayList* displayList) {
|
||||
jobject clazz, jlong displayListHandle) {
|
||||
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListHandle);
|
||||
return displayList->getRotation();
|
||||
}
|
||||
|
||||
static jfloat android_view_GLES20DisplayList_getRotationX(JNIEnv* env,
|
||||
jobject clazz, DisplayList* displayList) {
|
||||
jobject clazz, jlong displayListHandle) {
|
||||
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListHandle);
|
||||
return displayList->getRotationX();
|
||||
}
|
||||
|
||||
static jfloat android_view_GLES20DisplayList_getRotationY(JNIEnv* env,
|
||||
jobject clazz, DisplayList* displayList) {
|
||||
jobject clazz, jlong displayListHandle) {
|
||||
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListHandle);
|
||||
return displayList->getRotationY();
|
||||
}
|
||||
|
||||
static jfloat android_view_GLES20DisplayList_getPivotX(JNIEnv* env,
|
||||
jobject clazz, DisplayList* displayList) {
|
||||
jobject clazz, jlong displayListHandle) {
|
||||
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListHandle);
|
||||
return displayList->getPivotX();
|
||||
}
|
||||
|
||||
static jfloat android_view_GLES20DisplayList_getPivotY(JNIEnv* env,
|
||||
jobject clazz, DisplayList* displayList) {
|
||||
jobject clazz, jlong displayListHandle) {
|
||||
DisplayList* displayList = reinterpret_cast<DisplayList*>(displayListHandle);
|
||||
return displayList->getPivotY();
|
||||
}
|
||||
|
||||
@@ -299,58 +348,58 @@ const char* const kClassPathName = "android/view/GLES20DisplayList";
|
||||
|
||||
static JNINativeMethod gMethods[] = {
|
||||
#ifdef USE_OPENGL_RENDERER
|
||||
{ "nDestroyDisplayList", "(I)V", (void*) android_view_GLES20DisplayList_destroyDisplayList },
|
||||
{ "nGetDisplayListSize", "(I)I", (void*) android_view_GLES20DisplayList_getDisplayListSize },
|
||||
{ "nSetDisplayListName", "(ILjava/lang/String;)V",
|
||||
{ "nDestroyDisplayList", "(J)V", (void*) android_view_GLES20DisplayList_destroyDisplayList },
|
||||
{ "nGetDisplayListSize", "(J)I", (void*) android_view_GLES20DisplayList_getDisplayListSize },
|
||||
{ "nSetDisplayListName", "(JLjava/lang/String;)V",
|
||||
(void*) android_view_GLES20DisplayList_setDisplayListName },
|
||||
|
||||
{ "nReset", "(I)V", (void*) android_view_GLES20DisplayList_reset },
|
||||
{ "nSetCaching", "(IZ)V", (void*) android_view_GLES20DisplayList_setCaching },
|
||||
{ "nSetStaticMatrix", "(II)V", (void*) android_view_GLES20DisplayList_setStaticMatrix },
|
||||
{ "nSetAnimationMatrix", "(II)V", (void*) android_view_GLES20DisplayList_setAnimationMatrix },
|
||||
{ "nSetClipToBounds", "(IZ)V", (void*) android_view_GLES20DisplayList_setClipToBounds },
|
||||
{ "nSetAlpha", "(IF)V", (void*) android_view_GLES20DisplayList_setAlpha },
|
||||
{ "nSetHasOverlappingRendering", "(IZ)V",
|
||||
{ "nReset", "(J)V", (void*) android_view_GLES20DisplayList_reset },
|
||||
{ "nSetCaching", "(JZ)V", (void*) android_view_GLES20DisplayList_setCaching },
|
||||
{ "nSetStaticMatrix", "(JJ)V", (void*) android_view_GLES20DisplayList_setStaticMatrix },
|
||||
{ "nSetAnimationMatrix", "(JJ)V", (void*) android_view_GLES20DisplayList_setAnimationMatrix },
|
||||
{ "nSetClipToBounds", "(JZ)V", (void*) android_view_GLES20DisplayList_setClipToBounds },
|
||||
{ "nSetAlpha", "(JF)V", (void*) android_view_GLES20DisplayList_setAlpha },
|
||||
{ "nSetHasOverlappingRendering", "(JZ)V",
|
||||
(void*) android_view_GLES20DisplayList_setHasOverlappingRendering },
|
||||
{ "nSetTranslationX", "(IF)V", (void*) android_view_GLES20DisplayList_setTranslationX },
|
||||
{ "nSetTranslationY", "(IF)V", (void*) android_view_GLES20DisplayList_setTranslationY },
|
||||
{ "nSetRotation", "(IF)V", (void*) android_view_GLES20DisplayList_setRotation },
|
||||
{ "nSetRotationX", "(IF)V", (void*) android_view_GLES20DisplayList_setRotationX },
|
||||
{ "nSetRotationY", "(IF)V", (void*) android_view_GLES20DisplayList_setRotationY },
|
||||
{ "nSetScaleX", "(IF)V", (void*) android_view_GLES20DisplayList_setScaleX },
|
||||
{ "nSetScaleY", "(IF)V", (void*) android_view_GLES20DisplayList_setScaleY },
|
||||
{ "nSetTransformationInfo","(IFFFFFFFF)V",
|
||||
{ "nSetTranslationX", "(JF)V", (void*) android_view_GLES20DisplayList_setTranslationX },
|
||||
{ "nSetTranslationY", "(JF)V", (void*) android_view_GLES20DisplayList_setTranslationY },
|
||||
{ "nSetRotation", "(JF)V", (void*) android_view_GLES20DisplayList_setRotation },
|
||||
{ "nSetRotationX", "(JF)V", (void*) android_view_GLES20DisplayList_setRotationX },
|
||||
{ "nSetRotationY", "(JF)V", (void*) android_view_GLES20DisplayList_setRotationY },
|
||||
{ "nSetScaleX", "(JF)V", (void*) android_view_GLES20DisplayList_setScaleX },
|
||||
{ "nSetScaleY", "(JF)V", (void*) android_view_GLES20DisplayList_setScaleY },
|
||||
{ "nSetTransformationInfo","(JFFFFFFFF)V",
|
||||
(void*) android_view_GLES20DisplayList_setTransformationInfo },
|
||||
{ "nSetPivotX", "(IF)V", (void*) android_view_GLES20DisplayList_setPivotX },
|
||||
{ "nSetPivotY", "(IF)V", (void*) android_view_GLES20DisplayList_setPivotY },
|
||||
{ "nSetCameraDistance", "(IF)V", (void*) android_view_GLES20DisplayList_setCameraDistance },
|
||||
{ "nSetLeft", "(II)V", (void*) android_view_GLES20DisplayList_setLeft },
|
||||
{ "nSetTop", "(II)V", (void*) android_view_GLES20DisplayList_setTop },
|
||||
{ "nSetRight", "(II)V", (void*) android_view_GLES20DisplayList_setRight },
|
||||
{ "nSetBottom", "(II)V", (void*) android_view_GLES20DisplayList_setBottom },
|
||||
{ "nSetLeftTopRightBottom","(IIIII)V",
|
||||
{ "nSetPivotX", "(JF)V", (void*) android_view_GLES20DisplayList_setPivotX },
|
||||
{ "nSetPivotY", "(JF)V", (void*) android_view_GLES20DisplayList_setPivotY },
|
||||
{ "nSetCameraDistance", "(JF)V", (void*) android_view_GLES20DisplayList_setCameraDistance },
|
||||
{ "nSetLeft", "(JI)V", (void*) android_view_GLES20DisplayList_setLeft },
|
||||
{ "nSetTop", "(JI)V", (void*) android_view_GLES20DisplayList_setTop },
|
||||
{ "nSetRight", "(JI)V", (void*) android_view_GLES20DisplayList_setRight },
|
||||
{ "nSetBottom", "(JI)V", (void*) android_view_GLES20DisplayList_setBottom },
|
||||
{ "nSetLeftTopRightBottom","(JIIII)V",
|
||||
(void*) android_view_GLES20DisplayList_setLeftTopRightBottom },
|
||||
{ "nOffsetLeftAndRight", "(IF)V", (void*) android_view_GLES20DisplayList_offsetLeftAndRight },
|
||||
{ "nOffsetTopAndBottom", "(IF)V", (void*) android_view_GLES20DisplayList_offsetTopAndBottom },
|
||||
{ "nOffsetLeftAndRight", "(JF)V", (void*) android_view_GLES20DisplayList_offsetLeftAndRight },
|
||||
{ "nOffsetTopAndBottom", "(JF)V", (void*) android_view_GLES20DisplayList_offsetTopAndBottom },
|
||||
|
||||
|
||||
{ "nGetMatrix", "(II)V", (void*) android_view_GLES20DisplayList_getMatrix },
|
||||
{ "nHasOverlappingRendering", "(I)Z", (void*) android_view_GLES20DisplayList_hasOverlappingRendering },
|
||||
{ "nGetAlpha", "(I)F", (void*) android_view_GLES20DisplayList_getAlpha },
|
||||
{ "nGetLeft", "(I)F", (void*) android_view_GLES20DisplayList_getLeft },
|
||||
{ "nGetTop", "(I)F", (void*) android_view_GLES20DisplayList_getTop },
|
||||
{ "nGetRight", "(I)F", (void*) android_view_GLES20DisplayList_getRight },
|
||||
{ "nGetBottom", "(I)F", (void*) android_view_GLES20DisplayList_getBottom },
|
||||
{ "nGetCameraDistance", "(I)F", (void*) android_view_GLES20DisplayList_getCameraDistance },
|
||||
{ "nGetScaleX", "(I)F", (void*) android_view_GLES20DisplayList_getScaleX },
|
||||
{ "nGetScaleY", "(I)F", (void*) android_view_GLES20DisplayList_getScaleY },
|
||||
{ "nGetTranslationX", "(I)F", (void*) android_view_GLES20DisplayList_getTranslationX },
|
||||
{ "nGetTranslationY", "(I)F", (void*) android_view_GLES20DisplayList_getTranslationY },
|
||||
{ "nGetRotation", "(I)F", (void*) android_view_GLES20DisplayList_getRotation },
|
||||
{ "nGetRotationX", "(I)F", (void*) android_view_GLES20DisplayList_getRotationX },
|
||||
{ "nGetRotationY", "(I)F", (void*) android_view_GLES20DisplayList_getRotationY },
|
||||
{ "nGetPivotX", "(I)F", (void*) android_view_GLES20DisplayList_getPivotX },
|
||||
{ "nGetPivotY", "(I)F", (void*) android_view_GLES20DisplayList_getPivotY },
|
||||
{ "nGetMatrix", "(JJ)V", (void*) android_view_GLES20DisplayList_getMatrix },
|
||||
{ "nHasOverlappingRendering", "(J)Z", (void*) android_view_GLES20DisplayList_hasOverlappingRendering },
|
||||
{ "nGetAlpha", "(J)F", (void*) android_view_GLES20DisplayList_getAlpha },
|
||||
{ "nGetLeft", "(J)F", (void*) android_view_GLES20DisplayList_getLeft },
|
||||
{ "nGetTop", "(J)F", (void*) android_view_GLES20DisplayList_getTop },
|
||||
{ "nGetRight", "(J)F", (void*) android_view_GLES20DisplayList_getRight },
|
||||
{ "nGetBottom", "(J)F", (void*) android_view_GLES20DisplayList_getBottom },
|
||||
{ "nGetCameraDistance", "(J)F", (void*) android_view_GLES20DisplayList_getCameraDistance },
|
||||
{ "nGetScaleX", "(J)F", (void*) android_view_GLES20DisplayList_getScaleX },
|
||||
{ "nGetScaleY", "(J)F", (void*) android_view_GLES20DisplayList_getScaleY },
|
||||
{ "nGetTranslationX", "(J)F", (void*) android_view_GLES20DisplayList_getTranslationX },
|
||||
{ "nGetTranslationY", "(J)F", (void*) android_view_GLES20DisplayList_getTranslationY },
|
||||
{ "nGetRotation", "(J)F", (void*) android_view_GLES20DisplayList_getRotation },
|
||||
{ "nGetRotationX", "(J)F", (void*) android_view_GLES20DisplayList_getRotationX },
|
||||
{ "nGetRotationY", "(J)F", (void*) android_view_GLES20DisplayList_getRotationY },
|
||||
{ "nGetPivotX", "(J)F", (void*) android_view_GLES20DisplayList_getPivotX },
|
||||
{ "nGetPivotY", "(J)F", (void*) android_view_GLES20DisplayList_getPivotY },
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
@@ -89,6 +89,12 @@ static struct {
|
||||
#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 @@ public:
|
||||
// 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 @@ static GraphicBufferWrapper* android_view_GraphiceBuffer_create(JNIEnv* env, job
|
||||
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 void android_view_GraphiceBuffer_destroy(JNIEnv* env, jobject clazz,
|
||||
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 inline SkBitmap::Config convertPixelFormat(int32_t format) {
|
||||
}
|
||||
|
||||
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 @@ static jboolean android_view_GraphicBuffer_lockCanvas(JNIEnv* env, jobject,
|
||||
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 @@ static jboolean android_view_GraphicBuffer_lockCanvas(JNIEnv* env, jobject,
|
||||
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 jboolean android_view_GraphicBuffer_unlockCanvasAndPost(JNIEnv* env, jobj
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
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 @@ static GraphicBufferWrapper* android_view_GraphiceBuffer_read(JNIEnv* env, jobje
|
||||
|
||||
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 @@ sp<GraphicBuffer> graphicBufferForJavaObject(JNIEnv* env, jobject obj) {
|
||||
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 @@ int register_android_view_GraphicBuffer(JNIEnv* env) {
|
||||
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));
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ sp<Surface> android_view_Surface_getSurface(JNIEnv* env, jobject surfaceObj) {
|
||||
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;
|
||||
@@ -134,7 +134,7 @@ static inline bool isSurfaceValid(const sp<Surface>& sur) {
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
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) {
|
||||
@@ -150,20 +150,20 @@ static jint nativeCreateFromSurfaceTexture(JNIEnv* env, jclass clazz,
|
||||
}
|
||||
|
||||
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);
|
||||
@@ -191,14 +191,14 @@ static inline SkBitmap::Config convertPixelFormat(PixelFormat format) {
|
||||
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)) {
|
||||
@@ -262,11 +262,11 @@ static jint nativeLockCanvas(JNIEnv* env, jclass clazz,
|
||||
// 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;
|
||||
@@ -285,8 +285,8 @@ static void nativeUnlockCanvasAndPost(JNIEnv* env, jclass clazz,
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
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
|
||||
@@ -298,11 +298,11 @@ static jint nativeCreateFromSurfaceControl(JNIEnv* env, jclass clazz,
|
||||
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);
|
||||
@@ -317,7 +317,7 @@ static jint nativeReadFromParcel(JNIEnv* env, jclass clazz,
|
||||
if (self != NULL
|
||||
&& (self->getIGraphicBufferProducer()->asBinder() == binder)) {
|
||||
// same IGraphicBufferProducer, return ourselves
|
||||
return int(self.get());
|
||||
return jlong(self.get());
|
||||
}
|
||||
|
||||
sp<Surface> sur;
|
||||
@@ -334,11 +334,11 @@ static jint nativeReadFromParcel(JNIEnv* env, jclass clazz,
|
||||
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);
|
||||
@@ -351,23 +351,23 @@ static void nativeWriteToParcel(JNIEnv* env, jclass clazz,
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
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 },
|
||||
};
|
||||
|
||||
@@ -379,18 +379,18 @@ int register_android_view_Surface(JNIEnv* env)
|
||||
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");
|
||||
|
||||
@@ -122,7 +122,7 @@ private:
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
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 @@ static jint nativeCreate(JNIEnv* env, jclass clazz, jobject sessionObj,
|
||||
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);
|
||||
@@ -229,7 +229,7 @@ static void nativeSetAnimationTransaction(JNIEnv* env, jclass clazz) {
|
||||
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) {
|
||||
@@ -237,7 +237,7 @@ static void nativeSetLayer(JNIEnv* env, jclass clazz, jint nativeObject, jint zo
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
@@ -245,7 +245,7 @@ static void nativeSetPosition(JNIEnv* env, jclass clazz, jint nativeObject, jflo
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
@@ -253,7 +253,7 @@ static void nativeSetSize(JNIEnv* env, jclass clazz, jint nativeObject, jint w,
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
@@ -261,7 +261,7 @@ static void nativeSetFlags(JNIEnv* env, jclass clazz, jint nativeObject, jint fl
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
@@ -286,7 +286,7 @@ static void nativeSetTransparentRegionHint(JNIEnv* env, jclass clazz, jint nativ
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
@@ -294,7 +294,7 @@ static void nativeSetAlpha(JNIEnv* env, jclass clazz, jint nativeObject, jfloat
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
@@ -303,7 +303,7 @@ static void nativeSetMatrix(JNIEnv* env, jclass clazz, jint nativeObject,
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
@@ -313,7 +313,7 @@ static void nativeSetWindowCrop(JNIEnv* env, jclass clazz, jint nativeObject,
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
@@ -341,7 +341,7 @@ static void nativeDestroyDisplay(JNIEnv* env, jclass clazz, jobject tokenObj) {
|
||||
}
|
||||
|
||||
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;
|
||||
@@ -410,11 +410,11 @@ static void nativeUnblankDisplay(JNIEnv* env, jclass clazz, jobject tokenObj) {
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
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 },
|
||||
@@ -426,23 +426,23 @@ static JNINativeMethod sSurfaceControlMethods[] = {
|
||||
(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 },
|
||||
@@ -450,7 +450,7 @@ static JNINativeMethod sSurfaceControlMethods[] = {
|
||||
(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 },
|
||||
|
||||
@@ -59,9 +59,15 @@ static struct {
|
||||
#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__)
|
||||
|
||||
@@ -103,18 +109,18 @@ static void android_view_TextureView_createNativeWindow(JNIEnv* env, jobject tex
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,16 +128,16 @@ static inline void swapCanvasPtr(JNIEnv* env, jobject canvasObj, SkCanvas* newCa
|
||||
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;
|
||||
@@ -148,7 +154,7 @@ static jboolean android_view_TextureView_lockCanvas(JNIEnv* env, jobject,
|
||||
|
||||
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);
|
||||
|
||||
@@ -179,11 +185,11 @@ static jboolean android_view_TextureView_lockCanvas(JNIEnv* env, jobject,
|
||||
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);
|
||||
@@ -206,9 +212,9 @@ static JNINativeMethod gMethods[] = {
|
||||
{ "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 },
|
||||
};
|
||||
|
||||
@@ -236,14 +242,14 @@ int register_android_view_TextureView(JNIEnv* env) {
|
||||
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));
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ static void nativeClassInit(JNIEnv *_env, jclass eglImplClass)
|
||||
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 @@ static void jni_eglCreatePixmapSurface(JNIEnv *_env, jobject _this, jobject out_
|
||||
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) {
|
||||
|
||||
@@ -56,6 +56,6 @@ public class AvoidXfermode extends Xfermode {
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ public final class Bitmap implements Parcelable {
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public final int mNativeBitmap;
|
||||
public final long mNativeBitmap;
|
||||
|
||||
/**
|
||||
* Backing buffer for the Bitmap.
|
||||
@@ -103,7 +103,7 @@ public final class Bitmap implements Parcelable {
|
||||
* 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) {
|
||||
@@ -1511,7 +1511,7 @@ public final class Bitmap implements Parcelable {
|
||||
*/
|
||||
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");
|
||||
@@ -1545,9 +1545,9 @@ public final class Bitmap implements Parcelable {
|
||||
}
|
||||
|
||||
private static class BitmapFinalizer {
|
||||
private final int mNativeBitmap;
|
||||
private final long mNativeBitmap;
|
||||
|
||||
BitmapFinalizer(int nativeBitmap) {
|
||||
BitmapFinalizer(long nativeBitmap) {
|
||||
mNativeBitmap = nativeBitmap;
|
||||
}
|
||||
|
||||
@@ -1568,55 +1568,55 @@ public final class Bitmap implements Parcelable {
|
||||
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 nativeSetHasAlpha(int nBitmap, boolean hasAlpha);
|
||||
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 void nativePrepareToDraw(long nativeBitmap);
|
||||
private static native boolean nativeHasAlpha(long nativeBitmap);
|
||||
private static native void nativeSetHasAlpha(long nativeBitmap, boolean hasAlpha);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -583,7 +583,7 @@ public class BitmapFactory {
|
||||
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);
|
||||
@@ -686,7 +686,7 @@ public class BitmapFactory {
|
||||
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);
|
||||
|
||||
@@ -42,7 +42,7 @@ public class BitmapShader extends Shader {
|
||||
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 @@ public class BitmapShader extends Shader {
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -47,5 +47,5 @@ public class BlurMaskFilter extends MaskFilter {
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public class Canvas {
|
||||
|
||||
// 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 @@ public class Canvas {
|
||||
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 @@ public class Canvas {
|
||||
}
|
||||
|
||||
/** @hide */
|
||||
public Canvas(int nativeCanvas) {
|
||||
public Canvas(long nativeCanvas) {
|
||||
if (nativeCanvas == 0) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
@@ -157,8 +157,8 @@ public class Canvas {
|
||||
* 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 @@ public class Canvas {
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public int getNativeCanvas() {
|
||||
public long getNativeCanvas() {
|
||||
return mNativeCanvas;
|
||||
}
|
||||
|
||||
@@ -712,7 +712,7 @@ public class Canvas {
|
||||
}
|
||||
|
||||
public void setDrawFilter(DrawFilter filter) {
|
||||
int nativeFilter = 0;
|
||||
long nativeFilter = 0;
|
||||
if (filter != null) {
|
||||
nativeFilter = filter.mNativeInt;
|
||||
}
|
||||
@@ -1387,7 +1387,7 @@ public class Canvas {
|
||||
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 class Canvas {
|
||||
*/
|
||||
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);
|
||||
private static native void native_drawText(int nativeCanvas, String text,
|
||||
float y, int flags,
|
||||
long nativePaint);
|
||||
private static native void native_drawText(long nativeCanvas, String text,
|
||||
int start, int end, float x,
|
||||
float y, int flags, int paint);
|
||||
float y, int flags,
|
||||
long nativePaint);
|
||||
|
||||
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);
|
||||
float x, float y, int flags, long nativePaint);
|
||||
|
||||
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);
|
||||
float x, float y, int flags, long nativePaint);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -23,12 +23,12 @@ package android.graphics;
|
||||
|
||||
|
||||
public class ColorFilter {
|
||||
int native_instance;
|
||||
long native_instance;
|
||||
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public int nativeColorFilter;
|
||||
public long nativeColorFilter;
|
||||
|
||||
protected void finalize() throws Throwable {
|
||||
try {
|
||||
@@ -38,5 +38,5 @@ public class ColorFilter {
|
||||
}
|
||||
}
|
||||
|
||||
private static native void finalizer(int native_instance, int nativeColorFilter);
|
||||
private static native void finalizer(long native_instance, long nativeColorFilter);
|
||||
}
|
||||
|
||||
@@ -45,6 +45,6 @@ public class ColorMatrixColorFilter extends ColorFilter {
|
||||
nativeColorFilter = nColorMatrixFilter(native_instance, array);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ public class ComposePathEffect extends PathEffect {
|
||||
innerpe.native_instance);
|
||||
}
|
||||
|
||||
private static native int nativeCreate(int outerpe, int innerpe);
|
||||
private static native long nativeCreate(long nativeOuterpe,
|
||||
long nativeInnerpe);
|
||||
}
|
||||
|
||||
|
||||
@@ -104,12 +104,12 @@ public class ComposeShader extends Shader {
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -28,6 +28,6 @@ public class CornerPathEffect extends PathEffect {
|
||||
native_instance = nativeCreate(radius);
|
||||
}
|
||||
|
||||
private static native int nativeCreate(float radius);
|
||||
private static native long nativeCreate(float radius);
|
||||
}
|
||||
|
||||
|
||||
@@ -38,6 +38,6 @@ public class DashPathEffect extends PathEffect {
|
||||
native_instance = nativeCreate(intervals, phase);
|
||||
}
|
||||
|
||||
private static native int nativeCreate(float intervals[], float phase);
|
||||
private static native long nativeCreate(float intervals[], float phase);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,6 @@ public class DiscretePathEffect extends PathEffect {
|
||||
native_instance = nativeCreate(segmentLength, deviation);
|
||||
}
|
||||
|
||||
private static native int nativeCreate(float length, float deviation);
|
||||
private static native long nativeCreate(float length, float deviation);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ package android.graphics;
|
||||
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 @@ public class DrawFilter {
|
||||
}
|
||||
}
|
||||
|
||||
private static native void nativeDestructor(int nativeDrawFilter);
|
||||
private static native void nativeDestructor(long nativeDrawFilter);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,6 @@ public class EmbossMaskFilter extends MaskFilter {
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ import java.nio.ShortBuffer;
|
||||
* @hide
|
||||
*/
|
||||
public final class LargeBitmap {
|
||||
private int mNativeLargeBitmap;
|
||||
private long mNativeLargeBitmap;
|
||||
private boolean mRecycled;
|
||||
|
||||
/* Private constructor that must received an already allocated native
|
||||
@@ -45,8 +45,8 @@ public final class LargeBitmap {
|
||||
|
||||
This can be called from JNI code.
|
||||
*/
|
||||
private LargeBitmap(int lbm) {
|
||||
mNativeLargeBitmap = lbm;
|
||||
private LargeBitmap(long nativeLbm) {
|
||||
mNativeLargeBitmap = nativeLbm;
|
||||
mRecycled = false;
|
||||
}
|
||||
|
||||
@@ -119,10 +119,10 @@ public final class LargeBitmap {
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ public class LayerRasterizer extends Rasterizer {
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,6 @@ public class LightingColorFilter extends ColorFilter {
|
||||
nativeColorFilter = nCreateLightingFilter(native_instance, mul, add);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -116,12 +116,12 @@ public class LinearGradient extends Shader {
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -27,6 +27,6 @@ public class MaskFilter {
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -219,7 +219,7 @@ public class Matrix {
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public int native_instance;
|
||||
public long native_instance;
|
||||
|
||||
/**
|
||||
* Create an identity matrix
|
||||
@@ -800,83 +800,86 @@ public class Matrix {
|
||||
}
|
||||
}
|
||||
|
||||
/*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);
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public class NinePatch {
|
||||
*
|
||||
* @hide
|
||||
*/
|
||||
public final int mNativeChunk;
|
||||
public final long mNativeChunk;
|
||||
|
||||
private Paint mPaint;
|
||||
private String mSrcName;
|
||||
@@ -217,7 +217,7 @@ public class NinePatch {
|
||||
* 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 @@ public class NinePatch {
|
||||
* 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);
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ public class Paint {
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public int mNativePaint;
|
||||
public long mNativePaint;
|
||||
|
||||
private ColorFilter mColorFilter;
|
||||
private MaskFilter mMaskFilter;
|
||||
@@ -943,7 +943,7 @@ public class Paint {
|
||||
* @return shader
|
||||
*/
|
||||
public Shader setShader(Shader shader) {
|
||||
int shaderNative = 0;
|
||||
long shaderNative = 0;
|
||||
if (shader != null)
|
||||
shaderNative = shader.native_instance;
|
||||
native_setShader(mNativePaint, shaderNative);
|
||||
@@ -967,7 +967,7 @@ public class Paint {
|
||||
* @return filter
|
||||
*/
|
||||
public ColorFilter setColorFilter(ColorFilter filter) {
|
||||
int filterNative = 0;
|
||||
long filterNative = 0;
|
||||
if (filter != null)
|
||||
filterNative = filter.native_instance;
|
||||
native_setColorFilter(mNativePaint, filterNative);
|
||||
@@ -994,7 +994,7 @@ public class Paint {
|
||||
* @return xfermode
|
||||
*/
|
||||
public Xfermode setXfermode(Xfermode xfermode) {
|
||||
int xfermodeNative = 0;
|
||||
long xfermodeNative = 0;
|
||||
if (xfermode != null)
|
||||
xfermodeNative = xfermode.native_instance;
|
||||
native_setXfermode(mNativePaint, xfermodeNative);
|
||||
@@ -1021,7 +1021,7 @@ public class Paint {
|
||||
* @return effect
|
||||
*/
|
||||
public PathEffect setPathEffect(PathEffect effect) {
|
||||
int effectNative = 0;
|
||||
long effectNative = 0;
|
||||
if (effect != null) {
|
||||
effectNative = effect.native_instance;
|
||||
}
|
||||
@@ -1050,7 +1050,7 @@ public class Paint {
|
||||
* @return maskfilter
|
||||
*/
|
||||
public MaskFilter setMaskFilter(MaskFilter maskfilter) {
|
||||
int maskfilterNative = 0;
|
||||
long maskfilterNative = 0;
|
||||
if (maskfilter != null) {
|
||||
maskfilterNative = maskfilter.native_instance;
|
||||
}
|
||||
@@ -1081,7 +1081,7 @@ public class Paint {
|
||||
* @return typeface
|
||||
*/
|
||||
public Typeface setTypeface(Typeface typeface) {
|
||||
int typefaceNative = 0;
|
||||
long typefaceNative = 0;
|
||||
if (typeface != null) {
|
||||
typefaceNative = typeface.native_instance;
|
||||
}
|
||||
@@ -1112,7 +1112,7 @@ public class Paint {
|
||||
* @return rasterizer
|
||||
*/
|
||||
public Rasterizer setRasterizer(Rasterizer rasterizer) {
|
||||
int rasterizerNative = 0;
|
||||
long rasterizerNative = 0;
|
||||
if (rasterizer != null) {
|
||||
rasterizerNative = rasterizer.native_instance;
|
||||
}
|
||||
@@ -2207,68 +2207,68 @@ public class Paint {
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -38,6 +38,6 @@ public class PaintFlagsDrawFilter extends DrawFilter {
|
||||
mNativeInt = nativeConstructor(clearBits, setBits);
|
||||
}
|
||||
|
||||
private static native int nativeConstructor(int clearBits, int setBits);
|
||||
private static native long nativeConstructor(int clearBits, int setBits);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ public class Path {
|
||||
/**
|
||||
* @hide
|
||||
*/
|
||||
public final int mNativePath;
|
||||
public final long mNativePath;
|
||||
|
||||
/**
|
||||
* @hide
|
||||
@@ -56,7 +56,7 @@ public class Path {
|
||||
* @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;
|
||||
@@ -634,7 +634,7 @@ public class Path {
|
||||
* 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;
|
||||
@@ -673,7 +673,7 @@ public class Path {
|
||||
* 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;
|
||||
@@ -699,54 +699,54 @@ public class Path {
|
||||
}
|
||||
}
|
||||
|
||||
final int ni() {
|
||||
final long ni() {
|
||||
return mNativePath;
|
||||
}
|
||||
|
||||
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 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);
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public class PathDashPathEffect extends PathEffect {
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,6 +27,6 @@ public class PathEffect {
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ import java.io.OutputStream;
|
||||
*/
|
||||
public class Picture {
|
||||
private Canvas mRecordingCanvas;
|
||||
private final int mNativePicture;
|
||||
private final long mNativePicture;
|
||||
|
||||
/**
|
||||
* @hide
|
||||
@@ -63,7 +63,7 @@ public class Picture {
|
||||
* 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 @@ public class Picture {
|
||||
}
|
||||
}
|
||||
|
||||
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 @@ public class Picture {
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
@@ -29,5 +29,5 @@ public class PixelXorXfermode extends Xfermode {
|
||||
native_instance = nativeCreate(opColor);
|
||||
}
|
||||
|
||||
private static native int nativeCreate(int opColor);
|
||||
private static native long nativeCreate(int opColor);
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ public class PorterDuffColorFilter extends ColorFilter {
|
||||
nativeColorFilter = nCreatePorterDuffFilter(native_instance, srcColor, mode.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);
|
||||
}
|
||||
|
||||
@@ -32,5 +32,5 @@ public class PorterDuffXfermode extends Xfermode {
|
||||
native_instance = nativeCreateXfermode(mode.nativeInt);
|
||||
}
|
||||
|
||||
private static native int nativeCreateXfermode(int mode);
|
||||
private static native long nativeCreateXfermode(int mode);
|
||||
}
|
||||
|
||||
@@ -117,14 +117,14 @@ public class RadialGradient extends Shader {
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ public class Rasterizer {
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ public class Region implements Parcelable {
|
||||
/**
|
||||
* @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 @@ public class Region implements Parcelable {
|
||||
* @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 @@ public class Region implements Parcelable {
|
||||
}
|
||||
}
|
||||
|
||||
Region(int ni) {
|
||||
Region(long ni) {
|
||||
if (ni == 0) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
@@ -394,38 +394,38 @@ public class Region implements Parcelable {
|
||||
|
||||
/* 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);
|
||||
}
|
||||
|
||||
@@ -45,10 +45,10 @@ public class RegionIterator {
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,11 +28,11 @@ public class Shader {
|
||||
*
|
||||
* @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 @@ public class Shader {
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -27,6 +27,6 @@ public class SumPathEffect extends PathEffect {
|
||||
second.native_instance);
|
||||
}
|
||||
|
||||
private static native int nativeCreate(int first, int second);
|
||||
private static native long nativeCreate(long first, long second);
|
||||
}
|
||||
|
||||
|
||||
@@ -106,12 +106,12 @@ public class SweepGradient extends Shader {
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ public class TableMaskFilter extends MaskFilter {
|
||||
native_instance = nativeNewTable(table);
|
||||
}
|
||||
|
||||
private TableMaskFilter(int ni) {
|
||||
private TableMaskFilter(long ni) {
|
||||
native_instance = ni;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public class TableMaskFilter extends MaskFilter {
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ package android.graphics;
|
||||
|
||||
import android.content.res.AssetManager;
|
||||
import android.util.SparseArray;
|
||||
import android.util.LongSparseArray;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@@ -45,10 +46,10 @@ public class Typeface {
|
||||
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);
|
||||
|
||||
int native_instance;
|
||||
long native_instance;
|
||||
|
||||
// Style
|
||||
public static final int NORMAL = 0;
|
||||
@@ -100,7 +101,7 @@ public class Typeface {
|
||||
* @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) {
|
||||
@@ -170,7 +171,7 @@ public class Typeface {
|
||||
}
|
||||
|
||||
// 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");
|
||||
}
|
||||
@@ -214,15 +215,20 @@ public class Typeface {
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ public class Xfermode {
|
||||
}
|
||||
}
|
||||
|
||||
private static native void finalizer(int native_instance);
|
||||
private static native void finalizer(long native_instance);
|
||||
|
||||
int native_instance;
|
||||
long native_instance;
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ static void _nInit(JNIEnv *_env, jclass _this)
|
||||
gContextId = _env->GetFieldID(_this, "mContext", "I");
|
||||
|
||||
jclass bitmapClass = _env->FindClass("android/graphics/Bitmap");
|
||||
gNativeBitmapID = _env->GetFieldID(bitmapClass, "mNativeBitmap", "I");
|
||||
gNativeBitmapID = _env->GetFieldID(bitmapClass, "mNativeBitmap", "J");
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -522,7 +522,7 @@ static int
|
||||
nAllocationCreateFromBitmap(JNIEnv *_env, jobject _this, RsContext con, jint 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();
|
||||
@@ -538,7 +538,7 @@ static int
|
||||
nAllocationCreateBitmapBackedAllocation(JNIEnv *_env, jobject _this, RsContext con, jint 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();
|
||||
@@ -554,7 +554,7 @@ static int
|
||||
nAllocationCubeCreateFromBitmap(JNIEnv *_env, jobject _this, RsContext con, jint 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();
|
||||
@@ -570,7 +570,7 @@ static void
|
||||
nAllocationCopyFromBitmap(JNIEnv *_env, jobject _this, RsContext con, jint 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();
|
||||
@@ -587,7 +587,7 @@ static void
|
||||
nAllocationCopyToBitmap(JNIEnv *_env, jobject _this, RsContext con, jint alloc, jobject jbitmap)
|
||||
{
|
||||
SkBitmap const * nativeBitmap =
|
||||
(SkBitmap const *)_env->GetIntField(jbitmap, gNativeBitmapID);
|
||||
(SkBitmap const *)_env->GetLongField(jbitmap, gNativeBitmapID);
|
||||
const SkBitmap& bitmap(*nativeBitmap);
|
||||
|
||||
bitmap.lockPixels();
|
||||
|
||||
@@ -264,7 +264,7 @@ static jobject android_media_MediaMetadataRetriever_getFrameAtTime(JNIEnv *env,
|
||||
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 @@ static void android_media_MediaMetadataRetriever_native_init(JNIEnv *env)
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -288,8 +288,8 @@ public class AssetAtlasService extends IAssetAtlas.Stub {
|
||||
}
|
||||
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;
|
||||
|
||||
@@ -54,11 +54,11 @@ static struct {
|
||||
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 struct {
|
||||
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 @@ int register_android_server_AssetAtlasService(JNIEnv* env) {
|
||||
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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user