Bug 1229202 (part 7) - Pass a DrawTarget to gfxXlibNativeRenderer::DrawDirect(). r=mattwoodrow.

--HG--
extra : rebase_source : fe221f1bf1d3ef05e33ce01df45d8bf2453a734e
This commit is contained in:
Nicholas Nethercote 2015-12-02 15:32:17 -08:00
parent adb5b7b913
commit 8ed95a0919
2 changed files with 9 additions and 7 deletions

View File

@ -136,13 +136,13 @@ FINISH:
* @return True if we took the direct path
*/
bool
gfxXlibNativeRenderer::DrawDirect(gfxContext *ctx, IntSize size,
gfxXlibNativeRenderer::DrawDirect(DrawTarget* aDT, IntSize size,
uint32_t flags,
Screen *screen, Visual *visual)
{
// We need to actually borrow the context because we want to read out the
// clip rectangles.
BorrowedCairoContext borrowed(ctx->GetDrawTarget());
BorrowedCairoContext borrowed(aDT);
if (!borrowed.mCairo) {
return false;
}
@ -490,6 +490,8 @@ gfxXlibNativeRenderer::Draw(gfxContext* ctx, IntSize size,
NATIVE_DRAWING_NOTE("FALLBACK: unsupported operator");
}
DrawTarget* drawTarget = ctx->GetDrawTarget();
// Clipping to the region affected by drawing allows us to consider only
// the portions of the clip region that will be affected by drawing.
gfxRect clipExtents;
@ -498,12 +500,13 @@ gfxXlibNativeRenderer::Draw(gfxContext* ctx, IntSize size,
ctx->Clip(affectedRect);
clipExtents = ctx->GetClipExtents();
if (clipExtents.IsEmpty())
if (clipExtents.IsEmpty()) {
return; // nothing to do
}
if (canDrawOverBackground &&
DrawDirect(ctx, size, flags, screen, visual))
DrawDirect(drawTarget, size, flags, screen, visual)) {
return;
}
}
IntRect drawingRect(IntPoint(0, 0), size);
@ -525,7 +528,6 @@ gfxXlibNativeRenderer::Draw(gfxContext* ctx, IntSize size,
gfxPoint offset(drawingRect.x, drawingRect.y);
DrawingMethod method;
DrawTarget* drawTarget = ctx->GetDrawTarget();
Matrix dtTransform = drawTarget->GetTransform();
gfxPoint deviceTranslation = gfxPoint(dtTransform._31, dtTransform._32);
cairo_surface_t* cairoTarget = static_cast<cairo_surface_t*>

View File

@ -86,7 +86,7 @@ public:
uint32_t flags, Screen *screen, Visual *visual);
private:
bool DrawDirect(gfxContext *ctx, mozilla::gfx::IntSize bounds,
bool DrawDirect(mozilla::gfx::DrawTarget* aDT, mozilla::gfx::IntSize bounds,
uint32_t flags, Screen *screen, Visual *visual);
bool DrawCairo(cairo_t* cr, mozilla::gfx::IntSize size,