зеркало из https://github.com/mozilla/pjs.git
Removing this awesome template code because it causes library load crashes :(
This commit is contained in:
Родитель
829c9c1dff
Коммит
cc147bd7d1
|
@ -177,10 +177,7 @@ AndroidBridge::Init(JNIEnv *jEnv,
|
|||
jFlexSurfaceView = (jclass) jEnv->NewGlobalRef(jEnv->FindClass("org/mozilla/gecko/gfx/FlexibleGLSurfaceView"));
|
||||
|
||||
AndroidGLController::Init(jEnv);
|
||||
AndroidEGLObject<AndroidEGLDisplayInfo>::Init(jEnv);
|
||||
AndroidEGLObject<AndroidEGLConfigInfo>::Init(jEnv);
|
||||
AndroidEGLObject<AndroidEGLContextInfo>::Init(jEnv);
|
||||
AndroidEGLObject<AndroidEGLSurfaceInfo>::Init(jEnv);
|
||||
AndroidEGLObject::Init(jEnv);
|
||||
InitAndroidJavaWrappers(jEnv);
|
||||
|
||||
// jEnv should NOT be cached here by anything -- the jEnv here
|
||||
|
|
|
@ -40,30 +40,37 @@
|
|||
|
||||
static AndroidGLController sController;
|
||||
|
||||
template<>
|
||||
const char *AndroidEGLDisplay::sClassName = "com/google/android/gles_jni/EGLDisplayImpl";
|
||||
template<>
|
||||
const char *AndroidEGLDisplay::sPointerFieldName = "mEGLDisplay";
|
||||
template<>
|
||||
jfieldID AndroidEGLDisplay::jPointerField = 0;
|
||||
template<>
|
||||
const char *AndroidEGLConfig::sClassName = "com/google/android/gles_jni/EGLConfigImpl";
|
||||
template<>
|
||||
const char *AndroidEGLConfig::sPointerFieldName = "mEGLConfig";
|
||||
template<>
|
||||
jfieldID AndroidEGLConfig::jPointerField = 0;
|
||||
template<>
|
||||
const char *AndroidEGLContext::sClassName = "com/google/android/gles_jni/EGLContextImpl";
|
||||
template<>
|
||||
const char *AndroidEGLContext::sPointerFieldName = "mEGLContext";
|
||||
template<>
|
||||
jfieldID AndroidEGLContext::jPointerField = 0;
|
||||
template<>
|
||||
const char *AndroidEGLSurface::sClassName = "com/google/android/gles_jni/EGLSurfaceImpl";
|
||||
template<>
|
||||
const char *AndroidEGLSurface::sPointerFieldName = "mEGLSurface";
|
||||
template<>
|
||||
jfieldID AndroidEGLSurface::jPointerField = 0;
|
||||
static const char *sEGLDisplayClassName = "com/google/android/gles_jni/EGLDisplayImpl";
|
||||
static const char *sEGLDisplayPointerFieldName = "mEGLDisplay";
|
||||
static jfieldID jEGLDisplayPointerField = 0;
|
||||
|
||||
static const char *sEGLConfigClassName = "com/google/android/gles_jni/EGLConfigImpl";
|
||||
static const char *sEGLConfigPointerFieldName = "mEGLConfig";
|
||||
static jfieldID jEGLConfigPointerField = 0;
|
||||
|
||||
static const char *sEGLContextClassName = "com/google/android/gles_jni/EGLContextImpl";
|
||||
static const char *sEGLContextPointerFieldName = "mEGLContext";
|
||||
static jfieldID jEGLContextPointerField = 0;
|
||||
|
||||
static const char *sEGLSurfaceClassName = "com/google/android/gles_jni/EGLSurfaceImpl";
|
||||
static const char *sEGLSurfacePointerFieldName = "mEGLSurface";
|
||||
static jfieldID jEGLSurfacePointerField = 0;
|
||||
|
||||
void AndroidEGLObject::Init(JNIEnv* aJEnv) {
|
||||
jclass jClass;
|
||||
jClass = reinterpret_cast<jclass>
|
||||
(aJEnv->NewGlobalRef(aJEnv->FindClass(sEGLDisplayClassName)));
|
||||
jEGLDisplayPointerField = aJEnv->GetFieldID(jClass, sEGLDisplayPointerFieldName, "I");
|
||||
jClass = reinterpret_cast<jclass>
|
||||
(aJEnv->NewGlobalRef(aJEnv->FindClass(sEGLConfigClassName)));
|
||||
jEGLConfigPointerField = aJEnv->GetFieldID(jClass, sEGLConfigPointerFieldName, "I");
|
||||
jClass = reinterpret_cast<jclass>
|
||||
(aJEnv->NewGlobalRef(aJEnv->FindClass(sEGLContextClassName)));
|
||||
jEGLContextPointerField = aJEnv->GetFieldID(jClass, sEGLContextPointerFieldName, "I");
|
||||
jClass = reinterpret_cast<jclass>
|
||||
(aJEnv->NewGlobalRef(aJEnv->FindClass(sEGLSurfaceClassName)));
|
||||
jEGLSurfacePointerField = aJEnv->GetFieldID(jClass, sEGLSurfacePointerFieldName, "I");
|
||||
}
|
||||
|
||||
jmethodID AndroidGLController::jSetGLVersionMethod = 0;
|
||||
jmethodID AndroidGLController::jInitGLContextMethod = 0;
|
||||
|
@ -149,29 +156,29 @@ AndroidGLController::DisposeGLContext()
|
|||
EGLDisplay
|
||||
AndroidGLController::GetEGLDisplay()
|
||||
{
|
||||
AndroidEGLDisplay jEGLDisplay(mJEnv, mJEnv->CallObjectMethod(mJObj, jGetEGLDisplayMethod));
|
||||
return *jEGLDisplay;
|
||||
jobject jObj = mJEnv->CallObjectMethod(mJObj, jGetEGLDisplayMethod);
|
||||
return reinterpret_cast<EGLDisplay>(mJEnv->GetIntField(jObj, jEGLDisplayPointerField));
|
||||
}
|
||||
|
||||
EGLConfig
|
||||
AndroidGLController::GetEGLConfig()
|
||||
{
|
||||
AndroidEGLConfig jEGLConfig(mJEnv, mJEnv->CallObjectMethod(mJObj, jGetEGLConfigMethod));
|
||||
return *jEGLConfig;
|
||||
jobject jObj = mJEnv->CallObjectMethod(mJObj, jGetEGLConfigMethod);
|
||||
return reinterpret_cast<EGLConfig>(mJEnv->GetIntField(jObj, jEGLConfigPointerField));
|
||||
}
|
||||
|
||||
EGLContext
|
||||
AndroidGLController::GetEGLContext()
|
||||
{
|
||||
AndroidEGLContext jEGLContext(mJEnv, mJEnv->CallObjectMethod(mJObj, jGetEGLContextMethod));
|
||||
return *jEGLContext;
|
||||
jobject jObj = mJEnv->CallObjectMethod(mJObj, jGetEGLContextMethod);
|
||||
return reinterpret_cast<EGLContext>(mJEnv->GetIntField(jObj, jEGLContextPointerField));
|
||||
}
|
||||
|
||||
EGLSurface
|
||||
AndroidGLController::GetEGLSurface()
|
||||
{
|
||||
AndroidEGLSurface jEGLSurface(mJEnv, mJEnv->CallObjectMethod(mJObj, jGetEGLSurfaceMethod));
|
||||
return *jEGLSurface;
|
||||
jobject jObj = mJEnv->CallObjectMethod(mJObj, jGetEGLSurfaceMethod);
|
||||
return reinterpret_cast<EGLSurface>(mJEnv->GetIntField(jObj, jEGLSurfacePointerField));
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -46,19 +46,16 @@
|
|||
#include <pthread.h>
|
||||
#include <android/log.h>
|
||||
|
||||
template<typename T>
|
||||
typedef void *NativeType;
|
||||
|
||||
class AndroidEGLObject {
|
||||
public:
|
||||
AndroidEGLObject(JNIEnv* aJEnv, jobject aJObj)
|
||||
: mPtr(reinterpret_cast<typename T::NativeType>(aJEnv->GetIntField(aJObj, jPointerField))) {}
|
||||
: mPtr(reinterpret_cast<NativeType>(aJEnv->GetIntField(aJObj, jPointerField))) {}
|
||||
|
||||
static void Init(JNIEnv* aJEnv) {
|
||||
jclass jClass = reinterpret_cast<jclass>
|
||||
(aJEnv->NewGlobalRef(aJEnv->FindClass(sClassName)));
|
||||
jPointerField = aJEnv->GetFieldID(jClass, sPointerFieldName, "I");
|
||||
}
|
||||
static void Init(JNIEnv* aJEnv);
|
||||
|
||||
typename T::NativeType const& operator*() const {
|
||||
NativeType const& operator*() const {
|
||||
return mPtr;
|
||||
}
|
||||
|
||||
|
@ -67,7 +64,7 @@ private:
|
|||
static const char* sClassName;
|
||||
static const char* sPointerFieldName;
|
||||
|
||||
const typename T::NativeType mPtr;
|
||||
const NativeType mPtr;
|
||||
};
|
||||
|
||||
typedef void *EGLConfig;
|
||||
|
@ -75,39 +72,6 @@ typedef void *EGLContext;
|
|||
typedef void *EGLDisplay;
|
||||
typedef void *EGLSurface;
|
||||
|
||||
class AndroidEGLDisplayInfo {
|
||||
public:
|
||||
typedef EGLDisplay NativeType;
|
||||
private:
|
||||
AndroidEGLDisplayInfo() {}
|
||||
};
|
||||
|
||||
class AndroidEGLConfigInfo {
|
||||
public:
|
||||
typedef EGLConfig NativeType;
|
||||
private:
|
||||
AndroidEGLConfigInfo() {}
|
||||
};
|
||||
|
||||
class AndroidEGLContextInfo {
|
||||
public:
|
||||
typedef EGLContext NativeType;
|
||||
private:
|
||||
AndroidEGLContextInfo() {}
|
||||
};
|
||||
|
||||
class AndroidEGLSurfaceInfo {
|
||||
public:
|
||||
typedef EGLSurface NativeType;
|
||||
private:
|
||||
AndroidEGLSurfaceInfo() {}
|
||||
};
|
||||
|
||||
typedef AndroidEGLObject<AndroidEGLDisplayInfo> AndroidEGLDisplay;
|
||||
typedef AndroidEGLObject<AndroidEGLConfigInfo> AndroidEGLConfig;
|
||||
typedef AndroidEGLObject<AndroidEGLContextInfo> AndroidEGLContext;
|
||||
typedef AndroidEGLObject<AndroidEGLSurfaceInfo> AndroidEGLSurface;
|
||||
|
||||
class AndroidGLController {
|
||||
public:
|
||||
static void Init(JNIEnv* aJEnv);
|
||||
|
|
|
@ -209,8 +209,6 @@ AndroidGeckoSurfaceView::InitGeckoSurfaceViewClass(JNIEnv *jEnv)
|
|||
#else
|
||||
initInit();
|
||||
|
||||
jGeckoSurfaceViewClass = getClassGlobalRef("org/mozilla/gecko/gfx/layers/OGLSurfaceView");
|
||||
|
||||
jGetHolderMethod = getMethod("getHolder", "()Landroid/view/SurfaceHolder;");
|
||||
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче