Mercurial > mm7
comparison Render.cpp @ 1152:d8b455c81917
Render::DrawTextureRGB cleanup
author | Grumpy7 |
---|---|
date | Sun, 02 Jun 2013 17:06:38 +0200 |
parents | 4eca5bb63dc0 |
children | 38662d9c8be8 dac817fbf85a |
comparison
equal
deleted
inserted
replaced
1151:4eca5bb63dc0 | 1152:d8b455c81917 |
---|---|
9105 void Render::DrawTextureRGB(unsigned int uOutX, unsigned int uOutY, RGBTexture *a4) | 9105 void Render::DrawTextureRGB(unsigned int uOutX, unsigned int uOutY, RGBTexture *a4) |
9106 { | 9106 { |
9107 int v4; // edi@3 | 9107 int v4; // edi@3 |
9108 unsigned __int16 *v5; // edx@3 | 9108 unsigned __int16 *v5; // edx@3 |
9109 unsigned __int16 *v6; // esi@3 | 9109 unsigned __int16 *v6; // esi@3 |
9110 unsigned int v7; // ebx@4 | |
9111 unsigned int v8; // eax@5 | 9110 unsigned int v8; // eax@5 |
9112 unsigned int v9; // ebx@5 | 9111 unsigned int v9; // ebx@5 |
9113 unsigned int v10; // eax@6 | |
9114 unsigned int v11; // eax@7 | 9112 unsigned int v11; // eax@7 |
9115 unsigned int v12; // ebx@8 | 9113 unsigned int v12; // ebx@8 |
9116 unsigned int v13; // eax@10 | |
9117 unsigned int v14; // edi@11 | |
9118 unsigned int v15; // eax@14 | 9114 unsigned int v15; // eax@14 |
9119 unsigned int v16; // ebx@17 | |
9120 int v17; // eax@23 | |
9121 char v18; // zf@25 | |
9122 int v19; // [sp+10h] [bp-8h]@3 | 9115 int v19; // [sp+10h] [bp-8h]@3 |
9123 int v20; // [sp+14h] [bp-4h]@3 | |
9124 unsigned int uOutXa; // [sp+20h] [bp+8h]@16 | 9116 unsigned int uOutXa; // [sp+20h] [bp+8h]@16 |
9125 int uOutXb; // [sp+20h] [bp+8h]@21 | |
9126 int v23; // [sp+28h] [bp+10h]@3 | 9117 int v23; // [sp+28h] [bp+10h]@3 |
9127 | 9118 |
9128 if ( this->uNumSceneBegins && a4 ) | 9119 if ( this->uNumSceneBegins && a4 ) |
9129 { | 9120 { |
9130 v4 = a4->uWidth; | 9121 v4 = a4->uWidth; |
9131 v5 = &this->pTargetSurface[uOutX + uOutY * this->uTargetSurfacePitch]; | 9122 v5 = &this->pTargetSurface[uOutX + uOutY * this->uTargetSurfacePitch]; |
9132 v6 = a4->pPixels; | 9123 v6 = a4->pPixels; |
9133 v20 = v4; | |
9134 v23 = a4->uHeight; | 9124 v23 = a4->uHeight; |
9135 v19 = v4; | 9125 v19 = v4; |
9136 if ( this->bClip ) | 9126 if ( this->bClip ) |
9137 { | 9127 { |
9138 v7 = this->uClipX; | 9128 if ( (signed int)uOutX < (signed int)this->uClipX ) |
9139 if ( (signed int)uOutX < (signed int)v7 ) | 9129 { |
9140 { | 9130 v8 = this->uClipX - uOutX; |
9141 v8 = v7 - uOutX; | 9131 v9 = uOutX - this->uClipX; |
9142 v9 = uOutX - v7; | |
9143 v8 *= 2; | 9132 v8 *= 2; |
9144 v4 += v9; | 9133 v4 += v9; |
9145 v6 = (unsigned __int16 *)((char *)v6 + v8); | 9134 v6 = (unsigned __int16 *)((char *)v6 + v8); |
9146 v20 += v9; | |
9147 v5 = (unsigned __int16 *)((char *)v5 + v8); | 9135 v5 = (unsigned __int16 *)((char *)v5 + v8); |
9148 } | 9136 } |
9149 v10 = this->uClipY; | 9137 if ( (signed int)uOutY < (signed int)this->uClipY ) |
9150 if ( (signed int)uOutY < (signed int)v10 ) | 9138 { |
9151 { | 9139 v11 = this->uClipY - uOutY; |
9152 v11 = v10 - uOutY; | |
9153 v6 += v19 * v11; | 9140 v6 += v19 * v11; |
9154 v23 += uOutY - this->uClipY; | 9141 v23 += uOutY - this->uClipY; |
9155 v4 = v20; | |
9156 v5 += this->uTargetSurfacePitch * v11; | 9142 v5 += this->uTargetSurfacePitch * v11; |
9157 } | 9143 } |
9158 v12 = this->uClipX; | 9144 v12 = max(this->uClipX, uOutX); |
9159 if ( (signed int)v12 < (signed int)uOutX ) | 9145 if ( (signed int)(v4 + v12) > (signed int)this->uClipZ ) |
9160 v12 = uOutX; | 9146 { |
9161 v13 = this->uClipZ; | 9147 v4 = this->uClipZ - max(this->uClipX, uOutX); |
9162 if ( (signed int)(v4 + v12) > (signed int)v13 ) | 9148 } |
9163 { | 9149 v15 = max(this->uClipY, uOutY); |
9164 v14 = this->uClipX; | 9150 if ( (signed int)(v15 + v23) > (signed int)this->uClipW ) |
9165 if ( (signed int)v14 < (signed int)uOutX ) | 9151 { |
9166 v14 = uOutX; | 9152 v23 = this->uClipW - max(this->uClipY, uOutY); |
9167 v4 = v13 - v14; | 9153 } |
9168 } | 9154 } |
9169 v15 = this->uClipY; | 9155 |
9170 if ( (signed int)v15 < (signed int)uOutY ) | 9156 for (int outerCounter = 0; outerCounter < v23; outerCounter++) |
9171 v15 = uOutY; | 9157 { |
9172 uOutXa = this->uClipW; | 9158 for (int counter = 0; counter < v4; counter++) |
9173 if ( (signed int)(v15 + v23) > (signed int)uOutXa ) | 9159 { |
9174 { | 9160 *v5 = *v6; |
9175 v16 = this->uClipY; | 9161 ++v5; |
9176 if ( (signed int)v16 < (signed int)uOutY ) | 9162 ++v6; |
9177 v16 = uOutY; | 9163 } |
9178 v23 = uOutXa - v16; | 9164 v6 += v19 - v4; |
9179 } | 9165 v5 += this->uTargetSurfacePitch - v4; |
9180 } | |
9181 if ( v23 > 0 ) | |
9182 { | |
9183 uOutXb = v23; | |
9184 do | |
9185 { | |
9186 if ( v4 > 0 ) | |
9187 { | |
9188 v17 = v4; | |
9189 do | |
9190 { | |
9191 *v5 = *v6; | |
9192 ++v5; | |
9193 ++v6; | |
9194 --v17; | |
9195 } | |
9196 while ( v17 ); | |
9197 } | |
9198 v6 += v19 - v4; | |
9199 v18 = uOutXb-- == 1; | |
9200 v5 += this->uTargetSurfacePitch - v4; | |
9201 } | |
9202 while ( !v18 ); | |
9203 } | 9166 } |
9204 } | 9167 } |
9205 } | 9168 } |
9206 | 9169 |
9207 //----- (004A5D33) -------------------------------------------------------- | 9170 //----- (004A5D33) -------------------------------------------------------- |