Add a DrawWindowUnderlay() to match DrawWindowOverlay()

This commit is contained in:
Patrick Walton 2012-02-09 19:47:50 -08:00
Родитель 8604c20b3e
Коммит cd558a3396
8 изменённых файлов: 44 добавлений и 22 удалений

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

@ -42,6 +42,7 @@
#include "ShadowLayersParent.h"
#include "LayerManagerOGL.h"
#include "nsIWidget.h"
#include "nsGkAtoms.h"
#if defined(MOZ_WIDGET_ANDROID)
#include "AndroidBridge.h"
@ -192,6 +193,12 @@ CompositorParent::Composite()
#endif
layer->AsShadowLayer()->SetShadowTransform(worldTransform);
// 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);
mLayerManager->EndEmptyTransaction();
mLastCompose = mozilla::TimeStamp::Now();
}
@ -206,7 +213,7 @@ CompositorParent::GetPrimaryScrollableLayer()
nsTArray<Layer*> queue;
queue.AppendElement(root);
for (int i = 0; i < queue.Length(); i++) {
for (unsigned i = 0; i < queue.Length(); i++) {
ContainerLayer* containerLayer = queue[i]->AsContainerLayer();
if (!containerLayer) {
continue;

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

@ -140,6 +140,14 @@ private:
DISALLOW_EVIL_CONSTRUCTORS(CompositorParent);
};
class TransformLayerUserData : public LayerUserData {
public:
gfx3DMatrix matrix;
TransformLayerUserData(gfx3DMatrix& aMatrix) : matrix(aMatrix) {}
virtual ~TransformLayerUserData() {}
};
} // layers
} // mozilla

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

@ -785,10 +785,14 @@ LayerManagerOGL::Render()
mGLContext->fClearColor(1.0, 1.0, 1.0, 0.0);
mGLContext->fClear(LOCAL_GL_COLOR_BUFFER_BIT | LOCAL_GL_DEPTH_BUFFER_BIT);
// Allow widget to render a custom background.
mWidget->DrawWindowUnderlay(this, rect);
// Render our layers.
RootLayer()->RenderLayer(mGLContext->IsDoubleBuffered() ? 0 : mBackBufferFBO,
nsIntPoint(0, 0));
// Allow widget to render a custom foreground too.
mWidget->DrawWindowOverlay(this, rect);
if (mTarget) {
@ -801,8 +805,6 @@ LayerManagerOGL::Render()
mFPS.DrawFPS(mGLContext, GetCopy2DProgram());
}
PerformPostRenderHook();
if (mGLContext->IsDoubleBuffered()) {
mGLContext->SwapBuffers();
LayerManager::PostPresent();
@ -894,22 +896,6 @@ LayerManagerOGL::Render()
mGLContext->fBindBuffer(LOCAL_GL_ARRAY_BUFFER, 0);
}
void
LayerManagerOGL::PerformPreRenderHook()
{
#ifdef MOZ_WIDGET_ANDROID
// TODO: AndroidBridge::PerformPreRenderHook();
#endif
}
void
LayerManagerOGL::PerformPostRenderHook()
{
#ifdef MOZ_WIDGET_ANDROID
// TODO: AndroidBridge::PerformPostRenderHook();
#endif
}
void
LayerManagerOGL::SetWorldTransform(const gfxMatrix& aMatrix)
{

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

@ -387,9 +387,6 @@ public:
* to a window of the given dimensions.
*/
void SetupPipeline(int aWidth, int aHeight, WorldTransforPolicy aTransformPolicy);
void PerformPreRenderHook();
void PerformPostRenderHook();
/**
* Setup World transform matrix.

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

@ -2385,3 +2385,15 @@ nsWindow::GetIMEUpdatePreference()
return nsIMEUpdatePreference(true, true);
}
#ifdef MOZ_JAVA_COMPOSITOR
void
nsWindow::DrawWindowUnderlay(LayerManager* aManager, nsIntRect aRect) {
__android_log_print(ANDROID_LOG_ERROR, "Gecko", "### TODO: Render custom background");
}
void
nsWindow::DrawWindowOverlay(LayerManager* aManager, nsIntRect aRect) {
__android_log_print(ANDROID_LOG_ERROR, "Gecko", "### TODO: Render custom foreground");
}
#endif

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

@ -179,6 +179,9 @@ public:
#ifdef MOZ_JAVA_COMPOSITOR
static void BindToTexture();
static bool HasDirectTexture();
virtual void DrawWindowUnderlay(LayerManager* aManager, nsIntRect aRect);
virtual void DrawWindowOverlay(LayerManager* aManager, nsIntRect aRect);
#endif
protected:

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

@ -1071,6 +1071,14 @@ class nsIWidget : public nsISupports {
LayerManagerPersistence aPersistence = LAYER_MANAGER_CURRENT,
bool* aAllowRetaining = nsnull) = 0;
/**
* Called before the LayerManager draws the layer tree.
*
* @param aManager The drawing LayerManager.
* @param aWidgetRect The current widget rect that is being drawn.
*/
virtual void DrawWindowUnderlay(LayerManager* aManager, nsIntRect aRect) = 0;
/**
* Called after the LayerManager draws the layer tree
*

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

@ -132,6 +132,7 @@ public:
bool* aAllowRetaining = nsnull);
virtual void CreateCompositor();
virtual void DrawWindowUnderlay(LayerManager* aManager, nsIntRect aRect) {}
virtual void DrawWindowOverlay(LayerManager* aManager, nsIntRect aRect) {}
virtual void UpdateThemeGeometries(const nsTArray<ThemeGeometry>& aThemeGeometries) {}
virtual gfxASurface* GetThebesSurface();