Rev 6779 | Rev 6797 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6779 | Rev 6780 | ||
---|---|---|---|
Line 408... | Line 408... | ||
408 | cmp dword[owner],png_IDAT |
408 | cmp dword[owner],png_IDAT |
409 | jne .end1 ;if (..==..) |
409 | jne .end1 ;if (..==..) |
410 | mov eax,[edi+png_struct.flags] |
410 | mov eax,[edi+png_struct.flags] |
411 | and eax,PNG_FLAG_ZLIB_CUSTOM_STRATEGY |
411 | and eax,PNG_FLAG_ZLIB_CUSTOM_STRATEGY |
412 | cmp eax,0 |
- | |
413 | je @f ;if (..!=0) |
412 | jz @f ;if (..!=0) |
414 | mov eax,[edi+png_struct.zlib_strategy] |
413 | mov eax,[edi+png_struct.zlib_strategy] |
415 | mov dword[strategy],eax |
414 | mov dword[strategy],eax |
416 | jmp .end2 |
415 | jmp .end2 |
417 | @@: |
416 | @@: |
418 | cmp byte[edi+png_struct.do_filter],PNG_FILTER_NONE |
417 | cmp byte[edi+png_struct.do_filter],PNG_FILTER_NONE |
Line 475... | Line 474... | ||
475 | 474 | ||
Line 476... | Line 475... | ||
476 | ; Check against the previous initialized values, if any. |
475 | ; Check against the previous initialized values, if any. |
477 | mov eax,[edi+png_struct.flags] |
476 | mov eax,[edi+png_struct.flags] |
478 | and eax,PNG_FLAG_ZSTREAM_INITIALIZED |
477 | and eax,PNG_FLAG_ZSTREAM_INITIALIZED |
479 | cmp eax,0 |
- | |
480 | je .end4 |
478 | jz .end4 |
481 | mov eax,[level] |
479 | mov eax,[level] |
482 | cmp [edi+png_struct.zlib_set_level],eax |
480 | cmp [edi+png_struct.zlib_set_level],eax |
483 | jne @f |
481 | jne @f |
484 | mov eax,[method] |
482 | mov eax,[method] |
485 | cmp [edi+png_struct.zlib_set_method],eax |
483 | cmp [edi+png_struct.zlib_set_method],eax |
Line 518... | Line 516... | ||
518 | mov ecx,edi |
516 | mov ecx,edi |
519 | add ecx,png_struct.zstream |
517 | add ecx,png_struct.zstream |
520 | mov eax,[edi+png_struct.flags] |
518 | mov eax,[edi+png_struct.flags] |
521 | and eax,PNG_FLAG_ZSTREAM_INITIALIZED |
519 | and eax,PNG_FLAG_ZSTREAM_INITIALIZED |
522 | cmp eax,0 |
- | |
523 | je @f ;if (..!=0) |
520 | jz @f ;if (..!=0) |
524 | stdcall [deflateReset], ecx |
521 | stdcall [deflateReset], ecx |
525 | jmp .end5 |
522 | jmp .end5 |
526 | @@: ;else |
523 | @@: ;else |
527 | stdcall [deflateInit2], ecx, [level], [method], [windowBits],\ |
524 | stdcall [deflateInit2], ecx, [level], [method], [windowBits],\ |
528 | [memLevel], [strategy] |
525 | [memLevel], [strategy] |
Line 1098... | Line 1095... | ||
1098 | cmp [num_pal],eax |
1095 | cmp [num_pal],eax |
1099 | jg @f |
1096 | jg @f |
1100 | mov eax,[edi+png_struct.mng_features_permitted] |
1097 | mov eax,[edi+png_struct.mng_features_permitted] |
1101 | and eax,PNG_FLAG_MNG_EMPTY_PLTE |
1098 | and eax,PNG_FLAG_MNG_EMPTY_PLTE |
1102 | cmp eax,0 |
1099 | jnz .end1 |
1103 | jne .end1 |
- | |
1104 | cmp [num_pal],0 |
1100 | cmp [num_pal],0 |
1105 | jne .end1 |
1101 | jne .end1 |
1106 | @@: |
1102 | @@: |
1107 | end if |
1103 | end if |
1108 | 1104 | ||
Line 1116... | Line 1112... | ||
1116 | .end1: |
1112 | .end1: |
1117 | 1113 | ||
Line 1118... | Line 1114... | ||
1118 | movzx eax,byte[edi+png_struct.color_type] |
1114 | movzx eax,byte[edi+png_struct.color_type] |
1119 | and eax,PNG_COLOR_MASK_COLOR |
1115 | and eax,PNG_COLOR_MASK_COLOR |
1120 | cmp eax,0 |
- | |
1121 | jne @f ;if (..==0) |
1116 | jnz @f ;if (..==0) |
1122 | png_warning edi, 'Ignoring request to write a PLTE chunk in grayscale PNG' |
1117 | png_warning edi, 'Ignoring request to write a PLTE chunk in grayscale PNG' |
1123 | jmp .end_f |
1118 | jmp .end_f |
1124 | @@: |
1119 | @@: |
Line 1125... | Line 1120... | ||
1125 | 1120 | ||
Line 1274... | Line 1269... | ||
1274 | 1269 | ||
Line 1275... | Line 1270... | ||
1275 | if PNG_WRITE_OPTIMIZE_CMF_SUPPORTED eq 1 |
1270 | if PNG_WRITE_OPTIMIZE_CMF_SUPPORTED eq 1 |
1276 | mov eax,[edi+png_struct.mode] |
1271 | mov eax,[edi+png_struct.mode] |
1277 | and eax,PNG_HAVE_IDAT |
1272 | and eax,PNG_HAVE_IDAT |
1278 | cmp eax,0 |
- | |
1279 | jne @f |
1273 | jnz @f |
1280 | cmp byte[edi+png_struct.compression_type],PNG_COMPRESSION_TYPE_BASE |
1274 | cmp byte[edi+png_struct.compression_type],PNG_COMPRESSION_TYPE_BASE |
1281 | jne @f ;if (..==0 && ..==..) |
1275 | jne @f ;if (..==0 && ..==..) |
1282 | stdcall png_image_size, edi |
1276 | stdcall png_image_size, edi |
1283 | stdcall optimize_cmf, edx, eax |
1277 | stdcall optimize_cmf, edx, eax |
1284 | @@: |
1278 | @@: |
Line 1325... | Line 1319... | ||
1325 | 1319 | ||
Line 1326... | Line 1320... | ||
1326 | mov edx,[edi+png_struct.zbuffer_list] |
1320 | mov edx,[edi+png_struct.zbuffer_list] |
1327 | add edx,png_compression_buffer.output |
1321 | add edx,png_compression_buffer.output |
1328 | mov ecx,[edi+png_struct.zbuffer_size] |
1322 | mov ecx,[edi+png_struct.zbuffer_size] |
1329 | sub cx,[edi+png_struct.zstream.avail_out] |
1323 | movzx eax,word[edi+png_struct.zstream.avail_out] |
- | 1324 | sub ecx,eax |
|
1330 | ;edx = data |
1325 | ;edx = data |
1331 | ;ecx = size |
1326 | ;ecx = size |
Line 1332... | Line 1327... | ||
1332 | 1327 | ||
1333 | if PNG_WRITE_OPTIMIZE_CMF_SUPPORTED eq 1 |
1328 | if PNG_WRITE_OPTIMIZE_CMF_SUPPORTED eq 1 |
1334 | mov eax,[edi+png_struct.mode] |
1329 | mov eax,[edi+png_struct.mode] |
1335 | and eax,PNG_HAVE_IDAT |
- | |
1336 | cmp eax,0 |
1330 | and eax,PNG_HAVE_IDAT |
1337 | jne @f |
1331 | jnz @f |
1338 | cmp byte[edi+png_struct.compression_type],PNG_COMPRESSION_TYPE_BASE |
1332 | cmp byte[edi+png_struct.compression_type],PNG_COMPRESSION_TYPE_BASE |
1339 | jne @f ;if (..==0 && ..==..) |
1333 | jne @f ;if (..==0 && ..==..) |
1340 | stdcall png_image_size, edi |
1334 | stdcall png_image_size, edi |
1341 | stdcall optimize_cmf, edx, eax |
1335 | stdcall optimize_cmf, edx, eax |
Line 2421... | Line 2415... | ||
2421 | cmp byte[edi+png_struct.interlaced],0 |
2415 | cmp byte[edi+png_struct.interlaced],0 |
2422 | je @f |
2416 | je @f |
2423 | mov eax,[edi+png_struct.transformations] |
2417 | mov eax,[edi+png_struct.transformations] |
2424 | and eax,PNG_INTERLACE |
2418 | and eax,PNG_INTERLACE |
2425 | cmp eax,0 |
2419 | jnz @f ;if(..!=0 && ..==0) |
2426 | jne @f ;if(..!=0 && ..==0) |
- | |
2427 | movzx ecx,byte[png_pass_yinc] |
2420 | movzx ecx,byte[png_pass_yinc] |
2428 | mov eax,[edi+png_struct.height] |
2421 | mov eax,[edi+png_struct.height] |
2429 | add eax,ecx |
2422 | add eax,ecx |
2430 | dec eax |
2423 | dec eax |
2431 | movzx edx,byte[png_pass_ystart] |
2424 | movzx edx,byte[png_pass_ystart] |
2432 | sub eax,edx |
2425 | sub eax,edx |
Line 2477... | Line 2470... | ||
2477 | je .end0 ;if (..!=0) |
2470 | je .end0 ;if (..!=0) |
2478 | mov dword[edi+png_struct.row_number],0 |
2471 | mov dword[edi+png_struct.row_number],0 |
2479 | mov eax,[edi+png_struct.transformations] |
2472 | mov eax,[edi+png_struct.transformations] |
2480 | and eax,PNG_INTERLACE |
2473 | and eax,PNG_INTERLACE |
2481 | cmp eax,0 |
2474 | jz @f ;if (..!=0) |
2482 | je @f ;if (..!=0) |
- | |
2483 | inc byte[edi+png_struct.pass] |
2475 | inc byte[edi+png_struct.pass] |
2484 | jmp .end1 |
2476 | jmp .end1 |
2485 | @@: ;else |
2477 | @@: ;else |
2486 | ; Loop until we find a non-zero width or height pass |
2478 | ; Loop until we find a non-zero width or height pass |
2487 | .cycle0: ;do |
2479 | .cycle0: ;do |
2488 | inc byte[edi+png_struct.pass] |
2480 | inc byte[edi+png_struct.pass] |
Line 2518... | Line 2510... | ||
2518 | mov [edi+png_struct.num_rows],eax |
2510 | mov [edi+png_struct.num_rows],eax |
2519 | 2511 | ||
Line 2520... | Line 2512... | ||
2520 | mov eax,[edi+png_struct.transformations] |
2512 | mov eax,[edi+png_struct.transformations] |
2521 | and eax,PNG_INTERLACE |
2513 | and eax,PNG_INTERLACE |
2522 | cmp eax,0 |
- | |
2523 | jne .cycle0end ;if(..!=0) break |
2514 | jnz .cycle0end ;if(..!=0) break |
Line 2524... | Line 2515... | ||
2524 | 2515 | ||
2525 | cmp dword[edi+png_struct.usr_width],0 |
2516 | cmp dword[edi+png_struct.usr_width],0 |
2526 | je .cycle0 |
2517 | je .cycle0 |
2527 | cmp dword[edi+png_struct.num_rows],0 |
2518 | cmp dword[edi+png_struct.num_rows],0 |
Line 2874... | Line 2865... | ||
2874 | mov ah,byte[ebx] |
2865 | mov ah,byte[ebx] |
2875 | shr ah,1 |
2866 | shr ah,1 |
2876 | sub al,ah |
2867 | sub al,ah |
2877 | stosb |
2868 | stosb |
2878 | png_setup_abs [sum] |
2869 | png_setup_abs dword[sum] |
2879 | inc ebx |
2870 | inc ebx |
2880 | loop .cycle0 |
2871 | loop .cycle0 |
2881 | 2872 | ||
Line 2882... | Line 2873... | ||
2882 | mov ecx,[row_bytes] |
2873 | mov ecx,[row_bytes] |
2883 | sub ecx,[bpp] |
2874 | sub ecx,[bpp] |
Line 2895... | Line 2886... | ||
2895 | shr ax,1 |
2886 | shr ax,1 |
2896 | rol eax,8 |
2887 | rol eax,8 |
2897 | sub al,ah |
2888 | sub al,ah |
2898 | stosb |
2889 | stosb |
2899 | png_setup_abs [sum] |
2890 | png_setup_abs dword[sum] |
2900 | mov eax,[sum] |
2891 | mov eax,[sum] |
2901 | cmp eax,[lmins] |
2892 | cmp eax,[lmins] |
2902 | jg .cycle1end ;if (..>..) ;We are already worse, don't continue. |
2893 | jg .cycle1end ;if (..>..) ;We are already worse, don't continue. |
2903 | inc ebx |
2894 | inc ebx |
2904 | inc edx |
2895 | inc edx |
2905 | loop .cycle1 |
2896 | loop .cycle1 |
Line 3138... | Line 3129... | ||
3138 | jmp .end0 |
3129 | jmp .end0 |
3139 | @@: |
3130 | @@: |
3140 | mov eax,[filter_to_do] |
3131 | mov eax,[filter_to_do] |
3141 | and eax,PNG_FILTER_NONE |
3132 | and eax,PNG_FILTER_NONE |
3142 | cmp eax,0 |
3133 | jz .end0 |
3143 | je .end0 |
- | |
3144 | cmp dword[filter_to_do],PNG_FILTER_NONE |
3134 | cmp dword[filter_to_do],PNG_FILTER_NONE |
3145 | je .end0 ;else if (..!=0 && ..!=..) |
3135 | je .end0 ;else if (..!=0 && ..!=..) |
3146 | ; Overflow not possible and multiple filters in the list, including the |
3136 | ; Overflow not possible and multiple filters in the list, including the |
3147 | ; 'none' filter. |
3137 | ; 'none' filter. |
3148 | 3138 | ||
Line 3169... | Line 3159... | ||
3169 | mov [best_row],eax |
3159 | mov [best_row],eax |
3170 | jmp .end1 |
3160 | jmp .end1 |
3171 | @@: |
3161 | @@: |
3172 | and eax,PNG_FILTER_SUB |
3162 | and eax,PNG_FILTER_SUB |
3173 | cmp eax,0 |
3163 | jz .end1 ;else if (..!=0) |
3174 | je .end1 ;else if (..!=0) |
- | |
3175 | stdcall png_setup_sub_row, edi, [bpp], [row_bytes], [mins] |
3164 | stdcall png_setup_sub_row, edi, [bpp], [row_bytes], [mins] |
3176 | cmp eax,[mins] |
3165 | cmp eax,[mins] |
3177 | jge .end1 ;if (..<..) |
3166 | jge .end1 ;if (..<..) |
3178 | mov [mins],eax |
3167 | mov [mins],eax |
3179 | mov eax,[edi+png_struct.try_row] |
3168 | mov eax,[edi+png_struct.try_row] |
3180 | mov [best_row],eax |
3169 | mov [best_row],eax |
Line 3196... | Line 3185... | ||
3196 | mov [best_row],eax |
3185 | mov [best_row],eax |
3197 | jmp .end2 |
3186 | jmp .end2 |
3198 | @@: |
3187 | @@: |
3199 | and eax,PNG_FILTER_UP |
3188 | and eax,PNG_FILTER_UP |
3200 | cmp eax,0 |
3189 | jz .end2 ;else if (..!=0) |
3201 | je .end2 ;else if (..!=0) |
- | |
3202 | stdcall png_setup_up_row, edi, [row_bytes], [mins] |
3190 | stdcall png_setup_up_row, edi, [row_bytes], [mins] |
3203 | cmp eax,[mins] |
3191 | cmp eax,[mins] |
3204 | jge .end2 ;if (..<..) |
3192 | jge .end2 ;if (..<..) |
3205 | mov [mins],eax |
3193 | mov [mins],eax |
3206 | mov eax,[edi+png_struct.try_row] |
3194 | mov eax,[edi+png_struct.try_row] |
3207 | mov [best_row],eax |
3195 | mov [best_row],eax |
Line 3223... | Line 3211... | ||
3223 | mov [best_row],eax |
3211 | mov [best_row],eax |
3224 | jmp .end3 |
3212 | jmp .end3 |
3225 | @@: |
3213 | @@: |
3226 | and eax,PNG_FILTER_AVG |
3214 | and eax,PNG_FILTER_AVG |
3227 | cmp eax,0 |
3215 | jz .end3 ;else if (..!=0) |
3228 | je .end3 ;else if (..!=0) |
- | |
3229 | stdcall png_setup_avg_row, edi, [bpp], [row_bytes], [mins] |
3216 | stdcall png_setup_avg_row, edi, [bpp], [row_bytes], [mins] |
3230 | cmp eax,[mins] |
3217 | cmp eax,[mins] |
3231 | jge .end3 ;if (..<..) |
3218 | jge .end3 ;if (..<..) |
3232 | mov [mins],eax |
3219 | mov [mins],eax |
3233 | mov eax,[edi+png_struct.try_row] |
3220 | mov eax,[edi+png_struct.try_row] |
3234 | mov [best_row],eax |
3221 | mov [best_row],eax |
Line 3250... | Line 3237... | ||
3250 | mov [best_row],eax |
3237 | mov [best_row],eax |
3251 | jmp .end4 |
3238 | jmp .end4 |
3252 | @@: |
3239 | @@: |
3253 | and eax,PNG_FILTER_PAETH |
3240 | and eax,PNG_FILTER_PAETH |
3254 | cmp eax,0 |
3241 | jz .end4 ;else if (..!=0) |
3255 | je .end4 ;else if (..!=0) |
- | |
3256 | stdcall png_setup_paeth_row, edi, [bpp], [row_bytes], [mins] |
3242 | stdcall png_setup_paeth_row, edi, [bpp], [row_bytes], [mins] |
3257 | cmp eax,[mins] |
3243 | cmp eax,[mins] |
3258 | jge .end4 ;if (..<..) |
3244 | jge .end4 ;if (..<..) |
3259 | mov [mins],eax |
3245 | mov [mins],eax |
3260 | mov eax,[edi+png_struct.try_row] |
3246 | mov eax,[edi+png_struct.try_row] |
3261 | mov [best_row],eax |
3247 | mov [best_row],eax |