mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-12 05:36:59 -04:00
Fix empty bitmap issue
Fix: invalidate best size cache that is used in newer wxWidgets versions
This commit is contained in:
@@ -56,6 +56,7 @@ void CardViewer::redraw() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CardViewer::onChangeSize() {
|
void CardViewer::onChangeSize() {
|
||||||
|
InvalidateBestSize();
|
||||||
wxSize ws = GetSize(), cs = GetClientSize();
|
wxSize ws = GetSize(), cs = GetClientSize();
|
||||||
wxSize desired_cs = (wxSize)getRotation().getExternalSize() + ws - cs;
|
wxSize desired_cs = (wxSize)getRotation().getExternalSize() + ws - cs;
|
||||||
if (desired_cs != cs) {
|
if (desired_cs != cs) {
|
||||||
@@ -78,6 +79,9 @@ void CardViewer::onPaint(wxPaintEvent&) {
|
|||||||
WITH_DYNAMIC_ARG(inOnPaint, true);
|
WITH_DYNAMIC_ARG(inOnPaint, true);
|
||||||
#endif
|
#endif
|
||||||
wxSize cs = GetClientSize();
|
wxSize cs = GetClientSize();
|
||||||
|
if (cs.GetWidth() == 0 || cs.GetHeight() == 0) {
|
||||||
|
return; // empty bitmaps are not allowed because some idiots think that 0 is not a number
|
||||||
|
}
|
||||||
if (!buffer.Ok() || buffer.GetWidth() != cs.GetWidth() || buffer.GetHeight() != cs.GetHeight()) {
|
if (!buffer.Ok() || buffer.GetWidth() != cs.GetWidth() || buffer.GetHeight() != cs.GetHeight()) {
|
||||||
buffer = Bitmap(cs.GetWidth(), cs.GetHeight());
|
buffer = Bitmap(cs.GetWidth(), cs.GetHeight());
|
||||||
up_to_date = false;
|
up_to_date = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user