X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fsystem.c;h=c3d9575489c60fb74c5bb67c6fd8a926b2341268;hb=ade0034b74cb1213bfe0a73213f459081e10b85a;hp=20ea20bed03553ee0e76107830f8dc3031045e41;hpb=2f188e42574d95e8eb63e9137535a2867b482b89;p=rocksndiamonds.git diff --git a/src/libgame/system.c b/src/libgame/system.c index 20ea20be..c3d95754 100644 --- a/src/libgame/system.c +++ b/src/libgame/system.c @@ -189,9 +189,16 @@ void InitGfxDoor2Info(int vx, int vy, int vxsize, int vysize) gfx.vysize = vysize; } +void InitGfxWindowInfo(int win_xsize, int win_ysize) +{ + gfx.win_xsize = win_xsize; + gfx.win_ysize = win_ysize; +} + void InitGfxScrollbufferInfo(int scrollbuffer_width, int scrollbuffer_height) { /* currently only used by MSDOS code to alloc VRAM buffer, if available */ + /* 2009-03-24: also (temporarily?) used for overlapping blit workaround */ gfx.scrollbuffer_width = scrollbuffer_width; gfx.scrollbuffer_height = scrollbuffer_height; } @@ -492,7 +499,7 @@ void BlitBitmap(Bitmap *src_bitmap, Bitmap *dst_bitmap, return; #if 0 - /* !!! APPARENTLY THIS HAS BEEN FIXED IN SDL 1.2.12 !!! */ + /* !!! 2009-03-24: It seems that this problem still exists with 1.2.12 !!! */ #if defined(TARGET_SDL) && defined(PLATFORM_WIN32) if (src_bitmap == dst_bitmap) { @@ -502,15 +509,36 @@ void BlitBitmap(Bitmap *src_bitmap, Bitmap *dst_bitmap, recent SDL libraries, but apparently does not work in 1.2.11 directly */ static Bitmap *tmp_bitmap = NULL; + static int tmp_bitmap_xsize = 0; + static int tmp_bitmap_ysize = 0; + + /* start with largest static bitmaps for initial bitmap size ... */ + if (tmp_bitmap_xsize == 0 && tmp_bitmap_ysize == 0) + { + tmp_bitmap_xsize = MAX(gfx.win_xsize, gfx.scrollbuffer_width); + tmp_bitmap_ysize = MAX(gfx.win_ysize, gfx.scrollbuffer_height); + } + + /* ... and allow for later re-adjustments due to custom artwork bitmaps */ + if (src_bitmap->width > tmp_bitmap_xsize || + src_bitmap->height > tmp_bitmap_ysize) + { + tmp_bitmap_xsize = MAX(tmp_bitmap_xsize, src_bitmap->width); + tmp_bitmap_ysize = MAX(tmp_bitmap_ysize, src_bitmap->height); + + FreeBitmap(tmp_bitmap); + + tmp_bitmap = NULL; + } if (tmp_bitmap == NULL) - tmp_bitmap = CreateBitmap(MAX(FXSIZE, WIN_XSIZE), - MAX(FYSIZE, WIN_YSIZE), DEFAULT_DEPTH); + tmp_bitmap = CreateBitmap(tmp_bitmap_xsize, tmp_bitmap_ysize, + DEFAULT_DEPTH); sysCopyArea(src_bitmap, tmp_bitmap, src_x, src_y, width, height, dst_x, dst_y, BLIT_OPAQUE); sysCopyArea(tmp_bitmap, dst_bitmap, - src_x, src_y, width, height, dst_x, dst_y, BLIT_OPAQUE); + dst_x, dst_y, width, height, dst_x, dst_y, BLIT_OPAQUE); return; }