Bug 1006797 - Only apply the window render offset when actually rendering to the window. r=nical
This commit is contained in:
@@ -92,6 +92,8 @@ CompositingRenderTargetOGL::InitializeImpl()
|
|||||||
NS_ERROR(msg.get());
|
NS_ERROR(msg.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mInitParams.mStatus = InitParams::INITIALIZED;
|
||||||
|
|
||||||
mCompositor->PrepareViewport(mInitParams.mSize);
|
mCompositor->PrepareViewport(mInitParams.mSize);
|
||||||
mGL->fScissor(0, 0, mInitParams.mSize.width, mInitParams.mSize.height);
|
mGL->fScissor(0, 0, mInitParams.mSize.width, mInitParams.mSize.height);
|
||||||
if (mInitParams.mInit == INIT_MODE_CLEAR) {
|
if (mInitParams.mInit == INIT_MODE_CLEAR) {
|
||||||
@@ -99,7 +101,6 @@ CompositingRenderTargetOGL::InitializeImpl()
|
|||||||
mGL->fClear(LOCAL_GL_COLOR_BUFFER_BIT);
|
mGL->fClear(LOCAL_GL_COLOR_BUFFER_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
mInitParams.mStatus = InitParams::INITIALIZED;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ public:
|
|||||||
const gfx::IntSize& aSize)
|
const gfx::IntSize& aSize)
|
||||||
{
|
{
|
||||||
RefPtr<CompositingRenderTargetOGL> result
|
RefPtr<CompositingRenderTargetOGL> result
|
||||||
= new CompositingRenderTargetOGL(aCompositor, gfx::IntPoint(0, 0), 0, 0);
|
= new CompositingRenderTargetOGL(aCompositor, gfx::IntPoint(), 0, 0);
|
||||||
result->mInitParams = InitParams(aSize, 0, INIT_MODE_NONE);
|
result->mInitParams = InitParams(aSize, 0, INIT_MODE_NONE);
|
||||||
result->mInitParams.mStatus = InitParams::INITIALIZED;
|
result->mInitParams.mStatus = InitParams::INITIALIZED;
|
||||||
return result.forget();
|
return result.forget();
|
||||||
@@ -112,6 +112,8 @@ public:
|
|||||||
*/
|
*/
|
||||||
void BindRenderTarget();
|
void BindRenderTarget();
|
||||||
|
|
||||||
|
bool IsWindow() { return GetFBO() == 0; }
|
||||||
|
|
||||||
GLuint GetFBO() const
|
GLuint GetFBO() const
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(mInitParams.mStatus == InitParams::INITIALIZED);
|
MOZ_ASSERT(mInitParams.mStatus == InitParams::INITIALIZED);
|
||||||
|
|||||||
@@ -593,7 +593,10 @@ CompositorOGL::PrepareViewport(const gfx::IntSize& aSize)
|
|||||||
viewMatrix.PreScale(1.0f, -1.0f);
|
viewMatrix.PreScale(1.0f, -1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mTarget) {
|
MOZ_ASSERT(mCurrentRenderTarget, "No destination");
|
||||||
|
// If we're drawing directly to the window then we want to offset
|
||||||
|
// drawing by the render offset.
|
||||||
|
if (!mTarget && mCurrentRenderTarget->IsWindow()) {
|
||||||
viewMatrix.PreTranslate(mRenderOffset.x, mRenderOffset.y);
|
viewMatrix.PreTranslate(mRenderOffset.x, mRenderOffset.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -660,8 +663,8 @@ CompositorOGL::SetRenderTarget(CompositingRenderTarget *aSurface)
|
|||||||
CompositingRenderTargetOGL* surface
|
CompositingRenderTargetOGL* surface
|
||||||
= static_cast<CompositingRenderTargetOGL*>(aSurface);
|
= static_cast<CompositingRenderTargetOGL*>(aSurface);
|
||||||
if (mCurrentRenderTarget != surface) {
|
if (mCurrentRenderTarget != surface) {
|
||||||
surface->BindRenderTarget();
|
|
||||||
mCurrentRenderTarget = surface;
|
mCurrentRenderTarget = surface;
|
||||||
|
surface->BindRenderTarget();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1019,9 +1022,14 @@ CompositorOGL::DrawQuad(const Rect& aRect,
|
|||||||
js::ProfileEntry::Category::GRAPHICS);
|
js::ProfileEntry::Category::GRAPHICS);
|
||||||
|
|
||||||
MOZ_ASSERT(mFrameInProgress, "frame not started");
|
MOZ_ASSERT(mFrameInProgress, "frame not started");
|
||||||
|
MOZ_ASSERT(mCurrentRenderTarget, "No destination");
|
||||||
|
|
||||||
Rect clipRect = aClipRect;
|
Rect clipRect = aClipRect;
|
||||||
if (!mTarget) {
|
// aClipRect is in destination coordinate space (after all
|
||||||
|
// transforms and offsets have been applied) so if our
|
||||||
|
// drawing is going to be shifted by mRenderOffset then we need
|
||||||
|
// to shift the clip rect by the same amount.
|
||||||
|
if (!mTarget && mCurrentRenderTarget->IsWindow()) {
|
||||||
clipRect.MoveBy(mRenderOffset.x, mRenderOffset.y);
|
clipRect.MoveBy(mRenderOffset.x, mRenderOffset.y);
|
||||||
}
|
}
|
||||||
IntRect intClipRect;
|
IntRect intClipRect;
|
||||||
|
|||||||
Reference in New Issue
Block a user