Make blending work with RGB555.

This commit is contained in:
Brandon Wright 2019-03-07 14:28:37 -06:00
parent aba8dc5b61
commit 58aa23ba6d
2 changed files with 16 additions and 4 deletions

10
gfx.h
View File

@ -7,6 +7,8 @@
#ifndef _GFX_H_
#define _GFX_H_
#include "port.h"
struct SGFX
{
uint16 *Screen;
@ -146,13 +148,15 @@ extern struct SGFX GFX;
(((C1) ^ (C2)) & RGB_LOW_BITS_MASK))
#else
inline uint16 COLOR_ADD(uint16 C1, uint16 C2)
{
return ((brightness_cap[ (C1 >> 11) + (C2 >> 11) ] << 11) |
(brightness_cap[((C1 >> 6) & 0x1f) + ((C2 >> 6) & 0x1f)] << 6 ) |
return ((brightness_cap[ (C1 >> RED_SHIFT_BITS) + (C2 >> RED_SHIFT_BITS) ] << RED_SHIFT_BITS) |
(brightness_cap[((C1 >> GREEN_SHIFT_BITS) & 0x1f) + ((C2 >> GREEN_SHIFT_BITS) & 0x1f)] << GREEN_SHIFT_BITS) |
(brightness_cap[ (C1 & 0x1f) + (C2 & 0x1f)] ));
}
#endif
#endif // GFX_MULTI_FORMAT
#define COLOR_SUB1_2(C1, C2) \
GFX.ZERO[(((C1) | RGB_HI_BITS_MASKx2) - \

View File

@ -49,6 +49,8 @@ extern uint32 SPARE_RGB_BIT_MASK;
#define MAX_RED_RGB565 31
#define MAX_GREEN_RGB565 63
#define MAX_BLUE_RGB565 31
#define RED_SHIFT_BITS_RGB565 11
#define GREEN_SHIFT_BITS_RGB565 6
#define RED_LOW_BIT_MASK_RGB565 0x0800
#define GREEN_LOW_BIT_MASK_RGB565 0x0020
#define BLUE_LOW_BIT_MASK_RGB565 0x0001
@ -69,6 +71,8 @@ extern uint32 SPARE_RGB_BIT_MASK;
#define MAX_RED_RGB555 31
#define MAX_GREEN_RGB555 31
#define MAX_BLUE_RGB555 31
#define RED_SHIFT_BITS_RGB555 10
#define GREEN_SHIFT_BITS_RGB555 5
#define RED_LOW_BIT_MASK_RGB555 0x0400
#define GREEN_LOW_BIT_MASK_RGB555 0x0020
#define BLUE_LOW_BIT_MASK_RGB555 0x0001
@ -197,6 +201,8 @@ extern uint32 SPARE_RGB_BIT_MASK;
#define MAX_RED_D(F) CONCAT(MAX_RED_, F)
#define MAX_GREEN_D(F) CONCAT(MAX_GREEN_, F)
#define MAX_BLUE_D(F) CONCAT(MAX_BLUE_, F)
#define RED_SHIFT_BITS_D(F) CONCAT(RED_SHIFT_BITS_, F)
#define GREEN_SHIFT_BITS_D(F) CONCAT(GREEN_SHIFT_BITS_, F)
#define RED_LOW_BIT_MASK_D(F) CONCAT(RED_LOW_BIT_MASK_, F)
#define GREEN_LOW_BIT_MASK_D(F) CONCAT(GREEN_LOW_BIT_MASK_, F)
#define BLUE_LOW_BIT_MASK_D(F) CONCAT(BLUE_LOW_BIT_MASK_, F)
@ -211,6 +217,8 @@ extern uint32 SPARE_RGB_BIT_MASK;
#define MAX_RED MAX_RED_D(PIXEL_FORMAT)
#define MAX_GREEN MAX_GREEN_D(PIXEL_FORMAT)
#define MAX_BLUE MAX_BLUE_D(PIXEL_FORMAT)
#define RED_SHIFT_BITS RED_SHIFT_BITS_D(PIXEL_FORMAT)
#define GREEN_SHIFT_BITS GREEN_SHIFT_BITS_D(PIXEL_FORMAT)
#define RED_LOW_BIT_MASK RED_LOW_BIT_MASK_D(PIXEL_FORMAT)
#define GREEN_LOW_BIT_MASK GREEN_LOW_BIT_MASK_D(PIXEL_FORMAT)
#define BLUE_LOW_BIT_MASK BLUE_LOW_BIT_MASK_D(PIXEL_FORMAT)