mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 841503 - Delete a bunch of non-OMTC android codepaths. r=BenWa,snorp
This commit is contained in:
parent
0a21e6f55c
commit
77228f863b
@ -2110,22 +2110,7 @@ CreateSurfaceForWindow(nsIWidget *aWidget, EGLConfig config)
|
||||
sEGLLibrary.DumpEGLConfig(config);
|
||||
#endif
|
||||
|
||||
#if defined(MOZ_WIDGET_ANDROID)
|
||||
|
||||
// On Android, we have to ask Java to make the eglCreateWindowSurface
|
||||
// call for us. See GLHelpers.java for a description of why.
|
||||
//
|
||||
// We also only have one true "window", so we just use it directly and ignore
|
||||
// what was passed in.
|
||||
AndroidGeckoSurfaceView& sview = mozilla::AndroidBridge::Bridge()->SurfaceView();
|
||||
if (sview.isNull()) {
|
||||
printf_stderr("got null surface\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
surface = mozilla::AndroidBridge::Bridge()->
|
||||
CallEglCreateWindowSurface(EGL_DISPLAY(), config, sview);
|
||||
#else
|
||||
#if !defined(MOZ_WIDGET_ANDROID)
|
||||
surface = sEGLLibrary.fCreateWindowSurface(EGL_DISPLAY(), config, GET_NATIVE_WINDOW(aWidget), 0);
|
||||
#endif
|
||||
|
||||
|
@ -182,13 +182,6 @@ AndroidBridge::Init(JNIEnv *jEnv,
|
||||
jThumbnailHelperClass = (jclass) jEnv->NewGlobalRef(jEnv->FindClass("org/mozilla/gecko/ThumbnailHelper"));
|
||||
jNotifyThumbnail = jEnv->GetStaticMethodID(jThumbnailHelperClass, "notifyThumbnail", "(Ljava/nio/ByteBuffer;IZ)V");
|
||||
|
||||
jEGLContextClass = (jclass) jEnv->NewGlobalRef(jEnv->FindClass("javax/microedition/khronos/egl/EGLContext"));
|
||||
jEGL10Class = (jclass) jEnv->NewGlobalRef(jEnv->FindClass("javax/microedition/khronos/egl/EGL10"));
|
||||
jEGLSurfaceImplClass = (jclass) jEnv->NewGlobalRef(jEnv->FindClass("com/google/android/gles_jni/EGLSurfaceImpl"));
|
||||
jEGLContextImplClass = (jclass) jEnv->NewGlobalRef(jEnv->FindClass("com/google/android/gles_jni/EGLContextImpl"));
|
||||
jEGLConfigImplClass = (jclass) jEnv->NewGlobalRef(jEnv->FindClass("com/google/android/gles_jni/EGLConfigImpl"));
|
||||
jEGLDisplayImplClass = (jclass) jEnv->NewGlobalRef(jEnv->FindClass("com/google/android/gles_jni/EGLDisplayImpl"));
|
||||
|
||||
jStringClass = (jclass) jEnv->NewGlobalRef(jEnv->FindClass("java/lang/String"));
|
||||
|
||||
jSurfaceClass = (jclass) jEnv->NewGlobalRef(jEnv->FindClass("android/view/Surface"));
|
||||
@ -208,7 +201,6 @@ AndroidBridge::Init(JNIEnv *jEnv,
|
||||
jRegisterSurfaceTextureFrameListener = jEnv->GetStaticMethodID(jGeckoAppShellClass, "registerSurfaceTextureFrameListener", "(Ljava/lang/Object;I)V");
|
||||
jUnregisterSurfaceTextureFrameListener = jEnv->GetStaticMethodID(jGeckoAppShellClass, "unregisterSurfaceTextureFrameListener", "(Ljava/lang/Object;)V");
|
||||
|
||||
#ifdef MOZ_ANDROID_OMTC
|
||||
jPumpMessageLoop = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "pumpMessageLoop", "()Z");
|
||||
|
||||
jAddPluginView = jEnv->GetStaticMethodID(jGeckoAppShellClass, "addPluginView", "(Landroid/view/View;IIIIZ)V");
|
||||
@ -218,10 +210,6 @@ AndroidBridge::Init(JNIEnv *jEnv,
|
||||
|
||||
AndroidGLController::Init(jEnv);
|
||||
AndroidEGLObject::Init(jEnv);
|
||||
#else
|
||||
jAddPluginView = jEnv->GetStaticMethodID(jGeckoAppShellClass, "addPluginView", "(Landroid/view/View;DDDD)V");
|
||||
jRemovePluginView = jEnv->GetStaticMethodID(jGeckoAppShellClass, "removePluginView", "(Landroid/view/View;)V");
|
||||
#endif
|
||||
|
||||
InitAndroidJavaWrappers(jEnv);
|
||||
|
||||
@ -1083,12 +1071,6 @@ AndroidBridge::GetShowPasswordSetting()
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
AndroidBridge::SetSurfaceView(jobject obj)
|
||||
{
|
||||
mSurfaceView.Init(obj);
|
||||
}
|
||||
|
||||
void
|
||||
AndroidBridge::SetLayerClient(JNIEnv* env, jobject jobj)
|
||||
{
|
||||
@ -1111,12 +1093,10 @@ AndroidBridge::SetLayerClient(JNIEnv* env, jobject jobj)
|
||||
|
||||
if (resetting) {
|
||||
RegisterCompositor(env, true);
|
||||
#ifdef MOZ_ANDROID_OMTC
|
||||
// since we are re-linking the new java objects to Gecko, we need to get
|
||||
// the viewport from the compositor (since the Java copy was thrown away)
|
||||
// and we do that by setting the first-paint flag.
|
||||
nsWindow::ForceIsFirstPaint();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -1133,58 +1113,6 @@ AndroidBridge::ShowInputMethodPicker()
|
||||
env->CallStaticVoidMethod(mGeckoAppShellClass, jShowInputMethodPicker);
|
||||
}
|
||||
|
||||
void *
|
||||
AndroidBridge::CallEglCreateWindowSurface(void *dpy, void *config, AndroidGeckoSurfaceView &sview)
|
||||
{
|
||||
ALOG_BRIDGE("AndroidBridge::CallEglCreateWindowSurface");
|
||||
|
||||
JNIEnv *env = GetJNIForThread(); // called on the compositor thread
|
||||
if (!env)
|
||||
return NULL;
|
||||
|
||||
AutoLocalJNIFrame jniFrame(env);
|
||||
|
||||
/*
|
||||
* This is basically:
|
||||
*
|
||||
* s = EGLContext.getEGL().eglCreateWindowSurface(new EGLDisplayImpl(dpy),
|
||||
* new EGLConfigImpl(config),
|
||||
* view.getHolder(), null);
|
||||
* return s.mEGLSurface;
|
||||
*
|
||||
* We can't do it from java, because the EGLConfigImpl constructor is private.
|
||||
*/
|
||||
|
||||
jobject surfaceHolder = sview.GetSurfaceHolder(&jniFrame);
|
||||
if (!surfaceHolder)
|
||||
return nullptr;
|
||||
|
||||
// grab some fields and methods we'll need
|
||||
jmethodID constructConfig = env->GetMethodID(jEGLConfigImplClass, "<init>", "(I)V");
|
||||
jmethodID constructDisplay = env->GetMethodID(jEGLDisplayImplClass, "<init>", "(I)V");
|
||||
|
||||
jmethodID getEgl = env->GetStaticMethodID(jEGLContextClass, "getEGL", "()Ljavax/microedition/khronos/egl/EGL;");
|
||||
jmethodID createWindowSurface = env->GetMethodID(jEGL10Class, "eglCreateWindowSurface", "(Ljavax/microedition/khronos/egl/EGLDisplay;Ljavax/microedition/khronos/egl/EGLConfig;Ljava/lang/Object;[I)Ljavax/microedition/khronos/egl/EGLSurface;");
|
||||
|
||||
jobject egl = env->CallStaticObjectMethod(jEGLContextClass, getEgl);
|
||||
if (jniFrame.CheckForException())
|
||||
return nullptr;
|
||||
|
||||
jobject jdpy = env->NewObject(jEGLDisplayImplClass, constructDisplay, (int) dpy);
|
||||
jobject jconf = env->NewObject(jEGLConfigImplClass, constructConfig, (int) config);
|
||||
|
||||
// make the call
|
||||
jobject surf = env->CallObjectMethod(egl, createWindowSurface, jdpy, jconf, surfaceHolder, NULL);
|
||||
if (jniFrame.CheckForException() || !surf)
|
||||
return nullptr;
|
||||
|
||||
jfieldID sfield = env->GetFieldID(jEGLSurfaceImplClass, "mEGLSurface", "I");
|
||||
|
||||
jint realSurface = env->GetIntField(surf, sfield);
|
||||
|
||||
return (void*) realSurface;
|
||||
}
|
||||
|
||||
static AndroidGLController sController;
|
||||
|
||||
void
|
||||
@ -2029,15 +1957,6 @@ AndroidBridge::ReleaseNativeWindowForSurfaceTexture(void *window)
|
||||
// FIXME: we don't ref the pointer we get, so nothing to do currently. We should ref it.
|
||||
}
|
||||
|
||||
bool
|
||||
AndroidBridge::SetNativeWindowFormat(void *window, int width, int height, int format)
|
||||
{
|
||||
if (mHasNativeWindowAccess)
|
||||
return ANativeWindow_setBuffersGeometry(window, width, height, format) == 0;
|
||||
else
|
||||
return false; //unimplemented in fallback
|
||||
}
|
||||
|
||||
bool
|
||||
AndroidBridge::LockWindow(void *window, unsigned char **bits, int *width, int *height, int *format, int *stride)
|
||||
{
|
||||
@ -2329,7 +2248,6 @@ AndroidBridge::UnlockScreenOrientation()
|
||||
bool
|
||||
AndroidBridge::PumpMessageLoop()
|
||||
{
|
||||
#if MOZ_ANDROID_OMTC
|
||||
JNIEnv* env = GetJNIEnv();
|
||||
if (!env)
|
||||
return false;
|
||||
@ -2340,8 +2258,6 @@ AndroidBridge::PumpMessageLoop()
|
||||
return false;
|
||||
|
||||
return env->CallStaticBooleanMethod(mGeckoAppShellClass, jPumpMessageLoop);
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
@ -2362,9 +2278,7 @@ AndroidBridge::NotifyWakeLockChanged(const nsAString& topic, const nsAString& st
|
||||
void
|
||||
AndroidBridge::ScheduleComposite()
|
||||
{
|
||||
#if MOZ_ANDROID_OMTC
|
||||
nsWindow::ScheduleComposite();
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
@ -2461,16 +2375,10 @@ AndroidBridge::AddPluginView(jobject view, const gfxRect& rect, bool isFullScree
|
||||
|
||||
AutoLocalJNIFrame jniFrame(env);
|
||||
|
||||
#if MOZ_ANDROID_OMTC
|
||||
env->CallStaticVoidMethod(sBridge->mGeckoAppShellClass,
|
||||
sBridge->jAddPluginView, view,
|
||||
(int)rect.x, (int)rect.y, (int)rect.width, (int)rect.height,
|
||||
isFullScreen);
|
||||
#else
|
||||
env->CallStaticVoidMethod(sBridge->mGeckoAppShellClass,
|
||||
sBridge->jAddPluginView, view,
|
||||
rect.x, rect.y, rect.width, rect.height);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -180,9 +180,6 @@ public:
|
||||
void SetLayerClient(JNIEnv* env, jobject jobj);
|
||||
AndroidGeckoLayerClient &GetLayerClient() { return *mLayerClient; }
|
||||
|
||||
void SetSurfaceView(jobject jobj);
|
||||
AndroidGeckoSurfaceView& SurfaceView() { return mSurfaceView; }
|
||||
|
||||
bool GetHandlersForURL(const char *aURL,
|
||||
nsIMutableArray* handlersArray = nullptr,
|
||||
nsIHandlerApp **aDefaultApp = nullptr,
|
||||
@ -257,9 +254,6 @@ public:
|
||||
|
||||
bool GetShowPasswordSetting();
|
||||
|
||||
/* See GLHelpers.java as to why this is needed */
|
||||
void *CallEglCreateWindowSurface(void *dpy, void *config, AndroidGeckoSurfaceView& surfaceView);
|
||||
|
||||
// Switch Java to composite with the Gecko Compositor thread
|
||||
void RegisterCompositor(JNIEnv* env = NULL, bool resetting = false);
|
||||
EGLSurface ProvideEGLSurface(bool waitUntilValid);
|
||||
@ -302,8 +296,6 @@ public:
|
||||
void *AcquireNativeWindowFromSurfaceTexture(JNIEnv* aEnv, jobject aSurface);
|
||||
void ReleaseNativeWindowForSurfaceTexture(void *window);
|
||||
|
||||
bool SetNativeWindowFormat(void *window, int width, int height, int format);
|
||||
|
||||
bool LockWindow(void *window, unsigned char **bits, int *width, int *height, int *format, int *stride);
|
||||
bool UnlockWindow(void *window);
|
||||
|
||||
@ -382,9 +374,6 @@ protected:
|
||||
JNIEnv *mJNIEnv;
|
||||
void *mThread;
|
||||
|
||||
// the GeckoSurfaceView
|
||||
AndroidGeckoSurfaceView mSurfaceView;
|
||||
|
||||
AndroidGeckoLayerClient *mLayerClient;
|
||||
|
||||
// the GeckoAppShell java class
|
||||
@ -507,14 +496,6 @@ protected:
|
||||
jclass jSurfaceClass;
|
||||
jfieldID jSurfacePointerField;
|
||||
|
||||
// stuff we need for CallEglCreateWindowSurface
|
||||
jclass jEGLSurfaceImplClass;
|
||||
jclass jEGLContextImplClass;
|
||||
jclass jEGLConfigImplClass;
|
||||
jclass jEGLDisplayImplClass;
|
||||
jclass jEGLContextClass;
|
||||
jclass jEGL10Class;
|
||||
|
||||
jclass jLayerView;
|
||||
jmethodID jRegisterCompositorMethod;
|
||||
|
||||
|
@ -661,8 +661,6 @@ Java_org_mozilla_gecko_GeckoSmsManager_notifyReadingMessageListFailed(JNIEnv* je
|
||||
|
||||
#endif // MOZ_WEBSMS_BACKEND
|
||||
|
||||
#ifdef MOZ_ANDROID_OMTC
|
||||
|
||||
NS_EXPORT void JNICALL
|
||||
Java_org_mozilla_gecko_GeckoAppShell_scheduleComposite(JNIEnv*, jclass)
|
||||
{
|
||||
@ -871,5 +869,4 @@ Java_org_mozilla_gecko_GeckoAppShell_onSurfaceTextureFrameAvailable(JNIEnv* jenv
|
||||
st->NotifyFrameAvailable();
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
@ -109,16 +109,6 @@ jfieldID AndroidProgressiveUpdateData::jHeightField = 0;
|
||||
jfieldID AndroidProgressiveUpdateData::jScaleField = 0;
|
||||
jfieldID AndroidProgressiveUpdateData::jShouldAbortField = 0;
|
||||
|
||||
jclass AndroidGeckoSurfaceView::jGeckoSurfaceViewClass = 0;
|
||||
jmethodID AndroidGeckoSurfaceView::jBeginDrawingMethod = 0;
|
||||
jmethodID AndroidGeckoSurfaceView::jEndDrawingMethod = 0;
|
||||
jmethodID AndroidGeckoSurfaceView::jDraw2DBitmapMethod = 0;
|
||||
jmethodID AndroidGeckoSurfaceView::jDraw2DBufferMethod = 0;
|
||||
jmethodID AndroidGeckoSurfaceView::jGetSoftwareDrawBitmapMethod = 0;
|
||||
jmethodID AndroidGeckoSurfaceView::jGetSoftwareDrawBufferMethod = 0;
|
||||
jmethodID AndroidGeckoSurfaceView::jGetSurfaceMethod = 0;
|
||||
jmethodID AndroidGeckoSurfaceView::jGetHolderMethod = 0;
|
||||
|
||||
static jclass GetClassGlobalRef(JNIEnv* env, const char* className)
|
||||
{
|
||||
jobject classLocalRef = env->FindClass(className);
|
||||
@ -200,7 +190,6 @@ mozilla::InitAndroidJavaWrappers(JNIEnv *jEnv)
|
||||
AndroidLayerRendererFrame::InitLayerRendererFrameClass(jEnv);
|
||||
AndroidViewTransform::InitViewTransformClass(jEnv);
|
||||
AndroidProgressiveUpdateData::InitProgressiveUpdateDataClass(jEnv);
|
||||
AndroidGeckoSurfaceView::InitGeckoSurfaceViewClass(jEnv);
|
||||
}
|
||||
|
||||
void
|
||||
@ -249,25 +238,6 @@ AndroidGeckoEvent::InitGeckoEventClass(JNIEnv *jEnv)
|
||||
jByteBufferField = getField("mBuffer", "Ljava/nio/ByteBuffer;");
|
||||
}
|
||||
|
||||
void
|
||||
AndroidGeckoSurfaceView::InitGeckoSurfaceViewClass(JNIEnv *jEnv)
|
||||
{
|
||||
#ifndef MOZ_ANDROID_OMTC
|
||||
initInit();
|
||||
|
||||
jGeckoSurfaceViewClass = getClassGlobalRef("org/mozilla/gecko/GeckoSurfaceView");
|
||||
|
||||
jBeginDrawingMethod = getMethod("beginDrawing", "()I");
|
||||
jGetSoftwareDrawBitmapMethod = getMethod("getSoftwareDrawBitmap", "()Landroid/graphics/Bitmap;");
|
||||
jGetSoftwareDrawBufferMethod = getMethod("getSoftwareDrawBuffer", "()Ljava/nio/ByteBuffer;");
|
||||
jEndDrawingMethod = getMethod("endDrawing", "()V");
|
||||
jDraw2DBitmapMethod = getMethod("draw2D", "(Landroid/graphics/Bitmap;II)V");
|
||||
jDraw2DBufferMethod = getMethod("draw2D", "(Ljava/nio/ByteBuffer;I)V");
|
||||
jGetSurfaceMethod = getMethod("getSurface", "()Landroid/view/Surface;");
|
||||
jGetHolderMethod = getMethod("getHolder", "()Landroid/view/SurfaceHolder;");
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
AndroidLocation::InitLocationClass(JNIEnv *jEnv)
|
||||
{
|
||||
@ -349,7 +319,6 @@ AndroidRectF::InitRectFClass(JNIEnv *jEnv)
|
||||
void
|
||||
AndroidGeckoLayerClient::InitGeckoLayerClientClass(JNIEnv *jEnv)
|
||||
{
|
||||
#ifdef MOZ_ANDROID_OMTC
|
||||
initInit();
|
||||
|
||||
jGeckoLayerClientClass = getClassGlobalRef("org/mozilla/gecko/gfx/GeckoLayerClient");
|
||||
@ -371,14 +340,11 @@ AndroidGeckoLayerClient::InitGeckoLayerClientClass(JNIEnv *jEnv)
|
||||
jDisplayportResolution = GetFieldID(jEnv, jDisplayportClass, "resolution", "F");
|
||||
jProgressiveUpdateCallbackMethod = getMethod("progressiveUpdateCallback",
|
||||
"(ZFFFFFZ)Lorg/mozilla/gecko/gfx/ProgressiveUpdateData;");
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
AndroidLayerRendererFrame::InitLayerRendererFrameClass(JNIEnv *jEnv)
|
||||
{
|
||||
#ifdef MOZ_ANDROID_OMTC
|
||||
initInit();
|
||||
|
||||
jLayerRendererFrameClass = getClassGlobalRef("org/mozilla/gecko/gfx/LayerRenderer$Frame");
|
||||
@ -387,13 +353,11 @@ AndroidLayerRendererFrame::InitLayerRendererFrameClass(JNIEnv *jEnv)
|
||||
jDrawBackgroundMethod = getMethod("drawBackground", "()V");
|
||||
jDrawForegroundMethod = getMethod("drawForeground", "()V");
|
||||
jEndDrawingMethod = getMethod("endDrawing", "()V");
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
AndroidViewTransform::InitViewTransformClass(JNIEnv *jEnv)
|
||||
{
|
||||
#ifdef MOZ_ANDROID_OMTC
|
||||
initInit();
|
||||
|
||||
jViewTransformClass = getClassGlobalRef("org/mozilla/gecko/gfx/ViewTransform");
|
||||
@ -401,13 +365,11 @@ AndroidViewTransform::InitViewTransformClass(JNIEnv *jEnv)
|
||||
jXField = getField("x", "F");
|
||||
jYField = getField("y", "F");
|
||||
jScaleField = getField("scale", "F");
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
AndroidProgressiveUpdateData::InitProgressiveUpdateDataClass(JNIEnv *jEnv)
|
||||
{
|
||||
#ifdef MOZ_ANDROID_OMTC
|
||||
initInit();
|
||||
|
||||
jProgressiveUpdateDataClass = getClassGlobalRef("org/mozilla/gecko/gfx/ProgressiveUpdateData");
|
||||
@ -418,7 +380,6 @@ AndroidProgressiveUpdateData::InitProgressiveUpdateDataClass(JNIEnv *jEnv)
|
||||
jHeightField = getField("height", "F");
|
||||
jScaleField = getField("scale", "F");
|
||||
jShouldAbortField = getField("abort", "Z");
|
||||
#endif
|
||||
}
|
||||
|
||||
#undef initInit
|
||||
@ -749,65 +710,6 @@ AndroidProgressiveUpdateData::Init(jobject jobj)
|
||||
wrapped_obj = jobj;
|
||||
}
|
||||
|
||||
void
|
||||
AndroidGeckoSurfaceView::Init(jobject jobj)
|
||||
{
|
||||
NS_ASSERTION(wrapped_obj == nullptr, "Init called on non-null wrapped_obj!");
|
||||
|
||||
wrapped_obj = jobj;
|
||||
}
|
||||
|
||||
int
|
||||
AndroidGeckoSurfaceView::BeginDrawing()
|
||||
{
|
||||
NS_ASSERTION(!isNull(), "BeginDrawing called on null surfaceview!");
|
||||
|
||||
JNIEnv *env = AndroidBridge::GetJNIEnv();
|
||||
if (!env)
|
||||
return 0;
|
||||
|
||||
AutoLocalJNIFrame jniFrame(env, 0);
|
||||
|
||||
int ret = env->CallIntMethod(wrapped_obj, jBeginDrawingMethod);
|
||||
if (jniFrame.CheckForException())
|
||||
return 0;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
AndroidGeckoSurfaceView::EndDrawing()
|
||||
{
|
||||
JNIEnv *env = AndroidBridge::GetJNIEnv();
|
||||
if (!env)
|
||||
return;
|
||||
|
||||
AutoLocalJNIFrame jniFrame(env, 0);
|
||||
env->CallVoidMethod(wrapped_obj, jEndDrawingMethod);
|
||||
}
|
||||
|
||||
void
|
||||
AndroidGeckoSurfaceView::Draw2D(jobject bitmap, int width, int height)
|
||||
{
|
||||
JNIEnv *env = AndroidBridge::GetJNIEnv();
|
||||
if (!env)
|
||||
return;
|
||||
|
||||
AutoLocalJNIFrame jniFrame(env, 0);
|
||||
env->CallVoidMethod(wrapped_obj, jDraw2DBitmapMethod, bitmap, width, height);
|
||||
}
|
||||
|
||||
void
|
||||
AndroidGeckoSurfaceView::Draw2D(jobject buffer, int stride)
|
||||
{
|
||||
JNIEnv *env = AndroidBridge::GetJNIEnv();
|
||||
if (!env)
|
||||
return;
|
||||
|
||||
AutoLocalJNIFrame jniFrame(env, 0);
|
||||
env->CallVoidMethod(wrapped_obj, jDraw2DBufferMethod, buffer, stride);
|
||||
}
|
||||
|
||||
void
|
||||
AndroidGeckoLayerClient::SetFirstPaintViewport(const nsIntPoint& aOffset, float aZoom, const nsIntRect& aPageRect, const gfx::Rect& aCssPageRect)
|
||||
{
|
||||
@ -977,58 +879,6 @@ AndroidGeckoLayerClient::GetDisplayPort(AutoLocalJNIFrame *jniFrame, bool aPageS
|
||||
(*displayPort)->AddRef();
|
||||
}
|
||||
|
||||
jobject
|
||||
AndroidGeckoSurfaceView::GetSoftwareDrawBitmap(AutoLocalJNIFrame *jniFrame)
|
||||
{
|
||||
if (!jniFrame || !jniFrame->GetEnv())
|
||||
return nullptr;
|
||||
|
||||
jobject ret = jniFrame->GetEnv()->CallObjectMethod(wrapped_obj, jGetSoftwareDrawBitmapMethod);
|
||||
if (jniFrame->CheckForException())
|
||||
return nullptr;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
jobject
|
||||
AndroidGeckoSurfaceView::GetSoftwareDrawBuffer(AutoLocalJNIFrame *jniFrame)
|
||||
{
|
||||
if (!jniFrame || !jniFrame->GetEnv())
|
||||
return nullptr;
|
||||
|
||||
jobject ret = jniFrame->GetEnv()->CallObjectMethod(wrapped_obj, jGetSoftwareDrawBufferMethod);
|
||||
if (jniFrame->CheckForException())
|
||||
return nullptr;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
jobject
|
||||
AndroidGeckoSurfaceView::GetSurface(AutoLocalJNIFrame *jniFrame)
|
||||
{
|
||||
if (!jniFrame || !jniFrame->GetEnv())
|
||||
return nullptr;
|
||||
|
||||
jobject ret = jniFrame->GetEnv()->CallObjectMethod(wrapped_obj, jGetSurfaceMethod);
|
||||
if (jniFrame->CheckForException())
|
||||
return nullptr;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
jobject
|
||||
AndroidGeckoSurfaceView::GetSurfaceHolder(AutoLocalJNIFrame *jniFrame)
|
||||
{
|
||||
if (!jniFrame || !jniFrame->GetEnv())
|
||||
return nullptr;
|
||||
|
||||
jobject ret = jniFrame->GetEnv()->CallObjectMethod(wrapped_obj, jGetHolderMethod);
|
||||
if (jniFrame->CheckForException())
|
||||
return nullptr;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool
|
||||
AndroidGeckoLayerClient::CreateFrame(AutoLocalJNIFrame *jniFrame, AndroidLayerRendererFrame& aFrame)
|
||||
{
|
||||
|
@ -283,47 +283,6 @@ public:
|
||||
static jfieldID jDisplayportResolution;
|
||||
};
|
||||
|
||||
class AndroidGeckoSurfaceView : public WrappedJavaObject
|
||||
{
|
||||
public:
|
||||
static void InitGeckoSurfaceViewClass(JNIEnv *jEnv);
|
||||
|
||||
AndroidGeckoSurfaceView() { }
|
||||
AndroidGeckoSurfaceView(jobject jobj) {
|
||||
Init(jobj);
|
||||
}
|
||||
|
||||
void Init(jobject jobj);
|
||||
|
||||
enum {
|
||||
DRAW_ERROR = 0,
|
||||
DRAW_GLES_2 = 1,
|
||||
DRAW_2D = 2,
|
||||
DRAW_DISABLED = 3
|
||||
};
|
||||
|
||||
int BeginDrawing();
|
||||
jobject GetSoftwareDrawBitmap(AutoLocalJNIFrame *jniFrame);
|
||||
jobject GetSoftwareDrawBuffer(AutoLocalJNIFrame *jniFrame);
|
||||
void EndDrawing();
|
||||
void Draw2D(jobject bitmap, int width, int height);
|
||||
void Draw2D(jobject buffer, int stride);
|
||||
|
||||
jobject GetSurface(AutoLocalJNIFrame *jniFrame);
|
||||
jobject GetSurfaceHolder(AutoLocalJNIFrame *jniFrame);
|
||||
|
||||
protected:
|
||||
static jclass jGeckoSurfaceViewClass;
|
||||
static jmethodID jBeginDrawingMethod;
|
||||
static jmethodID jEndDrawingMethod;
|
||||
static jmethodID jDraw2DBitmapMethod;
|
||||
static jmethodID jDraw2DBufferMethod;
|
||||
static jmethodID jGetSoftwareDrawBitmapMethod;
|
||||
static jmethodID jGetSoftwareDrawBufferMethod;
|
||||
static jmethodID jGetSurfaceMethod;
|
||||
static jmethodID jGetHolderMethod;
|
||||
};
|
||||
|
||||
class AndroidKeyEvent
|
||||
{
|
||||
public:
|
||||
|
@ -299,17 +299,10 @@ const nsTArray<GfxDriverInfo>&
|
||||
GfxInfo::GetGfxDriverInfo()
|
||||
{
|
||||
if (mDriverInfo->IsEmpty()) {
|
||||
#ifdef MOZ_ANDROID_OMTC
|
||||
APPEND_TO_DRIVER_BLOCKLIST2( DRIVER_OS_ALL,
|
||||
(nsAString&) GfxDriverInfo::GetDeviceVendor(VendorAll), GfxDriverInfo::allDevices,
|
||||
nsIGfxInfo::FEATURE_OPENGL_LAYERS, nsIGfxInfo::FEATURE_NO_INFO,
|
||||
DRIVER_COMPARISON_IGNORED, GfxDriverInfo::allDriverVersions );
|
||||
#else
|
||||
APPEND_TO_DRIVER_BLOCKLIST2( DRIVER_OS_ALL,
|
||||
(nsAString&) GfxDriverInfo::GetDeviceVendor(VendorAll), GfxDriverInfo::allDevices,
|
||||
nsIGfxInfo::FEATURE_OPENGL_LAYERS, nsIGfxInfo::FEATURE_BLOCKED_DEVICE,
|
||||
DRIVER_COMPARISON_IGNORED, GfxDriverInfo::allDriverVersions );
|
||||
#endif
|
||||
}
|
||||
|
||||
return *mDriverInfo;
|
||||
|
@ -110,11 +110,7 @@ static bool gMenuConsumed;
|
||||
// one.
|
||||
static nsTArray<nsWindow*> gTopLevelWindows;
|
||||
|
||||
static nsRefPtr<gl::GLContext> sGLContext;
|
||||
static bool sFailedToCreateGLContext = false;
|
||||
static bool sValidSurface;
|
||||
static bool sSurfaceExists = false;
|
||||
static void *sNativeWindow = nullptr;
|
||||
|
||||
// Multitouch swipe thresholds in inches
|
||||
static const double SWIPE_MAX_PINCH_DELTA_INCHES = 0.4;
|
||||
@ -724,30 +720,6 @@ nsWindow::GetLayerManager(PLayersChild*, LayersBackend, LayerManagerPersistence,
|
||||
{
|
||||
printf_stderr(" -- creating basic, not accelerated\n");
|
||||
mLayerManager = CreateBasicLayerManager();
|
||||
return mLayerManager;
|
||||
}
|
||||
|
||||
if (!mLayerManager) {
|
||||
if (!sGLContext) {
|
||||
// the window we give doesn't matter here
|
||||
sGLContext = mozilla::gl::GLContextProvider::CreateForWindow(this);
|
||||
}
|
||||
|
||||
if (sGLContext) {
|
||||
nsRefPtr<mozilla::layers::LayerManagerOGL> layerManager =
|
||||
new mozilla::layers::LayerManagerOGL(this);
|
||||
|
||||
if (layerManager && layerManager->Initialize(sGLContext))
|
||||
mLayerManager = layerManager;
|
||||
sValidSurface = true;
|
||||
}
|
||||
|
||||
if (!sGLContext || !mLayerManager) {
|
||||
sGLContext = nullptr;
|
||||
sFailedToCreateGLContext = true;
|
||||
|
||||
mLayerManager = CreateBasicLayerManager();
|
||||
}
|
||||
}
|
||||
|
||||
return mLayerManager;
|
||||
@ -902,37 +874,6 @@ nsWindow::OnGlobalAndroidEvent(AndroidGeckoEvent *ae)
|
||||
}
|
||||
break;
|
||||
|
||||
case AndroidGeckoEvent::SURFACE_CREATED:
|
||||
sSurfaceExists = true;
|
||||
|
||||
if (AndroidBridge::Bridge()->HasNativeWindowAccess()) {
|
||||
AndroidGeckoSurfaceView& sview(AndroidBridge::Bridge()->SurfaceView());
|
||||
JNIEnv *env = AndroidBridge::GetJNIEnv();
|
||||
if (env) {
|
||||
AutoLocalJNIFrame jniFrame(env);
|
||||
jobject surface = sview.GetSurface(&jniFrame);
|
||||
if (surface) {
|
||||
sNativeWindow = AndroidBridge::Bridge()->AcquireNativeWindow(env, surface);
|
||||
if (sNativeWindow) {
|
||||
AndroidBridge::Bridge()->SetNativeWindowFormat(sNativeWindow, 0, 0, AndroidBridge::WINDOW_FORMAT_RGB_565);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case AndroidGeckoEvent::SURFACE_DESTROYED:
|
||||
if (sGLContext && sValidSurface) {
|
||||
sGLContext->ReleaseSurface();
|
||||
}
|
||||
if (sNativeWindow) {
|
||||
AndroidBridge::Bridge()->ReleaseNativeWindow(sNativeWindow);
|
||||
sNativeWindow = nullptr;
|
||||
}
|
||||
sSurfaceExists = false;
|
||||
sValidSurface = false;
|
||||
break;
|
||||
|
||||
case AndroidGeckoEvent::COMPOSITOR_PAUSE:
|
||||
// The compositor gets paused when the app is about to go into the
|
||||
// background. While the compositor is paused, we need to ensure that
|
||||
|
@ -10,10 +10,7 @@
|
||||
#include "gfxPoint.h"
|
||||
#include "nsIIdleServiceInternal.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
#ifdef MOZ_ANDROID_OMTC
|
||||
#include "AndroidJavaWrappers.h"
|
||||
#endif
|
||||
|
||||
class gfxASurface;
|
||||
|
||||
@ -145,7 +142,6 @@ public:
|
||||
|
||||
NS_IMETHOD ReparentNativeWidget(nsIWidget* aNewParent);
|
||||
|
||||
#ifdef MOZ_ANDROID_OMTC
|
||||
virtual bool NeedsPaint();
|
||||
virtual void DrawWindowUnderlay(LayerManager* aManager, nsIntRect aRect);
|
||||
virtual void DrawWindowOverlay(LayerManager* aManager, nsIntRect aRect);
|
||||
@ -159,7 +155,6 @@ public:
|
||||
static float ComputeRenderIntegrity();
|
||||
|
||||
virtual bool WidgetPaintsBackground();
|
||||
#endif
|
||||
|
||||
protected:
|
||||
void BringToFront();
|
||||
@ -229,14 +224,12 @@ private:
|
||||
void HandleSpecialKey(mozilla::AndroidGeckoEvent *ae);
|
||||
void RedrawAll();
|
||||
|
||||
#ifdef MOZ_ANDROID_OMTC
|
||||
mozilla::AndroidLayerRendererFrame mLayerRendererFrame;
|
||||
|
||||
static nsRefPtr<mozilla::layers::LayerManager> sLayerManager;
|
||||
static nsRefPtr<mozilla::layers::CompositorParent> sCompositorParent;
|
||||
static nsRefPtr<mozilla::layers::CompositorChild> sCompositorChild;
|
||||
static bool sCompositorPaused;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif /* NSWINDOW_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user