Bug 1229202 (part 7) - Pass a DrawTarget to gfxXlibNativeRenderer::DrawDirect(). r=mattwoodrow.
authorNicholas Nethercote <nnethercote@mozilla.com>
Wed, 02 Dec 2015 15:32:17 -0800
changeset 275370 3e1abfc084f08983da4c873d41f55429a0c00a2a
parent 275369 f07938cebd6f8a0c1bb6b21d6e1986d4dc2e432f
child 275371 19dce9ab4d97753da057403d47e4e0a40b884105
push id29752
push usercbook@mozilla.com
push dateThu, 03 Dec 2015 11:03:31 +0000
treeherdermozilla-central@85cf2e720a84 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1229202 (part 7) - Pass a DrawTarget to gfxXlibNativeRenderer::DrawDirect(). r=mattwoodrow.
--- a/gfx/thebes/gfxXlibNativeRenderer.cpp
+++ b/gfx/thebes/gfxXlibNativeRenderer.cpp
@@ -131,23 +131,23 @@ FINISH:
  * Try the direct path.
  * @return True if we took the direct path
-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;
     bool direct = DrawCairo(borrowed.mCairo, size, flags, screen, visual);
     return direct;
@@ -485,30 +485,33 @@ gfxXlibNativeRenderer::Draw(gfxContext* 
         // little larger than the drawingRect;
         NATIVE_DRAWING_NOTE("FALLBACK: matrix not integer translation");
     } else if (!canDrawOverBackground) {
         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;
         gfxContextAutoSaveRestore autoSR(ctx);
         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)) {
+        }
     IntRect drawingRect(IntPoint(0, 0), size);
     // Drawing need only be performed within the clip extents
     // (and padding for the filter).
     if (!matrixIsIntegerTranslation) {
         // The source surface may need to be a little larger than the clip
         // extents due to the filter footprint.
@@ -520,17 +523,16 @@ gfxXlibNativeRenderer::Draw(gfxContext* 
     drawingRect.IntersectRect(drawingRect, intExtents);
     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*>
     cairo_surface_t* tempXlibSurface =
         CreateTempXlibSurface(cairoTarget, drawTarget, size,
                               canDrawOverBackground, flags, screen, visual,
--- a/gfx/thebes/gfxXlibNativeRenderer.h
+++ b/gfx/thebes/gfxXlibNativeRenderer.h
@@ -81,17 +81,17 @@ public:
      * rendered image into a surface similar to the surface of ctx; if
      * successful, a pointer to the new gfxASurface is stored in *resultSurface,
      * otherwise *resultSurface is set to nullptr.
     void Draw(gfxContext* ctx, mozilla::gfx::IntSize size,
               uint32_t flags, Screen *screen, Visual *visual);
-    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,
                    uint32_t flags, Screen *screen, Visual *visual);
     void DrawFallback(mozilla::gfx::DrawTarget* dt, gfxContext* ctx,
                       gfxASurface* aSurface, mozilla::gfx::IntSize& size,
                       mozilla::gfx::IntRect& drawingRect, bool canDrawOverBackground,