mirror of
https://github.com/vcmi/vcmi.git
synced 2025-05-13 22:06:58 +02:00
Fixed CID 1197342
This commit is contained in:
parent
7126bd61a4
commit
45ae1ef165
@ -185,23 +185,24 @@ void CSDL_Ext::alphaTransform(SDL_Surface *src)
|
|||||||
template<int bpp>
|
template<int bpp>
|
||||||
int CSDL_Ext::blit8bppAlphaTo24bppT(const SDL_Surface * src, const SDL_Rect * srcRect, SDL_Surface * dst, SDL_Rect * dstRect)
|
int CSDL_Ext::blit8bppAlphaTo24bppT(const SDL_Surface * src, const SDL_Rect * srcRect, SDL_Surface * dst, SDL_Rect * dstRect)
|
||||||
{
|
{
|
||||||
if (src && src->format->BytesPerPixel==1 && dst && (bpp==3 || bpp==4 || bpp==2)) //everything's ok
|
|
||||||
{
|
|
||||||
SDL_Rect fulldst;
|
|
||||||
int srcx, srcy, w, h;
|
|
||||||
|
|
||||||
/* Make sure the surfaces aren't locked */
|
/* Make sure the surfaces aren't locked */
|
||||||
if ( ! src || ! dst )
|
if ( ! src || ! dst )
|
||||||
{
|
{
|
||||||
SDL_SetError("SDL_UpperBlit: passed a nullptr surface");
|
SDL_SetError("SDL_UpperBlit: passed a nullptr surface");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( src->locked || dst->locked )
|
if ( src->locked || dst->locked )
|
||||||
{
|
{
|
||||||
SDL_SetError("Surfaces must not be locked during blit");
|
SDL_SetError("Surfaces must not be locked during blit");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (src->format->BytesPerPixel==1 && (bpp==3 || bpp==4 || bpp==2)) //everything's ok
|
||||||
|
{
|
||||||
|
SDL_Rect fulldst;
|
||||||
|
int srcx, srcy, w, h;
|
||||||
|
|
||||||
/* If the destination rectangle is nullptr, use the entire dest surface */
|
/* If the destination rectangle is nullptr, use the entire dest surface */
|
||||||
if ( dstRect == nullptr )
|
if ( dstRect == nullptr )
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user