diff options
author | inmarket <andrewh@inmarket.com.au> | 2015-04-07 23:20:16 +1000 |
---|---|---|
committer | inmarket <andrewh@inmarket.com.au> | 2015-04-07 23:20:16 +1000 |
commit | beacfaa9946014ca05e12eb740d1d33a1f5f996f (patch) | |
tree | d7903fd1d629ed23ebb5b55efc290526d9783259 /src | |
parent | 601fd6855dcef309ca3d0bdc47008a1431145db0 (diff) | |
download | uGFX-beacfaa9946014ca05e12eb740d1d33a1f5f996f.tar.gz uGFX-beacfaa9946014ca05e12eb740d1d33a1f5f996f.tar.bz2 uGFX-beacfaa9946014ca05e12eb740d1d33a1f5f996f.zip |
Fix in color conversions for some strange compilers that don't do macro expansion in the highest available integer format
Diffstat (limited to 'src')
-rw-r--r-- | src/gdisp/gdisp_colors.h | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/gdisp/gdisp_colors.h b/src/gdisp/gdisp_colors.h index f417a5e4..6ad463fc 100644 --- a/src/gdisp/gdisp_colors.h +++ b/src/gdisp/gdisp_colors.h @@ -306,25 +306,25 @@ typedef uint16_t colorformat; // Calculate HTML2COLOR #if COLOR_BITS_R + COLOR_SHIFT_R == 24 - #define HTML2COLOR_R(h) ((h) & ((0xFF & ~((1<<(8-COLOR_BITS_R))-1))<<16)) + #define HTML2COLOR_R(h) ((h) & ((0xFFL & ~((1<<(8-COLOR_BITS_R))-1))<<16)) #elif COLOR_BITS_R + COLOR_SHIFT_R > 24 - #define HTML2COLOR_R(h) (((h) & ((0xFF & ~((1<<(8-COLOR_BITS_R))-1))<<16)) << (COLOR_BITS_R+COLOR_SHIFT_R-24)) + #define HTML2COLOR_R(h) (((h) & ((0xFFL & ~((1<<(8-COLOR_BITS_R))-1))<<16)) << (COLOR_BITS_R+COLOR_SHIFT_R-24)) #else // COLOR_BITS_R + COLOR_SHIFT_R < 24 - #define HTML2COLOR_R(h) (((h) & ((0xFF & ~((1<<(8-COLOR_BITS_R))-1))<<16)) >> (24-(COLOR_BITS_R+COLOR_SHIFT_R))) + #define HTML2COLOR_R(h) (((h) & ((0xFFL & ~((1<<(8-COLOR_BITS_R))-1))<<16)) >> (24-(COLOR_BITS_R+COLOR_SHIFT_R))) #endif #if COLOR_BITS_G + COLOR_SHIFT_G == 16 - #define HTML2COLOR_G(h) ((h) & ((0xFF & ~((1<<(8-COLOR_BITS_G))-1))<<8)) + #define HTML2COLOR_G(h) ((h) & ((0xFFL & ~((1<<(8-COLOR_BITS_G))-1))<<8)) #elif COLOR_BITS_G + COLOR_SHIFT_G > 16 - #define HTML2COLOR_G(h) (((h) & ((0xFF & ~((1<<(8-COLOR_BITS_G))-1))<<8)) << (COLOR_BITS_G+COLOR_SHIFT_G-16)) + #define HTML2COLOR_G(h) (((h) & ((0xFFL & ~((1<<(8-COLOR_BITS_G))-1))<<8)) << (COLOR_BITS_G+COLOR_SHIFT_G-16)) #else // COLOR_BITS_G + COLOR_SHIFT_G < 16 - #define HTML2COLOR_G(h) (((h) & ((0xFF & ~((1<<(8-COLOR_BITS_G))-1))<<8)) >> (16-(COLOR_BITS_G+COLOR_SHIFT_G))) + #define HTML2COLOR_G(h) (((h) & ((0xFFL & ~((1<<(8-COLOR_BITS_G))-1))<<8)) >> (16-(COLOR_BITS_G+COLOR_SHIFT_G))) #endif #if COLOR_BITS_B + COLOR_SHIFT_B == 8 - #define HTML2COLOR_B(h) ((h) & (0xFF & ~((1<<(8-COLOR_BITS_B))-1))) + #define HTML2COLOR_B(h) ((h) & (0xFFL & ~((1<<(8-COLOR_BITS_B))-1))) #elif COLOR_BITS_B + COLOR_SHIFT_B > 8 - #define HTML2COLOR_B(h) (((h) & (0xFF & ~((1<<(8-COLOR_BITS_B))-1))) << (COLOR_BITS_B+COLOR_SHIFT_B-8)) + #define HTML2COLOR_B(h) (((h) & (0xFFL & ~((1<<(8-COLOR_BITS_B))-1))) << (COLOR_BITS_B+COLOR_SHIFT_B-8)) #else // COLOR_BITS_B + COLOR_SHIFT_B < 8 - #define HTML2COLOR_B(h) (((h) & (0xFF & ~((1<<(8-COLOR_BITS_B))-1))) >> (8-(COLOR_BITS_B+COLOR_SHIFT_B))) + #define HTML2COLOR_B(h) (((h) & (0xFFL & ~((1<<(8-COLOR_BITS_B))-1))) >> (8-(COLOR_BITS_B+COLOR_SHIFT_B))) #endif #define HTML2COLOR(h) ((COLOR_TYPE)(HTML2COLOR_R(h) | HTML2COLOR_G(h) | HTML2COLOR_B(h))) |