Bug 1450307 - Round scaled paint size instead of paint bounds in GenerateFallbackData. r?jrmuizel
A component of dtSize could be zero because RoundedToInt(rect).Size() is not the same as
RoundedToInt(rect.Size()). The size after rounding might be zero, even if the rounded size
is not zero. For example with x0=0.5, x1=1.1.
MozReview-Commit-ID: 3NeBMAVD5ub
--- a/gfx/layers/wr/WebRenderCommandBuilder.cpp
+++ b/gfx/layers/wr/WebRenderCommandBuilder.cpp
@@ -1603,19 +1603,19 @@ WebRenderCommandBuilder::GenerateFallbac
// has some sort of scaling applied.
LayerIntSize paintSize = RoundedToInt(LayerSize(bounds.Width() * scale.width, bounds.Height() * scale.height));
if (paintSize.width == 0 || paintSize.height == 0) {
return nullptr;
}
// Some display item may draw exceed the paintSize, we need prepare a larger
// draw target to contain the result.
- auto scaledBounds = bounds * LayoutDeviceToLayerScale(1);
- scaledBounds.Scale(scale.width, scale.height);
- LayerIntSize dtSize = RoundedToInt(scaledBounds).Size();
+ auto scaledPaintSize = bounds.Size() * LayoutDeviceToLayerScale(1);
+ scaledPaintSize.Scale(scale.width, scale.height);
+ LayerIntSize dtSize = RoundedToInt(scaledPaintSize);
bool needPaint = true;
LayoutDeviceIntPoint offset = RoundedToInt(bounds.TopLeft());
aImageRect = LayoutDeviceRect(offset, LayoutDeviceSize(RoundedToInt(bounds).Size()));
LayerRect paintRect = LayerRect(LayerPoint(0, 0), LayerSize(paintSize));
nsDisplayItemGeometry* geometry = fallbackData->GetGeometry();
// nsDisplayFilter is rendered via BasicLayerManager which means the invalidate