From 5997381ace56e7bdd4384e3184027f851a46b689 Mon Sep 17 00:00:00 2001 From: "vladimir@pobox.com" Date: Sat, 23 Feb 2008 16:59:49 -0800 Subject: [PATCH] b=418494; use SOURCE instead of OVER when source has no transparency; r=stuart --- gfx/src/thebes/nsThebesImage.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/gfx/src/thebes/nsThebesImage.cpp b/gfx/src/thebes/nsThebesImage.cpp index bbef8cef1d08..aee4714ab092 100644 --- a/gfx/src/thebes/nsThebesImage.cpp +++ b/gfx/src/thebes/nsThebesImage.cpp @@ -436,10 +436,15 @@ nsThebesImage::Draw(nsIRenderingContext &aContext, return NS_OK; // otherwise + gfxContext::GraphicsOperator op = ctx->CurrentOperator(); + if (op == gfxContext::OPERATOR_OVER && mSinglePixelColor.a == 1.0) + ctx->SetOperator(gfxContext::OPERATOR_SOURCE); + ctx->SetColor(mSinglePixelColor); ctx->NewPath(); ctx->Rectangle(aDestRect, PR_TRUE); ctx->Fill(); + ctx->SetOperator(op); return NS_OK; } @@ -553,11 +558,18 @@ nsThebesImage::Draw(nsIRenderingContext &aContext, #endif } + gfxContext::GraphicsOperator op = ctx->CurrentOperator(); + if (op == gfxContext::OPERATOR_OVER && mFormat == gfxASurface::ImageFormatRGB24) + ctx->SetOperator(gfxContext::OPERATOR_SOURCE); + ctx->NewPath(); ctx->SetPattern(pat); ctx->Rectangle(destRect); ctx->Fill(); + ctx->SetOperator(op); + ctx->SetColor(gfxRGBA(0,0,0,0)); + return NS_OK; } @@ -650,10 +662,15 @@ nsThebesImage::ThebesDrawTile(gfxContext *thebesContext, thebesContext->SetPattern(&pat); } + gfxContext::GraphicsOperator op = thebesContext->CurrentOperator(); + if (op == gfxContext::OPERATOR_OVER && mFormat == gfxASurface::ImageFormatRGB24) + thebesContext->SetOperator(gfxContext::OPERATOR_SOURCE); + thebesContext->NewPath(); thebesContext->Rectangle(targetRect, doSnap); thebesContext->Fill(); + thebesContext->SetOperator(op); thebesContext->SetColor(gfxRGBA(0,0,0,0)); return NS_OK;