compile fix

This commit is contained in:
Jaime Passos 2019-09-17 22:29:53 -03:00
parent 3e95451960
commit a6831aff9c
3 changed files with 13 additions and 13 deletions

View File

@ -149,7 +149,7 @@ static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipm
{ {
RGBA_t rgbatexel; RGBA_t rgbatexel;
rgbatexel.rgba = *(UINT32 *)dest; rgbatexel.rgba = *(UINT32 *)dest;
colortemp = ASTBlendPixel(rgbatexel, colortemp, originPatch->style, originPatch->alpha); colortemp.rgba = ASTBlendPixel(rgbatexel, colortemp, originPatch->style, originPatch->alpha);
} }
memcpy(dest, &colortemp, sizeof(RGBA_t)-sizeof(UINT8)); memcpy(dest, &colortemp, sizeof(RGBA_t)-sizeof(UINT8));
break; break;
@ -159,7 +159,7 @@ static void HWR_DrawColumnInCache(const column_t *patchcol, UINT8 *block, GLMipm
{ {
RGBA_t rgbatexel; RGBA_t rgbatexel;
rgbatexel.rgba = *(UINT32 *)dest; rgbatexel.rgba = *(UINT32 *)dest;
colortemp = ASTBlendPixel(rgbatexel, colortemp, originPatch->style, originPatch->alpha); colortemp.rgba = ASTBlendPixel(rgbatexel, colortemp, originPatch->style, originPatch->alpha);
} }
memcpy(dest, &colortemp, sizeof(RGBA_t)); memcpy(dest, &colortemp, sizeof(RGBA_t));
break; break;
@ -263,7 +263,7 @@ static void HWR_DrawFlippedColumnInCache(const column_t *patchcol, UINT8 *block,
{ {
RGBA_t rgbatexel; RGBA_t rgbatexel;
rgbatexel.rgba = *(UINT32 *)dest; rgbatexel.rgba = *(UINT32 *)dest;
colortemp = ASTBlendPixel(rgbatexel, colortemp, originPatch->style, originPatch->alpha); colortemp.rgba = ASTBlendPixel(rgbatexel, colortemp, originPatch->style, originPatch->alpha);
} }
memcpy(dest, &colortemp, sizeof(RGBA_t)-sizeof(UINT8)); memcpy(dest, &colortemp, sizeof(RGBA_t)-sizeof(UINT8));
break; break;
@ -273,7 +273,7 @@ static void HWR_DrawFlippedColumnInCache(const column_t *patchcol, UINT8 *block,
{ {
RGBA_t rgbatexel; RGBA_t rgbatexel;
rgbatexel.rgba = *(UINT32 *)dest; rgbatexel.rgba = *(UINT32 *)dest;
colortemp = ASTBlendPixel(rgbatexel, colortemp, originPatch->style, originPatch->alpha); colortemp.rgba = ASTBlendPixel(rgbatexel, colortemp, originPatch->style, originPatch->alpha);
} }
memcpy(dest, &colortemp, sizeof(RGBA_t)); memcpy(dest, &colortemp, sizeof(RGBA_t));
break; break;

View File

@ -241,7 +241,7 @@ static inline void R_DrawFlippedColumnInCache(column_t *patch, UINT8 *cache, tex
} }
} }
RGBA_t ASTBlendPixel(RGBA_t background, RGBA_t foreground, int style, UINT8 alpha) UINT32 ASTBlendPixel(RGBA_t background, RGBA_t foreground, int style, UINT8 alpha)
{ {
RGBA_t output; RGBA_t output;
if (style == AST_TRANSLUCENT) if (style == AST_TRANSLUCENT)
@ -298,13 +298,13 @@ RGBA_t ASTBlendPixel(RGBA_t background, RGBA_t foreground, int style, UINT8 alph
} }
// just copy the pixel // just copy the pixel
else if (style == AST_COPY) else if (style == AST_COPY)
return background; output.rgba = foreground.rgba;
output.s.alpha = 0xFF;
return output.rgba;
} }
#undef clamp #undef clamp
// unimplemented blend modes return the background pixel return 0;
output = background;
output.s.alpha = 0xFF;
return output;
} }
UINT8 ASTBlendPixel_8bpp(UINT8 background, UINT8 foreground, int style, UINT8 alpha) UINT8 ASTBlendPixel_8bpp(UINT8 background, UINT8 foreground, int style, UINT8 alpha)
@ -321,7 +321,7 @@ UINT8 ASTBlendPixel_8bpp(UINT8 background, UINT8 foreground, int style, UINT8 al
} }
// just copy the pixel // just copy the pixel
else if (style == AST_COPY) else if (style == AST_COPY)
return background; return foreground;
// use ASTBlendPixel for all other blend modes // use ASTBlendPixel for all other blend modes
// and find the nearest colour in the palette // and find the nearest colour in the palette
else if (style != AST_TRANSLUCENT) else if (style != AST_TRANSLUCENT)
@ -329,7 +329,7 @@ UINT8 ASTBlendPixel_8bpp(UINT8 background, UINT8 foreground, int style, UINT8 al
RGBA_t texel; RGBA_t texel;
RGBA_t bg = V_GetColor(background); RGBA_t bg = V_GetColor(background);
RGBA_t fg = V_GetColor(foreground); RGBA_t fg = V_GetColor(foreground);
texel = ASTBlendPixel(bg, fg, style, alpha); texel.rgba = ASTBlendPixel(bg, fg, style, alpha);
return NearestColor(texel.s.red, texel.s.green, texel.s.blue); return NearestColor(texel.s.red, texel.s.green, texel.s.blue);
} }
// fallback if all above fails, somehow // fallback if all above fails, somehow

View File

@ -25,7 +25,7 @@
// Possible alpha types for a patch. // Possible alpha types for a patch.
enum patchalphastyle {AST_COPY, AST_TRANSLUCENT, AST_ADD, AST_SUBTRACT, AST_REVERSESUBTRACT, AST_MODULATE, AST_OVERLAY}; enum patchalphastyle {AST_COPY, AST_TRANSLUCENT, AST_ADD, AST_SUBTRACT, AST_REVERSESUBTRACT, AST_MODULATE, AST_OVERLAY};
RGBA_t ASTBlendPixel(RGBA_t background, RGBA_t foreground, int style, UINT8 alpha); UINT32 ASTBlendPixel(RGBA_t background, RGBA_t foreground, int style, UINT8 alpha);
UINT8 ASTBlendPixel_8bpp(UINT8 background, UINT8 foreground, int style, UINT8 alpha); UINT8 ASTBlendPixel_8bpp(UINT8 background, UINT8 foreground, int style, UINT8 alpha);
UINT8 NearestColor(UINT8 r, UINT8 g, UINT8 b); UINT8 NearestColor(UINT8 r, UINT8 g, UINT8 b);