All pastes #1896839 Raw Edit

Anonymous

public c v1 · immutable
#1896839 ·published 2010-07-08 20:16 UTC
rendered paste body
#include "rescaler.h"SDL_Surface *screensurface;void hInit_rescaler(SDL_Surface *screen){	screensurface=screen;	return;}void hSDL_UpdateRect(SDL_Surface *surface, Sint32 x, Sint32 y, Sint32 w, Sint32 h){	int m,n;	int a, b,bb, sa=0, sb=0,t;		m=y;	a=(int)(y*0.857143); //Cada 6	bb=(int)(x*0.952381);//Cada 20	while(m<y+h){		if (sa != 6){			n=x*4;			b=bb*4;						t=(x+w)*4;					while(n<t){							if(sb != 20){					*(Uint32*) //We copy data in chunks of 4 bytes					(						( char* )screensurface->pixels + //We start from pixel 0x0 of the surface, and use chars to move byte by byte						( screensurface->pitch * a ) +  b  //Where is the pixel we are interested in writing					)					= //The pixel from below will get assigned to the pixel from above					*(Uint32*) 					(						( char* )surface->pixels + 						( surface->pitch * m ) +  n 					);					b+=4;					sb++;				}else{					sb=0;				}				n+=4;			}								a++;			sa++;		}else{			sa=0;		}		m++;	}	SDL_UpdateRect(screensurface, (int)(x*0.952381), (int)(y*0.857143), (int)(w*0.952381), (int)(h*0.857143));	return;}/*void hSDL_UpdateRect(SDL_Surface *surface, Sint32 x, Sint32 y, Sint32 w, Sint32 h){	int n,m;	float fn, fm;		m=y;	fm=y*0.857143;	while(m<y+h){			n=x;		fn=x*0.952381;		while(n<x+w){						*(Uint32*) //We copy data in chunks of 4 bytes			(				( char* )screensurface->pixels + //We start from pixel 0x0 of the surface, and use chars to move byte by byte				( screensurface->pitch * (int)fm ) + ( 4 * (int)fn ) //Where is the pixel we are interested in writing			)			= //The pixel from below will get assigned to the pixel from above			*(Uint32*) 			(				( char* )surface->pixels + 				( surface->pitch * m ) + ( 4 * n )			);			n++;			fn+=0.952381;		}				m++;		fm+=0.857143;	}	SDL_UpdateRect(screensurface, (int)(x*0.952381), (int)(y*0.857143), (int)(w*0.952381), (int)(h*0.857143));	return;}*/int hSDL_Flip(SDL_Surface* screen){	return SDL_Flip(screensurface);}