# HG changeset patch # User Grumpy7 # Date 1370143355 -7200 # Node ID 05b30ed00d7c32efd7f95f4cf8c774e931bb1fe7 # Parent ee6bccef32e81d591a94bc856df7756d8ca5329d sub_451007_scale_image_bicubic cleanup - changing if+dowhile pair to for diff -r ee6bccef32e8 -r 05b30ed00d7c mm7_2.cpp --- a/mm7_2.cpp Sun Jun 02 05:01:51 2013 +0200 +++ b/mm7_2.cpp Sun Jun 02 05:22:35 2013 +0200 @@ -2168,7 +2168,6 @@ int a10, int a11) { int result; // eax@1 - int v14; // ecx@10 float v17; // ST3C_4@12 float v18; // ST38_4@12 unsigned int v19; // esi@12 @@ -2224,69 +2223,59 @@ return result; do { - v14 = 0; - if ( dstWidth > 0 ) - { - do - { - a6s = (double)v14 / (double)dstWidth * (double)srcWidth; - widthRatio = bankersRounding(a6s); - a6t = (double)(v14 + 1) / (double)dstWidth * (double)srcWidth; - widthRatioPlusOne = bankersRounding(a6t); - v17 = (double)v231 / (double)dstHeight * (double)srcHeight; - heightRatio = bankersRounding(v17); - v18 = (double)(v231 + 1) / (double)dstHeight * (double)srcHeight; - heightRatioPlusOne = bankersRounding(v18); - v251 = 0; - v19 = (heightRatioPlusOne - heightRatio) * (widthRatioPlusOne - widthRatio); - v252 = 0; - a6b = 0; - v240 = 0i64; - if ( heightRatio < heightRatioPlusOne ) - { - v160 = heightRatioPlusOne - heightRatio; - v175 = (unsigned short*)((char *)pSrc + field_0_bits * (widthRatio + srcPitch * heightRatio)); - do - { - int ratioDiff = widthRatioPlusOne - widthRatio; - for(int i = 0; i < ratioDiff; i++) - { - if(field0value == 32) - v21 = _450FB1((int)v175[i]); - else if(field0value == 16) - v21 = _450FB1((_WORD)v175[i]); - else - v21 = _450FB1((unsigned __int8)v175[i]); - v240 += ((unsigned int)v21 >> 24); - a6b += BYTE2(v21); - v252 += BYTE1(v21); - v251 += (unsigned __int8)v21; - } - if(field0value == 32) - v175 += 2 * srcPitch; - else if(field0value == 16) - v175 += srcPitch; - else - v175 = (unsigned short*)((char *)v175 + 2 * srcPitch); - --v160; - } - while ( v160 ); - } - v22 = (unsigned int)v240 / ((heightRatioPlusOne - heightRatio) * (widthRatioPlusOne - widthRatio)); - if ( v19 ) - { - a6b /= v19; - v252 /= v19; - v251 /= v19; - } - if ( v22 != 255 ) - v22 &= 0x7FFFFFFFu; - v23 = _450F55(v251 | ((v252 | ((a6b | (v22 << 8)) << 8)) << 8)); - *(_DWORD *)v193 = v23; - v193 = (unsigned __int16 *)((char *)v193 + field_20_bits); - ++v14; - } - while ( v14 < dstWidth ); + for (int counter = 0; counter < dstWidth; counter++) + { + a6s = (double)counter / (double)dstWidth * (double)srcWidth; + widthRatio = bankersRounding(a6s); + a6t = (double)(counter + 1) / (double)dstWidth * (double)srcWidth; + widthRatioPlusOne = bankersRounding(a6t); + v17 = (double)v231 / (double)dstHeight * (double)srcHeight; + heightRatio = bankersRounding(v17); + v18 = (double)(v231 + 1) / (double)dstHeight * (double)srcHeight; + heightRatioPlusOne = bankersRounding(v18); + v251 = 0; + v19 = (heightRatioPlusOne - heightRatio) * (widthRatioPlusOne - widthRatio); + v252 = 0; + a6b = 0; + v240 = 0i64; + + v175 = (unsigned short*)((char *)pSrc + field_0_bits * (widthRatio + srcPitch * heightRatio)); + for (int heightDiff = 0; heightDiff < heightRatioPlusOne - heightRatio; heightDiff++) + { + int ratioDiff = widthRatioPlusOne - widthRatio; + for(int i = 0; i < ratioDiff; i++) + { + if(field0value == 32) + v21 = _450FB1((int)v175[i]); + else if(field0value == 16) + v21 = _450FB1((_WORD)v175[i]); + else + v21 = _450FB1((unsigned __int8)v175[i]); + v240 += ((unsigned int)v21 >> 24); + a6b += BYTE2(v21); + v252 += BYTE1(v21); + v251 += (unsigned __int8)v21; + } + if(field0value == 32) + v175 += 2 * srcPitch; + else if(field0value == 16) + v175 += srcPitch; + else + v175 = (unsigned short*)((char *)v175 + 2 * srcPitch); + } + v22 = (unsigned int)v240 / ((heightRatioPlusOne - heightRatio) * (widthRatioPlusOne - widthRatio)); + assert(v19 < 2); + if ( v19 ) + { + a6b /= v19; + v252 /= v19; + v251 /= v19; + } + if ( v22 != 255 ) + v22 &= 0x7FFFFFFFu; + v23 = _450F55(v251 | ((v252 | ((a6b | (v22 << 8)) << 8)) << 8)); + *(_DWORD *)v193 = v23; + v193 = (unsigned __int16 *)((char *)v193 + field_20_bits); } v193 = (unsigned __int16 *)((char *)v193 + field_20_bits * (dstPitch - dstWidth)); ++v231;