From 7e1afc46491850b2deb756d7c277cd26697e34d1 Mon Sep 17 00:00:00 2001 From: Bradley Bell Date: Mon, 2 Feb 2015 00:32:42 -0800 Subject: [PATCH] preserve movie aspect ratio, keep centered vertically --- main/movie.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/main/movie.c b/main/movie.c index ca860b76..c4009daa 100644 --- a/main/movie.c +++ b/main/movie.c @@ -173,11 +173,19 @@ void MovieShowFrame(ubyte *buf, uint bufw, uint bufh, uint sx, uint sy, source_bm.bm_data = buf; if (menu_use_game_res.intval) { - dest_canv = gr_create_sub_canvas(grd_curcanv, dstx * GWIDTH / MVESpec.screenWidth, dsty * GHEIGHT / MVESpec.screenHeight, w * GWIDTH / MVESpec.screenWidth, h * GHEIGHT / MVESpec.screenHeight); + float aspect = (float)w / (float)h; + + w = w * GWIDTH / MVESpec.screenWidth; + h = w / aspect; + dstx = dstx * GWIDTH / MVESpec.screenWidth; + dsty = GHEIGHT / 2 - h / 2; + + dest_canv = gr_create_sub_canvas(grd_curcanv, dstx, dsty, w, h); save_canv = grd_curcanv; gr_set_current_canvas(dest_canv); show_fullscr(&source_bm); gr_set_current_canvas(save_canv); + gr_free_sub_canvas(dest_canv); } else gr_bm_ubitblt(bufw,bufh,dstx,dsty,sx,sy,&source_bm,&grd_curcanv->cv_bitmap); } -- 2.39.2