From b74634d8018bb56bd3d682d525a5f26376b9a29d Mon Sep 17 00:00:00 2001 From: Walter Litwinczyk Date: Wed, 2 Jul 2014 10:27:25 -0700 Subject: [PATCH] Bug 913999 - DrawWindow() - Remove hard-coded 1.0f in DrawOptions and only use Azure if alpha is not needed. r=mattwoodrow --- content/canvas/src/CanvasRenderingContext2D.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/content/canvas/src/CanvasRenderingContext2D.cpp b/content/canvas/src/CanvasRenderingContext2D.cpp index 6c7c366fc0fc..3db265fad722 100644 --- a/content/canvas/src/CanvasRenderingContext2D.cpp +++ b/content/canvas/src/CanvasRenderingContext2D.cpp @@ -3660,7 +3660,11 @@ CanvasRenderingContext2D::DrawWindow(nsGlobalWindow& window, double x, } nsRefPtr thebes; RefPtr drawDT; - if (gfxPlatform::GetPlatform()->SupportsAzureContentForDrawTarget(mTarget)) { + // Rendering directly is faster and can be done if mTarget supports Azure + // and does not need alpha blending. + if (gfxPlatform::GetPlatform()->SupportsAzureContentForDrawTarget(mTarget) && + GlobalAlpha() == 1.0f) + { thebes = new gfxContext(mTarget); thebes->SetMatrix(gfxMatrix(matrix._11, matrix._12, matrix._21, matrix._22, matrix._31, matrix._32)); @@ -3698,7 +3702,7 @@ CanvasRenderingContext2D::DrawWindow(nsGlobalWindow& window, double x, mgfx::Rect sourceRect(0, 0, sw, sh); mTarget->DrawSurface(source, destRect, sourceRect, DrawSurfaceOptions(mgfx::Filter::POINT), - DrawOptions(1.0f, CompositionOp::OP_OVER, + DrawOptions(GlobalAlpha(), CompositionOp::OP_OVER, AntialiasMode::NONE)); mTarget->Flush(); } else {