DS GX: Make colors unsigned
Vicki Pfau vi@endrift.com
Wed, 01 Mar 2017 11:01:50 -0800
2 files changed,
11 insertions(+),
11 deletions(-)
M
include/mgba/internal/ds/gx/software.h
→
include/mgba/internal/ds/gx/software.h
@@ -27,18 +27,18 @@ unsigned polyId;
int32_t y0; // 20.12 int32_t x0; // 20.12 int32_t w0; // 20.12 - int8_t cr0; - int8_t cg0; - int8_t cb0; + uint8_t cr0; + uint8_t cg0; + uint8_t cb0; int16_t s0; int16_t t0; int32_t y1; // 20.12 int32_t x1; // 20.12 int32_t w1; // 20.12 - int8_t cr1; - int8_t cg1; - int8_t cb1; + uint8_t cr1; + uint8_t cg1; + uint8_t cb1; int16_t s1; int16_t t1; };@@ -46,9 +46,9 @@
struct DSGXSoftwareEndpoint { int32_t x; // 20.12 int32_t w; // 20.12 - int8_t cr; - int8_t cg; - int8_t cb; + uint8_t cr; + uint8_t cg; + uint8_t cb; int16_t s; int16_t t; };
M
src/ds/gx/software.c
→
src/ds/gx/software.c
@@ -21,13 +21,13 @@ static void DSGXSoftwareRendererSetRAM(struct DSGXRenderer* renderer, struct DSGXVertex* verts, struct DSGXPolygon* polys, unsigned polyCount);
static void DSGXSoftwareRendererDrawScanline(struct DSGXRenderer* renderer, int y); static void DSGXSoftwareRendererGetScanline(struct DSGXRenderer* renderer, int y, color_t** output); -static void _expandColor(uint16_t c15, int8_t* r, int8_t* g, int8_t* b) { +static void _expandColor(uint16_t c15, uint8_t* r, uint8_t* g, uint8_t* b) { *r = ((c15 << 1) & 0x3E) | 1; *g = ((c15 >> 4) & 0x3E) | 1; *b = ((c15 >> 9) & 0x3E) | 1; } -static color_t _finishColor(int8_t r, int8_t g, int8_t b) { +static color_t _finishColor(uint8_t r, uint8_t g, uint8_t b) { #ifndef COLOR_16_BIT color_t rgb = (r << 2) & 0xF8; rgb |= (g << 10) & 0xF800;