mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-12-23 17:00:57 +01:00
Protection against a resize of size 0
This commit is contained in:
parent
2dee47c827
commit
7331b79021
1 changed files with 3 additions and 4 deletions
|
@ -51,7 +51,6 @@ static bool IsWithinTouchscreen(const EmuWindow::FramebufferLayout& layout, unsi
|
||||||
}
|
}
|
||||||
|
|
||||||
std::tuple<unsigned,unsigned> EmuWindow::ClipToTouchScreen(unsigned new_x, unsigned new_y) {
|
std::tuple<unsigned,unsigned> EmuWindow::ClipToTouchScreen(unsigned new_x, unsigned new_y) {
|
||||||
|
|
||||||
new_x = std::max(new_x, framebuffer_layout.bottom_screen.left);
|
new_x = std::max(new_x, framebuffer_layout.bottom_screen.left);
|
||||||
new_x = std::min(new_x, framebuffer_layout.bottom_screen.right-1);
|
new_x = std::min(new_x, framebuffer_layout.bottom_screen.right-1);
|
||||||
|
|
||||||
|
@ -92,9 +91,9 @@ void EmuWindow::TouchMoved(unsigned framebuffer_x, unsigned framebuffer_y) {
|
||||||
}
|
}
|
||||||
|
|
||||||
EmuWindow::FramebufferLayout EmuWindow::FramebufferLayout::DefaultScreenLayout(unsigned width, unsigned height) {
|
EmuWindow::FramebufferLayout EmuWindow::FramebufferLayout::DefaultScreenLayout(unsigned width, unsigned height) {
|
||||||
|
// When hiding the widget, the function receives a size of 0
|
||||||
ASSERT(width > 0);
|
if (width == 0) width = 1;
|
||||||
ASSERT(height > 0);
|
if (height == 0) height = 1;
|
||||||
|
|
||||||
EmuWindow::FramebufferLayout res = { width, height, {}, {} };
|
EmuWindow::FramebufferLayout res = { width, height, {}, {} };
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue