Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent renderer behaviour on rotation #847

Closed
SDLBugzilla opened this issue Feb 10, 2021 · 0 comments
Closed

Inconsistent renderer behaviour on rotation #847

SDLBugzilla opened this issue Feb 10, 2021 · 0 comments

Comments

@SDLBugzilla
Copy link
Collaborator

This bug report was migrated from our old Bugzilla tracker.

These attachments are available in the static archive:

Reported in version: HG 2.0
Reported for operating system, platform: Linux, x86_64

Comments on the original bug report:

On 2013-04-25 05:25:37 +0000, Sebastian wrote:

Created attachment 1124
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.

On 2013-07-12 22:15:33 +0000, Ryan C. Gordon wrote:

(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.

On 2016-11-07 08:49:34 +0000, Sylvain wrote:

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);

On 2016-11-07 14:43:56 +0000, Sylvain wrote:

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);

On 2016-11-07 14:54:47 +0000, Sylvain wrote:

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 */

On 2017-10-24 19:33:43 +0000, Sylvain wrote:

that was fixed
https://hg.libsdl.org/SDL/rev/c7209688838b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant