rem: fprintf (stderr, "TFB_DrawCanvas_Scale: Tried to zoom an image to be larger than the screen!  Failing.\n");
add: fprintf (stderr, "TFB_DrawCanvas_Scale: Tried to zoom an image to unreasonable size!  Failing.\n");
context: TFB_DrawCanvas_Rescale_Nearest (TFB_Canvas src_canvas, TFB_Canvas dest_canvas, EXTENT size){	SDL_Surface *src = (SDL_Surface *)src_canvas;	SDL_Surface *dst = (SDL_Surface *)dest_canvas;	int x, y, sx, sy, *csax, *csay, csx, csy;	int sax[321], say[241];	if (size.width > 320 || size.height > 240)	{		fprintf (stderr, "TFB_DrawCanvas_Scale: Tried to zoom an image to be larger than the screen!  Failing.\n");		return;	}	if (size.width > dst->w || size.height > dst->h) 	{		fprintf (stderr, "TFB_DrawCanvas_Scale: Tried to scale image to size %d %d when dest_canvas has only dimensions of %d %d!  Failing.\n",			size.width, size.height, dst->w, dst->h);		return;	}	sx = (int) (65536.0 * (float) src->w / (float) size.width);	sy = (int) (65536.0 * (float) src->h / (float) size.height);	/*	 * Precalculate row increments 	 */	csx = 0;	csax = sax;	for (x = 0; x <= size.width; x++) {		*csax = csx >> 16;		csax++;		csx &= 0xffff;		csx += sx;	}	csy = 0;	csay = say;	for (y = 0; y <= size.height; y++) {		*csay = csy >> 16;		csay++;		csy &= 0xffff;		csy += sy;	}	SDL_LockSurface (src);	SDL_LockSurface (dst);	if (src->format->BytesPerPixel == 1 && dst->format->BytesPerPixel == 1)	{		Uint8 *sp, *csp, *dp, *cdp;		sp = csp = (Uint8 *) src->pixels;		dp = cdp = (Uint8 *) dst->pixels;		csay = say;		for (y = 0; y < size.height; ++y) {			sp = csp;			dp = cdp;			csax = sax;			for (x = 0; x < size.width; ++x) {				*dp = *sp;				++csax;				sp += *csax;				++dp;			}			++csay;			csp += (*csay) * src->pitch;			cdp += dst->pitch;		}	}		else if (src->format->BytesPerPixel == 4 && dst->format->BytesPerPixel == 4)	{		Uint32 *sp, *csp, *dp, *cdp;		int sgap, dgap;		sgap = src->pitch >> 2;		dgap = dst->pitch >> 2;				sp = csp = (Uint32 *) src->pixels;		dp = cdp = (Uint32 *) dst->pixels;		csay = say;		for (y = 0; y < size.height; ++y) {			sp = csp;			dp = cdp;			csax = sax;			for (x = 0; x < size.width; ++x) {				*dp = *sp;				++csax;				sp += *csax;				++dp;			}			++csay;			csp += (*csay) * sgap;			cdp += dgap;		}	}	else	{		fprintf (stderr, "Tried to deal with unknown BPP: %d -> %d\n", src->format->BitsPerPixel, dst->format->BitsPerPixel);	}	SDL_UnlockSurface (dst);	SDL_UnlockSurface (src);}