зеркало из https://github.com/mozilla/pjs.git
Implement the rendering hooks for Java compositor integration. Currently segfaulting, so ifdef'd out.
This commit is contained in:
Родитель
c1d4efa039
Коммит
da517c9015
|
@ -193,11 +193,13 @@ CompositorParent::Composite()
|
|||
#endif
|
||||
layer->AsShadowLayer()->SetShadowTransform(worldTransform);
|
||||
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
// Hang the transform of the root layer off the layer manager.
|
||||
gfx3DMatrix transform = layer->GetTransform();
|
||||
transform *= worldTransform;
|
||||
TransformLayerUserData* transformUserData = new TransformLayerUserData(transform);
|
||||
mLayerManager->SetUserData(nsGkAtoms::transform, transformUserData);
|
||||
#endif
|
||||
|
||||
mLayerManager->EndEmptyTransaction();
|
||||
mLastCompose = mozilla::TimeStamp::Now();
|
||||
|
|
|
@ -140,14 +140,6 @@ private:
|
|||
DISALLOW_EVIL_CONSTRUCTORS(CompositorParent);
|
||||
};
|
||||
|
||||
class TransformLayerUserData : public LayerUserData {
|
||||
public:
|
||||
gfx3DMatrix matrix;
|
||||
|
||||
TransformLayerUserData(gfx3DMatrix& aMatrix) : matrix(aMatrix) {}
|
||||
virtual ~TransformLayerUserData() {}
|
||||
};
|
||||
|
||||
} // layers
|
||||
} // mozilla
|
||||
|
||||
|
|
|
@ -694,8 +694,22 @@ AndroidGeckoGLLayerClient::Init(jobject jobj)
|
|||
void
|
||||
AndroidLayerRendererFrame::Init(jobject jobj)
|
||||
{
|
||||
NS_ASSERTION(wrapped_obj == nsnull, "Init called on non-null wrapped_obj!");
|
||||
wrapped_obj = jobj;
|
||||
if (!isNull()) {
|
||||
Dispose();
|
||||
}
|
||||
|
||||
wrapped_obj = GetJNIForThread()->NewGlobalRef(jobj);
|
||||
}
|
||||
|
||||
void
|
||||
AndroidLayerRendererFrame::Dispose()
|
||||
{
|
||||
if (isNull()) {
|
||||
return;
|
||||
}
|
||||
|
||||
GetJNIForThread()->DeleteGlobalRef(wrapped_obj);
|
||||
wrapped_obj = 0;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -242,6 +242,7 @@ public:
|
|||
static void InitLayerRendererFrameClass(JNIEnv *jEnv);
|
||||
|
||||
void Init(jobject jobj);
|
||||
void Dispose();
|
||||
|
||||
void BeginDrawing();
|
||||
void DrawBackground();
|
||||
|
|
|
@ -2388,12 +2388,30 @@ nsWindow::GetIMEUpdatePreference()
|
|||
#ifdef MOZ_JAVA_COMPOSITOR
|
||||
void
|
||||
nsWindow::DrawWindowUnderlay(LayerManager* aManager, nsIntRect aRect) {
|
||||
__android_log_print(ANDROID_LOG_ERROR, "Gecko", "### TODO: Render custom background");
|
||||
#if 0
|
||||
TransformLayerUserData* userData =
|
||||
static_cast<TransformLayerUserData*>(aManager->GetUserData(nsGkAtoms::transform));
|
||||
NS_ABORT_IF_FALSE(userData, "No transform user data!");
|
||||
|
||||
// Transform the unit square to figure out the offset and scale we need.
|
||||
gfxRect rect(0, 0, 1, 1);
|
||||
userData->matrix.TransformBounds(rect);
|
||||
|
||||
AndroidGeckoLayerClient& client = AndroidBridge::Bridge()->GetLayerClient();
|
||||
AndroidGeckoGLLayerClient& glClient = static_cast<AndroidGeckoGLLayerClient&>(client);
|
||||
glClient.CreateFrame(mLayerRendererFrame, rect.x, rect.y, rect.width);
|
||||
mLayerRendererFrame.DrawBackground();
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
nsWindow::DrawWindowOverlay(LayerManager* aManager, nsIntRect aRect) {
|
||||
__android_log_print(ANDROID_LOG_ERROR, "Gecko", "### TODO: Render custom foreground");
|
||||
#if 0
|
||||
NS_ABORT_IF_FALSE(!mLayerRendererFrame.isNull(),
|
||||
"Frame should have been created in DrawWindowUnderlay()!");
|
||||
mLayerRendererFrame.DrawForeground();
|
||||
mLayerRendererFrame.Dispose();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -47,6 +47,11 @@
|
|||
#include "nsAccessible.h"
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_JAVA_COMPOSITOR
|
||||
#include "AndroidJavaWrappers.h"
|
||||
#include "Layers.h"
|
||||
#endif
|
||||
|
||||
class gfxASurface;
|
||||
class nsIdleService;
|
||||
|
||||
|
@ -249,6 +254,18 @@ private:
|
|||
*/
|
||||
nsAccessible *DispatchAccessibleEvent();
|
||||
#endif // ACCESSIBILITY
|
||||
|
||||
#ifdef MOZ_JAVA_COMPOSITOR
|
||||
mozilla::AndroidLayerRendererFrame mLayerRendererFrame;
|
||||
#endif
|
||||
};
|
||||
|
||||
class TransformLayerUserData : public mozilla::layers::LayerUserData {
|
||||
public:
|
||||
gfx3DMatrix matrix;
|
||||
|
||||
TransformLayerUserData(gfx3DMatrix& aMatrix) : matrix(aMatrix) {}
|
||||
virtual ~TransformLayerUserData() {}
|
||||
};
|
||||
|
||||
#endif /* NSWINDOW_H_ */
|
||||
|
|
Загрузка…
Ссылка в новой задаче