diff Render.cpp @ 2096:115373c2d1cd

RasterLine2D fix
author Ritor1
date Fri, 13 Dec 2013 01:21:07 +0600
parents 52415f8bf7c2
children 2b39f6b451f9
line wrap: on
line diff
--- a/Render.cpp	Thu Dec 12 21:44:02 2013 +0600
+++ b/Render.cpp	Fri Dec 13 01:21:07 2013 +0600
@@ -3619,7 +3619,7 @@
     v21 = pRenderer->uTargetSurfacePitch;
     if ( pRenderer->uTargetSurfacePitch )
     {
-      v12 = uX + v8 * pRenderer->uTargetSurfacePitch;
+      v12 = uX + uY * pRenderer->uTargetSurfacePitch;
       v22 = v11 - v8;
       v23 = v22;
       uYb = v22;
@@ -3653,11 +3653,17 @@
             v31 = 2 * v24;
             v32 = 2 * v21;
             v12 = (int)&v26[v12];
+            int y = 0;
             for ( v30; v30; --v30 )
             {
               v25 += uXa;
-              *(short *)v12 = uColor;
-              v12 += v32;
+              //*(short *)v12 = uColor;
+              //v12 += v32;
+              WritePixel16(uX + v25, uY + y, uColor);
+              if ( v32 >= 0 )
+                y += 1;
+              else
+                y -= 1;
               if ( v25 > 0 )
               {
                 v25 -= uYb;
@@ -3669,6 +3675,7 @@
         else//рисуем горизонтальную линию
         {
           v27 = uXa + 1;
+          int x = 0;
           if ( (signed int)(uXa + 1) > 0 )
           {
             v28 = 2 * v21;
@@ -3677,8 +3684,13 @@
             for ( v27; v27; --v27 )
             {
               v25 += uYb;
-              *(short *)v12 = uColor;
-              v12 += v29;
+              //*(short *)v12 = uColor;
+              //v12 += v29;
+              WritePixel16(uX + x, uY + v25, uColor);
+              if ( v29 >= 0 )
+                x += 1;
+              else
+                x -= 1;
               if ( v25 > (signed int)uXa )
               {
                 v25 -= uXa;