Prevent assertions because of zero image size
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73441 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
2803fb9caf
commit
ab6b186064
@ -10774,6 +10774,10 @@ bool wxRichTextImage::LoadImageCache(wxDC& dc, bool resetCache)
|
||||
// Subtract borders
|
||||
sz = buffer->GetRichTextCtrl()->GetClientSize();
|
||||
|
||||
// Use a minimum size to stop images becoming very small
|
||||
sz.x = wxMax(sz.x, 100);
|
||||
sz.y = wxMax(sz.y, 100);
|
||||
|
||||
wxRect marginRect, borderRect, contentRect, paddingRect, outlineRect;
|
||||
marginRect = wxRect(0, 0, sz.x, sz.y);
|
||||
buffer->GetBoxRects(dc, buffer, buffer->GetAttributes(), marginRect, borderRect, contentRect, paddingRect, outlineRect);
|
||||
@ -10861,6 +10865,10 @@ bool wxRichTextImage::LoadImageCache(wxDC& dc, bool resetCache)
|
||||
width = (int) (float(m_originalImageSize.GetWidth()) * (float(height)/float(m_originalImageSize.GetHeight())));
|
||||
}
|
||||
|
||||
// Prevent the use of zero size
|
||||
width = wxMax(1, width);
|
||||
height = wxMax(1, height);
|
||||
|
||||
if (m_imageCache.IsOk() && m_imageCache.GetWidth() == width && m_imageCache.GetHeight() == height)
|
||||
{
|
||||
// Do nothing, we didn't need to change the image cache
|
||||
|
Loading…
Reference in New Issue
Block a user