зеркало из https://github.com/mozilla/pjs.git
Bug 598538 - Reset the viewport rect when we create a temporary VBO, which can be bigger than the viewport! r=vlad a=b
This commit is contained in:
Родитель
959c8f586a
Коммит
5d541fe0e5
|
@ -169,9 +169,8 @@ ContainerLayerOGL::RenderLayer(int aPreviousFrameBuffer,
|
||||||
childOffset.x = visibleRect.x;
|
childOffset.x = visibleRect.x;
|
||||||
childOffset.y = visibleRect.y;
|
childOffset.y = visibleRect.y;
|
||||||
|
|
||||||
// Note that we don't set a new viewport here, even though we're
|
gl()->PushViewportRect();
|
||||||
// about to render to a new FBO -- see the comments in
|
mOGLManager->SetupPipeline(visibleRect.width, visibleRect.height);
|
||||||
// LayerManagerOGL::SetupPipeline.
|
|
||||||
|
|
||||||
gl()->fScissor(0, 0, visibleRect.width, visibleRect.height);
|
gl()->fScissor(0, 0, visibleRect.width, visibleRect.height);
|
||||||
gl()->fClearColor(0.0, 0.0, 0.0, 0.0);
|
gl()->fClearColor(0.0, 0.0, 0.0, 0.0);
|
||||||
|
@ -214,6 +213,12 @@ ContainerLayerOGL::RenderLayer(int aPreviousFrameBuffer,
|
||||||
|
|
||||||
if (needsFramebuffer) {
|
if (needsFramebuffer) {
|
||||||
// Unbind the current framebuffer and rebind the previous one.
|
// Unbind the current framebuffer and rebind the previous one.
|
||||||
|
|
||||||
|
// Restore the viewport
|
||||||
|
gl()->PopViewportRect();
|
||||||
|
nsIntRect viewport = gl()->ViewportRect();
|
||||||
|
mOGLManager->SetupPipeline(viewport.width, viewport.height);
|
||||||
|
|
||||||
gl()->fBindFramebuffer(LOCAL_GL_FRAMEBUFFER, aPreviousFrameBuffer);
|
gl()->fBindFramebuffer(LOCAL_GL_FRAMEBUFFER, aPreviousFrameBuffer);
|
||||||
gl()->fDeleteFramebuffers(1, &frameBuffer);
|
gl()->fDeleteFramebuffers(1, &frameBuffer);
|
||||||
|
|
||||||
|
|
|
@ -671,20 +671,7 @@ LayerManagerOGL::Render()
|
||||||
void
|
void
|
||||||
LayerManagerOGL::SetupPipeline(int aWidth, int aHeight)
|
LayerManagerOGL::SetupPipeline(int aWidth, int aHeight)
|
||||||
{
|
{
|
||||||
// Set the viewport correctly. Note that his viewport is used
|
// Set the viewport correctly.
|
||||||
// throughout the GL layers rendering pipeline, even when we're
|
|
||||||
// rendering to a FBO with different dimensions than the window.
|
|
||||||
// This means that we can set the viewMatrix once on every program
|
|
||||||
// (below). When we render to a FBO (as in ContainerLayerOGL), we
|
|
||||||
// have to pass a correct child offset so that the coordinate system
|
|
||||||
// is translated appropriately to start at the origin of the FBO
|
|
||||||
// (or, put another way, so that the FBO looks to be at the right
|
|
||||||
// spot in the parent).
|
|
||||||
//
|
|
||||||
// Note: this effectively means that we can't really draw to a FBO
|
|
||||||
// that is bigger than the window dimensions. This is fine for now,
|
|
||||||
// but might be a problem if we ever start doing GL drawing to
|
|
||||||
// retained layer FBOs that happen to retain more than is visible.
|
|
||||||
//
|
//
|
||||||
// When we're not double buffering, we use a FBO as our backbuffer.
|
// When we're not double buffering, we use a FBO as our backbuffer.
|
||||||
// We use a normal view transform in that case, meaning that our FBO
|
// We use a normal view transform in that case, meaning that our FBO
|
||||||
|
|
|
@ -321,6 +321,12 @@ public:
|
||||||
return mWidgetSize;
|
return mWidgetSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setup the viewport and projection matrix for rendering
|
||||||
|
* to a window of the given dimensions.
|
||||||
|
*/
|
||||||
|
void SetupPipeline(int aWidth, int aHeight);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/** Widget associated with this layer manager */
|
/** Widget associated with this layer manager */
|
||||||
nsIWidget *mWidget;
|
nsIWidget *mWidget;
|
||||||
|
@ -382,15 +388,12 @@ private:
|
||||||
* Render the current layer tree to the active target.
|
* Render the current layer tree to the active target.
|
||||||
*/
|
*/
|
||||||
void Render();
|
void Render();
|
||||||
/**
|
|
||||||
* Setup the viewport and projection matrix for rendering
|
|
||||||
* to a window of the given dimensions.
|
|
||||||
*/
|
|
||||||
void SetupPipeline(int aWidth, int aHeight);
|
|
||||||
/**
|
/**
|
||||||
* Setup a backbuffer of the given dimensions.
|
* Setup a backbuffer of the given dimensions.
|
||||||
*/
|
*/
|
||||||
void SetupBackBuffer(int aWidth, int aHeight);
|
void SetupBackBuffer(int aWidth, int aHeight);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copies the content of our backbuffer to the set transaction target.
|
* Copies the content of our backbuffer to the set transaction target.
|
||||||
*/
|
*/
|
||||||
|
|
Загрузка…
Ссылка в новой задаче