Bug 841503 - Delete a bunch of non-OMTC android codepaths. r=BenWa,snorp

This commit is contained in:
Kartikaya Gupta 2013-02-19 12:35:38 -05:00
Родитель 28982fff89
Коммит df4a6ddf5d
9 изменённых файлов: 1 добавлений и 394 удалений

Просмотреть файл

@ -2110,22 +2110,7 @@ CreateSurfaceForWindow(nsIWidget *aWidget, EGLConfig config)
sEGLLibrary.DumpEGLConfig(config); sEGLLibrary.DumpEGLConfig(config);
#endif #endif
#if defined(MOZ_WIDGET_ANDROID) #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
surface = sEGLLibrary.fCreateWindowSurface(EGL_DISPLAY(), config, GET_NATIVE_WINDOW(aWidget), 0); surface = sEGLLibrary.fCreateWindowSurface(EGL_DISPLAY(), config, GET_NATIVE_WINDOW(aWidget), 0);
#endif #endif

Просмотреть файл

@ -182,13 +182,6 @@ AndroidBridge::Init(JNIEnv *jEnv,
jThumbnailHelperClass = (jclass) jEnv->NewGlobalRef(jEnv->FindClass("org/mozilla/gecko/ThumbnailHelper")); jThumbnailHelperClass = (jclass) jEnv->NewGlobalRef(jEnv->FindClass("org/mozilla/gecko/ThumbnailHelper"));
jNotifyThumbnail = jEnv->GetStaticMethodID(jThumbnailHelperClass, "notifyThumbnail", "(Ljava/nio/ByteBuffer;IZ)V"); 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")); jStringClass = (jclass) jEnv->NewGlobalRef(jEnv->FindClass("java/lang/String"));
jSurfaceClass = (jclass) jEnv->NewGlobalRef(jEnv->FindClass("android/view/Surface")); 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"); jRegisterSurfaceTextureFrameListener = jEnv->GetStaticMethodID(jGeckoAppShellClass, "registerSurfaceTextureFrameListener", "(Ljava/lang/Object;I)V");
jUnregisterSurfaceTextureFrameListener = jEnv->GetStaticMethodID(jGeckoAppShellClass, "unregisterSurfaceTextureFrameListener", "(Ljava/lang/Object;)V"); jUnregisterSurfaceTextureFrameListener = jEnv->GetStaticMethodID(jGeckoAppShellClass, "unregisterSurfaceTextureFrameListener", "(Ljava/lang/Object;)V");
#ifdef MOZ_ANDROID_OMTC
jPumpMessageLoop = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "pumpMessageLoop", "()Z"); jPumpMessageLoop = (jmethodID) jEnv->GetStaticMethodID(jGeckoAppShellClass, "pumpMessageLoop", "()Z");
jAddPluginView = jEnv->GetStaticMethodID(jGeckoAppShellClass, "addPluginView", "(Landroid/view/View;IIIIZ)V"); jAddPluginView = jEnv->GetStaticMethodID(jGeckoAppShellClass, "addPluginView", "(Landroid/view/View;IIIIZ)V");
@ -218,10 +210,6 @@ AndroidBridge::Init(JNIEnv *jEnv,
AndroidGLController::Init(jEnv); AndroidGLController::Init(jEnv);
AndroidEGLObject::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); InitAndroidJavaWrappers(jEnv);
@ -1083,12 +1071,6 @@ AndroidBridge::GetShowPasswordSetting()
return ret; return ret;
} }
void
AndroidBridge::SetSurfaceView(jobject obj)
{
mSurfaceView.Init(obj);
}
void void
AndroidBridge::SetLayerClient(JNIEnv* env, jobject jobj) AndroidBridge::SetLayerClient(JNIEnv* env, jobject jobj)
{ {
@ -1111,12 +1093,10 @@ AndroidBridge::SetLayerClient(JNIEnv* env, jobject jobj)
if (resetting) { if (resetting) {
RegisterCompositor(env, true); RegisterCompositor(env, true);
#ifdef MOZ_ANDROID_OMTC
// since we are re-linking the new java objects to Gecko, we need to get // 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) // the viewport from the compositor (since the Java copy was thrown away)
// and we do that by setting the first-paint flag. // and we do that by setting the first-paint flag.
nsWindow::ForceIsFirstPaint(); nsWindow::ForceIsFirstPaint();
#endif
} }
} }
@ -1133,58 +1113,6 @@ AndroidBridge::ShowInputMethodPicker()
env->CallStaticVoidMethod(mGeckoAppShellClass, jShowInputMethodPicker); 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; static AndroidGLController sController;
void 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. // 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 bool
AndroidBridge::LockWindow(void *window, unsigned char **bits, int *width, int *height, int *format, int *stride) AndroidBridge::LockWindow(void *window, unsigned char **bits, int *width, int *height, int *format, int *stride)
{ {
@ -2329,7 +2248,6 @@ AndroidBridge::UnlockScreenOrientation()
bool bool
AndroidBridge::PumpMessageLoop() AndroidBridge::PumpMessageLoop()
{ {
#if MOZ_ANDROID_OMTC
JNIEnv* env = GetJNIEnv(); JNIEnv* env = GetJNIEnv();
if (!env) if (!env)
return false; return false;
@ -2340,8 +2258,6 @@ AndroidBridge::PumpMessageLoop()
return false; return false;
return env->CallStaticBooleanMethod(mGeckoAppShellClass, jPumpMessageLoop); return env->CallStaticBooleanMethod(mGeckoAppShellClass, jPumpMessageLoop);
#endif
return false;
} }
void void
@ -2362,9 +2278,7 @@ AndroidBridge::NotifyWakeLockChanged(const nsAString& topic, const nsAString& st
void void
AndroidBridge::ScheduleComposite() AndroidBridge::ScheduleComposite()
{ {
#if MOZ_ANDROID_OMTC
nsWindow::ScheduleComposite(); nsWindow::ScheduleComposite();
#endif
} }
void void
@ -2461,16 +2375,10 @@ AndroidBridge::AddPluginView(jobject view, const gfxRect& rect, bool isFullScree
AutoLocalJNIFrame jniFrame(env); AutoLocalJNIFrame jniFrame(env);
#if MOZ_ANDROID_OMTC
env->CallStaticVoidMethod(sBridge->mGeckoAppShellClass, env->CallStaticVoidMethod(sBridge->mGeckoAppShellClass,
sBridge->jAddPluginView, view, sBridge->jAddPluginView, view,
(int)rect.x, (int)rect.y, (int)rect.width, (int)rect.height, (int)rect.x, (int)rect.y, (int)rect.width, (int)rect.height,
isFullScreen); isFullScreen);
#else
env->CallStaticVoidMethod(sBridge->mGeckoAppShellClass,
sBridge->jAddPluginView, view,
rect.x, rect.y, rect.width, rect.height);
#endif
} }
void void

Просмотреть файл

@ -180,9 +180,6 @@ public:
void SetLayerClient(JNIEnv* env, jobject jobj); void SetLayerClient(JNIEnv* env, jobject jobj);
AndroidGeckoLayerClient &GetLayerClient() { return *mLayerClient; } AndroidGeckoLayerClient &GetLayerClient() { return *mLayerClient; }
void SetSurfaceView(jobject jobj);
AndroidGeckoSurfaceView& SurfaceView() { return mSurfaceView; }
bool GetHandlersForURL(const char *aURL, bool GetHandlersForURL(const char *aURL,
nsIMutableArray* handlersArray = nullptr, nsIMutableArray* handlersArray = nullptr,
nsIHandlerApp **aDefaultApp = nullptr, nsIHandlerApp **aDefaultApp = nullptr,
@ -257,9 +254,6 @@ public:
bool GetShowPasswordSetting(); 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 // Switch Java to composite with the Gecko Compositor thread
void RegisterCompositor(JNIEnv* env = NULL, bool resetting = false); void RegisterCompositor(JNIEnv* env = NULL, bool resetting = false);
EGLSurface ProvideEGLSurface(bool waitUntilValid); EGLSurface ProvideEGLSurface(bool waitUntilValid);
@ -302,8 +296,6 @@ public:
void *AcquireNativeWindowFromSurfaceTexture(JNIEnv* aEnv, jobject aSurface); void *AcquireNativeWindowFromSurfaceTexture(JNIEnv* aEnv, jobject aSurface);
void ReleaseNativeWindowForSurfaceTexture(void *window); 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 LockWindow(void *window, unsigned char **bits, int *width, int *height, int *format, int *stride);
bool UnlockWindow(void *window); bool UnlockWindow(void *window);
@ -382,9 +374,6 @@ protected:
JNIEnv *mJNIEnv; JNIEnv *mJNIEnv;
void *mThread; void *mThread;
// the GeckoSurfaceView
AndroidGeckoSurfaceView mSurfaceView;
AndroidGeckoLayerClient *mLayerClient; AndroidGeckoLayerClient *mLayerClient;
// the GeckoAppShell java class // the GeckoAppShell java class
@ -507,14 +496,6 @@ protected:
jclass jSurfaceClass; jclass jSurfaceClass;
jfieldID jSurfacePointerField; jfieldID jSurfacePointerField;
// stuff we need for CallEglCreateWindowSurface
jclass jEGLSurfaceImplClass;
jclass jEGLContextImplClass;
jclass jEGLConfigImplClass;
jclass jEGLDisplayImplClass;
jclass jEGLContextClass;
jclass jEGL10Class;
jclass jLayerView; jclass jLayerView;
jmethodID jRegisterCompositorMethod; jmethodID jRegisterCompositorMethod;

Просмотреть файл

@ -661,8 +661,6 @@ Java_org_mozilla_gecko_GeckoSmsManager_notifyReadingMessageListFailed(JNIEnv* je
#endif // MOZ_WEBSMS_BACKEND #endif // MOZ_WEBSMS_BACKEND
#ifdef MOZ_ANDROID_OMTC
NS_EXPORT void JNICALL NS_EXPORT void JNICALL
Java_org_mozilla_gecko_GeckoAppShell_scheduleComposite(JNIEnv*, jclass) Java_org_mozilla_gecko_GeckoAppShell_scheduleComposite(JNIEnv*, jclass)
{ {
@ -871,5 +869,4 @@ Java_org_mozilla_gecko_GeckoAppShell_onSurfaceTextureFrameAvailable(JNIEnv* jenv
st->NotifyFrameAvailable(); st->NotifyFrameAvailable();
} }
#endif
} }

Просмотреть файл

@ -109,16 +109,6 @@ jfieldID AndroidProgressiveUpdateData::jHeightField = 0;
jfieldID AndroidProgressiveUpdateData::jScaleField = 0; jfieldID AndroidProgressiveUpdateData::jScaleField = 0;
jfieldID AndroidProgressiveUpdateData::jShouldAbortField = 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) static jclass GetClassGlobalRef(JNIEnv* env, const char* className)
{ {
jobject classLocalRef = env->FindClass(className); jobject classLocalRef = env->FindClass(className);
@ -200,7 +190,6 @@ mozilla::InitAndroidJavaWrappers(JNIEnv *jEnv)
AndroidLayerRendererFrame::InitLayerRendererFrameClass(jEnv); AndroidLayerRendererFrame::InitLayerRendererFrameClass(jEnv);
AndroidViewTransform::InitViewTransformClass(jEnv); AndroidViewTransform::InitViewTransformClass(jEnv);
AndroidProgressiveUpdateData::InitProgressiveUpdateDataClass(jEnv); AndroidProgressiveUpdateData::InitProgressiveUpdateDataClass(jEnv);
AndroidGeckoSurfaceView::InitGeckoSurfaceViewClass(jEnv);
} }
void void
@ -249,25 +238,6 @@ AndroidGeckoEvent::InitGeckoEventClass(JNIEnv *jEnv)
jByteBufferField = getField("mBuffer", "Ljava/nio/ByteBuffer;"); 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 void
AndroidLocation::InitLocationClass(JNIEnv *jEnv) AndroidLocation::InitLocationClass(JNIEnv *jEnv)
{ {
@ -349,7 +319,6 @@ AndroidRectF::InitRectFClass(JNIEnv *jEnv)
void void
AndroidGeckoLayerClient::InitGeckoLayerClientClass(JNIEnv *jEnv) AndroidGeckoLayerClient::InitGeckoLayerClientClass(JNIEnv *jEnv)
{ {
#ifdef MOZ_ANDROID_OMTC
initInit(); initInit();
jGeckoLayerClientClass = getClassGlobalRef("org/mozilla/gecko/gfx/GeckoLayerClient"); jGeckoLayerClientClass = getClassGlobalRef("org/mozilla/gecko/gfx/GeckoLayerClient");
@ -371,14 +340,11 @@ AndroidGeckoLayerClient::InitGeckoLayerClientClass(JNIEnv *jEnv)
jDisplayportResolution = GetFieldID(jEnv, jDisplayportClass, "resolution", "F"); jDisplayportResolution = GetFieldID(jEnv, jDisplayportClass, "resolution", "F");
jProgressiveUpdateCallbackMethod = getMethod("progressiveUpdateCallback", jProgressiveUpdateCallbackMethod = getMethod("progressiveUpdateCallback",
"(ZFFFFFZ)Lorg/mozilla/gecko/gfx/ProgressiveUpdateData;"); "(ZFFFFFZ)Lorg/mozilla/gecko/gfx/ProgressiveUpdateData;");
#endif
} }
void void
AndroidLayerRendererFrame::InitLayerRendererFrameClass(JNIEnv *jEnv) AndroidLayerRendererFrame::InitLayerRendererFrameClass(JNIEnv *jEnv)
{ {
#ifdef MOZ_ANDROID_OMTC
initInit(); initInit();
jLayerRendererFrameClass = getClassGlobalRef("org/mozilla/gecko/gfx/LayerRenderer$Frame"); jLayerRendererFrameClass = getClassGlobalRef("org/mozilla/gecko/gfx/LayerRenderer$Frame");
@ -387,13 +353,11 @@ AndroidLayerRendererFrame::InitLayerRendererFrameClass(JNIEnv *jEnv)
jDrawBackgroundMethod = getMethod("drawBackground", "()V"); jDrawBackgroundMethod = getMethod("drawBackground", "()V");
jDrawForegroundMethod = getMethod("drawForeground", "()V"); jDrawForegroundMethod = getMethod("drawForeground", "()V");
jEndDrawingMethod = getMethod("endDrawing", "()V"); jEndDrawingMethod = getMethod("endDrawing", "()V");
#endif
} }
void void
AndroidViewTransform::InitViewTransformClass(JNIEnv *jEnv) AndroidViewTransform::InitViewTransformClass(JNIEnv *jEnv)
{ {
#ifdef MOZ_ANDROID_OMTC
initInit(); initInit();
jViewTransformClass = getClassGlobalRef("org/mozilla/gecko/gfx/ViewTransform"); jViewTransformClass = getClassGlobalRef("org/mozilla/gecko/gfx/ViewTransform");
@ -401,13 +365,11 @@ AndroidViewTransform::InitViewTransformClass(JNIEnv *jEnv)
jXField = getField("x", "F"); jXField = getField("x", "F");
jYField = getField("y", "F"); jYField = getField("y", "F");
jScaleField = getField("scale", "F"); jScaleField = getField("scale", "F");
#endif
} }
void void
AndroidProgressiveUpdateData::InitProgressiveUpdateDataClass(JNIEnv *jEnv) AndroidProgressiveUpdateData::InitProgressiveUpdateDataClass(JNIEnv *jEnv)
{ {
#ifdef MOZ_ANDROID_OMTC
initInit(); initInit();
jProgressiveUpdateDataClass = getClassGlobalRef("org/mozilla/gecko/gfx/ProgressiveUpdateData"); jProgressiveUpdateDataClass = getClassGlobalRef("org/mozilla/gecko/gfx/ProgressiveUpdateData");
@ -418,7 +380,6 @@ AndroidProgressiveUpdateData::InitProgressiveUpdateDataClass(JNIEnv *jEnv)
jHeightField = getField("height", "F"); jHeightField = getField("height", "F");
jScaleField = getField("scale", "F"); jScaleField = getField("scale", "F");
jShouldAbortField = getField("abort", "Z"); jShouldAbortField = getField("abort", "Z");
#endif
} }
#undef initInit #undef initInit
@ -749,65 +710,6 @@ AndroidProgressiveUpdateData::Init(jobject jobj)
wrapped_obj = 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 void
AndroidGeckoLayerClient::SetFirstPaintViewport(const nsIntPoint& aOffset, float aZoom, const nsIntRect& aPageRect, const gfx::Rect& aCssPageRect) 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(); (*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 bool
AndroidGeckoLayerClient::CreateFrame(AutoLocalJNIFrame *jniFrame, AndroidLayerRendererFrame& aFrame) AndroidGeckoLayerClient::CreateFrame(AutoLocalJNIFrame *jniFrame, AndroidLayerRendererFrame& aFrame)
{ {

Просмотреть файл

@ -283,47 +283,6 @@ public:
static jfieldID jDisplayportResolution; 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 class AndroidKeyEvent
{ {
public: public:

Просмотреть файл

@ -299,17 +299,10 @@ const nsTArray<GfxDriverInfo>&
GfxInfo::GetGfxDriverInfo() GfxInfo::GetGfxDriverInfo()
{ {
if (mDriverInfo->IsEmpty()) { if (mDriverInfo->IsEmpty()) {
#ifdef MOZ_ANDROID_OMTC
APPEND_TO_DRIVER_BLOCKLIST2( DRIVER_OS_ALL, APPEND_TO_DRIVER_BLOCKLIST2( DRIVER_OS_ALL,
(nsAString&) GfxDriverInfo::GetDeviceVendor(VendorAll), GfxDriverInfo::allDevices, (nsAString&) GfxDriverInfo::GetDeviceVendor(VendorAll), GfxDriverInfo::allDevices,
nsIGfxInfo::FEATURE_OPENGL_LAYERS, nsIGfxInfo::FEATURE_NO_INFO, nsIGfxInfo::FEATURE_OPENGL_LAYERS, nsIGfxInfo::FEATURE_NO_INFO,
DRIVER_COMPARISON_IGNORED, GfxDriverInfo::allDriverVersions ); 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; return *mDriverInfo;

Просмотреть файл

@ -110,11 +110,7 @@ static bool gMenuConsumed;
// one. // one.
static nsTArray<nsWindow*> gTopLevelWindows; static nsTArray<nsWindow*> gTopLevelWindows;
static nsRefPtr<gl::GLContext> sGLContext;
static bool sFailedToCreateGLContext = false; static bool sFailedToCreateGLContext = false;
static bool sValidSurface;
static bool sSurfaceExists = false;
static void *sNativeWindow = nullptr;
// Multitouch swipe thresholds in inches // Multitouch swipe thresholds in inches
static const double SWIPE_MAX_PINCH_DELTA_INCHES = 0.4; 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"); printf_stderr(" -- creating basic, not accelerated\n");
mLayerManager = CreateBasicLayerManager(); 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; return mLayerManager;
@ -902,37 +874,6 @@ nsWindow::OnGlobalAndroidEvent(AndroidGeckoEvent *ae)
} }
break; 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: case AndroidGeckoEvent::COMPOSITOR_PAUSE:
// The compositor gets paused when the app is about to go into the // The compositor gets paused when the app is about to go into the
// background. While the compositor is paused, we need to ensure that // background. While the compositor is paused, we need to ensure that

Просмотреть файл

@ -10,10 +10,7 @@
#include "gfxPoint.h" #include "gfxPoint.h"
#include "nsIIdleServiceInternal.h" #include "nsIIdleServiceInternal.h"
#include "nsTArray.h" #include "nsTArray.h"
#ifdef MOZ_ANDROID_OMTC
#include "AndroidJavaWrappers.h" #include "AndroidJavaWrappers.h"
#endif
class gfxASurface; class gfxASurface;
@ -145,7 +142,6 @@ public:
NS_IMETHOD ReparentNativeWidget(nsIWidget* aNewParent); NS_IMETHOD ReparentNativeWidget(nsIWidget* aNewParent);
#ifdef MOZ_ANDROID_OMTC
virtual bool NeedsPaint(); virtual bool NeedsPaint();
virtual void DrawWindowUnderlay(LayerManager* aManager, nsIntRect aRect); virtual void DrawWindowUnderlay(LayerManager* aManager, nsIntRect aRect);
virtual void DrawWindowOverlay(LayerManager* aManager, nsIntRect aRect); virtual void DrawWindowOverlay(LayerManager* aManager, nsIntRect aRect);
@ -159,7 +155,6 @@ public:
static float ComputeRenderIntegrity(); static float ComputeRenderIntegrity();
virtual bool WidgetPaintsBackground(); virtual bool WidgetPaintsBackground();
#endif
protected: protected:
void BringToFront(); void BringToFront();
@ -229,14 +224,12 @@ private:
void HandleSpecialKey(mozilla::AndroidGeckoEvent *ae); void HandleSpecialKey(mozilla::AndroidGeckoEvent *ae);
void RedrawAll(); void RedrawAll();
#ifdef MOZ_ANDROID_OMTC
mozilla::AndroidLayerRendererFrame mLayerRendererFrame; mozilla::AndroidLayerRendererFrame mLayerRendererFrame;
static nsRefPtr<mozilla::layers::LayerManager> sLayerManager; static nsRefPtr<mozilla::layers::LayerManager> sLayerManager;
static nsRefPtr<mozilla::layers::CompositorParent> sCompositorParent; static nsRefPtr<mozilla::layers::CompositorParent> sCompositorParent;
static nsRefPtr<mozilla::layers::CompositorChild> sCompositorChild; static nsRefPtr<mozilla::layers::CompositorChild> sCompositorChild;
static bool sCompositorPaused; static bool sCompositorPaused;
#endif
}; };
#endif /* NSWINDOW_H_ */ #endif /* NSWINDOW_H_ */