]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
fix crash on texturing a span that starts at the bottom row of a texture
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 25 Jan 2011 12:42:07 +0000 (12:42 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Tue, 25 Jan 2011 12:42:07 +0000 (12:42 +0000)
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

dpsoftrast.c

index b666d25453a19ee6698971d9030b1612dc4a1c1d..1a4c241feb4d6fc7776c49ac1b34b59d7e280614 100644 (file)
@@ -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])