mirror of https://github.com/encounter/SDL.git
Fixed bug 1822 - Inconsistent renderer behaviour on rotation
Sylvain 2016-11-07 08:49:34 UTC when rotated +90 or -90, some transparent lines appears, though there is no Alpha or ColorKey. if you set a dummy colorkey, it will remove the line ... if you set a some alpha mod, the +90/-90 get transparent but not the 0/180 ...
This commit is contained in:
parent
23c01c1890
commit
77000ff8cb
|
@ -417,7 +417,7 @@ SDLgfx_rotateSurface(SDL_Surface * src, double angle, int centerx, int centery,
|
||||||
SDL_Surface *rz_dst;
|
SDL_Surface *rz_dst;
|
||||||
int is32bit, angle90;
|
int is32bit, angle90;
|
||||||
int i;
|
int i;
|
||||||
Uint8 r = 0, g = 0, b = 0;
|
Uint8 r = 0, g = 0, b = 0, a = 0;
|
||||||
Uint32 colorkey = 0;
|
Uint32 colorkey = 0;
|
||||||
int colorKeyAvailable = 0;
|
int colorKeyAvailable = 0;
|
||||||
double sangleinv, cangleinv;
|
double sangleinv, cangleinv;
|
||||||
|
@ -428,12 +428,12 @@ SDLgfx_rotateSurface(SDL_Surface * src, double angle, int centerx, int centery,
|
||||||
if (src == NULL)
|
if (src == NULL)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
if (src->flags & SDL_TRUE/* SDL_SRCCOLORKEY */)
|
if (src->flags & SDL_TRUE/* SDL_SRCCOLORKEY */) {
|
||||||
{
|
|
||||||
colorkey = _colorkey(src);
|
colorkey = _colorkey(src);
|
||||||
SDL_GetRGB(colorkey, src->format, &r, &g, &b);
|
SDL_GetRGBA(colorkey, src->format, &r, &g, &b, &a);
|
||||||
colorKeyAvailable = 1;
|
colorKeyAvailable = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Determine if source surface is 32bit or 8bit
|
* Determine if source surface is 32bit or 8bit
|
||||||
*/
|
*/
|
||||||
|
@ -485,10 +485,10 @@ SDLgfx_rotateSurface(SDL_Surface * src, double angle, int centerx, int centery,
|
||||||
/* Adjust for guard rows */
|
/* Adjust for guard rows */
|
||||||
rz_dst->h = dstheight;
|
rz_dst->h = dstheight;
|
||||||
|
|
||||||
if (colorKeyAvailable == 1){
|
if (colorKeyAvailable == 1) {
|
||||||
colorkey = SDL_MapRGB(rz_dst->format, r, g, b);
|
colorkey = SDL_MapRGBA(rz_dst->format, r, g, b, a);
|
||||||
|
|
||||||
SDL_FillRect(rz_dst, NULL, colorkey );
|
SDL_FillRect(rz_dst, NULL, colorkey);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -523,10 +523,9 @@ SDLgfx_rotateSurface(SDL_Surface * src, double angle, int centerx, int centery,
|
||||||
_transformSurfaceRGBA(rz_src, rz_dst, centerx, centery, (int) (sangleinv), (int) (cangleinv), flipx, flipy, smooth);
|
_transformSurfaceRGBA(rz_src, rz_dst, centerx, centery, (int) (sangleinv), (int) (cangleinv), flipx, flipy, smooth);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Turn on source-alpha support
|
* Turn on source-alpha support
|
||||||
*/
|
*/
|
||||||
/* SDL_SetAlpha(rz_dst, SDL_SRCALPHA, 255); */
|
/* SDL_SetAlpha(rz_dst, SDL_SRCALPHA, 255); */
|
||||||
SDL_SetColorKey(rz_dst, /* SDL_SRCCOLORKEY */ SDL_TRUE | SDL_RLEACCEL, _colorkey(rz_src));
|
|
||||||
} else {
|
} else {
|
||||||
/*
|
/*
|
||||||
* Copy palette and colorkey info
|
* Copy palette and colorkey info
|
||||||
|
@ -543,7 +542,12 @@ SDLgfx_rotateSurface(SDL_Surface * src, double angle, int centerx, int centery,
|
||||||
} else {
|
} else {
|
||||||
transformSurfaceY(rz_src, rz_dst, centerx, centery, (int)(sangleinv), (int)(cangleinv), flipx, flipy);
|
transformSurfaceY(rz_src, rz_dst, centerx, centery, (int)(sangleinv), (int)(cangleinv), flipx, flipy);
|
||||||
}
|
}
|
||||||
SDL_SetColorKey(rz_dst, /* SDL_SRCCOLORKEY */ SDL_TRUE | SDL_RLEACCEL, _colorkey(rz_src));
|
}
|
||||||
|
|
||||||
|
if (colorKeyAvailable == 1) {
|
||||||
|
SDL_SetColorKey(rz_dst, /* SDL_SRCCOLORKEY */ SDL_TRUE | SDL_RLEACCEL, colorkey);
|
||||||
|
} else {
|
||||||
|
SDL_SetColorKey(rz_dst, SDL_FALSE, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* copy alpha mod, color mod, and blend mode */
|
/* copy alpha mod, color mod, and blend mode */
|
||||||
|
|
Loading…
Reference in New Issue