mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Poke the compositor to composite on a pan or zoom; stub AndroidBridge::GetViewTransform()
This commit is contained in:
parent
9159739ff5
commit
50c7df015c
@ -82,6 +82,13 @@ CompositorParent::RecvStop()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CompositorParent::ScheduleCompositionOnCompositorThread(::base::Thread &aCompositorThread)
|
||||
{
|
||||
CancelableTask *composeTask = NewRunnableMethod(this, &CompositorParent::Composite);
|
||||
aCompositorThread.message_loop()->PostTask(FROM_HERE, composeTask);
|
||||
}
|
||||
|
||||
void
|
||||
CompositorParent::ScheduleComposition()
|
||||
{
|
||||
|
@ -43,6 +43,7 @@
|
||||
|
||||
#include "mozilla/layers/PCompositorParent.h"
|
||||
#include "mozilla/layers/PLayersParent.h"
|
||||
#include "base/thread.h"
|
||||
#include "ShadowLayersManager.h"
|
||||
|
||||
class nsIWidget;
|
||||
@ -89,6 +90,7 @@ public:
|
||||
|
||||
void SetTransformation(float aScale, nsIntPoint aScrollOffset);
|
||||
void AsyncRender();
|
||||
void ScheduleCompositionOnCompositorThread(::base::Thread &aCompositorThread);
|
||||
|
||||
protected:
|
||||
virtual PLayersParent* AllocPLayers(const LayersBackend &backendType);
|
||||
|
@ -170,6 +170,7 @@ public class GeckoAppShell
|
||||
public static native ByteBuffer allocateDirectBuffer(long size);
|
||||
public static native void freeDirectBuffer(ByteBuffer buf);
|
||||
public static native void bindWidgetTexture();
|
||||
public static native void scheduleComposite();
|
||||
|
||||
// A looper thread, accessed by GeckoAppShell.getHandler
|
||||
private static class LooperThread extends Thread {
|
||||
|
@ -52,6 +52,7 @@ public class FlexibleGLSurfaceView extends SurfaceView implements SurfaceHolder.
|
||||
private GLSurfaceView.Renderer mRenderer;
|
||||
private GLThread mGLThread; // Protected by this class's monitor.
|
||||
private GLController mController;
|
||||
private Listener mListener;
|
||||
|
||||
public FlexibleGLSurfaceView(Context context) {
|
||||
super(context);
|
||||
@ -79,10 +80,17 @@ public class FlexibleGLSurfaceView extends SurfaceView implements SurfaceHolder.
|
||||
return mRenderer;
|
||||
}
|
||||
|
||||
public void setListener(Listener listener) {
|
||||
mListener = listener;
|
||||
}
|
||||
|
||||
public synchronized void requestRender() {
|
||||
if (mGLThread != null) {
|
||||
mGLThread.renderFrame();
|
||||
}
|
||||
if (mListener != null) {
|
||||
mListener.renderRequested();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -182,6 +190,10 @@ public class FlexibleGLSurfaceView extends SurfaceView implements SurfaceHolder.
|
||||
}
|
||||
}
|
||||
|
||||
public interface Listener {
|
||||
void renderRequested();
|
||||
}
|
||||
|
||||
public static class FlexibleGLSurfaceViewException extends RuntimeException {
|
||||
public static final long serialVersionUID = 1L;
|
||||
|
||||
|
@ -296,6 +296,7 @@ SHELL_WRAPPER1(cameraCallbackBridge, jbyteArray)
|
||||
SHELL_WRAPPER3(notifyBatteryChange, jdouble, jboolean, jdouble)
|
||||
SHELL_WRAPPER3(notifySmsReceived, jstring, jstring, jlong)
|
||||
SHELL_WRAPPER0(bindWidgetTexture)
|
||||
SHELL_WRAPPER0(scheduleComposite)
|
||||
SHELL_WRAPPER3_WITH_RETURN(saveMessageInSentbox, jint, jstring, jstring, jlong)
|
||||
SHELL_WRAPPER6(notifySmsSent, jint, jstring, jstring, jlong, jint, jlong)
|
||||
SHELL_WRAPPER4(notifySmsDelivered, jint, jstring, jstring, jlong)
|
||||
@ -710,6 +711,7 @@ loadGeckoLibs(const char *apkName)
|
||||
GETFUNC(notifyBatteryChange);
|
||||
GETFUNC(notifySmsReceived);
|
||||
GETFUNC(bindWidgetTexture);
|
||||
GETFUNC(scheduleComposite);
|
||||
GETFUNC(saveMessageInSentbox);
|
||||
GETFUNC(notifySmsSent);
|
||||
GETFUNC(notifySmsDelivered);
|
||||
|
@ -35,6 +35,10 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "mozilla/Util.h"
|
||||
#include "mozilla/layers/CompositorChild.h"
|
||||
#include "mozilla/layers/CompositorParent.h"
|
||||
|
||||
#include <android/log.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
@ -1849,6 +1853,38 @@ AndroidBridge::IsTablet()
|
||||
return env->CallStaticBooleanMethod(mGeckoAppShellClass, jIsTablet);
|
||||
}
|
||||
|
||||
void
|
||||
AndroidBridge::SetCompositorParent(mozilla::layers::CompositorParent* aCompositorParent,
|
||||
::base::Thread* aCompositorThread)
|
||||
{
|
||||
mCompositorParent = aCompositorParent;
|
||||
mCompositorThread = aCompositorThread;
|
||||
}
|
||||
|
||||
void
|
||||
AndroidBridge::ScheduleComposite()
|
||||
{
|
||||
if (mCompositorParent) {
|
||||
mCompositorParent->ScheduleCompositionOnCompositorThread(*mCompositorThread);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
AndroidBridge::GetViewTransform(nsIntPoint& aScrollOffset, float& aScaleX, float& aScaleY)
|
||||
{
|
||||
__android_log_print(ANDROID_LOG_ERROR, "Gecko", "### GetViewTransform() TODO");
|
||||
}
|
||||
|
||||
AndroidBridge::AndroidBridge()
|
||||
: mLayerClient(NULL)
|
||||
, mLayerClientType(0)
|
||||
{
|
||||
}
|
||||
|
||||
AndroidBridge::~AndroidBridge()
|
||||
{
|
||||
}
|
||||
|
||||
/* Implementation file */
|
||||
NS_IMPL_ISUPPORTS1(nsAndroidBridge, nsIAndroidBridge)
|
||||
|
||||
|
@ -55,6 +55,7 @@
|
||||
#include "nsIMutableArray.h"
|
||||
#include "nsIMIMEInfo.h"
|
||||
#include "nsColor.h"
|
||||
#include "BasicLayers.h"
|
||||
|
||||
#include "nsIAndroidBridge.h"
|
||||
|
||||
@ -71,6 +72,10 @@ extern "C" JNIEnv * GetJNIForThread();
|
||||
extern bool mozilla_AndroidBridge_SetMainThread(void *);
|
||||
extern jclass GetGeckoAppShellClass();
|
||||
|
||||
namespace base {
|
||||
class Thread;
|
||||
} // end namespace base
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
namespace hal {
|
||||
@ -84,6 +89,10 @@ struct SmsFilterData;
|
||||
} // namespace sms
|
||||
} // namespace dom
|
||||
|
||||
namespace layers {
|
||||
class CompositorParent;
|
||||
} // namespace layers
|
||||
|
||||
// The order and number of the members in this structure must correspond
|
||||
// to the attrsAppearance array in GeckoAppShell.getSystemColors()
|
||||
typedef struct AndroidSystemColors {
|
||||
@ -391,6 +400,11 @@ public:
|
||||
void EnableNetworkNotifications();
|
||||
void DisableNetworkNotifications();
|
||||
|
||||
void SetCompositorParent(mozilla::layers::CompositorParent* aCompositorParent,
|
||||
base::Thread* aCompositorThread);
|
||||
void ScheduleComposite();
|
||||
void GetViewTransform(nsIntPoint& aScrollOffset, float& aScaleX, float& aScaleY);
|
||||
|
||||
protected:
|
||||
static AndroidBridge *sBridge;
|
||||
|
||||
@ -407,10 +421,15 @@ protected:
|
||||
AndroidGeckoLayerClient *mLayerClient;
|
||||
int mLayerClientType;
|
||||
|
||||
nsRefPtr<mozilla::layers::CompositorParent> mCompositorParent;
|
||||
base::Thread *mCompositorThread;
|
||||
|
||||
// the GeckoAppShell java class
|
||||
jclass mGeckoAppShellClass;
|
||||
|
||||
AndroidBridge() : mLayerClient(NULL), mLayerClientType(0) { }
|
||||
AndroidBridge();
|
||||
~AndroidBridge();
|
||||
|
||||
bool Init(JNIEnv *jEnv, jclass jGeckoApp);
|
||||
|
||||
bool mOpenedGraphicsLibraries;
|
||||
|
@ -106,6 +106,7 @@ extern "C" {
|
||||
|
||||
#ifdef MOZ_JAVA_COMPOSITOR
|
||||
NS_EXPORT void JNICALL Java_org_mozilla_gecko_GeckoAppShell_bindWidgetTexture(JNIEnv* jenv, jclass);
|
||||
NS_EXPORT void JNICALL Java_org_mozilla_gecko_GeckoAppShell_scheduleComposite(JNIEnv* jenv, jclass);
|
||||
#endif
|
||||
|
||||
}
|
||||
@ -853,4 +854,11 @@ Java_org_mozilla_gecko_GeckoAppShell_bindWidgetTexture(JNIEnv* jenv, jclass)
|
||||
nsWindow::BindToTexture();
|
||||
}
|
||||
|
||||
NS_EXPORT void JNICALL
|
||||
Java_org_mozilla_gecko_GeckoAppShell_scheduleComposite(JNIEnv*, jclass)
|
||||
{
|
||||
__android_log_print(ANDROID_LOG_ERROR, "Gecko", "### scheduleComposite()");
|
||||
AndroidBridge::Bridge()->ScheduleComposite();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -776,8 +776,12 @@ nsWindow::GetLayerManager(PLayersChild*, LayersBackend, LayerManagerPersistence,
|
||||
|
||||
if (useCompositor) {
|
||||
CreateCompositor();
|
||||
if (mLayerManager)
|
||||
if (mLayerManager) {
|
||||
AndroidBridge::Bridge()->SetCompositorParent(mCompositorParent, mCompositorThread);
|
||||
return mLayerManager;
|
||||
}
|
||||
|
||||
// If we get here, then off main thread compositing failed to initialize.
|
||||
sFailedToCreateGLContext = true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user