Bug 1494924. Set the visible area of the blob to GetBuildingRect. r=mattwoodrow
authorJeff Muizelaar <jrmuizel@gmail.com>
Sat, 19 Jan 2019 23:13:43 -0500
changeset 514790 0a5759a02d0727f4fefeb4920db8158e1103258d
parent 514789 2bd66516b97abfc669d8a123da1af6a8174cde11
child 514791 44be6c1eb581bdd91023174d70f5b49052904945
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1494924
milestone66.0a1
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 1494924. Set the visible area of the blob to GetBuildingRect. r=mattwoodrow This lets us get some of the advantages of clipped blobs by drawing less of the fallback blob while still not needing to rerecord and redraw the blob completely during scrolling because of the changing clip rect. It drops the number of tiles requested on a reduced test case reduced from the Googled doc from 60 to a much more reasonable number. Differential Revision: https://phabricator.services.mozilla.com/D17180
gfx/layers/wr/WebRenderCommandBuilder.cpp
--- a/gfx/layers/wr/WebRenderCommandBuilder.cpp
+++ b/gfx/layers/wr/WebRenderCommandBuilder.cpp
@@ -2034,16 +2034,24 @@ WebRenderCommandBuilder::GenerateFallbac
   auto snappedTrans = LayerIntPoint::Floor(trans);
   LayerPoint residualOffset = trans - snappedTrans;
 
   auto dtRect = LayerIntRect::FromUnknownRect(
       ScaleToOutsidePixelsOffset(paintBounds, scale.width, scale.height,
                                  appUnitsPerDevPixel, residualOffset));
   auto dtSize = dtRect.Size();
 
+  auto visibleRect = LayerIntRect::FromUnknownRect(
+                         ScaleToOutsidePixelsOffset(
+                             aItem->GetBuildingRect(), scale.width,
+                             scale.height, appUnitsPerDevPixel, residualOffset))
+                         .Intersect(dtRect);
+  // visibleRect is relative to the blob origin so adjust for that
+  visibleRect -= dtRect.TopLeft();
+
   if (dtSize.IsEmpty()) {
     return nullptr;
   }
 
   aImageRect = dtRect / layerScale;
 
   auto offset = aImageRect.TopLeft();
 
@@ -2141,16 +2149,20 @@ WebRenderCommandBuilder::GenerateFallbac
         fallbackData->SetFonts(fonts);
       } else {
         // If there is no invalidation region and we don't have a image key,
         // it means we don't need to push image for the item.
         if (!fallbackData->GetBlobImageKey().isSome()) {
           return nullptr;
         }
       }
+      aResources.SetBlobImageVisibleArea(
+          fallbackData->GetBlobImageKey().value(),
+          ViewAs<ImagePixel>(visibleRect,
+                             PixelCastJustification::LayerIsImage));
     } else {
       fallbackData->CreateImageClientIfNeeded();
       RefPtr<ImageClient> imageClient = fallbackData->GetImageClient();
       RefPtr<ImageContainer> imageContainer =
           LayerManager::CreateImageContainer();
       bool isInvalidated = false;
 
       {