diff options
-rw-r--r-- | plat.c | 24 |
1 files changed, 9 insertions, 15 deletions
@@ -431,8 +431,8 @@ void app_rencpy( int x, y, sj = 0; int w = viewport_w * s; int h = viewport_h * s; - int ex = sx + w; - int ey = sy + h; + int ex = mini(sx + w, max_pc_window_w); + int ey = mini(sy + h, max_pc_window_h); for (y = sy; y < ey; y++, sj++) { int sy = sj / s; int si = 0; @@ -449,7 +449,7 @@ void app_rencpy( i->wi, i->gc, i->bb, - 0, 0, + sx, sy, sx, sy, w, h ); @@ -472,19 +472,13 @@ void app_rencpy( } void app_end(App* a) { - int s = 1; - int m1, m2; + int s, x, y; App_Internal* i = (App_Internal*)(&a[1]); - if (i->w < i->h) { - m1 = i->w; - m2 = viewport_w; - } else { - m1 = i->h; - m2 = viewport_h; - } - while (m2 * s < m1) s++; /* lol */ - s = maxi(1, s - 1); - app_rencpy(a, i, 0, 0, s); + for (s = 1; viewport_w * s <= i->w && viewport_h * s <= i->h; s++); + if (s > 1) s--; + x = (i->w >> 1) - ((viewport_w * s) >> 1); + y = (i->h >> 1) - ((viewport_h * s) >> 1); + app_rencpy(a, i, x, y, s); i->end = get_timer(); a->fps = 1000000000 / (i->end - i->begin); } |