Bug 627273, part 3: Add gfxContext::FillWithOpacity. sr=vlad
This commit is contained in:
@@ -743,14 +743,7 @@ BasicImageLayer::PaintContext(gfxPattern* aPattern,
|
|||||||
// No need to snap here; our transform has already taken care of it.
|
// No need to snap here; our transform has already taken care of it.
|
||||||
aContext->Rectangle(gfxRect(0, 0, aSize.width, aSize.height));
|
aContext->Rectangle(gfxRect(0, 0, aSize.width, aSize.height));
|
||||||
aContext->SetPattern(aPattern);
|
aContext->SetPattern(aPattern);
|
||||||
if (aOpacity != 1.0) {
|
aContext->FillWithOpacity(aOpacity);
|
||||||
aContext->Save();
|
|
||||||
aContext->Clip();
|
|
||||||
aContext->Paint(aOpacity);
|
|
||||||
aContext->Restore();
|
|
||||||
} else {
|
|
||||||
aContext->Fill();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class BasicColorLayer : public ColorLayer, BasicImplData {
|
class BasicColorLayer : public ColorLayer, BasicImplData {
|
||||||
@@ -962,14 +955,7 @@ BasicCanvasLayer::PaintWithOpacity(gfxContext* aContext,
|
|||||||
// No need to snap here; our transform is already set up to snap our rect
|
// No need to snap here; our transform is already set up to snap our rect
|
||||||
aContext->Rectangle(gfxRect(0, 0, mBounds.width, mBounds.height));
|
aContext->Rectangle(gfxRect(0, 0, mBounds.width, mBounds.height));
|
||||||
aContext->SetPattern(pat);
|
aContext->SetPattern(pat);
|
||||||
if (aOpacity != 1.0) {
|
aContext->FillWithOpacity(aOpacity);
|
||||||
aContext->Save();
|
|
||||||
aContext->Clip();
|
|
||||||
aContext->Paint(aOpacity);
|
|
||||||
aContext->Restore();
|
|
||||||
} else {
|
|
||||||
aContext->Fill();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mNeedsYFlip) {
|
if (mNeedsYFlip) {
|
||||||
aContext->SetMatrix(m);
|
aContext->SetMatrix(m);
|
||||||
@@ -2496,7 +2482,7 @@ BasicShadowCanvasLayer::Paint(gfxContext* aContext,
|
|||||||
// No need to snap here; our transform has already taken care of it
|
// No need to snap here; our transform has already taken care of it
|
||||||
aContext->Rectangle(r);
|
aContext->Rectangle(r);
|
||||||
aContext->SetPattern(pat);
|
aContext->SetPattern(pat);
|
||||||
aContext->Fill();
|
aContext->FillWithOpacity(GetEffectiveOpacity());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a shadow layer (PLayerChild) for aLayer, if we're forwarding
|
// Create a shadow layer (PLayerChild) for aLayer, if we're forwarding
|
||||||
|
|||||||
@@ -151,6 +151,21 @@ gfxContext::Fill()
|
|||||||
cairo_fill_preserve(mCairo);
|
cairo_fill_preserve(mCairo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gfxContext::FillWithOpacity(gfxFloat aOpacity)
|
||||||
|
{
|
||||||
|
// This method exists in the hope that one day cairo gets a direct
|
||||||
|
// API for this, and then we would change this method to use that
|
||||||
|
// API instead.
|
||||||
|
if (aOpacity != 1.0) {
|
||||||
|
gfxContextAutoSaveRestore saveRestore(this);
|
||||||
|
Clip();
|
||||||
|
Paint(aOpacity);
|
||||||
|
} else {
|
||||||
|
Fill();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gfxContext::MoveTo(const gfxPoint& pt)
|
gfxContext::MoveTo(const gfxPoint& pt)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -129,6 +129,14 @@ public:
|
|||||||
*/
|
*/
|
||||||
void Fill();
|
void Fill();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fill the current path according to the current settings and
|
||||||
|
* with |aOpacity|.
|
||||||
|
*
|
||||||
|
* Does not consume the current path.
|
||||||
|
*/
|
||||||
|
void FillWithOpacity(gfxFloat aOpacity);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Forgets the current path.
|
* Forgets the current path.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user