mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-12-01 16:41:09 +00:00
Simplify code slightly
This commit is contained in:
parent
1e239ba4bb
commit
2052a6db53
1 changed files with 46 additions and 41 deletions
|
@ -923,52 +923,57 @@ static void BlendColorRevSub_Src_One(int y, int x0, int x1, PolyTriangleThreadDa
|
|||
|
||||
static void SelectWriteColorFunc(PolyTriangleThreadData* thread)
|
||||
{
|
||||
void(*writecolorfunc)(int y, int x0, int x1, PolyTriangleThreadData * thread);
|
||||
|
||||
FRenderStyle style = thread->RenderStyle;
|
||||
if (style.BlendOp == STYLEOP_Add && style.SrcAlpha == STYLEALPHA_One && style.DestAlpha == STYLEALPHA_Zero)
|
||||
if (style.BlendOp == STYLEOP_Add)
|
||||
{
|
||||
writecolorfunc = &BlendColorOpaque;
|
||||
if (style.SrcAlpha == STYLEALPHA_One && style.DestAlpha == STYLEALPHA_Zero)
|
||||
{
|
||||
thread->WriteColorFunc = &BlendColorOpaque;
|
||||
}
|
||||
else if (style.BlendOp == STYLEOP_Add && style.SrcAlpha == STYLEALPHA_Src && style.DestAlpha == STYLEALPHA_InvSrc)
|
||||
else if (style.SrcAlpha == STYLEALPHA_Src && style.DestAlpha == STYLEALPHA_InvSrc)
|
||||
{
|
||||
writecolorfunc = &BlendColorAdd_Src_InvSrc;
|
||||
thread->WriteColorFunc = &BlendColorAdd_Src_InvSrc;
|
||||
}
|
||||
else if (style.BlendOp == STYLEOP_Add && style.SrcAlpha == STYLEALPHA_SrcCol && style.DestAlpha == STYLEALPHA_InvSrcCol)
|
||||
else if (style.SrcAlpha == STYLEALPHA_SrcCol && style.DestAlpha == STYLEALPHA_InvSrcCol)
|
||||
{
|
||||
writecolorfunc = &BlendColorAdd_SrcCol_InvSrcCol;
|
||||
thread->WriteColorFunc = &BlendColorAdd_SrcCol_InvSrcCol;
|
||||
}
|
||||
else if (style.BlendOp == STYLEOP_Add && style.SrcAlpha == STYLEALPHA_Src && style.DestAlpha == STYLEALPHA_One)
|
||||
else if (style.SrcAlpha == STYLEALPHA_Src && style.DestAlpha == STYLEALPHA_One)
|
||||
{
|
||||
writecolorfunc = &BlendColorAdd_Src_One;
|
||||
thread->WriteColorFunc = &BlendColorAdd_Src_One;
|
||||
}
|
||||
else if (style.BlendOp == STYLEOP_Add && style.SrcAlpha == STYLEALPHA_SrcCol && style.DestAlpha == STYLEALPHA_One)
|
||||
else if (style.SrcAlpha == STYLEALPHA_SrcCol && style.DestAlpha == STYLEALPHA_One)
|
||||
{
|
||||
writecolorfunc = &BlendColorAdd_SrcCol_One;
|
||||
thread->WriteColorFunc = &BlendColorAdd_SrcCol_One;
|
||||
}
|
||||
else if (style.BlendOp == STYLEOP_Add && style.SrcAlpha == STYLEALPHA_DstCol && style.DestAlpha == STYLEALPHA_Zero)
|
||||
else if (style.SrcAlpha == STYLEALPHA_DstCol && style.DestAlpha == STYLEALPHA_Zero)
|
||||
{
|
||||
writecolorfunc = &BlendColorAdd_DstCol_Zero;
|
||||
thread->WriteColorFunc = &BlendColorAdd_DstCol_Zero;
|
||||
}
|
||||
else if (style.BlendOp == STYLEOP_Add && style.SrcAlpha == STYLEALPHA_InvDstCol && style.DestAlpha == STYLEALPHA_Zero)
|
||||
else if (style.SrcAlpha == STYLEALPHA_InvDstCol && style.DestAlpha == STYLEALPHA_Zero)
|
||||
{
|
||||
writecolorfunc = &BlendColorAdd_InvDstCol_Zero;
|
||||
}
|
||||
else if (style.BlendOp == STYLEOP_RevSub && style.SrcAlpha == STYLEALPHA_Src && style.DestAlpha == STYLEALPHA_One)
|
||||
{
|
||||
writecolorfunc = &BlendColorRevSub_Src_One;
|
||||
thread->WriteColorFunc = &BlendColorAdd_InvDstCol_Zero;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (style.BlendOp)
|
||||
thread->WriteColorFunc = &BlendColor<BlendColorOpt_Add>;
|
||||
}
|
||||
}
|
||||
else if (style.BlendOp == STYLEOP_Sub)
|
||||
{
|
||||
default:
|
||||
case STYLEOP_Add: writecolorfunc = &BlendColor<BlendColorOpt_Add>; break;
|
||||
case STYLEOP_Sub: writecolorfunc = &BlendColor<BlendColorOpt_Sub>; break;
|
||||
case STYLEOP_RevSub: writecolorfunc = &BlendColor<BlendColorOpt_RevSub>; break;
|
||||
thread->WriteColorFunc = &BlendColor<BlendColorOpt_Sub>;
|
||||
}
|
||||
else // if (style.BlendOp == STYLEOP_RevSub)
|
||||
{
|
||||
if (style.SrcAlpha == STYLEALPHA_Src && style.DestAlpha == STYLEALPHA_One)
|
||||
{
|
||||
thread->WriteColorFunc = &BlendColorRevSub_Src_One;
|
||||
}
|
||||
else
|
||||
{
|
||||
thread->WriteColorFunc = &BlendColor<BlendColorOpt_RevSub>;
|
||||
}
|
||||
}
|
||||
thread->WriteColorFunc = writecolorfunc;
|
||||
}
|
||||
|
||||
static void WriteDepth(int y, int x0, int x1, PolyTriangleThreadData* thread)
|
||||
|
|
Loading…
Reference in a new issue