Bug 1006797 - Only apply the window render offset when actually rendering to the window. r=nical

This commit is contained in:
Chris Lord
2014-10-03 13:22:32 +13:00
parent e71bc2cdd9
commit d97c2034f7
3 changed files with 16 additions and 5 deletions

View File

@@ -593,7 +593,10 @@ CompositorOGL::PrepareViewport(const gfx::IntSize& aSize)
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);
}
@@ -660,8 +663,8 @@ CompositorOGL::SetRenderTarget(CompositingRenderTarget *aSurface)
CompositingRenderTargetOGL* surface
= static_cast<CompositingRenderTargetOGL*>(aSurface);
if (mCurrentRenderTarget != surface) {
surface->BindRenderTarget();
mCurrentRenderTarget = surface;
surface->BindRenderTarget();
}
}
@@ -1019,9 +1022,14 @@ CompositorOGL::DrawQuad(const Rect& aRect,
js::ProfileEntry::Category::GRAPHICS);
MOZ_ASSERT(mFrameInProgress, "frame not started");
MOZ_ASSERT(mCurrentRenderTarget, "No destination");
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);
}
IntRect intClipRect;