Mercurial > mm7
diff Render.cpp @ 2130:4f6c52ed6f7c
Слияние
author | Ritor1 |
---|---|
date | Sat, 28 Dec 2013 13:13:54 +0600 |
parents | 0d0aa7c1ccdd |
children | 651b24553ae9 |
line wrap: on
line diff
--- a/Render.cpp Sat Dec 28 13:12:52 2013 +0600 +++ b/Render.cpp Sat Dec 28 13:13:54 2013 +0600 @@ -2576,7 +2576,7 @@ //Render *v7; // ebx@1 void *v8; // esi@3 void *v9; // esi@3 - int v10; // ecx@4 + //int v10; // ecx@4 unsigned short* v11; // eax@4 //int v12; // eax@6 int v13; // eax@8 @@ -2625,21 +2625,21 @@ Src.vdpi = 75; v27.planes = 3; v27.palette_info = 1; - memcpy(data_buff, &Src, 1u); + memcpy(data_buff, &Src, 1); v8 = (char *)v8 + 1; - memcpy(v8, &Src.version, 1u); + memcpy(v8, &Src.version, 1); v8 = (char *)v8 + 1; - memcpy(v8, &Src.encoding, 1u); + memcpy(v8, &Src.encoding, 1); v8 = (char *)v8 + 1; - memcpy(v8, &Src.bpp, 1u); + memcpy(v8, &Src.bpp, 1); v8 = (char *)v8 + 1; - memcpy(v8, &Src.left, 2u); + memcpy(v8, &Src.left, 2); v8 = (char *)v8 + 2; - memcpy(v8, &Src.up, 2u); + memcpy(v8, &Src.up, 2); v8 = (char *)v8 + 2; - memcpy(v8, &Src.right, 2u); + memcpy(v8, &Src.right, 2); v8 = (char *)v8 + 2; - memcpy(v8, &Src.bottom, 2u); + memcpy(v8, &Src.bottom, 2); v8 = (char *)v8 + 2; memcpy(v8, &Src.hdpi, 2); v8 = (char *)v8 + 2; @@ -2661,7 +2661,7 @@ lineRGB = (char*)malloc(3 * (wight + 2)); if ( heidth > 0 ) { - v10 = pitch; + //v10 = pitch; v26 = 3 * pitch; v23 = 2 * wight; v11 = picture_data; @@ -2678,15 +2678,16 @@ lineRGB[i] = (signed int)(this->uTargetRMask & *line_pictute_data) >> (this->uTargetGBits + this->uTargetBBits + this->uTargetRBits - 8); lineG[i] = (signed int)(this->uTargetGMask & *line_pictute_data) >> ( this->uTargetBBits + this->uTargetGBits- 8); lineB[i] = (this->uTargetBMask & *line_pictute_data) << (8 - this->uTargetBBits); + line_pictute_data += 2; } } for ( i = 0; i < v26; v9 = (char *)v9 + 1 ) { - pict_byte = lineRGB [i]; + pict_byte = lineRGB[i]; for ( test_byte = 1; test_byte < 63; ++test_byte ) { v15 = i + test_byte; - if ( *((char *)lineRGB + v15) != pict_byte ) + if ( lineRGB[v15] != pict_byte ) break; if ( !(v15 % pitch) ) break; @@ -2702,8 +2703,8 @@ memcpy(v9, &pict_byte, 1); i += test_byte; } - v11 +=wight ; - v10 = pitch; + v11 += wight; + //v10 = pitch; } } free(lineRGB); @@ -2711,13 +2712,13 @@ } //----- (0049F8B5) -------------------------------------------------------- -FILE *Render::SavePCXImage(const char *Filename, char *pPixels, int width, int height) +FILE *Render::SavePCXImage(const char *Filename, unsigned short* picture_data, int width, int height) { //Render *v5; // esi@1 FILE *result; // eax@1 FILE *pOutFile; // edi@4 - int v8; // ecx@5 - int v9; // eax@5 + //int v8; // ecx@5 + unsigned short* v9; // eax@5 int v10; // eax@7 //int v11; // ecx@9 signed int v12; // eax@12 @@ -2731,9 +2732,13 @@ int image_width; // [sp+7Ch] [bp-28h]@5 PCXHeader_1 header1; // [sp+80h] [bp-24h]@4 PCXHeader_2 header2; // [sp+90h] [bp-14h]@4 - void *for_rad; // [sp+98h] [bp-Ch]@4 - int new_width; // [sp+9Ch] [bp-8h]@2 - char *for_blue; // [sp+A0h] [bp-4h]@8 + char *lineRGB; // [sp+98h] [bp-Ch]@4 + int pitch; // [sp+9Ch] [bp-8h]@2 + char *lineB; // [sp+A0h] [bp-4h]@8 + char *lineG; + unsigned short* line_pictute_data; + byte test_byte; + char v43; int num_r_bits = 5; int num_g_bits = 6; @@ -2747,14 +2752,14 @@ Filename = (const char *)result; if ( result ) { - new_width = width; + pitch = width; if ( width & 1 ) - new_width = width + 1; + pitch = width + 1; header1.left = 0; header1.up = 0; header1.right = width - 1; header1.bottom = height - 1; - header2.pitch = new_width; + header2.pitch = pitch; memset(color_map, 0, sizeof(color_map)); header2.reserved = 0; memset(v14, 0, sizeof(v14)); @@ -2784,58 +2789,59 @@ fwrite(&header2.pitch, 2, 1, pOutFile); fwrite(&header2.palette_info, 2, 1, pOutFile); fwrite(v14, 0x3Au, 1, pOutFile); - for_rad = malloc(3 * width + 6); + + lineRGB = (char *)malloc(3 * (width + 2)); // // . //if ( height > 0 ) //{ - v8 = new_width; - image_width = 3 * new_width; + //v8 = pitch; + image_width = 3 * pitch; v17 = 2 * width; - //v9 = (int)pPixels; + v9 = picture_data; //v19 = pPixels; for ( v18 = 0; v18 < height; v18++ )// { - //pPixels = v9; - char *for_green = (char *)for_rad + v8; - for_blue = (char *)for_rad + 2 * new_width; - - for ( v10 = 0; v10 < width; v10++ )// - { - *((char *)for_rad + v10) = (signed int)(r_mask & *(short *)pPixels) >> (num_g_bits + num_b_bits + num_r_bits - 8); - for_green[v10] = (signed int)(g_mask & *(short *)pPixels) >> (num_b_bits + num_g_bits - 8); - for_blue[v10] = (b_mask & *(char *)pPixels) << (8 - num_b_bits); - pPixels += 2; - } - - for ( int i = 0; (signed int)i < image_width; i++ )// += BYTE3(pPixels) ) - { - unsigned char test_byte = *((char *)for_rad + i); + line_pictute_data = v9; + lineG = (char *)lineRGB + pitch; + lineB = (char *)lineRGB + 2 * pitch; + + for ( int i = 0; i < width; i++ )// + { + lineRGB[i] = (signed int)(r_mask & *line_pictute_data) >> (num_g_bits + num_b_bits + num_r_bits - 8); + lineG[i] = (signed int)(g_mask & *line_pictute_data) >> (num_b_bits + num_g_bits - 8); + lineB[i] = (b_mask & *line_pictute_data) << (8 - num_b_bits); + line_pictute_data += 2; + } + test_byte = 1; + for ( int i = 0; (signed int)i < image_width; i += test_byte )// += BYTE3(pPixels) ) + { + unsigned char pic_byte = lineRGB[i]; //for ( BYTE3(pPixels) = 1; BYTE3(pPixels) < 0x3F; ++BYTE3(pPixels) ) - for ( int j = 1; j < 0x3F; ++j )// + for ( test_byte; test_byte < 63; ++test_byte )// { - v12 = (signed int)&for_blue[BYTE3(pPixels)]; - if ( *((char *)for_rad + j) != test_byte ) + v12 = i + test_byte; + if ( lineRGB[v12] != pic_byte ) break; - if ( !(v12 % new_width) ) + if ( !(v12 % pitch) ) break; } - if ( (signed int)&for_blue[BYTE3(pPixels)] > image_width ) - BYTE3(pPixels) = 3 * new_width - (char)i; - if ( BYTE3(pPixels) > 1 || test_byte >= 0xC0 ) + if ( i + test_byte > image_width ) + test_byte = 3 * pitch - i; + if ( test_byte > 1 || pic_byte >= 0xC0 ) { - BYTE3(for_green) = BYTE3(pPixels) | 0xC0;//- - fwrite((char *)&for_green + 3, 1, 1, pOutFile); + v43 = test_byte | 0xC0;//- + fwrite(&v43, 1, 1, pOutFile); } - fwrite((char *)&Filename + 3, 1, 1, pOutFile); - } - //v9 = (int)&v19[v17]; + fwrite(&pic_byte, 1, 1, pOutFile); + } + v9 += width; //v19 += v17; - pPixels += v17; - v8 = new_width; + //pPixels += v17; + //v8 = pitch; } //} - free(for_rad); + free(lineRGB); result = (FILE *)fclose(pOutFile); } return result;