X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=blobdiff_plain;f=src%2Flibgame%2Fsystem.c;h=e5105b44a9b7627f6ac1e9c2b7c7a517b28f8020;hp=78a323486fdb8ec8536196d4b83038db39d66adb;hb=abe44529b439ad39b4d8dbf19cbd67c9b9844279;hpb=b7282fd678d6f5c7ebf6a12062eb391129a800a7 diff --git a/src/libgame/system.c b/src/libgame/system.c index 78a32348..e5105b44 100644 --- a/src/libgame/system.c +++ b/src/libgame/system.c @@ -1,15 +1,13 @@ -/*********************************************************** -* Artsoft Retro-Game Library * -*----------------------------------------------------------* -* (c) 1994-2006 Artsoft Entertainment * -* Holger Schemel * -* Detmolder Strasse 189 * -* 33604 Bielefeld * -* Germany * -* e-mail: info@artsoft.org * -*----------------------------------------------------------* -* system.c * -***********************************************************/ +// ============================================================================ +// Artsoft Retro-Game Library +// ---------------------------------------------------------------------------- +// (c) 1995-2014 by Artsoft Entertainment +// Holger Schemel +// info@artsoft.org +// http://www.artsoft.org/ +// ---------------------------------------------------------------------------- +// system.c +// ============================================================================ #include #include @@ -1115,9 +1113,32 @@ void ReloadCustomImage(Bitmap *bitmap, char *basename) Bitmap *ZoomBitmap(Bitmap *src_bitmap, int zoom_width, int zoom_height) { +#if 0 + // !!! TEST ONLY !!! + Bitmap *dst_bitmap = CreateBitmap(zoom_width, zoom_height, DEFAULT_DEPTH); + print_timestamp_time("CreateBitmap"); + + SDL_Rect src_rect, dst_rect; + + src_rect.x = 0; + src_rect.y = 0; + src_rect.w = src_bitmap->width - 0; + src_rect.h = src_bitmap->height; + + dst_rect.x = 0; + dst_rect.y = 0; + dst_rect.w = dst_bitmap->width; + dst_rect.h = dst_bitmap->height; - SDLZoomBitmap(src_bitmap, dst_bitmap); + SDL_BlitScaled(src_bitmap->surface, &src_rect, + dst_bitmap->surface, &dst_rect); + print_timestamp_time("SDL_BlitScaled"); + +#else + + Bitmap *dst_bitmap = SDLZoomBitmap(src_bitmap, zoom_width, zoom_height); +#endif return dst_bitmap; } @@ -1148,6 +1169,8 @@ static void CreateScaledBitmaps(Bitmap *old_bitmap, int zoom_factor, int old_width, old_height; int new_width, new_height; + print_timestamp_init("CreateScaledBitmaps"); + old_width = old_bitmap->width; old_height = old_bitmap->height; @@ -1199,7 +1222,15 @@ static void CreateScaledBitmaps(Bitmap *old_bitmap, int zoom_factor, else if (width_0 == width_final) tmp_bitmap_0 = tmp_bitmap_final; else + { +#if 0 + if (old_width != width_0) + printf("::: %d, %d -> %d, %d\n", + old_width, old_height, width_0, height_0); +#endif + tmp_bitmap_0 = ZoomBitmap(old_bitmap, width_0, height_0); + } UPDATE_BUSY_STATE(); } @@ -1464,8 +1495,13 @@ static void CreateScaledBitmaps(Bitmap *old_bitmap, int zoom_factor, SDL_SetColorKey(old_surface, SET_TRANSPARENT_PIXEL, SDL_MapRGB(old_surface->format, 0x00, 0x00, 0x00)); +#if 1 + if ((old_bitmap->surface_masked = SDLGetNativeSurface(old_surface)) == NULL) + Error(ERR_EXIT, "SDL_DisplayFormat() failed"); +#else if ((old_bitmap->surface_masked = SDL_DisplayFormat(old_surface)) == NULL) Error(ERR_EXIT, "SDL_DisplayFormat() failed"); +#endif SDL_SetColorKey(old_surface, UNSET_TRANSPARENT_PIXEL, 0); } @@ -1474,6 +1510,8 @@ static void CreateScaledBitmaps(Bitmap *old_bitmap, int zoom_factor, UPDATE_BUSY_STATE(); FreeBitmap(new_bitmap); /* this actually frees the _old_ bitmap now */ + + print_timestamp_done("CreateScaledBitmaps"); } void CreateBitmapWithSmallBitmaps(Bitmap *old_bitmap, int zoom_factor,