mirror of https://github.com/encounter/SDL.git
Fixed bug #2199: make SDL_blit_slow handles SDL_PIXELFORMAT_ARGB2101010, storing as RGBA
This commit is contained in:
parent
3bebdaccb7
commit
f3e86b9fd3
|
@ -231,9 +231,7 @@ SDL_CalculateBlit(SDL_Surface * surface)
|
||||||
if (map->identity && !(map->info.flags & ~SDL_COPY_RLE_DESIRED)) {
|
if (map->identity && !(map->info.flags & ~SDL_COPY_RLE_DESIRED)) {
|
||||||
blit = SDL_BlitCopy;
|
blit = SDL_BlitCopy;
|
||||||
} else if (surface->format->Rloss > 8 || dst->format->Rloss > 8) {
|
} else if (surface->format->Rloss > 8 || dst->format->Rloss > 8) {
|
||||||
/* Greater than 8 bits per channel not supported yet */
|
blit = SDL_Blit_Slow;
|
||||||
SDL_InvalidateMap(map);
|
|
||||||
return SDL_SetError("Blit combination not supported");
|
|
||||||
}
|
}
|
||||||
#if SDL_HAVE_BLIT_0
|
#if SDL_HAVE_BLIT_0
|
||||||
else if (surface->format->BitsPerPixel < 8 &&
|
else if (surface->format->BitsPerPixel < 8 &&
|
||||||
|
|
|
@ -46,6 +46,8 @@ SDL_Blit_Slow(SDL_BlitInfo * info)
|
||||||
SDL_PixelFormat *dst_fmt = info->dst_fmt;
|
SDL_PixelFormat *dst_fmt = info->dst_fmt;
|
||||||
int srcbpp = src_fmt->BytesPerPixel;
|
int srcbpp = src_fmt->BytesPerPixel;
|
||||||
int dstbpp = dst_fmt->BytesPerPixel;
|
int dstbpp = dst_fmt->BytesPerPixel;
|
||||||
|
int srcfmt_isnot_2101010 = (src_fmt->format != SDL_PIXELFORMAT_ARGB2101010);
|
||||||
|
int dstfmt_isnot_2101010 = (dst_fmt->format != SDL_PIXELFORMAT_ARGB2101010);
|
||||||
Uint32 rgbmask = ~src_fmt->Amask;
|
Uint32 rgbmask = ~src_fmt->Amask;
|
||||||
Uint32 ckey = info->colorkey & rgbmask;
|
Uint32 ckey = info->colorkey & rgbmask;
|
||||||
|
|
||||||
|
@ -62,14 +64,19 @@ SDL_Blit_Slow(SDL_BlitInfo * info)
|
||||||
while (n--) {
|
while (n--) {
|
||||||
srcx = posx >> 16;
|
srcx = posx >> 16;
|
||||||
src = (info->src + (srcy * info->src_pitch) + (srcx * srcbpp));
|
src = (info->src + (srcy * info->src_pitch) + (srcx * srcbpp));
|
||||||
if (src_fmt->Amask) {
|
if (srcfmt_isnot_2101010) {
|
||||||
DISEMBLE_RGBA(src, srcbpp, src_fmt, srcpixel, srcR, srcG,
|
if (src_fmt->Amask) {
|
||||||
srcB, srcA);
|
DISEMBLE_RGBA(src, srcbpp, src_fmt, srcpixel, srcR, srcG, srcB, srcA);
|
||||||
|
} else {
|
||||||
|
DISEMBLE_RGB(src, srcbpp, src_fmt, srcpixel, srcR, srcG, srcB);
|
||||||
|
srcA = 0xFF;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
DISEMBLE_RGB(src, srcbpp, src_fmt, srcpixel, srcR, srcG,
|
/* SDL_PIXELFORMAT_ARGB2101010 */
|
||||||
srcB);
|
srcpixel = *((Uint32 *)(src));
|
||||||
srcA = 0xFF;
|
RGBA_FROM_ARGB2101010(srcpixel, srcR, srcG, srcB, srcA);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & SDL_COPY_COLORKEY) {
|
if (flags & SDL_COPY_COLORKEY) {
|
||||||
/* srcpixel isn't set for 24 bpp */
|
/* srcpixel isn't set for 24 bpp */
|
||||||
if (srcbpp == 3) {
|
if (srcbpp == 3) {
|
||||||
|
@ -82,13 +89,17 @@ SDL_Blit_Slow(SDL_BlitInfo * info)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (dst_fmt->Amask) {
|
if (dstfmt_isnot_2101010) {
|
||||||
DISEMBLE_RGBA(dst, dstbpp, dst_fmt, dstpixel, dstR, dstG,
|
if (dst_fmt->Amask) {
|
||||||
dstB, dstA);
|
DISEMBLE_RGBA(dst, dstbpp, dst_fmt, dstpixel, dstR, dstG, dstB, dstA);
|
||||||
|
} else {
|
||||||
|
DISEMBLE_RGB(dst, dstbpp, dst_fmt, dstpixel, dstR, dstG, dstB);
|
||||||
|
dstA = 0xFF;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
DISEMBLE_RGB(dst, dstbpp, dst_fmt, dstpixel, dstR, dstG,
|
/* SDL_PIXELFORMAT_ARGB2101010 */
|
||||||
dstB);
|
dstpixel = *((Uint32 *)(dst));
|
||||||
dstA = 0xFF;
|
RGBA_FROM_ARGB2101010(dstpixel, dstR, dstG, dstB, dstA);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & SDL_COPY_MODULATE_COLOR) {
|
if (flags & SDL_COPY_MODULATE_COLOR) {
|
||||||
|
@ -151,10 +162,16 @@ SDL_Blit_Slow(SDL_BlitInfo * info)
|
||||||
dstA = 255;
|
dstA = 255;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (dst_fmt->Amask) {
|
if (dstfmt_isnot_2101010) {
|
||||||
ASSEMBLE_RGBA(dst, dstbpp, dst_fmt, dstR, dstG, dstB, dstA);
|
if (dst_fmt->Amask) {
|
||||||
|
ASSEMBLE_RGBA(dst, dstbpp, dst_fmt, dstR, dstG, dstB, dstA);
|
||||||
|
} else {
|
||||||
|
ASSEMBLE_RGB(dst, dstbpp, dst_fmt, dstR, dstG, dstB);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
ASSEMBLE_RGB(dst, dstbpp, dst_fmt, dstR, dstG, dstB);
|
Uint32 Pixel;
|
||||||
|
ARGB2101010_FROM_RGBA(Pixel, dstR, dstG, dstB, dstA);
|
||||||
|
*(Uint32 *)dst = Pixel;
|
||||||
}
|
}
|
||||||
posx += incx;
|
posx += incx;
|
||||||
dst += dstbpp;
|
dst += dstbpp;
|
||||||
|
|
Loading…
Reference in New Issue