Fixed issue #2331 - assertion and crash with fractional scaling and oversampling

This commit is contained in:
Matthias Koefferlein 2026-04-20 22:55:27 +02:00
parent 5ccf6260f1
commit 93090948ee
1 changed files with 6 additions and 4 deletions

View File

@ -947,8 +947,10 @@ LayoutCanvas::screenshot ()
void
LayoutCanvas::resize_event (unsigned int width, unsigned int height)
{
unsigned int w = width * dpr () + 0.5, h = height * dpr () + 0.5;
unsigned int wl = width * m_oversampling * dpr () + 0.5, hl = height * m_oversampling * dpr () + 0.5;
unsigned int w = (unsigned int) ceil (width * dpr () - db::epsilon);
unsigned int h = (unsigned int) ceil (height * dpr () - db::epsilon);
unsigned int wl = w * m_oversampling;
unsigned int hl = h * m_oversampling;
if (m_viewport.width () != w || m_viewport.height () != h ||
m_viewport_l.width () != wl || m_viewport_l.height () != hl) {
@ -957,8 +959,8 @@ LayoutCanvas::resize_event (unsigned int width, unsigned int height)
m_image_cache.clear ();
// set the viewport to the new size
m_viewport.set_size (width * dpr () + 0.5, height * dpr () + 0.5);
m_viewport_l.set_size (width * m_oversampling * dpr () + 0.5, height * m_oversampling * dpr () + 0.5);
m_viewport.set_size (w, h);
m_viewport_l.set_size (wl, hl);
mouse_event_trans (db::DCplxTrans (1.0 / dpr ()) * m_viewport.trans ());
do_redraw_all (true);