From 298876b7478847426761d4ec892ba39b36024b15 Mon Sep 17 00:00:00 2001 From: Tor Arvid Lund Date: Wed, 12 Feb 2014 10:07:47 -0500 Subject: [PATCH] Bug 948765 - Implement BasicColorLayer::Paint. r=nical --- gfx/layers/basic/BasicColorLayer.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/gfx/layers/basic/BasicColorLayer.cpp b/gfx/layers/basic/BasicColorLayer.cpp index 7f08217a9a3..b170dc737af 100644 --- a/gfx/layers/basic/BasicColorLayer.cpp +++ b/gfx/layers/basic/BasicColorLayer.cpp @@ -9,6 +9,7 @@ #include "BasicLayers.h" // for BasicLayerManager #include "gfxContext.h" // for gfxContext, etc #include "gfxRect.h" // for gfxRect +#include "gfx2DGlue.h" #include "mozilla/mozalloc.h" // for operator new #include "nsAutoPtr.h" // for nsRefPtr #include "nsCOMPtr.h" // for already_AddRefed @@ -45,13 +46,27 @@ public: virtual void Paint(DrawTarget* aTarget, SourceSurface* aMaskSurface) { - DeprecatedPaint(new gfxContext(aTarget), nullptr); //TODO: null->aMaskSurface + if (IsHidden()) { + return; + } + CompositionOp mixBlendMode = GetEffectiveMixBlendMode(); + CompositionOp op = + mixBlendMode != CompositionOp::OP_OVER ? mixBlendMode : GetOperator(); + + DrawOptions opts = DrawOptions(); + opts.mCompositionOp = op; + ColorPattern pattern(ToColor(mColor)); + aTarget->MaskSurface(pattern, + aMaskSurface, + ToIntRect(GetBounds()).TopLeft(), + opts); } virtual void DeprecatedPaint(gfxContext* aContext, Layer* aMaskLayer) { - if (IsHidden()) + if (IsHidden()) { return; + } gfxContextAutoSaveRestore contextSR(aContext); gfxContext::GraphicsOperator mixBlendMode = DeprecatedGetEffectiveMixBlendMode(); AutoSetOperator setOptimizedOperator(aContext,