mirror of
				https://github.com/libsdl-org/SDL.git
				synced 2025-10-26 12:27:44 +00:00 
			
		
		
		
	Convert bitmap surface to RGBA for scaling
Scaling bitmaps isn't currently supported, so we convert to RGBA for now.
This commit is contained in:
		| @@ -1240,6 +1240,15 @@ int SDL_BlitSurfaceUncheckedScaled(SDL_Surface *src, const SDL_Rect *srcrect, | ||||
|             src->format == dst->format && | ||||
|             !SDL_ISPIXELFORMAT_INDEXED(src->format)) { | ||||
|             return SDL_SoftStretch(src, srcrect, dst, dstrect, SDL_SCALEMODE_NEAREST); | ||||
|         } else if (SDL_BITSPERPIXEL(src->format) < 8) { | ||||
|             // Scaling bitmap not yet supported, convert to RGBA for blit | ||||
|             int retval = -1; | ||||
|             SDL_Surface *tmp = SDL_ConvertSurface(src, SDL_PIXELFORMAT_ARGB8888); | ||||
|             if (tmp) { | ||||
|                 retval = SDL_BlitSurfaceUncheckedScaled(tmp, srcrect, dst, dstrect, SDL_SCALEMODE_NEAREST); | ||||
|                 SDL_DestroySurface(tmp); | ||||
|             } | ||||
|             return retval; | ||||
|         } else { | ||||
|             return SDL_BlitSurfaceUnchecked(src, srcrect, dst, dstrect); | ||||
|         } | ||||
| @@ -1251,6 +1260,15 @@ int SDL_BlitSurfaceUncheckedScaled(SDL_Surface *src, const SDL_Rect *srcrect, | ||||
|             src->format != SDL_PIXELFORMAT_ARGB2101010) { | ||||
|             /* fast path */ | ||||
|             return SDL_SoftStretch(src, srcrect, dst, dstrect, SDL_SCALEMODE_LINEAR); | ||||
|         } else if (SDL_BITSPERPIXEL(src->format) < 8) { | ||||
|             // Scaling bitmap not yet supported, convert to RGBA for blit | ||||
|             int retval = -1; | ||||
|             SDL_Surface *tmp = SDL_ConvertSurface(src, SDL_PIXELFORMAT_ARGB8888); | ||||
|             if (tmp) { | ||||
|                 retval = SDL_BlitSurfaceUncheckedScaled(tmp, srcrect, dst, dstrect, scaleMode); | ||||
|                 SDL_DestroySurface(tmp); | ||||
|             } | ||||
|             return retval; | ||||
|         } else { | ||||
|             /* Use intermediate surface(s) */ | ||||
|             SDL_Surface *tmp1 = NULL; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Sam Lantinga
					Sam Lantinga