mirror of https://github.com/mgba-emu/mgba.git
GBA Video: Code cleanup
This commit is contained in:
parent
7020ea35a3
commit
98f2d14b81
|
@ -94,7 +94,7 @@
|
|||
\
|
||||
uint32_t current = *pixel; \
|
||||
MOSAIC(COORD) \
|
||||
if (pixelData) { \
|
||||
if (pixelData && IS_WRITABLE(current)) { \
|
||||
COMPOSITE_256_ ## OBJWIN (BLEND, 0); \
|
||||
} \
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ static inline void _compositeBlendObjwin(struct GBAVideoSoftwareRenderer* render
|
|||
if (current & FLAG_TARGET_1 && color & FLAG_TARGET_2) {
|
||||
color = _mix(renderer->blda, current, renderer->bldb, color);
|
||||
} else {
|
||||
color = (current & 0x00FFFFFF) | (current & (FLAG_REBLEND | FLAG_OBJWIN));
|
||||
color = current & (0x00FFFFFF | FLAG_REBLEND | FLAG_OBJWIN);
|
||||
}
|
||||
} else {
|
||||
color = (color & ~FLAG_TARGET_2) | (current & FLAG_OBJWIN);
|
||||
|
@ -52,14 +52,11 @@ static inline void _compositeBlendObjwin(struct GBAVideoSoftwareRenderer* render
|
|||
}
|
||||
|
||||
static inline void _compositeBlendNoObjwin(struct GBAVideoSoftwareRenderer* renderer, uint32_t* pixel, uint32_t color, uint32_t current) {
|
||||
if (!IS_WRITABLE(current)) { \
|
||||
return; \
|
||||
} \
|
||||
if (color >= current) {
|
||||
if (current & FLAG_TARGET_1 && color & FLAG_TARGET_2) {
|
||||
color = _mix(renderer->blda, current, renderer->bldb, color);
|
||||
} else {
|
||||
color = (current & 0x00FFFFFF) | (current & (FLAG_REBLEND | FLAG_OBJWIN));
|
||||
color = current & (0x00FFFFFF | FLAG_REBLEND | FLAG_OBJWIN);
|
||||
}
|
||||
} else {
|
||||
color = color & ~FLAG_TARGET_2;
|
||||
|
@ -73,7 +70,7 @@ static inline void _compositeNoBlendObjwin(struct GBAVideoSoftwareRenderer* rend
|
|||
if (color < current) {
|
||||
color |= (current & FLAG_OBJWIN);
|
||||
} else {
|
||||
color = (current & 0x00FFFFFF) | (current & (FLAG_REBLEND | FLAG_OBJWIN));
|
||||
color = current & (0x00FFFFFF | FLAG_REBLEND | FLAG_OBJWIN);
|
||||
}
|
||||
*pixel = color;
|
||||
}
|
||||
|
@ -82,15 +79,12 @@ static inline void _compositeNoBlendNoObjwin(struct GBAVideoSoftwareRenderer* re
|
|||
uint32_t current) {
|
||||
UNUSED(renderer);
|
||||
if (color >= current) {
|
||||
color = (current & 0x00FFFFFF) | (current & (FLAG_REBLEND | FLAG_OBJWIN));
|
||||
color = current & (0x00FFFFFF | FLAG_REBLEND | FLAG_OBJWIN);
|
||||
}
|
||||
*pixel = color;
|
||||
}
|
||||
|
||||
#define COMPOSITE_16_OBJWIN(BLEND, IDX) \
|
||||
if (!IS_WRITABLE(current)) { \
|
||||
continue; \
|
||||
} \
|
||||
if (objwinForceEnable || (!(current & FLAG_OBJWIN)) == objwinOnly) { \
|
||||
unsigned color = (current & FLAG_OBJWIN) ? objwinPalette[paletteData | pixelData] : palette[pixelData]; \
|
||||
unsigned mergedFlags = flags; \
|
||||
|
@ -104,9 +98,6 @@ static inline void _compositeNoBlendNoObjwin(struct GBAVideoSoftwareRenderer* re
|
|||
_composite ## BLEND ## NoObjwin(renderer, &pixel[IDX], palette[pixelData] | flags, current);
|
||||
|
||||
#define COMPOSITE_256_OBJWIN(BLEND, IDX) \
|
||||
if (!IS_WRITABLE(current)) { \
|
||||
continue; \
|
||||
} \
|
||||
if (objwinForceEnable || (!(current & FLAG_OBJWIN)) == objwinOnly) { \
|
||||
unsigned color = (current & FLAG_OBJWIN) ? objwinPalette[pixelData] : palette[pixelData]; \
|
||||
unsigned mergedFlags = flags; \
|
||||
|
|
Loading…
Reference in New Issue