From 7fe4d31af28ffb88e63d88176e1b2267851e8136 Mon Sep 17 00:00:00 2001 From: Joe Drew Date: Wed, 22 Sep 2010 14:17:01 -0400 Subject: [PATCH] Bug 596784 - Only draw the rects of the visible region, not the bounds. r=vlad a=b --- gfx/layers/opengl/ThebesLayerOGL.cpp | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/gfx/layers/opengl/ThebesLayerOGL.cpp b/gfx/layers/opengl/ThebesLayerOGL.cpp index 3294a48377b..7aac49ed67e 100644 --- a/gfx/layers/opengl/ThebesLayerOGL.cpp +++ b/gfx/layers/opengl/ThebesLayerOGL.cpp @@ -163,18 +163,22 @@ ThebesLayerBufferOGL::RenderTo(const nsIntPoint& aOffset, gl()->fBindTexture(LOCAL_GL_TEXTURE_2D, mTexImage->Texture()); } - nsIntRect quadRect = mLayer->GetVisibleRegion().GetBounds(); - program->Activate(); - program->SetLayerQuadRect(quadRect); - program->SetLayerOpacity(mLayer->GetOpacity()); - program->SetLayerTransform(mLayer->GetTransform()); - program->SetRenderOffset(aOffset); - program->SetTextureUnit(0); - DEBUG_GL_ERROR_CHECK(gl()); + nsIntRegionRectIterator iter(mLayer->GetVisibleRegion()); + const nsIntRect *iterRect; + while (iterRect = iter.Next()) { + nsIntRect quadRect = *iterRect; + program->Activate(); + program->SetLayerQuadRect(quadRect); + program->SetLayerOpacity(mLayer->GetOpacity()); + program->SetLayerTransform(mLayer->GetTransform()); + program->SetRenderOffset(aOffset); + program->SetTextureUnit(0); + DEBUG_GL_ERROR_CHECK(gl()); - quadRect.MoveBy(-GetOriginOffset()); - BindAndDrawQuadWithTextureRect(program, quadRect, mTexImage->GetSize(), gl()); - DEBUG_GL_ERROR_CHECK(gl()); + quadRect.MoveBy(-GetOriginOffset()); + BindAndDrawQuadWithTextureRect(program, quadRect, mTexImage->GetSize(), gl()); + DEBUG_GL_ERROR_CHECK(gl()); + } }