rem: TFB_DrawImage_FixScaling (img, scale);
add: int type; if (optMeleeScale == TFB_SCALE_TRILINEAR && img->MipmapImg) { type = TFB_SCALE_TRILINEAR; if (palette) { if (((SDL_Surface *)img->NormalImg)->format->palette) SDL_SetColors (img->NormalImg, (SDL_Color*)palette, 0, 256); if (((SDL_Surface *)img->MipmapImg)->format->palette) SDL_SetColors (img->MipmapImg, (SDL_Color*)palette, 0, 256); } } else { type = TFB_SCALE_NEAREST; }  TFB_DrawImage_FixScaling (img, scale, type);
context: TFB_DrawCanvas_Image (TFB_Image *img, int x, int y, int scale, TFB_Palette *palette, TFB_Canvas target){	SDL_Rect srcRect, targetRect, *pSrcRect;	SDL_Surface *surf;	if (img == 0)	{		fprintf (stderr, "ERROR: TFB_DrawCanvas_Image passed null image ptr\n");		return;	}	LockMutex (img->mutex);	targetRect.x = x;	targetRect.y = y;	if (scale != 0 && scale != GSCALE_IDENTITY)	{		TFB_DrawImage_FixScaling (img, scale);		surf = img->ScaledImg;		srcRect.x = 0;		srcRect.y = 0;		srcRect.w = img->extent.width;		srcRect.h = img->extent.height;		pSrcRect = &srcRect;	}	else	{		surf = img->NormalImg;		pSrcRect = NULL;	}		if (surf->format->palette)	{		if (palette)		{			SDL_SetColors (surf, (SDL_Color*)palette, 0, 256);		}		else		{			SDL_SetColors (surf, (SDL_Color*)img->Palette, 0, 256);		}	}		SDL_BlitSurface(surf, pSrcRect, (NativeCanvas) target, &targetRect);	UnlockMutex (img->mutex);}