зеркало из https://github.com/mozilla/gecko-dev.git
Bug 854873. Keep scissor rect enabled. r=kats,nical
This commit is contained in:
Родитель
82b3f4eef5
Коммит
cfa81cf3d7
|
@ -399,6 +399,12 @@ public:
|
|||
virtual nsIWidget* GetWidget() const { return nullptr; }
|
||||
virtual const nsIntSize& GetWidgetSize() = 0;
|
||||
|
||||
// Call before and after any rendering not done by this compositor but which
|
||||
// might affect the compositor's internal state or the state of any APIs it
|
||||
// uses. For example, internal GL state.
|
||||
virtual void SaveState() {}
|
||||
virtual void RestoreState() {}
|
||||
|
||||
/**
|
||||
* Debug-build assertion that can be called to ensure code is running on the
|
||||
* compositor thread.
|
||||
|
|
|
@ -348,19 +348,23 @@ LayerManagerComposite::Render()
|
|||
}
|
||||
|
||||
// Allow widget to render a custom background.
|
||||
mCompositor->SaveState();
|
||||
mCompositor->GetWidget()->DrawWindowUnderlay(this, nsIntRect(actualBounds.x,
|
||||
actualBounds.y,
|
||||
actualBounds.width,
|
||||
actualBounds.height));
|
||||
mCompositor->RestoreState();
|
||||
|
||||
// Render our layers.
|
||||
RootLayer()->RenderLayer(nsIntPoint(0, 0), clipRect);
|
||||
|
||||
// Allow widget to render a custom foreground.
|
||||
mCompositor->SaveState();
|
||||
mCompositor->GetWidget()->DrawWindowOverlay(this, nsIntRect(actualBounds.x,
|
||||
actualBounds.y,
|
||||
actualBounds.width,
|
||||
actualBounds.height));
|
||||
mCompositor->RestoreState();
|
||||
|
||||
// Debugging
|
||||
RenderDebugOverlay(actualBounds);
|
||||
|
|
|
@ -510,7 +510,7 @@ CompositorOGL::Initialize()
|
|||
if (console) {
|
||||
nsString msg;
|
||||
msg +=
|
||||
NS_LITERAL_STRING("OpenGL LayerManager Initialized Succesfully.\nVersion: ");
|
||||
NS_LITERAL_STRING("OpenGL compositor Initialized Succesfully.\nVersion: ");
|
||||
msg += NS_ConvertUTF8toUTF16(
|
||||
nsDependentCString((const char*)mGLContext->fGetString(LOCAL_GL_VERSION)));
|
||||
msg += NS_LITERAL_STRING("\nVendor: ");
|
||||
|
@ -817,6 +817,8 @@ CompositorOGL::BeginFrame(const Rect *aClipRectIn, const gfxMatrix& aTransform,
|
|||
LOCAL_GL_ONE, LOCAL_GL_ONE);
|
||||
mGLContext->fEnable(LOCAL_GL_BLEND);
|
||||
|
||||
mGLContext->fEnable(LOCAL_GL_SCISSOR_TEST);
|
||||
|
||||
if (!aClipRectIn) {
|
||||
mGLContext->fScissor(0, 0, width, height);
|
||||
if (aClipRectOut) {
|
||||
|
@ -826,8 +828,6 @@ CompositorOGL::BeginFrame(const Rect *aClipRectIn, const gfxMatrix& aTransform,
|
|||
mGLContext->fScissor(aClipRectIn->x, aClipRectIn->y, aClipRectIn->width, aClipRectIn->height);
|
||||
}
|
||||
|
||||
mGLContext->fEnable(LOCAL_GL_SCISSOR_TEST);
|
||||
|
||||
// If the Android compositor is being used, this clear will be done in
|
||||
// DrawWindowUnderlay. Make sure the bits used here match up with those used
|
||||
// in mobile/android/base/gfx/LayerRenderer.java
|
||||
|
@ -986,8 +986,12 @@ CompositorOGL::DrawQuad(const Rect& aRect, const Rect& aClipRect,
|
|||
PROFILER_LABEL("CompositorOGL", "DrawQuad");
|
||||
MOZ_ASSERT(mFrameInProgress, "frame not started");
|
||||
|
||||
Rect clipRect = aClipRect;
|
||||
if (!mTarget) {
|
||||
clipRect.MoveBy(mRenderOffset.x, mRenderOffset.y);
|
||||
}
|
||||
IntRect intClipRect;
|
||||
aClipRect.ToIntRect(&intClipRect);
|
||||
clipRect.ToIntRect(&intClipRect);
|
||||
mGLContext->PushScissorRect(nsIntRect(intClipRect.x, intClipRect.y,
|
||||
intClipRect.width, intClipRect.height));
|
||||
|
||||
|
@ -1441,6 +1445,21 @@ CompositorOGL::GetMaxTextureSize() const
|
|||
return texSize;
|
||||
}
|
||||
|
||||
void
|
||||
CompositorOGL::SaveState()
|
||||
{
|
||||
mGLContext->PushScissorRect();
|
||||
}
|
||||
|
||||
void
|
||||
CompositorOGL::RestoreState()
|
||||
{
|
||||
// Restore state that might be changed by drawBackground/drawForeground in
|
||||
// mobile/android/base/gfx/LayerRenderer.java
|
||||
mGLContext->fEnable(LOCAL_GL_SCISSOR_TEST);
|
||||
mGLContext->PopScissorRect();
|
||||
}
|
||||
|
||||
void
|
||||
CompositorOGL::MakeCurrent(MakeCurrentFlags aFlags) {
|
||||
if (mDestroyed) {
|
||||
|
|
|
@ -158,6 +158,9 @@ public:
|
|||
return gfx::FORMAT_R8G8B8A8;
|
||||
}
|
||||
|
||||
virtual void SaveState() MOZ_OVERRIDE;
|
||||
virtual void RestoreState() MOZ_OVERRIDE;
|
||||
|
||||
/**
|
||||
* The compositor provides with temporary textures for use with direct
|
||||
* textruing like gralloc texture.
|
||||
|
|
|
@ -580,6 +580,9 @@ public class LayerRenderer implements Tabs.OnTabsChangedListener {
|
|||
|
||||
/** This function is invoked via JNI; be careful when modifying signature. */
|
||||
public void drawBackground() {
|
||||
// Any GL state which is changed here must be restored in
|
||||
// CompositorOGL::RestoreState
|
||||
|
||||
GLES20.glDisable(GLES20.GL_SCISSOR_TEST);
|
||||
|
||||
// Draw the overscroll background area as a solid color
|
||||
|
@ -612,6 +615,9 @@ public class LayerRenderer implements Tabs.OnTabsChangedListener {
|
|||
|
||||
/** This function is invoked via JNI; be careful when modifying signature. */
|
||||
public void drawForeground() {
|
||||
// Any GL state which is changed here must be restored in
|
||||
// CompositorOGL::RestoreState
|
||||
|
||||
/* Draw any extra layers that were added (likely plugins) */
|
||||
if (mExtraLayers.size() > 0) {
|
||||
for (Layer layer : mExtraLayers) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче