From ca64bb914998c9a265f3b5a5eb0a9fdb115bf984 Mon Sep 17 00:00:00 2001 From: rob Date: Tue, 15 Jan 2008 02:44:09 +0000 Subject: [PATCH] when reading 24-bit pixels set the alpha bits to full opacity ensures that when/if the pixel is written to a 32-bit format with alpha and later blitted, the pixel will be seen git-svn-id: https://svn.aros.org:8080/svn/aros/trunk/AROS@27724 fb15a70f-31f2-0310-bbcc-cdcc74a49acc --- workbench/hidds/graphics/convertpixels.c | 6 ++++-- workbench/hidds/graphics/stdpixfmts_be.h | 8 ++++++-- workbench/hidds/graphics/stdpixfmts_le.h | 8 ++++++-- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/workbench/hidds/graphics/convertpixels.c b/workbench/hidds/graphics/convertpixels.c index d148c433d..db9cd3daf 100644 --- a/workbench/hidds/graphics/convertpixels.c +++ b/workbench/hidds/graphics/convertpixels.c @@ -28,7 +28,8 @@ #define GETPIX24(s, pix) \ do \ { \ - pix = (((UBYTE *)s)[0] << 16) | \ + pix = 0xFF000000 | \ + (((UBYTE *)s)[0] << 16) | \ (((UBYTE *)s)[1] << 8) | \ ((UBYTE *)s)[2]; \ s = (UBYTE *)s + 3; \ @@ -38,7 +39,8 @@ #define GETPIX24(s, pix) \ do \ { \ - pix = (((UBYTE *)s)[2] << 16) | \ + pix = 0xFF000000 | \ + (((UBYTE *)s)[2] << 16) | \ (((UBYTE *)s)[1] << 8) | \ ((UBYTE *)s)[0]; \ s = (UBYTE *)s + 3; \ diff --git a/workbench/hidds/graphics/stdpixfmts_be.h b/workbench/hidds/graphics/stdpixfmts_be.h index f0c0f5e46..846c25818 100644 --- a/workbench/hidds/graphics/stdpixfmts_be.h +++ b/workbench/hidds/graphics/stdpixfmts_be.h @@ -14,10 +14,14 @@ const HIDDT_PixelFormat stdpfs[] = { { + /* 24-bit formats have a alpha mask set here to ensure that the 0xFF + * alpha returned by GETPIX24 is seen correctly when converting to a + * format that supports it */ + /* R8G8B8 */ 24, 24, 3 - , 0x00FF0000, 0x0000FF00, 0x000000FF, 0x00000000 + , 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000 , 8, 16, 24, 0 , 0, 0 , vHidd_StdPixFmt_RGB24 @@ -26,7 +30,7 @@ const HIDDT_PixelFormat stdpfs[] = /* B8G8R8 */ 24, 24, 3 - , 0x000000FF, 0x0000FF00, 0x00FF0000, 0x00000000 + , 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000 , 24, 16, 8, 0 , 0, 0 , vHidd_StdPixFmt_BGR24 diff --git a/workbench/hidds/graphics/stdpixfmts_le.h b/workbench/hidds/graphics/stdpixfmts_le.h index 430a850c3..ac5a93247 100644 --- a/workbench/hidds/graphics/stdpixfmts_le.h +++ b/workbench/hidds/graphics/stdpixfmts_le.h @@ -14,10 +14,14 @@ const HIDDT_PixelFormat stdpfs[] = { { + /* 24-bit formats have a alpha mask set here to ensure that the 0xFF + * alpha returned by GETPIX24 is seen correctly when converting to a + * format that supports it */ + /* R8G8B8 */ 24, 24, 3 - , 0x000000FF, 0x0000FF00, 0x00FF0000, 0x00000000 + , 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000 , 24, 16, 8, 0 , 0, 0 , vHidd_StdPixFmt_RGB24 @@ -26,7 +30,7 @@ const HIDDT_PixelFormat stdpfs[] = /* B8G8R8 */ 24, 24, 3 - , 0x00FF0000, 0x0000FF00, 0x000000FF, 0x00000000 + , 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000 , 8, 16, 24, 0 , 0, 0 , vHidd_StdPixFmt_BGR24 -- 2.11.4.GIT