sdl.c: support 32 bpp cursors
PATCH 1/1 sdl.c: support 32 bpp cursors
Hello,
currently when a 32 bpp cursor gets defined the result is all-black in the areas that are not transparent (you'll get a 32 bpp cursor if you use my previous patch to allow vmware_vga to use a 32 bpp framebuffer). This is because the switch in sdl.c lacks a 32 bpp case.
The thing I am unsure about though is which byte is the unused one and should be skipped, the first or the last - for the black-and-white cursors I tested it doesn't make a difference...
sdl.c +3 -0
@@ -771,6 +771,9 @@ static void sdl_mouse_define(int width, int height, int bpp, line = image;for (x =0 ; x < width; x ++, dst ++) {switch (bpp) { +case 32 : + src = *(line ++); src |= *(line ++); src |= *(line ++); line++; +break ;case 24 : src = *(line ++); src |= *(line ++); src |= *(line ++);break ;
Quoted 3 lines · Reimar Döffinger
The thing I am unsure about though is which byte is the unused one and should be skipped, the first or the last - for the black-and-white cursors I tested it doesn't make a difference...
You could skip the one that is always zero. If none is, then one of the bytes is the alpha and you should either skip no byte, or set src _just to that_ byte.
Paolo
Quoted 8 lines · Paolo Bonzini
Quoted 3 lines · Reimar Döffinger
The thing I am unsure about though is which byte is the unused one and should be skipped, the first or the last - for the black-and-white cursors I tested it doesn't make a difference...
You could skip the one that is always zero. If none is, then one of the bytes is the alpha and you should either skip no byte, or set src
_justtothat_byte.
There is no alpha, there is already a mask that defines transparency, the 4th byte is only padding and should be ignored, just like for the framebuffer (where that issue even made it into the FAQ since some library incorrectly treated that as alpha which gave strange effects). Well, at least that's how I am convinced it should be, I have not yet found a specification or even proper documentation for this stuff (I admit I haven't looked too hard).