From 26c1e7d198ca834980764a2c89a91e544e7bd03b Mon Sep 17 00:00:00 2001 From: gewlitys Date: Tue, 1 Jul 2003 21:11:37 +0000 Subject: [PATCH] Added code for debugging clipping (guarded with #ifdef CLIPDEBUG) git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1005 8092fc87-c524-0410-9efc-e669fe64eaf9 --- .../sc2code/libs/graphics/sdl/3do_getbody.c | 25 +++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/sc2/src/sc2code/libs/graphics/sdl/3do_getbody.c b/sc2/src/sc2code/libs/graphics/sdl/3do_getbody.c index a0237b243..aad13f119 100644 --- a/sc2/src/sc2code/libs/graphics/sdl/3do_getbody.c +++ b/sc2/src/sc2code/libs/graphics/sdl/3do_getbody.c @@ -60,9 +60,30 @@ process_image (FRAMEPTR FramePtr, SDL_Surface *img[], AniData *ani, int cel_ct) tfbimg = FramePtr->image; tfbimg->colormap_index = ani[cel_ct].colormap_index; img[cel_ct] = (SDL_Surface *)tfbimg->NormalImg; - - FramePtr->HotSpot = MAKE_HOT_SPOT (hx, hy); + + FramePtr->HotSpot = MAKE_HOT_SPOT (hx, hy); SetFrameBounds (FramePtr, img[cel_ct]->w, img[cel_ct]->h); + +#ifdef CLIPDEBUG + { + /* for debugging clipping: + draws white (or most matching color from palette) pixels to + every corner of the image + */ + Uint32 color = SDL_MapRGB (img[cel_ct]->format, 255, 255, 255); + SDL_Rect r = {0, 0, 1, 1}; + if (img[cel_ct]->w > 2 && img[cel_ct]->h > 2) + { + SDL_FillRect (img[cel_ct], &r, color); + r.x = img[cel_ct]->w - 1; + SDL_FillRect (img[cel_ct], &r, color); + r.y = img[cel_ct]->h - 1; + SDL_FillRect (img[cel_ct], &r, color); + r.x = 0; + SDL_FillRect (img[cel_ct], &r, color); + } + } +#endif } static void