Bug 948765 - Implement BasicColorLayer::Paint. r=nical

This commit is contained in:
Tor Arvid Lund 2014-02-12 10:07:47 -05:00
parent 09df5cf35c
commit 298876b747

View File

@ -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,