AArch64: Make graphics classes 64-bit compatible

This a merger of two commits submitted to AOSP by
the following authors:

ashok.bhat@arm.com, david.butcher@arm.coma
craig.barber@arm.com, kevin.petit@arm.com and
marcus.oakland@arm.com

Due to the very large number of internal conflicts, I
have chosen to cherry-pick this change instead
of letting it merge through AOSP because the merge
conflict resolution would be very hard to review.

Commit messages below:

================================================
AArch64: Make graphics classes 64-bit compatible

Changes in this patch include

[x] Long is used to store native pointers as they can
    be 64-bit.

[x] Some minor changes have been done to conform with
    standard JNI practice (e.g. use of jint instead of int
    in JNI function prototypes)

[x] AssetAtlasManager is not completely 64-bit compatible
    yet. Specifically mAtlasMap member has to be converted
    to hold native pointer using long. Added a TODO to
    AssetAtlasManager.java to indicate the change required.

Signed-off-by: Ashok Bhat <ashok.bhat@arm.com>
Signed-off-by: Craig Barber <craig.barber@arm.com>
Signed-off-by: Kévin PETIT <kevin.petit@arm.com>
Signed-off-by: Marcus Oakland <marcus.oakland@arm.com>

==================================================================

AArch64: Use long for pointers in graphics/Camera

For storing pointers, long is used in
android/graphics/Camera class, as native
pointers can be 64-bit.

In addition, some minor changes have been done
to conform with standard JNI practice (e.g. use of
jint instead of int in JNI function prototypes)

Signed-off-by: Ashok Bhat <ashok.bhat@arm.com>
Signed-off-by: Marcus Oakland <marcus.oakland@arm.com>

===================================================================

Change-Id: Ib3eab85ed97ea3e3c227617c20f8d213f17d4ba0
This commit is contained in:
Ashok Bhat
2014-01-20 20:08:01 +00:00
committed by Narayan Kamath
parent 4507ea9e3c
commit 18b4cbeede
88 changed files with 2651 additions and 2147 deletions

View File

@@ -41,7 +41,7 @@ public final class Bitmap implements Parcelable {
*
* @hide
*/
public final int mNativeBitmap;
public final long mNativeBitmap;
/**
* Backing buffer for the Bitmap.
@@ -113,7 +113,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) {
@@ -1536,7 +1536,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");
@@ -1570,9 +1570,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;
}
@@ -1593,56 +1593,57 @@ 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 nativeSetAlphaAndPremultiplied(int nBitmap, boolean hasAlpha,
private static native void nativePrepareToDraw(long nativeBitmap);
private static native boolean nativeHasAlpha(long nativeBitmap);
private static native void nativeSetAlphaAndPremultiplied(long nativeBitmap,
boolean hasAlpha,
boolean isPremul);
private static native boolean nativeHasMipMap(int nativeBitmap);
private static native void nativeSetHasMipMap(int nBitmap, boolean hasMipMap);
private static native boolean nativeSameAs(int nb0, int nb1);
/* package */ final int ni() {
private static native boolean nativeHasMipMap(long nativeBitmap);
private static native void nativeSetHasMipMap(long nativeBitmap, boolean hasMipMap);
private static native boolean nativeSameAs(long nativeBitmap0, long nativeBitmap1);
/* package */ final long ni() {
return mNativeBitmap;
}
}