Simplify the math.
authorHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Sun, 8 Jun 2014 17:36:12 +0000 (17:36 +0000)
committerHermès Bélusca-Maïto <hermes.belusca-maito@reactos.org>
Sun, 8 Jun 2014 17:36:12 +0000 (17:36 +0000)
svn path=/trunk/; revision=63560

reactos/win32ss/user/winsrv/consrv/frontends/gui/text.c

index feb128b..b3caf59 100644 (file)
@@ -167,12 +167,11 @@ CopyLines(PTEXTMODE_SCREEN_BUFFER Buffer,
     }
     else // if (End->Y > Begin->Y)
     {
-        NumChars = (Buffer->ScreenBufferSize.X - 1) - (Begin->X) + 1;
+        NumChars = Buffer->ScreenBufferSize.X - Begin->X;
 
-        if (Begin->Y + 1 <= End->Y - 1)
+        if (End->Y >= Begin->Y + 2)
         {
-            NumChars += ( (Buffer->ScreenBufferSize.X - 1) + 1 ) *
-                        ( (End->Y - 1) - (Begin->Y + 1) + 1);
+            NumChars += (End->Y - Begin->Y - 1) * Buffer->ScreenBufferSize.X;
         }
 
         NumChars += End->X + 1;