all repos — mgba @ 7d688ceb5acbfa5bd18956cf8f7ff34528e38ad9

mGBA Game Boy Advance Emulator

Use unsigned instead of color_t where size is irrelevant
Jeffrey Pfau jeffrey@endrift.com
Mon, 04 Nov 2013 21:25:08 -0800
commit

7d688ceb5acbfa5bd18956cf8f7ff34528e38ad9

parent

3005c6c9fb7bb9d91c1f4dde4ec7e88f99a1a620

1 files changed, 16 insertions(+), 16 deletions(-)

jump to
M src/gba/renderers/video-software.csrc/gba/renderers/video-software.c

@@ -36,9 +36,9 @@ static int _preprocessSprite(struct GBAVideoSoftwareRenderer* renderer, struct GBAObj* sprite, int y);

static void _postprocessSprite(struct GBAVideoSoftwareRenderer* renderer, unsigned priority); static void _updatePalettes(struct GBAVideoSoftwareRenderer* renderer); -static inline color_t _brighten(color_t color, int y); -static inline color_t _darken(color_t color, int y); -static color_t _mix(int weightA, color_t colorA, int weightB, color_t colorB); +static inline unsigned _brighten(unsigned color, int y); +static inline unsigned _darken(unsigned color, int y); +static unsigned _mix(int weightA, unsigned colorA, int weightB, unsigned colorB); void GBAVideoSoftwareRendererCreate(struct GBAVideoSoftwareRenderer* renderer) { renderer->d.init = GBAVideoSoftwareRendererInit;

@@ -277,9 +277,9 @@

static void GBAVideoSoftwareRendererWritePalette(struct GBAVideoRenderer* renderer, uint32_t address, uint16_t value) { struct GBAVideoSoftwareRenderer* softwareRenderer = (struct GBAVideoSoftwareRenderer*) renderer; #ifdef COLOR_16_BIT - color_t color = value; + unsigned color = value; #else - color_t color = 0; + unsigned color = 0; color |= (value << 3) & 0xF8; color |= (value << 6) & 0xF800; color |= (value << 9) & 0xF80000;

@@ -1084,7 +1084,7 @@ BACKGROUND_BITMAP_ITERATE(VIDEO_HORIZONTAL_PIXELS, VIDEO_VERTICAL_PIXELS);

color = ((uint16_t*)renderer->d.vram)[(localX >> 8) + (localY >> 8) * VIDEO_HORIZONTAL_PIXELS]; #ifndef COLOR_16_BIT - color_t color32; + unsigned color32; color32 = 0; color32 |= (color << 3) & 0xF8; color32 |= (color << 6) & 0xF800;

@@ -1149,7 +1149,7 @@ BACKGROUND_BITMAP_ITERATE(160, 128);

color = ((uint16_t*)renderer->d.vram)[offset + (localX >> 8) + (localY >> 8) * 160]; #ifndef COLOR_16_BIT - color_t color32 = 0; + unsigned color32 = 0; color32 |= (color << 9) & 0xF80000; color32 |= (color << 3) & 0xF8; color32 |= (color << 6) & 0xF800;

@@ -1414,9 +1414,9 @@ }

} } -static inline color_t _brighten(color_t color, int y) { - color_t c = 0; - color_t a; +static inline unsigned _brighten(unsigned color, int y) { + unsigned c = 0; + unsigned a; #ifdef COLOR_16_BIT a = color & 0x1F; c |= (a + ((0x1F - a) * y) / 16) & 0x1F;

@@ -1439,9 +1439,9 @@ #endif

return c; } -static inline color_t _darken(color_t color, int y) { - color_t c = 0; - color_t a; +static inline unsigned _darken(unsigned color, int y) { + unsigned c = 0; + unsigned a; #ifdef COLOR_16_BIT a = color & 0x1F; c |= (a - (a * y) / 16) & 0x1F;

@@ -1464,9 +1464,9 @@ #endif

return c; } -static color_t _mix(int weightA, color_t colorA, int weightB, color_t colorB) { - color_t c = 0; - color_t a, b; +static unsigned _mix(int weightA, unsigned colorA, int weightB, unsigned colorB) { + unsigned c = 0; + unsigned a, b; #ifdef COLOR_16_BIT a = colorA & 0x1F; b = colorB & 0x1F;