Bug 1484101 - Ensure DrawTargetTiled::PadEdges is called with region in device space. r=rhunt
authorJamie Nicol <jnicol@mozilla.com>
Wed, 22 Aug 2018 16:29:52 +0000
changeset 481274 e65592761f4cb4562a194cd2bc5c9c907e13f898
parent 481273 3dd6ba40f3bf51dc3513c0ad88c86f62473330b6
child 481275 202f0986f4599698554946394d878597b7263484
push id232
push userfmarier@mozilla.com
push dateWed, 05 Sep 2018 20:45:54 +0000
reviewersrhunt
bugs1484101
milestone63.0a1
Bug 1484101 - Ensure DrawTargetTiled::PadEdges is called with region in device space. r=rhunt In MultiTiledContentClient we can create a DrawTargetTiled with a different origin than the layer we are painting. We must therefore ensure when edge-padding that we provide the valid region in the draw target's device-space rather than layer-space. Not doing so was causing us to pad out in incorrect directions, causing visible seams. Differential Revision: https://phabricator.services.mozilla.com/D3993
gfx/2d/2D.h
gfx/layers/client/MultiTiledContentClient.cpp
--- a/gfx/2d/2D.h
+++ b/gfx/2d/2D.h
@@ -1295,16 +1295,17 @@ public:
   /**
    * Perform an in-place blur operation. This is only supported on data draw
    * targets.
    */
   virtual void Blur(const AlphaBoxBlur& aBlur);
 
   /**
    * Performs an in-place edge padding operation.
+   * aRegion is specified in device space.
    */
   virtual void PadEdges(const IntRegion& aRegion);
 
   /**
    * Performs an in-place buffer unrotation operation.
    */
   virtual bool Unrotate(IntPoint aRotation);
 
--- a/gfx/layers/client/MultiTiledContentClient.cpp
+++ b/gfx/layers/client/MultiTiledContentClient.cpp
@@ -265,17 +265,17 @@ void ClientMultiTiledLayerBuffer::Update
         ctx->CurrentMatrix().PreScale(mResolution, mResolution).PreTranslate(-mTilingOrigin));
 
       mCallback(&mPaintedLayer, ctx, paintRegion, dirtyRegion,
                 DrawRegionClip::DRAW, nsIntRegion(), mCallbackData);
       ctx = nullptr;
 
       // Edge padding allows us to avoid resampling artifacts
       if (gfxPrefs::TileEdgePaddingEnabled() && mResolution == 1) {
-        drawTarget->PadEdges(newValidRegion);
+        drawTarget->PadEdges(newValidRegion.MovedBy(-mTilingOrigin));
       }
 
       // Reset
       mPaintTiles.clear();
       mTilingOrigin = IntPoint(std::numeric_limits<int32_t>::max(),
                                std::numeric_limits<int32_t>::max());
     }