From 3b65888eb15853010d4237489a9f4182feaff387d93dc6ee65da28dbb2cd07d2 Mon Sep 17 00:00:00 2001 From: Victor Roman Archidona Date: Tue, 29 Jul 2014 09:25:00 +0200 Subject: [PATCH] Some graphics library cleanup --- dlls/src/graphics/SDL_rotozoom.c | 31 +++++++++++++------------ dlls/src/graphics/graphics.c | 39 +++++++++++--------------------- 2 files changed, 30 insertions(+), 40 deletions(-) diff --git a/dlls/src/graphics/SDL_rotozoom.c b/dlls/src/graphics/SDL_rotozoom.c index 535268d..2aac820 100644 --- a/dlls/src/graphics/SDL_rotozoom.c +++ b/dlls/src/graphics/SDL_rotozoom.c @@ -554,21 +554,24 @@ transformSurfaceY (SDL_Surface * src, SDL_Surface * dst, int cx, int cy, */ -/*XPUT/* Sanity check */ -/* Determine if source surface is 32bit or 8bit */ -/* New source surface is 32bit with a defined RGBA ordering */ -/* Sanity check zoom factor */ -/* Check if we have a rotozoom or just a zoom */ -/* Angle!=0: full rotozoom * -//* ----------------------- */ -/* Calculate target factors from sin/cos and zoom +/* + Sanity check + Determine if source surface is 32bit or 8bit + New source surface is 32bit with a defined RGBA ordering + Sanity check zoom factor + Check if we have a rotozoom or just a zoom + Angle!=0: full rotozoom + Calculate target factors from sin/cos and zoom +*/ + +/* + Determine destination width and height by rotating a centered source box + Alloc space to completely contain the rotated surface + Target surface is 32bit with source RGBA/ABGR ordering + Lock source surface + Check which kind of surface we have + Call the 32bit transformation routine to do the rotation (using alpha) */ -/* Determine destination width and height by rotating a centered source box */ -/* Alloc space to completely contain the rotated surface */ -/* Target surface is 32bit with source RGBA/ABGR ordering */ -/* Lock source surface */ -/* Check which kind of surface we have */ -/* Call the 32bit transformation routine to do the rotation (using alpha) */ #define VALUE_LIMIT 0.001 diff --git a/dlls/src/graphics/graphics.c b/dlls/src/graphics/graphics.c index 225fae7..4103d44 100644 --- a/dlls/src/graphics/graphics.c +++ b/dlls/src/graphics/graphics.c @@ -177,20 +177,26 @@ FILE * memo ; * nombre. * @param nombre_program Nombre del programa, obtenido de fp->nombre_program */ -void guarda_pantallazo(char* nombre_program) +void guarda_pantallazo(unsigned char *nombre_program) { char capturef[256]; int c=0; FILE* f; - sprintf(capturef,"%s%04d.bmp",nombre_program,c); - while(f=fopen(capturef,"rb")) { - fclose(f); - c++; - sprintf(capturef,"%s%04d.bmp",nombre_program,c); - if(c==0) + while(1) { + /* 256 son mas que suficientes */ + if (c >= 256) break; + + sprintf(capturef,"%s%04d.bmp",nombre_program,c); + f = fopen(capturef, "rb"); + + if (f == NULL) + c++; + + fclose(f); } + SDL_SaveBMP(screen,capturef); } @@ -344,25 +350,6 @@ void frame(FUNCTION_PARAMS) { if ( draws[i].existe ) { - -/* if ( draws[i].x + draws[i].Surface->w >= fp->regions[0].x && draws[i].x < fp->regions[0].x + fp->regions[0].w && - draws[i].y + draws[i].Surface->h >= fp->regions[0].y && draws[i].y < fp->regions[0].y + fp->regions[0].h ) - { - if ( draws[i].x >= fp->regions[0].x && draws[i].x + draws[i].Surface->w < fp->regions[0].x + fp->regions[0].w && - draws[i].y >= fp->regions[0].y && draws[i].y + draws[i].Surface->h < fp->regions[0].y + fp->regions[0].h ) - { - srcrect.x = 0 ; - srcrect.y = 0 ; - srcrect.w = draws[i].Surface->w ; - srcrect.h = draws[i].Surface->h ; - - dstrect.x = draws[i].x ; - dstrect.y = draws[i].y ; - dstrect.w = 0 ; /* Se ignora *//* - dstrect.h = 0 ; /* Se ignora *//* - Dibuja( draws[i].Surface , srcrect , dstrect , z , draws[i].t,100,0) ; - } - }*/ Dibuja(draws[i].Surface,draws[i].x,draws[i].y,0,0,draws[i].region,z,0,draws[i].t,100,0); } }