mirror of https://github.com/mgba-emu/mgba.git
Qt: Fix race condition in Qt display driver that could cause division by zero
This commit is contained in:
parent
e8e6b803f2
commit
be85200b3e
|
@ -130,6 +130,10 @@ void DisplayQt::paintEvent(QPaintEvent*) {
|
||||||
struct mRectangle frame;
|
struct mRectangle frame;
|
||||||
VideoBackendGetFrame(&m_backend, &frame);
|
VideoBackendGetFrame(&m_backend, &frame);
|
||||||
QPoint origin(-frame.x, -frame.y);
|
QPoint origin(-frame.x, -frame.y);
|
||||||
|
QSize drawSize(contentSize());
|
||||||
|
if (!drawSize.isValid() || drawSize.width() < 1 || drawSize.height() < 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
QRect full(clampSize(contentSize(), size(), isAspectRatioLocked(), isIntegerScalingLocked()));
|
QRect full(clampSize(contentSize(), size(), isAspectRatioLocked(), isIntegerScalingLocked()));
|
||||||
painter.save();
|
painter.save();
|
||||||
painter.translate(full.topLeft());
|
painter.translate(full.topLeft());
|
||||||
|
|
Loading…
Reference in New Issue