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:
parent
f93920a4f1
commit
15a19bd69f
1 changed files with 18 additions and 0 deletions
|
@ -1240,6 +1240,15 @@ int SDL_BlitSurfaceUncheckedScaled(SDL_Surface *src, const SDL_Rect *srcrect,
|
||||||
src->format == dst->format &&
|
src->format == dst->format &&
|
||||||
!SDL_ISPIXELFORMAT_INDEXED(src->format)) {
|
!SDL_ISPIXELFORMAT_INDEXED(src->format)) {
|
||||||
return SDL_SoftStretch(src, srcrect, dst, dstrect, SDL_SCALEMODE_NEAREST);
|
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 {
|
} else {
|
||||||
return SDL_BlitSurfaceUnchecked(src, srcrect, dst, dstrect);
|
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) {
|
src->format != SDL_PIXELFORMAT_ARGB2101010) {
|
||||||
/* fast path */
|
/* fast path */
|
||||||
return SDL_SoftStretch(src, srcrect, dst, dstrect, SDL_SCALEMODE_LINEAR);
|
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 {
|
} else {
|
||||||
/* Use intermediate surface(s) */
|
/* Use intermediate surface(s) */
|
||||||
SDL_Surface *tmp1 = NULL;
|
SDL_Surface *tmp1 = NULL;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue