summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gfx.h2
-rw-r--r--src/pixform.h27
-rw-r--r--src/port.h4
3 files changed, 32 insertions, 1 deletions
diff --git a/src/gfx.h b/src/gfx.h
index 362da1d..adc568e 100644
--- a/src/gfx.h
+++ b/src/gfx.h
@@ -224,7 +224,7 @@ static INLINE uint16_t COLOR_ADD(uint16_t C1, uint16_t C2)
{
const int RED_MASK = 0x1F << RED_SHIFT_BITS;
const int GREEN_MASK = 0x1F << GREEN_SHIFT_BITS;
- const int BLUE_MASK = 0x1F;
+ const int BLUE_MASK = 0x1F << BLUE_SHIFT_BITS;
int rb = (C1 & (RED_MASK | BLUE_MASK)) + (C2 & (RED_MASK | BLUE_MASK));
int rbcarry = rb & ((0x20 << RED_SHIFT_BITS) | (0x20 << 0));
diff --git a/src/pixform.h b/src/pixform.h
index 1edd9c5..8f22825 100644
--- a/src/pixform.h
+++ b/src/pixform.h
@@ -88,6 +88,7 @@ extern uint32 HIGH_BITS_SHIFTED_TWO_MASK;
#define MAX_BLUE_RGB565 31
#define RED_SHIFT_BITS_RGB565 11
#define GREEN_SHIFT_BITS_RGB565 6
+#define BLUE_SHIFT_BITS_RGB565 0
#define RED_LOW_BIT_MASK_RGB565 0x0800
#define GREEN_LOW_BIT_MASK_RGB565 0x0020
#define BLUE_LOW_BIT_MASK_RGB565 0x0001
@@ -99,6 +100,29 @@ extern uint32 HIGH_BITS_SHIFTED_TWO_MASK;
#define THIRD_COLOR_MASK_RGB565 0x001F
#define ALPHA_BITS_MASK_RGB565 0x0000
+// BGR555 format
+#define BUILD_PIXEL_BGR555(R,G,B) (((int) (B) << 10) | ((int) (G) << 5) | (int) (R))
+#define BUILD_PIXEL2_BGR555(R,G,B) (((int) (B) << 10) | ((int) (G) << 5) | (int) (R))
+#define DECOMPOSE_PIXEL_BGR555(PIX,R,G,B) {(B) = (PIX) >> 10; (G) = ((PIX) >> 5) & 0x1f; (R) = (PIX) & 0x1f; }
+#define SPARE_RGB_BIT_MASK_BGR555 (1 << 5)
+
+#define MAX_RED_BGR555 31
+#define MAX_GREEN_BGR555 31
+#define MAX_BLUE_BGR555 31
+#define RED_SHIFT_BITS_BGR555 0
+#define GREEN_SHIFT_BITS_BGR555 5
+#define BLUE_SHIFT_BITS_BGR555 10
+#define RED_LOW_BIT_MASK_BGR555 0x0001
+#define GREEN_LOW_BIT_MASK_BGR555 0x0020
+#define BLUE_LOW_BIT_MASK_BGR555 0x0400
+#define RED_HI_BIT_MASK_BGR555 0x0010
+#define GREEN_HI_BIT_MASK_BGR555 0x0200
+#define BLUE_HI_BIT_MASK_BGR555 0x4000
+#define FIRST_COLOR_MASK_BGR555 0x7C00
+#define SECOND_COLOR_MASK_BGR555 0x03E0
+#define THIRD_COLOR_MASK_BGR555 0x001F
+#define ALPHA_BITS_MASK_BGR555 0x0000
+
// RGB555 format
#define BUILD_PIXEL_RGB555(R,G,B) (((int) (R) << 10) | ((int) (G) << 5) | (int) (B))
#define BUILD_PIXEL2_RGB555(R,G,B) (((int) (R) << 10) | ((int) (G) << 5) | (int) (B))
@@ -110,6 +134,7 @@ extern uint32 HIGH_BITS_SHIFTED_TWO_MASK;
#define MAX_BLUE_RGB555 31
#define RED_SHIFT_BITS_RGB555 10
#define GREEN_SHIFT_BITS_RGB555 5
+#define BLUE_SHIFT_BITS_RGB555 0
#define RED_LOW_BIT_MASK_RGB555 0x0400
#define GREEN_LOW_BIT_MASK_RGB555 0x0020
#define BLUE_LOW_BIT_MASK_RGB555 0x0001
@@ -139,6 +164,7 @@ extern uint32 HIGH_BITS_SHIFTED_TWO_MASK;
#define MAX_GREEN_D(F) CONCAT(MAX_GREEN_,F)
#define RED_SHIFT_BITS_D(F) CONCAT(RED_SHIFT_BITS_, F)
#define GREEN_SHIFT_BITS_D(F) CONCAT(GREEN_SHIFT_BITS_, F)
+#define BLUE_SHIFT_BITS_D(F) CONCAT(BLUE_SHIFT_BITS_, F)
#define RED_LOW_BIT_MASK_D(F) CONCAT(RED_LOW_BIT_MASK_,F)
#define BLUE_LOW_BIT_MASK_D(F) CONCAT(BLUE_LOW_BIT_MASK_,F)
#define GREEN_LOW_BIT_MASK_D(F) CONCAT(GREEN_LOW_BIT_MASK_,F)
@@ -155,6 +181,7 @@ extern uint32 HIGH_BITS_SHIFTED_TWO_MASK;
#define MAX_GREEN MAX_GREEN_D(PIXEL_FORMAT)
#define RED_SHIFT_BITS RED_SHIFT_BITS_D(PIXEL_FORMAT)
#define GREEN_SHIFT_BITS GREEN_SHIFT_BITS_D(PIXEL_FORMAT)
+#define BLUE_SHIFT_BITS BLUE_SHIFT_BITS_D(PIXEL_FORMAT)
#define RED_LOW_BIT_MASK RED_LOW_BIT_MASK_D(PIXEL_FORMAT)
#define BLUE_LOW_BIT_MASK BLUE_LOW_BIT_MASK_D(PIXEL_FORMAT)
#define GREEN_LOW_BIT_MASK GREEN_LOW_BIT_MASK_D(PIXEL_FORMAT)
diff --git a/src/port.h b/src/port.h
index e6b5c1d..c8d0be8 100644
--- a/src/port.h
+++ b/src/port.h
@@ -110,7 +110,11 @@ typedef short int16_32;
#define VAR_CYCLES
//#define SPC700_SHUTDOWN
#define FASTCALL
+#if defined(PS2)
+#define PIXEL_FORMAT BGR555
+#else
#define PIXEL_FORMAT RGB565
+#endif
#define CPU_SHUTDOWN
#define PACKING __attribute__ ((packed))
#define ALIGN_BY_ONE __attribute__ ((aligned (1), packed))