We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 1638 - Blit Alpha surface bug
Summary: Blit Alpha surface bug
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: HG 2.0
Hardware: x86_64 Linux
: P2 normal
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords: target-2.0.0
Depends on:
Blocks:
 
Reported: 2012-11-09 23:32 UTC by Sylvain
Modified: 2013-08-01 04:30 UTC (History)
0 users

See Also:


Attachments
example file (2.33 KB, text/x-csrc)
2012-11-09 23:32 UTC, Sylvain
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sylvain 2012-11-09 23:32:05 UTC
On linux + SDL-2.0 HG (6589)

When blitting an Alpha surface to an opaque surface, the output is not as expected !


It can be solved by switch to 32 bpp, or using an alpha of 128 instead of 192.


See the exemple in attachment.
Comment 1 Sylvain 2012-11-09 23:32:47 UTC
Created attachment 986 [details]
example file
Comment 2 Ryan C. Gordon 2013-07-12 22:15:34 UTC
(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.
Comment 3 Sam Lantinga 2013-07-23 11:15:39 UTC
Can you try the latest snapshot and see if that gives you the results you expect?
http://www.libsdl.org/tmp/SDL-2.0.zip

If it doesn't, can you describe the results that you expect and the results you get?

Thanks!
Comment 4 Sam Lantinga 2013-07-27 05:40:41 UTC
I believe this is fixed by the alpha blend formula change in this commit:
http://hg.libsdl.org/SDL/rev/6ff02ff3cf06

Please reopen the bug if that's not the case.

Thanks!
Comment 5 Sylvain 2013-07-29 15:40:23 UTC
Hi,

I reopen the issue as it seems not to be fixed with the current latest version of today.

in the attached file, I constructed to surface : surf1 and surf2.
surf2 is black+alpha, and is blitted several time to surf1. It's done in a *disjoint* way so that surf1 is fully colored by surf2.

It appears black diagonals. like if some line pitch was never taken into account.

Sylvain
Comment 6 Sam Lantinga 2013-08-01 04:30:56 UTC
Fixed, thanks for the great test case!
http://hg.libsdl.org/SDL/rev/5287c82340e3

Also, the reason you needed this:
surf2 = SDL_ConvertSurface(surf2, surf2->format, surf2->flags);
was because as a side effect it set up the surface for alpha blending.

You can add this line instead:
SDL_SetSurfaceBlendMode(surf2, SDL_BLENDMODE_BLEND);

Cheers!