From: havoc Date: Tue, 25 Jan 2011 12:42:07 +0000 (+0000) Subject: fix crash on texturing a span that starts at the bottom row of a texture X-Git-Tag: xonotic-v0.5.0~438^2~100 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=0bcc0608ad060912a227df0c850eca17d7d1870b;p=xonotic%2Fdarkplaces.git fix crash on texturing a span that starts at the bottom row of a texture but does not end on the bottom row of the texture, which was passing a check for an optimized fill routine but should not have been git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10741 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/dpsoftrast.c b/dpsoftrast.c index b666d254..1a4c241f 100644 --- a/dpsoftrast.c +++ b/dpsoftrast.c @@ -1605,8 +1605,8 @@ void DPSOFTRAST_Draw_Span_Texture2DVarying(const DPSOFTRAST_State_Draw_Span * RE } if(filter) { - tci[0] = (subtc[0]>>12) - tcimin[0]; - tci[1] = (subtc[1]>>12) - tcimin[0]; + tci[0] = (subtc[0]>>12) - tcimin[0] + 1; + tci[1] = (subtc[1]>>12) - tcimin[1] + 1; tci1[0] = ((subtc[0] + (endsub - x)*substep[0])>>12) + 1; tci1[1] = ((subtc[1] + (endsub - x)*substep[1])>>12) + 1; if (tci[0] <= tcimax[0] && tci[1] <= tcimax[1] && tci1[0] <= tcimax[0] && tci1[1] <= tcimax[1]) @@ -1820,8 +1820,8 @@ void DPSOFTRAST_Draw_Span_Texture2DVaryingBGRA8(const DPSOFTRAST_State_Draw_Span if (filter && dpsoftrast_test) { const unsigned int * RESTRICT pixeli[4]; - tci[0] = (subtc[0]>>12) - tcimin[0]; - tci[1] = (subtc[1]>>12) - tcimin[0]; + tci[0] = (subtc[0]>>12) - tcimin[0] + 1; + tci[1] = (subtc[1]>>12) - tcimin[1] + 1; tci1[0] = ((subtc[0] + (endsub - x)*substep[0])>>12) + 1; tci1[1] = ((subtc[1] + (endsub - x)*substep[1])>>12) + 1; if (tci[0] <= tcimax[0] && tci[1] <= tcimax[1] && tci1[0] <= tcimax[0] && tci1[1] <= tcimax[1]) @@ -1890,8 +1890,8 @@ void DPSOFTRAST_Draw_Span_Texture2DVaryingBGRA8(const DPSOFTRAST_State_Draw_Span #endif if (filter) { - tci[0] = (subtc[0]>>12) - tcimin[0]; - tci[1] = (subtc[1]>>12) - tcimin[0]; + tci[0] = (subtc[0]>>12) - tcimin[0] + 1; + tci[1] = (subtc[1]>>12) - tcimin[1] + 1; tci1[0] = ((subtc[0] + (endsub - x)*substep[0])>>12) + 1; tci1[1] = ((subtc[1] + (endsub - x)*substep[1])>>12) + 1; if (tci[0] <= tcimax[0] && tci[1] <= tcimax[1] && tci1[0] <= tcimax[0] && tci1[1] <= tcimax[1]) @@ -1964,8 +1964,8 @@ void DPSOFTRAST_Draw_Span_Texture2DVaryingBGRA8(const DPSOFTRAST_State_Draw_Span } else { - tci[0] = (subtc[0]>>12) - tcimin[0]; - tci[1] = (subtc[1]>>12) - tcimin[0]; + tci[0] = (subtc[0]>>12) - tcimin[0] + 1; + tci[1] = (subtc[1]>>12) - tcimin[1] + 1; tci1[0] = ((subtc[0] + (endsub - x)*substep[0])>>12); tci1[1] = ((subtc[1] + (endsub - x)*substep[1])>>12); if (tci[0] <= tcimax[0] && tci[1] <= tcimax[1] && tci1[0] <= tcimax[0] && tci1[1] <= tcimax[1])