X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fsystem.c;h=7ec7d7df5aa37ac0f59ef2f7a2c6a63826716048;hb=56c6c0e7a97a0831480dd9fdac411923b046ba38;hp=1fbafd7818052124b5e0b17847bfc5a35f1d6258;hpb=ab0c2cf87c09fdc785f5124640a9f3334bb3a4b4;p=rocksndiamonds.git diff --git a/src/libgame/system.c b/src/libgame/system.c index 1fbafd78..7ec7d7df 100644 --- a/src/libgame/system.c +++ b/src/libgame/system.c @@ -391,7 +391,7 @@ inline static void FreeBitmapPointers(Bitmap *bitmap) bitmap->surface_masked = NULL; #else /* The X11 version seems to have a memory leak here -- although - "XFreePixmap()" is called, the correspondig memory seems not + "XFreePixmap()" is called, the corresponding memory seems not to be freed (according to "ps"). The SDL version apparently does not have this problem. */ @@ -878,6 +878,49 @@ Bitmap *ZoomBitmap(Bitmap *src_bitmap, int zoom_width, int zoom_height) return dst_bitmap; } +void CreateBitmapWithSmallBitmaps(Bitmap *src_bitmap) +{ + Bitmap *tmp_bitmap, *tmp_bitmap_2, *tmp_bitmap_4, *tmp_bitmap_8; + int src_width, src_height; + int tmp_width, tmp_height; + + src_width = src_bitmap->width; + src_height = src_bitmap->height; + + tmp_width = src_width; + tmp_height = src_height + src_height / 2; + + tmp_bitmap = CreateBitmap(tmp_width, tmp_height, DEFAULT_DEPTH); + + tmp_bitmap_2 = ZoomBitmap(src_bitmap, src_width / 2, src_height / 2); + tmp_bitmap_4 = ZoomBitmap(src_bitmap, src_width / 4, src_height / 4); + tmp_bitmap_8 = ZoomBitmap(src_bitmap, src_width / 8, src_height / 8); + + BlitBitmap(src_bitmap, tmp_bitmap, 0, 0, src_width, src_height, 0, 0); + BlitBitmap(tmp_bitmap_2, tmp_bitmap, 0, 0, src_width / 2, src_height / 2, + 0, src_height); + BlitBitmap(tmp_bitmap_4, tmp_bitmap, 0, 0, src_width / 4, src_height / 4, + src_width / 2, src_height); + BlitBitmap(tmp_bitmap_8, tmp_bitmap, 0, 0, src_width / 8, src_height / 8, + 3 * src_width / 4, src_height); + + FreeBitmap(tmp_bitmap_2); + FreeBitmap(tmp_bitmap_4); + FreeBitmap(tmp_bitmap_8); + +#ifdef TARGET_SDL + src_bitmap->surface = tmp_bitmap->surface; + tmp_bitmap->surface = NULL; +#else + src_bitmap->drawable = tmp_bitmap->drawable; + tmp_bitmap->drawable = None; +#endif + + src_bitmap->height = tmp_bitmap->height; + + FreeBitmap(tmp_bitmap); +} + /* ========================================================================= */ /* audio functions */