| Summary: | Inconsistent renderer behaviour on rotation | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Sebastian <mightyofthefmc> |
| Component: | video | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | minor | ||
| Priority: | P2 | CC: | jizc, sylvain.becker |
| Version: | HG 2.0 | Keywords: | target-2.0.0 |
| Hardware: | x86_64 | ||
| OS: | Linux | ||
| Attachments: | self contained testcase (needs sdl2 and sdl2_image) | ||
(Sorry if you get a lot of copies of this email, we're touching dozens of bug reports right now.) Tagging a bunch of bugs as target-2.0.0, Priority 2. This means we're in the final stretch for an official SDL 2.0.0 release! These are the bugs we really want to fix before shipping if humanly possible. That being said, we don't promise to fix them because of this tag, we just want to make sure we don't forget to deal with them before we bless a final 2.0.0 release, and generally be organized about what we're aiming to ship. Hopefully you'll hear more about this bug soon. If you have more information (including "this got fixed at some point, nevermind"), we would love to have you come add more information to the bug report when you have a moment. Thanks! --ryan. I believe the position is fixed from #2421 but there is still a weird behaviour with the renderer software: 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 ... SDL_Surface *surf = IMG_Load_RW(SDL_RWFromMem((void*)street_vert_jpg, sizeof(street_vert_jpg)), 0); SDL_PixelFormat *pixel_format = SDL_AllocFormat(SDL_PIXELFORMAT_RGB888); SDL_Surface *surf2 = SDL_ConvertSurface(surf, pixel_format, 0); SDL_SetColorKey(surf2, SDL_FALSE, 0); // SDL_SetColorKey(surf2, SDL_TRUE, 999);// a colorkey would remove the lines ... SDL_SetSurfaceBlendMode(surf2, SDL_BLENDMODE_NONE); // SDL_SetSurfaceAlphaMod(surf2, 0); // setting alpha mod, make +90&-90 transparent SDL_Texture *tex = SDL_CreateTextureFromSurface(renderer, surf2); Plain black (0/0/0) was interpreted as a ColorKey, because SDL gfx rotate function uses former SDL-1.2 style to interpret SDL_Surface flags.
Some patch ...
--- a/src/render/software/SDL_rotate.c Sun Nov 06 20:26:48 2016 -0800
+++ b/src/render/software/SDL_rotate.c Mon Nov 07 15:40:47 2016 +0100
@@ -428,7 +428,7 @@
if (src == NULL)
return (NULL);
- if (src->flags & SDL_TRUE/* SDL_SRCCOLORKEY */)
+ if (SDL_GetColorKey(src, &colorkey) == 0)
{
colorkey = _colorkey(src);
SDL_GetRGB(colorkey, src->format, &r, &g, &b);
oops wrong patch, the error was a little after: background surface had always the ColorKey set.
--- a/src/render/software/SDL_rotate.c Sun Nov 06 20:26:48 2016 -0800
+++ b/src/render/software/SDL_rotate.c Mon Nov 07 15:52:03 2016 +0100
@@ -526,7 +526,6 @@
* Turn on source-alpha support
*/
/* SDL_SetAlpha(rz_dst, SDL_SRCALPHA, 255); */
- SDL_SetColorKey(rz_dst, /* SDL_SRCCOLORKEY */ SDL_TRUE | SDL_RLEACCEL, _colorkey(rz_src));
} else {
/*
* Copy palette and colorkey info
@@ -543,7 +542,12 @@
} else {
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(rz_src));
+ } else {
+ SDL_SetColorKey(rz_dst, SDL_FALSE, 0);
}
/* copy alpha mod, color mod, and blend mode */
that was fixed https://hg.libsdl.org/SDL/rev/c7209688838b |
Created attachment 1124 [details] self contained testcase (needs sdl2 and sdl2_image) The different renderers behave differently when using RenderCopyEx with rotation on images with even width and height. When rendering a 64x64 tile with 90.0 degrees rotation and a NULL center the resulting image is moved one pixel further to the right when using software or direct3d renderer than it would be when using the opengl renderer. This is not really a problem when you force a renderer, but I guess it would be more consistent if all renderers behaved the same. I tested this on win and linux (each 64 bit). You'll find a self contained testcase attached. To test the different renderers just uncomment the appropriate string at the top.