From 30521f0c57fe61a29bb4384047bcb64cd437969c Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Thu, 3 Jan 2019 17:51:05 -0700 Subject: [PATCH] gal: Fix zoom extents for large screens When at small zoom levels, the integer bbox can overflow, preventing redraw. We fix this by redrawing the full tree when this happens Fixes: lp:1733067 * https://bugs.launchpad.net/kicad/+bug/1733067 --- common/view/view.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/common/view/view.cpp b/common/view/view.cpp index 2690e703e3..e8f280949c 100644 --- a/common/view/view.cpp +++ b/common/view/view.cpp @@ -1147,12 +1147,19 @@ void VIEW::Redraw() #endif /* __WXDEBUG__ */ VECTOR2D screenSize = m_gal->GetScreenPixelSize(); - BOX2I rect( ToWorld( VECTOR2D( 0, 0 ) ), + BOX2D rect( ToWorld( VECTOR2D( 0, 0 ) ), ToWorld( screenSize ) - ToWorld( VECTOR2D( 0, 0 ) ) ); + rect.Normalize(); + BOX2I recti( rect.GetPosition(), rect.GetSize() ); - redrawRect( rect ); + // The view rtree uses integer positions. Large screens can overflow + // this size so in this case, simply set the rectangle to the full rtree + if( rect.GetWidth() > std::numeric_limits::max() || + rect.GetHeight() > std::numeric_limits::max() ) + recti.SetMaximum(); + redrawRect( recti ); // All targets were redrawn, so nothing is dirty markTargetClean( TARGET_CACHED ); markTargetClean( TARGET_NONCACHED );