summaryrefslogtreecommitdiffstats
path: root/opengl
diff options
context:
space:
mode:
authorAshok Bhat <ashok.bhat@arm.com>2014-01-27 16:58:46 +0000
committerDavid Butcher <david.butcher@arm.com>2014-01-31 16:27:30 +0000
commit863f98bbb3e234e18c62ce2678ae970b75995f69 (patch)
tree119cc10a408e32cd789a6d71244caaa33f096f8c /opengl
parente05b7b50e234e8ed2471f5ad96bb3d715067e9f3 (diff)
downloadframeworks_base-863f98bbb3e234e18c62ce2678ae970b75995f69.zip
frameworks_base-863f98bbb3e234e18c62ce2678ae970b75995f69.tar.gz
frameworks_base-863f98bbb3e234e18c62ce2678ae970b75995f69.tar.bz2
Use long to store pointers in GLES_JNI/EGL classes
Change-Id: I43b32f2a85c07b3f59c57e28e3d03e8d1cabcd8b Signed-off-by: Marcus Oakland <marcus.oakland@arm.com> Signed-off-by: Ashok Bhat <ashok.bhat@arm.com>
Diffstat (limited to 'opengl')
-rw-r--r--opengl/java/com/google/android/gles_jni/EGLConfigImpl.java6
-rw-r--r--opengl/java/com/google/android/gles_jni/EGLContextImpl.java16
-rw-r--r--opengl/java/com/google/android/gles_jni/EGLDisplayImpl.java12
-rw-r--r--opengl/java/com/google/android/gles_jni/EGLImpl.java30
-rw-r--r--opengl/java/com/google/android/gles_jni/EGLSurfaceImpl.java14
5 files changed, 48 insertions, 30 deletions
diff --git a/opengl/java/com/google/android/gles_jni/EGLConfigImpl.java b/opengl/java/com/google/android/gles_jni/EGLConfigImpl.java
index c2f4400..1902a40 100644
--- a/opengl/java/com/google/android/gles_jni/EGLConfigImpl.java
+++ b/opengl/java/com/google/android/gles_jni/EGLConfigImpl.java
@@ -19,13 +19,13 @@ package com.google.android.gles_jni;
import javax.microedition.khronos.egl.*;
public class EGLConfigImpl extends EGLConfig {
- private int mEGLConfig;
+ private long mEGLConfig;
- EGLConfigImpl(int config) {
+ EGLConfigImpl(long config) {
mEGLConfig = config;
}
- int get() {
+ long get() {
return mEGLConfig;
}
}
diff --git a/opengl/java/com/google/android/gles_jni/EGLContextImpl.java b/opengl/java/com/google/android/gles_jni/EGLContextImpl.java
index cd36099..47369ac 100644
--- a/opengl/java/com/google/android/gles_jni/EGLContextImpl.java
+++ b/opengl/java/com/google/android/gles_jni/EGLContextImpl.java
@@ -21,13 +21,13 @@ import javax.microedition.khronos.opengles.GL;
public class EGLContextImpl extends EGLContext {
private GLImpl mGLContext;
- int mEGLContext;
-
- public EGLContextImpl(int ctx) {
+ long mEGLContext;
+
+ public EGLContextImpl(long ctx) {
mEGLContext = ctx;
mGLContext = new GLImpl();
}
-
+
@Override
public GL getGL() {
return mGLContext;
@@ -45,6 +45,12 @@ public class EGLContextImpl extends EGLContext {
@Override
public int hashCode() {
- return mEGLContext;
+ /*
+ * Based on the algorithm suggested in
+ * http://developer.android.com/reference/java/lang/Object.html
+ */
+ int result = 17;
+ result = 31 * result + (int) (mEGLContext ^ (mEGLContext >>> 32));
+ return result;
}
}
diff --git a/opengl/java/com/google/android/gles_jni/EGLDisplayImpl.java b/opengl/java/com/google/android/gles_jni/EGLDisplayImpl.java
index e6c9817..9b932fc 100644
--- a/opengl/java/com/google/android/gles_jni/EGLDisplayImpl.java
+++ b/opengl/java/com/google/android/gles_jni/EGLDisplayImpl.java
@@ -19,9 +19,9 @@ package com.google.android.gles_jni;
import javax.microedition.khronos.egl.*;
public class EGLDisplayImpl extends EGLDisplay {
- int mEGLDisplay;
+ long mEGLDisplay;
- public EGLDisplayImpl(int dpy) {
+ public EGLDisplayImpl(long dpy) {
mEGLDisplay = dpy;
}
@@ -38,6 +38,12 @@ public class EGLDisplayImpl extends EGLDisplay {
@Override
public int hashCode() {
- return mEGLDisplay;
+ /*
+ * Based on the algorithm suggested in
+ * http://developer.android.com/reference/java/lang/Object.html
+ */
+ int result = 17;
+ result = 31 * result + (int) (mEGLDisplay ^ (mEGLDisplay >>> 32));
+ return result;
}
}
diff --git a/opengl/java/com/google/android/gles_jni/EGLImpl.java b/opengl/java/com/google/android/gles_jni/EGLImpl.java
index 64a54c2..41fb072 100644
--- a/opengl/java/com/google/android/gles_jni/EGLImpl.java
+++ b/opengl/java/com/google/android/gles_jni/EGLImpl.java
@@ -51,7 +51,7 @@ public class EGLImpl implements EGL10 {
public static native int getInitCount(EGLDisplay display);
public EGLContext eglCreateContext(EGLDisplay display, EGLConfig config, EGLContext share_context, int[] attrib_list) {
- int eglContextId = _eglCreateContext(display, config, share_context, attrib_list);
+ long eglContextId = _eglCreateContext(display, config, share_context, attrib_list);
if (eglContextId == 0) {
return EGL10.EGL_NO_CONTEXT;
}
@@ -59,7 +59,7 @@ public class EGLImpl implements EGL10 {
}
public EGLSurface eglCreatePbufferSurface(EGLDisplay display, EGLConfig config, int[] attrib_list) {
- int eglSurfaceId = _eglCreatePbufferSurface(display, config, attrib_list);
+ long eglSurfaceId = _eglCreatePbufferSurface(display, config, attrib_list);
if (eglSurfaceId == 0) {
return EGL10.EGL_NO_SURFACE;
}
@@ -87,7 +87,7 @@ public class EGLImpl implements EGL10 {
sur = (Surface) native_window;
}
- int eglSurfaceId;
+ long eglSurfaceId;
if (sur != null) {
eglSurfaceId = _eglCreateWindowSurface(display, config, sur, attrib_list);
} else if (native_window instanceof SurfaceTexture) {
@@ -106,7 +106,7 @@ public class EGLImpl implements EGL10 {
}
public synchronized EGLDisplay eglGetDisplay(Object native_display) {
- int value = _eglGetDisplay(native_display);
+ long value = _eglGetDisplay(native_display);
if (value == 0) {
return EGL10.EGL_NO_DISPLAY;
}
@@ -116,7 +116,7 @@ public class EGLImpl implements EGL10 {
}
public synchronized EGLContext eglGetCurrentContext() {
- int value = _eglGetCurrentContext();
+ long value = _eglGetCurrentContext();
if (value == 0) {
return EGL10.EGL_NO_CONTEXT;
}
@@ -126,7 +126,7 @@ public class EGLImpl implements EGL10 {
}
public synchronized EGLDisplay eglGetCurrentDisplay() {
- int value = _eglGetCurrentDisplay();
+ long value = _eglGetCurrentDisplay();
if (value == 0) {
return EGL10.EGL_NO_DISPLAY;
}
@@ -136,7 +136,7 @@ public class EGLImpl implements EGL10 {
}
public synchronized EGLSurface eglGetCurrentSurface(int readdraw) {
- int value = _eglGetCurrentSurface(readdraw);
+ long value = _eglGetCurrentSurface(readdraw);
if (value == 0) {
return EGL10.EGL_NO_SURFACE;
}
@@ -145,15 +145,15 @@ public class EGLImpl implements EGL10 {
return mSurface;
}
- private native int _eglCreateContext(EGLDisplay display, EGLConfig config, EGLContext share_context, int[] attrib_list);
- private native int _eglCreatePbufferSurface(EGLDisplay display, EGLConfig config, int[] attrib_list);
+ private native long _eglCreateContext(EGLDisplay display, EGLConfig config, EGLContext share_context, int[] attrib_list);
+ private native long _eglCreatePbufferSurface(EGLDisplay display, EGLConfig config, int[] attrib_list);
private native void _eglCreatePixmapSurface(EGLSurface sur, EGLDisplay display, EGLConfig config, Object native_pixmap, int[] attrib_list);
- private native int _eglCreateWindowSurface(EGLDisplay display, EGLConfig config, Object native_window, int[] attrib_list);
- private native int _eglCreateWindowSurfaceTexture(EGLDisplay display, EGLConfig config, Object native_window, int[] attrib_list);
- private native int _eglGetDisplay(Object native_display);
- private native int _eglGetCurrentContext();
- private native int _eglGetCurrentDisplay();
- private native int _eglGetCurrentSurface(int readdraw);
+ private native long _eglCreateWindowSurface(EGLDisplay display, EGLConfig config, Object native_window, int[] attrib_list);
+ private native long _eglCreateWindowSurfaceTexture(EGLDisplay display, EGLConfig config, Object native_window, int[] attrib_list);
+ private native long _eglGetDisplay(Object native_display);
+ private native long _eglGetCurrentContext();
+ private native long _eglGetCurrentDisplay();
+ private native long _eglGetCurrentSurface(int readdraw);
native private static void _nativeClassInit();
static { _nativeClassInit(); }
diff --git a/opengl/java/com/google/android/gles_jni/EGLSurfaceImpl.java b/opengl/java/com/google/android/gles_jni/EGLSurfaceImpl.java
index e7f15dc..7a3ed24 100644
--- a/opengl/java/com/google/android/gles_jni/EGLSurfaceImpl.java
+++ b/opengl/java/com/google/android/gles_jni/EGLSurfaceImpl.java
@@ -19,13 +19,13 @@ package com.google.android.gles_jni;
import javax.microedition.khronos.egl.*;
public class EGLSurfaceImpl extends EGLSurface {
- int mEGLSurface;
- private int mNativePixelRef;
+ long mEGLSurface;
+ private long mNativePixelRef;
public EGLSurfaceImpl() {
mEGLSurface = 0;
mNativePixelRef = 0;
}
- public EGLSurfaceImpl(int surface) {
+ public EGLSurfaceImpl(long surface) {
mEGLSurface = surface;
mNativePixelRef = 0;
}
@@ -43,6 +43,12 @@ public class EGLSurfaceImpl extends EGLSurface {
@Override
public int hashCode() {
- return mEGLSurface;
+ /*
+ * Based on the algorithm suggested in
+ * http://developer.android.com/reference/java/lang/Object.html
+ */
+ int result = 17;
+ result = 31 * result + (int) (mEGLSurface ^ (mEGLSurface >>> 32));
+ return result;
}
}