Merge pull request #2334 from KLayout/bugfix/issue-2331

Fixed issue #2331 - assertion and crash with fractional scaling and o…
This commit is contained in:
Matthias Köfferlein 2026-05-20 19:02:43 +02:00 committed by GitHub
commit e17c486cd1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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);