Bug 1233605 - Cull some uses of gfxContext. r=dholbert.

This commit is contained in:
Nicholas Nethercote 2015-12-17 19:36:09 -08:00
parent 4641b0f483
commit f90f35bce1
7 changed files with 14 additions and 19 deletions

View File

@ -190,7 +190,6 @@ ClientLayerManager::BeginTransactionWithTarget(gfxContext* aTarget)
mPhase = PHASE_CONSTRUCTION;
MOZ_ASSERT(mKeepAlive.IsEmpty(), "uncommitted txn?");
RefPtr<gfxContext> targetContext = aTarget;
// If the last transaction was incomplete (a failed DoEmptyTransaction),
// don't signal a new transaction to ShadowLayerForwarder. Carry on adding

View File

@ -1328,8 +1328,6 @@ ClientMultiTiledLayerBuffer::ValidateTile(TileClient& aTile,
RefPtr<DrawTarget> drawTarget = backBuffer->BorrowDrawTarget();
drawTarget->SetTransform(Matrix());
RefPtr<gfxContext> ctxt = new gfxContext(drawTarget);
// XXX Perhaps we should just copy the bounding rectangle here?
RefPtr<gfx::SourceSurface> source = mSinglePaintDrawTarget->Snapshot();
nsIntRegionRectIterator it(aDirtyRegion);
@ -1363,7 +1361,6 @@ ClientMultiTiledLayerBuffer::ValidateTile(TileClient& aTile,
aTileOrigin.y * GetPresShellResolution(), GetTileLength(), GetTileLength());
#endif
ctxt = nullptr;
drawTarget = nullptr;
nsIntRegion tileRegion =

View File

@ -1716,8 +1716,9 @@ gfxFont::DrawOneGlyph(uint32_t aGlyphID, double aAdvance, gfxPoint *aPt,
}
if (fontParams.haveColorGlyphs &&
RenderColorGlyph(runParams.context, fontParams.scaledFont,
fontParams.renderingOptions, fontParams.drawOptions,
RenderColorGlyph(runParams.dt,
fontParams.scaledFont, fontParams.renderingOptions,
fontParams.drawOptions,
fontParams.matInv * gfx::Point(devPt.x, devPt.y),
aGlyphID)) {
return;
@ -2098,7 +2099,7 @@ gfxFont::RenderSVGGlyph(gfxContext *aContext, gfxPoint aPoint, DrawMode aDrawMod
}
bool
gfxFont::RenderColorGlyph(gfxContext* aContext,
gfxFont::RenderColorGlyph(DrawTarget* aDrawTarget,
mozilla::gfx::ScaledFont* scaledFont,
GlyphRenderingOptions* aRenderingOptions,
mozilla::gfx::DrawOptions aDrawOptions,
@ -2112,7 +2113,6 @@ gfxFont::RenderColorGlyph(gfxContext* aContext,
return false;
}
RefPtr<DrawTarget> dt = aContext->GetDrawTarget();
for (uint32_t layerIndex = 0; layerIndex < layerGlyphs.Length();
layerIndex++) {
Glyph glyph;
@ -2123,9 +2123,9 @@ gfxFont::RenderColorGlyph(gfxContext* aContext,
buffer.mGlyphs = &glyph;
buffer.mNumGlyphs = 1;
dt->FillGlyphs(scaledFont, buffer,
ColorPattern(layerColors[layerIndex]),
aDrawOptions, aRenderingOptions);
aDrawTarget->FillGlyphs(scaledFont, buffer,
ColorPattern(layerColors[layerIndex]),
aDrawOptions, aRenderingOptions);
}
return true;
}

View File

@ -2125,7 +2125,7 @@ protected:
gfxTextRunDrawCallbacks *aCallbacks,
bool& aEmittedGlyphs) const;
bool RenderColorGlyph(gfxContext* aContext,
bool RenderColorGlyph(DrawTarget* aDrawTarget,
mozilla::gfx::ScaledFont* scaledFont,
mozilla::gfx::GlyphRenderingOptions* renderingOptions,
mozilla::gfx::DrawOptions drawOptions,

View File

@ -5736,15 +5736,15 @@ FrameLayerBuilder::PaintItems(nsTArray<ClippedDisplayItem>& aItems,
* items separately for each rect in the visible region rather
* than clipping to a complex region.
*/
static bool ShouldDrawRectsSeparately(gfxContext* aContext, DrawRegionClip aClip)
static bool
ShouldDrawRectsSeparately(DrawTarget* aDrawTarget, DrawRegionClip aClip)
{
if (!gfxPrefs::LayoutPaintRectsSeparately() ||
aClip == DrawRegionClip::NONE) {
return false;
}
DrawTarget *dt = aContext->GetDrawTarget();
return !dt->SupportsRegionClipping();
return !aDrawTarget->SupportsRegionClipping();
}
static void DrawForcedBackgroundColor(DrawTarget& aDrawTarget,
@ -5821,7 +5821,8 @@ FrameLayerBuilder::DrawPaintedLayer(PaintedLayer* aLayer,
(aLayer->GetUserData(&gPaintedDisplayItemLayerUserData));
NS_ASSERTION(userData, "where did our user data go?");
bool shouldDrawRectsSeparately = ShouldDrawRectsSeparately(aContext, aClip);
bool shouldDrawRectsSeparately =
ShouldDrawRectsSeparately(&aDrawTarget, aClip);
if (!shouldDrawRectsSeparately) {
if (aClip == DrawRegionClip::DRAW) {

View File

@ -929,10 +929,9 @@ nsCSSRendering::PaintOutline(nsPresContext* aPresContext,
Float(width / twipsPerPixel) };
// start drawing
gfxContext *ctx = aRenderingContext.ThebesContext();
nsCSSBorderRenderer br(aPresContext->Type(),
ctx->GetDrawTarget(),
aRenderingContext.GetDrawTarget(),
oRect,
outlineStyles,
outlineWidths,

View File

@ -476,7 +476,6 @@ nsTextBoxFrame::DrawText(nsRenderingContext& aRenderingContext,
presContext->RoundAppUnitsToNearestDevPixels(aTextRect.y + ascent);
}
RefPtr<gfxContext> ctx = aRenderingContext.ThebesContext();
Point pt(presContext->AppUnitsToGfxUnits(aTextRect.x),
presContext->AppUnitsToGfxUnits(aTextRect.y));
Float width = presContext->AppUnitsToGfxUnits(aTextRect.width);