From afc3aa773a66d2d874c2ebfec86ce3890c24a544 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 24 Mar 2021 19:14:47 +0100 Subject: [PATCH] Don't try scaling wxHtmlImageCell if it has 0 size This just results in assertion failures from wxImage and nothing useful. --- src/html/m_image.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/html/m_image.cpp b/src/html/m_image.cpp index 4123efcffb..64f9ed0ab1 100644 --- a/src/html/m_image.cpp +++ b/src/html/m_image.cpp @@ -596,7 +596,7 @@ void wxHtmlImageCell::Draw(wxDC& dc, int x, int y, dc.DrawRectangle(x + m_PosX, y + m_PosY, m_Width, m_Height); x++, y++; } - if ( m_bitmap ) + if ( m_bitmap && m_Width && m_Height ) { // We add in the scaling from the desired bitmap width // and height, so we only do the scaling once. @@ -606,7 +606,7 @@ void wxHtmlImageCell::Draw(wxDC& dc, int x, int y, // Optimisation for Windows: WIN32 scaling for window DCs is very poor, // so unless we're using a printer DC, do the scaling ourselves. #if defined(__WXMSW__) && wxUSE_IMAGE - if (m_Width >= 0 && m_Width != m_bitmap->GetWidth() + if (m_Width != m_bitmap->GetWidth() #if wxUSE_PRINTING_ARCHITECTURE && !dc.IsKindOf(CLASSINFO(wxPrinterDC)) #endif