Bug 1107414 - Get rid of gfxContext::FillWithOpacity. r=mattwoodrow

--HG--
extra : rebase_source : d64412c46d72a4d08be8edf1913c83bb12387b49
This commit is contained in:
Jonathan Watt 2014-12-02 14:29:44 -08:00
parent 491103743a
commit 8f47bfb387
4 changed files with 13 additions and 28 deletions

View File

@ -238,18 +238,6 @@ gfxContext::Fill(const Pattern& aPattern)
FillAzure(aPattern, 1.0f);
}
void
gfxContext::FillWithOpacity(gfxFloat aOpacity)
{
FillWithOpacity(PatternFromState(this), aOpacity);
}
void
gfxContext::FillWithOpacity(const Pattern& aPattern, gfxFloat aOpacity)
{
FillAzure(aPattern, Float(aOpacity));
}
void
gfxContext::MoveTo(const gfxPoint& pt)
{

View File

@ -108,15 +108,6 @@ public:
void Fill();
void Fill(const Pattern& aPattern);
/**
* Fill the current path according to the current settings and
* with |aOpacity|.
*
* Does not consume the current path.
*/
void FillWithOpacity(gfxFloat aOpacity);
void FillWithOpacity(const Pattern& aPattern, gfxFloat aOpacity);
/**
* Forgets the current path.
*/

View File

@ -200,6 +200,8 @@ gfxPatternDrawable::Draw(gfxContext* aContext,
gfxFloat aOpacity,
const gfxMatrix& aTransform)
{
DrawTarget& aDrawTarget = *aContext->GetDrawTarget();
if (!mPattern)
return false;
@ -216,12 +218,11 @@ gfxPatternDrawable::Draw(gfxContext* aContext,
aOpacity, aTransform);
}
aContext->NewPath();
gfxMatrix oldMatrix = mPattern->GetMatrix();
mPattern->SetMatrix(aTransform * oldMatrix);
aContext->SetPattern(mPattern);
aContext->Rectangle(aFillRect);
aContext->FillWithOpacity(aOpacity);
DrawOptions drawOptions(aOpacity);
aDrawTarget.FillRect(ToRect(aFillRect),
*mPattern->GetPattern(&aDrawTarget), drawOptions);
mPattern->SetMatrix(oldMatrix);
return true;
}

View File

@ -2835,9 +2835,14 @@ SVGTextDrawPathCallbacks::NotifySelectionBackgroundPathEmitted()
GeneralPattern fillPattern;
MakeFillPattern(&fillPattern);
if (fillPattern.GetPattern()) {
gfx->SetFillRule(nsSVGUtils::ToFillRule(mFrame->StyleSVG()->mFillRule));
gfx->FillWithOpacity(fillPattern,
mColor == NS_40PERCENT_FOREGROUND_COLOR ? 0.4 : 1.0);
RefPtr<Path> path = gfx->GetPath();
FillRule fillRule = nsSVGUtils::ToFillRule(mFrame->StyleSVG()->mFillRule);
if (fillRule != path->GetFillRule()) {
RefPtr<PathBuilder> builder = path->CopyToBuilder(fillRule);
path = builder->Finish();
}
DrawOptions drawOptions(mColor == NS_40PERCENT_FOREGROUND_COLOR ? 0.4 : 1.0);
gfx->GetDrawTarget()->Fill(path, fillPattern, drawOptions);
}
gfx->Restore();
}