Don't try scaling wxHtmlImageCell if it has 0 size

This just results in assertion failures from wxImage and nothing useful.
This commit is contained in:
Vadim Zeitlin
2021-03-24 19:14:47 +01:00
parent 43d359f96d
commit afc3aa773a

View File

@@ -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); dc.DrawRectangle(x + m_PosX, y + m_PosY, m_Width, m_Height);
x++, y++; x++, y++;
} }
if ( m_bitmap ) if ( m_bitmap && m_Width && m_Height )
{ {
// We add in the scaling from the desired bitmap width // We add in the scaling from the desired bitmap width
// and height, so we only do the scaling once. // 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, // Optimisation for Windows: WIN32 scaling for window DCs is very poor,
// so unless we're using a printer DC, do the scaling ourselves. // so unless we're using a printer DC, do the scaling ourselves.
#if defined(__WXMSW__) && wxUSE_IMAGE #if defined(__WXMSW__) && wxUSE_IMAGE
if (m_Width >= 0 && m_Width != m_bitmap->GetWidth() if (m_Width != m_bitmap->GetWidth()
#if wxUSE_PRINTING_ARCHITECTURE #if wxUSE_PRINTING_ARCHITECTURE
&& !dc.IsKindOf(CLASSINFO(wxPrinterDC)) && !dc.IsKindOf(CLASSINFO(wxPrinterDC))
#endif #endif