Bug 1450307 - Round scaled paint size instead of paint bounds in GenerateFallbackData. r?jrmuizel draft
authorRyan Hunt <rhunt@eqrion.net>
Mon, 02 Apr 2018 17:07:04 -0500
changeset 776361 a691ccf2ff0d62bd2d121b28b4aff4c0b9c33fae
parent 776018 c44f60c43432d468639b5fe078420e60c13fd3de
push id104851
push userbmo:rhunt@eqrion.net
push dateMon, 02 Apr 2018 22:07:25 +0000
reviewersjrmuizel
bugs1450307
milestone61.0a1
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
gfx/layers/wr/WebRenderCommandBuilder.cpp
--- 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