Fix crash resizing the window when we restart the app on OS X and it was closed on fullscreen size

This commit is contained in:
David Capello 2015-10-19 11:32:33 -03:00
parent 6e15553c88
commit caf8388ac6

View File

@ -384,23 +384,38 @@ void osx_update_dirty_lines(void)
qd_view_port = [qd_view qdPort];
if (qd_view_port) {
Rect qd_view_bounds;
int qd_view_width;
int qd_view_height;
GetPortBounds(qd_view_port, &qd_view_bounds);
qd_view_width = (qd_view_bounds.right - qd_view_bounds.left);
qd_view_height = (qd_view_bounds.bottom - qd_view_bounds.top);
ASSERT(qd_view_width > 0);
ASSERT(qd_view_height > 0);
if (qd_view_width > 0 && qd_view_height > 0) {
int titlebar_height =
((int)([osx_window frame].size.height) - gfx_quartz_window.h);
qd_view_pitch = GetPixRowBytes(GetPortPixMap(qd_view_port));
qd_view_addr = GetPixBaseAddr(GetPortPixMap(qd_view_port)) +
((int)([osx_window frame].size.height) - gfx_quartz_window.h) * qd_view_pitch;
titlebar_height * qd_view_pitch;
if (colorconv_blitter || (osx_setup_colorconv_blitter() == 0)) {
SetEmptyRgn(update_region);
rect.left = 0;
rect.right = gfx_quartz_window.w;
rect.right = qd_view_width;
while (rect.top < gfx_quartz_window.h) {
while ((!dirty_lines[rect.top]) && (rect.top < gfx_quartz_window.h))
while (rect.top < qd_view_height) {
while ((!dirty_lines[rect.top]) && (rect.top < qd_view_height))
rect.top++;
if (rect.top >= gfx_quartz_window.h)
if (rect.top >= qd_view_height)
break;
rect.bottom = rect.top;
while ((dirty_lines[rect.bottom]) && (rect.bottom < gfx_quartz_window.h)) {
while ((dirty_lines[rect.bottom]) && (rect.bottom < qd_view_height)) {
dirty_lines[rect.bottom] = 0;
rect.bottom++;
}
@ -426,6 +441,7 @@ void osx_update_dirty_lines(void)
rect.top = rect.bottom;
}
}
}
QDFlushPortBuffer(qd_view_port, update_region);
}
UnlockPortBits([qd_view qdPort]);