Skip to content

Commit

Permalink
Add DrawWindowUnderlay implementation for embedlite. rainemak
Browse files Browse the repository at this point in the history
  • Loading branch information
tmeshkova authored and rojkov committed May 19, 2015
1 parent b36d353 commit 7a5ccc5
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 2 deletions.
4 changes: 4 additions & 0 deletions embedding/embedlite/EmbedLiteView.h
Expand Up @@ -65,8 +65,12 @@ class EmbedLiteViewListener
virtual bool SendAsyncScrollDOMEvent(const gfxRect& aContentRect,
const gfxSize& aScrollableSize) { return false; }

// Will be always called from the compositor thread.
virtual void DrawUnderlay() {}

// Will be always called from the compositor thread.
virtual void DrawOverlay(const nsIntRect& aRect) {}

};

class EmbedLiteApp;
Expand Down
8 changes: 8 additions & 0 deletions embedding/embedlite/embedshared/EmbedLitePuppetWidget.cpp
Expand Up @@ -585,6 +585,14 @@ EmbedLitePuppetWidget::HasGLContext()
return parent->RequestGLContext();
}

void
EmbedLitePuppetWidget::DrawWindowUnderlay(LayerManagerComposite *aManager, nsIntRect aRect)
{
EmbedLiteCompositorParent* parent =
static_cast<EmbedLiteCompositorParent*>(mCompositorParent.get());
parent->DrawWindowUnderlay(aManager, aRect);
}

void
EmbedLitePuppetWidget::DrawWindowOverlay(LayerManagerComposite *aManager, nsIntRect aRect)
{
Expand Down
8 changes: 8 additions & 0 deletions embedding/embedlite/embedshared/EmbedLitePuppetWidget.h
Expand Up @@ -147,6 +147,14 @@ class EmbedLitePuppetWidget : public nsBaseWidget
virtual nsIntRect GetNaturalBounds();
virtual bool HasGLContext();

/**
* Called before the LayerManager draws the layer tree.
*
* Always called from the compositing thread. Puppet Widget passes the call
* forward to the EmbedLiteCompositorParent.
*/
virtual void DrawWindowUnderlay(LayerManagerComposite* aManager, nsIntRect aRect);

/**
* Called after the LayerManager draws the layer tree
*
Expand Down
8 changes: 8 additions & 0 deletions embedding/embedlite/embedthread/EmbedLiteCompositorParent.cpp
Expand Up @@ -339,6 +339,14 @@ bool EmbedLiteCompositorParent::RequestGLContext()
return view ? view->GetListener()->RequestCurrentGLContext() : false;
}

void EmbedLiteCompositorParent::DrawWindowUnderlay(LayerManagerComposite *aManager, nsIntRect aRect)
{
EmbedLiteView* view = EmbedLiteApp::GetInstance()->GetViewByID(mId);
if (view) {
view->GetListener()->DrawUnderlay();
}
}

void EmbedLiteCompositorParent::DrawWindowOverlay(LayerManagerComposite *aManager, nsIntRect aRect)
{
EmbedLiteView* view = EmbedLiteApp::GetInstance()->GetViewByID(mId);
Expand Down
Expand Up @@ -39,6 +39,7 @@ class EmbedLiteCompositorParent : public mozilla::layers::CompositorParent

virtual bool RequestGLContext();

void DrawWindowUnderlay(mozilla::layers::LayerManagerComposite *aManager, nsIntRect aRect);
void DrawWindowOverlay(mozilla::layers::LayerManagerComposite *aManager, nsIntRect aRect);

protected:
Expand Down
6 changes: 4 additions & 2 deletions gfx/layers/opengl/CompositorOGL.cpp
Expand Up @@ -648,8 +648,10 @@ CompositorOGL::BeginFrame(const nsIntRegion& aInvalidRegion,
// DrawWindowUnderlay. Make sure the bits used here match up with those used
// in mobile/android/base/gfx/LayerRenderer.java
#ifndef MOZ_WIDGET_ANDROID
mGLContext->fClearColor(0.0, 0.0, 0.0, 0.0);
mGLContext->fClear(LOCAL_GL_COLOR_BUFFER_BIT | LOCAL_GL_DEPTH_BUFFER_BIT);
if (gfxPrefs::ClearCompoisitorContext()) {
mGLContext->fClearColor(0.0, 0.0, 0.0, 0.0);
mGLContext->fClear(LOCAL_GL_COLOR_BUFFER_BIT | LOCAL_GL_DEPTH_BUFFER_BIT);
}
#endif
}

Expand Down
2 changes: 2 additions & 0 deletions gfx/thebes/gfxPrefs.h
Expand Up @@ -196,6 +196,8 @@ class gfxPrefs final
DECL_GFX_PREF(Once, "gfx.canvas.skiagl.cache-size", CanvasSkiaGLCacheSize, int32_t, 96);
DECL_GFX_PREF(Once, "gfx.canvas.skiagl.cache-items", CanvasSkiaGLCacheItems, int32_t, 256);

DECL_GFX_PREF(Once, "gfx.compositor.clear-context", ClearCompoisitorContext, bool, true);

DECL_GFX_PREF(Live, "gfx.color_management.enablev4", CMSEnableV4, bool, false);
DECL_GFX_PREF(Live, "gfx.color_management.mode", CMSMode, int32_t,-1);
// The zero default here should match QCMS_INTENT_DEFAULT from qcms.h
Expand Down

0 comments on commit 7a5ccc5

Please sign in to comment.