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
This commit is contained in:
Jeff Muizelaar 2019-01-19 23:13:43 -05:00
Родитель 4760725faa
Коммит 98ad049f2d
1 изменённых файлов: 12 добавлений и 0 удалений

Просмотреть файл

@ -2039,6 +2039,14 @@ WebRenderCommandBuilder::GenerateFallbackData(
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;
}
@ -2146,6 +2154,10 @@ WebRenderCommandBuilder::GenerateFallbackData(
return nullptr;
}
}
aResources.SetBlobImageVisibleArea(
fallbackData->GetBlobImageKey().value(),
ViewAs<ImagePixel>(visibleRect,
PixelCastJustification::LayerIsImage));
} else {
fallbackData->CreateImageClientIfNeeded();
RefPtr<ImageClient> imageClient = fallbackData->GetImageClient();