Bug 956401 - 5/9 - Let DrawWindow{Under,Over}lay take care of saving and restoring GL state - r=nrc

This commit is contained in:
Benoit Jacob 2014-01-07 15:02:18 -05:00
Родитель 89a33dce75
Коммит f89d762216
3 изменённых файлов: 15 добавлений и 4 удалений

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

@ -388,23 +388,19 @@ LayerManagerComposite::Render()
} }
// Allow widget to render a custom background. // Allow widget to render a custom background.
mCompositor->SaveState();
mCompositor->GetWidget()->DrawWindowUnderlay(this, nsIntRect(actualBounds.x, mCompositor->GetWidget()->DrawWindowUnderlay(this, nsIntRect(actualBounds.x,
actualBounds.y, actualBounds.y,
actualBounds.width, actualBounds.width,
actualBounds.height)); actualBounds.height));
mCompositor->RestoreState();
// Render our layers. // Render our layers.
RootLayer()->RenderLayer(clipRect); RootLayer()->RenderLayer(clipRect);
// Allow widget to render a custom foreground. // Allow widget to render a custom foreground.
mCompositor->SaveState();
mCompositor->GetWidget()->DrawWindowOverlay(this, nsIntRect(actualBounds.x, mCompositor->GetWidget()->DrawWindowOverlay(this, nsIntRect(actualBounds.x,
actualBounds.y, actualBounds.y,
actualBounds.width, actualBounds.width,
actualBounds.height)); actualBounds.height));
mCompositor->RestoreState();
// Debugging // Debugging
RenderDebugOverlay(actualBounds); RenderDebugOverlay(actualBounds);

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

@ -47,6 +47,8 @@ using mozilla::unused;
#include "mozilla/layers/APZCTreeManager.h" #include "mozilla/layers/APZCTreeManager.h"
#include "GLContext.h" #include "GLContext.h"
#include "GLContextProvider.h" #include "GLContextProvider.h"
#include "ScopedGLHelpers.h"
#include "mozilla/layers/CompositorOGL.h"
#include "nsTArray.h" #include "nsTArray.h"
@ -2380,6 +2382,10 @@ nsWindow::DrawWindowUnderlay(LayerManagerComposite* aManager, nsIntRect aRect)
return; return;
} }
gl::GLContext* gl = static_cast<CompositorOGL*>(aManager->GetCompositor())->gl();
gl::ScopedGLState scopedScissorTestState(gl, LOCAL_GL_SCISSOR_TEST);
gl::ScopedScissorRect scopedScissorRectState(gl);
client->ActivateProgram(); client->ActivateProgram();
if (!mLayerRendererFrame.BeginDrawing(&jniFrame)) return; if (!mLayerRendererFrame.BeginDrawing(&jniFrame)) return;
if (!mLayerRendererFrame.DrawBackground(&jniFrame)) return; if (!mLayerRendererFrame.DrawBackground(&jniFrame)) return;
@ -2402,6 +2408,10 @@ nsWindow::DrawWindowOverlay(LayerManagerComposite* aManager, nsIntRect aRect)
GeckoLayerClient* client = AndroidBridge::Bridge()->GetLayerClient(); GeckoLayerClient* client = AndroidBridge::Bridge()->GetLayerClient();
gl::GLContext* gl = static_cast<CompositorOGL*>(aManager->GetCompositor())->gl();
gl::ScopedGLState scopedScissorTestState(gl, LOCAL_GL_SCISSOR_TEST);
gl::ScopedScissorRect scopedScissorRectState(gl);
client->ActivateProgram(); client->ActivateProgram();
if (!mLayerRendererFrame.DrawForeground(&jniFrame)) return; if (!mLayerRendererFrame.DrawForeground(&jniFrame)) return;
if (!mLayerRendererFrame.EndDrawing(&jniFrame)) return; if (!mLayerRendererFrame.EndDrawing(&jniFrame)) return;

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

@ -62,6 +62,7 @@
#include "GLContextProvider.h" #include "GLContextProvider.h"
#include "GLContextCGL.h" #include "GLContextCGL.h"
#include "GLUploadHelpers.h" #include "GLUploadHelpers.h"
#include "ScopedGLHelpers.h"
#include "mozilla/layers/GLManager.h" #include "mozilla/layers/GLManager.h"
#include "mozilla/layers/CompositorOGL.h" #include "mozilla/layers/CompositorOGL.h"
#include "mozilla/layers/BasicCompositor.h" #include "mozilla/layers/BasicCompositor.h"
@ -2089,6 +2090,10 @@ nsChildView::DrawWindowOverlay(LayerManagerComposite* aManager, nsIntRect aRect)
void void
nsChildView::DrawWindowOverlay(GLManager* aManager, nsIntRect aRect) nsChildView::DrawWindowOverlay(GLManager* aManager, nsIntRect aRect)
{ {
GLContext* gl = aManager->gl();
ScopedGLState scopedScissorTestState(gl, LOCAL_GL_SCISSOR_TEST);
ScopedScissorRect scopedScissorRectState(gl);
MaybeDrawTitlebar(aManager, aRect); MaybeDrawTitlebar(aManager, aRect);
MaybeDrawResizeIndicator(aManager, aRect); MaybeDrawResizeIndicator(aManager, aRect);
MaybeDrawRoundedCorners(aManager, aRect); MaybeDrawRoundedCorners(aManager, aRect);