mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 882120 - Apply rounding to the layer-pixel rect in Java to fix robopan regression. r=kentuckyfriedtakahe
This commit is contained in:
parent
00adf5a054
commit
79ecb8de2c
@ -560,10 +560,12 @@ public class GeckoLayerClient implements LayerView.Listener, PanZoomTarget
|
||||
Tab tab = Tabs.getInstance().getSelectedTab();
|
||||
|
||||
RectF cssPageRect = new RectF(cssPageLeft, cssPageTop, cssPageRight, cssPageBottom);
|
||||
RectF pageRect = RectUtils.scaleAndRound(cssPageRect, zoom);
|
||||
|
||||
final ImmutableViewportMetrics newMetrics = currentMetrics
|
||||
.setViewportOrigin(offsetX, offsetY)
|
||||
.setZoomFactor(zoom)
|
||||
.setPageRect(RectUtils.scale(cssPageRect, zoom), cssPageRect)
|
||||
.setPageRect(pageRect, cssPageRect)
|
||||
.setIsRTL(tab.getIsRTL());
|
||||
// Since we have switched to displaying a different document, we need to update any
|
||||
// viewport-related state we have lying around. This includes mGeckoViewport and
|
||||
|
@ -74,6 +74,15 @@ public final class RectUtils {
|
||||
y + (rect.height() * scale));
|
||||
}
|
||||
|
||||
public static RectF scaleAndRound(RectF rect, float scale) {
|
||||
float left = rect.left * scale;
|
||||
float top = rect.top * scale;
|
||||
return new RectF(Math.round(left),
|
||||
Math.round(top),
|
||||
Math.round(left + (rect.width() * scale)),
|
||||
Math.round(top + (rect.height() * scale)));
|
||||
}
|
||||
|
||||
/** Returns the nearest integer rect of the given rect. */
|
||||
public static Rect round(RectF rect) {
|
||||
Rect r = new Rect();
|
||||
|
Loading…
Reference in New Issue
Block a user