changeset 1152:d8b455c81917

Render::DrawTextureRGB cleanup
author Grumpy7
date Sun, 02 Jun 2013 17:06:38 +0200
parents 4eca5bb63dc0
children 8ce08eea96ed 38662d9c8be8 336f0d008666
files Render.cpp
diffstat 1 files changed, 29 insertions(+), 66 deletions(-) [+]
line wrap: on
line diff
--- a/Render.cpp	Sun Jun 02 16:43:22 2013 +0200
+++ b/Render.cpp	Sun Jun 02 17:06:38 2013 +0200
@@ -9107,22 +9107,13 @@
   int v4; // edi@3
   unsigned __int16 *v5; // edx@3
   unsigned __int16 *v6; // esi@3
-  unsigned int v7; // ebx@4
   unsigned int v8; // eax@5
   unsigned int v9; // ebx@5
-  unsigned int v10; // eax@6
   unsigned int v11; // eax@7
   unsigned int v12; // ebx@8
-  unsigned int v13; // eax@10
-  unsigned int v14; // edi@11
   unsigned int v15; // eax@14
-  unsigned int v16; // ebx@17
-  int v17; // eax@23
-  char v18; // zf@25
   int v19; // [sp+10h] [bp-8h]@3
-  int v20; // [sp+14h] [bp-4h]@3
   unsigned int uOutXa; // [sp+20h] [bp+8h]@16
-  int uOutXb; // [sp+20h] [bp+8h]@21
   int v23; // [sp+28h] [bp+10h]@3
 
   if ( this->uNumSceneBegins && a4 )
@@ -9130,76 +9121,48 @@
     v4 = a4->uWidth;
     v5 = &this->pTargetSurface[uOutX + uOutY * this->uTargetSurfacePitch];
     v6 = a4->pPixels;
-    v20 = v4;
     v23 = a4->uHeight;
     v19 = v4;
     if ( this->bClip )
     {
-      v7 = this->uClipX;
-      if ( (signed int)uOutX < (signed int)v7 )
-      {
-        v8 = v7 - uOutX;
-        v9 = uOutX - v7;
+      if ( (signed int)uOutX < (signed int)this->uClipX )
+      {
+        v8 = this->uClipX - uOutX;
+        v9 = uOutX - this->uClipX;
         v8 *= 2;
         v4 += v9;
         v6 = (unsigned __int16 *)((char *)v6 + v8);
-        v20 += v9;
         v5 = (unsigned __int16 *)((char *)v5 + v8);
       }
-      v10 = this->uClipY;
-      if ( (signed int)uOutY < (signed int)v10 )
-      {
-        v11 = v10 - uOutY;
+      if ( (signed int)uOutY < (signed int)this->uClipY )
+      {
+        v11 = this->uClipY - uOutY;
         v6 += v19 * v11;
         v23 += uOutY - this->uClipY;
-        v4 = v20;
         v5 += this->uTargetSurfacePitch * v11;
       }
-      v12 = this->uClipX;
-      if ( (signed int)v12 < (signed int)uOutX )
-        v12 = uOutX;
-      v13 = this->uClipZ;
-      if ( (signed int)(v4 + v12) > (signed int)v13 )
-      {
-        v14 = this->uClipX;
-        if ( (signed int)v14 < (signed int)uOutX )
-          v14 = uOutX;
-        v4 = v13 - v14;
-      }
-      v15 = this->uClipY;
-      if ( (signed int)v15 < (signed int)uOutY )
-        v15 = uOutY;
-      uOutXa = this->uClipW;
-      if ( (signed int)(v15 + v23) > (signed int)uOutXa )
-      {
-        v16 = this->uClipY;
-        if ( (signed int)v16 < (signed int)uOutY )
-          v16 = uOutY;
-        v23 = uOutXa - v16;
-      }
-    }
-    if ( v23 > 0 )
-    {
-      uOutXb = v23;
-      do
-      {
-        if ( v4 > 0 )
-        {
-          v17 = v4;
-          do
-          {
-            *v5 = *v6;
-            ++v5;
-            ++v6;
-            --v17;
-          }
-          while ( v17 );
-        }
-        v6 += v19 - v4;
-        v18 = uOutXb-- == 1;
-        v5 += this->uTargetSurfacePitch - v4;
-      }
-      while ( !v18 );
+      v12 = max(this->uClipX, uOutX);
+      if ( (signed int)(v4 + v12) > (signed int)this->uClipZ )
+      {
+        v4 = this->uClipZ - max(this->uClipX, uOutX);
+      }
+      v15 = max(this->uClipY, uOutY);
+      if ( (signed int)(v15 + v23) > (signed int)this->uClipW )
+      {
+        v23 = this->uClipW - max(this->uClipY, uOutY);
+      }
+    }
+
+    for (int outerCounter = 0; outerCounter < v23; outerCounter++)
+    {
+      for (int counter = 0; counter < v4; counter++)
+      {
+        *v5 = *v6;
+        ++v5;
+        ++v6;
+      }
+      v6 += v19 - v4;
+      v5 += this->uTargetSurfacePitch - v4;
     }
   }
 }