From cebc8097cd3e251304eb895ab464ba5976618e65 Mon Sep 17 00:00:00 2001 From: Matt Woodrow Date: Fri, 18 Feb 2011 11:47:04 +1300 Subject: [PATCH] Bug 634784 - Fix scaling being applied twice on component alpha surfaces. r=joe a=blocking2.0 --- gfx/layers/opengl/ThebesLayerOGL.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/gfx/layers/opengl/ThebesLayerOGL.cpp b/gfx/layers/opengl/ThebesLayerOGL.cpp index f81a0b41bbe..56ac63aff4e 100644 --- a/gfx/layers/opengl/ThebesLayerOGL.cpp +++ b/gfx/layers/opengl/ThebesLayerOGL.cpp @@ -379,11 +379,9 @@ BasicBufferOGL::GetQuadrantRectangle(XSide aXSide, YSide aYSide) static void FillSurface(gfxASurface* aSurface, const nsIntRegion& aRegion, - const nsIntPoint& aOffset, const gfxRGBA& aColor, - float aXRes, float aYRes) + const nsIntPoint& aOffset, const gfxRGBA& aColor) { nsRefPtr ctx = new gfxContext(aSurface); - ctx->Scale(aXRes, aYRes); ctx->Translate(-gfxPoint(aOffset.x, aOffset.y)); gfxUtils::ClipToRegion(ctx, aRegion); ctx->SetColor(aColor); @@ -451,14 +449,15 @@ BasicBufferOGL::BeginPaint(ContentType aContentType, return result; nsIntRect visibleBounds = mLayer->GetVisibleRegion().GetBounds(); - if (visibleBounds.width > gl()->GetMaxTextureSize() || - visibleBounds.height > gl()->GetMaxTextureSize()) { - return result; - } - nsIntRect drawBounds = result.mRegionToDraw.GetBounds(); nsIntSize destBufferDims = ScaledSize(visibleBounds.Size(), aXResolution, aYResolution); + + if (destBufferDims.width > gl()->GetMaxTextureSize() || + destBufferDims.height > gl()->GetMaxTextureSize()) { + return result; + } + nsRefPtr destBuffer; nsRefPtr destBufferOnWhite; nsIntRect destBufferRect; @@ -609,8 +608,8 @@ BasicBufferOGL::BeginPaint(ContentType aContentType, gfxASurface *onWhite = mTexImageOnWhite->BeginUpdate(result.mRegionToDraw); NS_ASSERTION(result.mRegionToDraw == drawRegionCopy, "BeginUpdate should always modify the draw region in the same way!"); - FillSurface(onBlack, result.mRegionToDraw, nsIntPoint(0,0), gfxRGBA(0.0, 0.0, 0.0, 1.0), aXResolution, aYResolution); - FillSurface(onWhite, result.mRegionToDraw, nsIntPoint(0,0), gfxRGBA(1.0, 1.0, 1.0, 1.0), aXResolution, aYResolution); + FillSurface(onBlack, result.mRegionToDraw, nsIntPoint(0,0), gfxRGBA(0.0, 0.0, 0.0, 1.0)); + FillSurface(onWhite, result.mRegionToDraw, nsIntPoint(0,0), gfxRGBA(1.0, 1.0, 1.0, 1.0)); gfxASurface* surfaces[2] = { onBlack, onWhite }; nsRefPtr surf = new gfxTeeSurface(surfaces, NS_ARRAY_LENGTH(surfaces));