mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-12-25 08:06:49 +03:00
fix, optimize, clean code
git-svn-id: svn://kolibrios.org@6779 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
ce0f946c73
commit
cdfe44d0b7
@ -173,8 +173,7 @@ endl
|
||||
@@: ;else ;critical
|
||||
mov eax,[edi+png_struct.flags]
|
||||
and eax,PNG_FLAG_CRC_CRITICAL_IGNORE
|
||||
cmp eax,0
|
||||
je .end0 ;if (..!=0)
|
||||
jz .end0 ;if (..!=0)
|
||||
mov dword[need_crc],0
|
||||
.end0:
|
||||
|
||||
@ -552,8 +551,7 @@ if PNG_tRNS_SUPPORTED eq 1
|
||||
mov eax,[mask]
|
||||
and eax,PNG_FREE_TRNS
|
||||
and eax,[esi+png_info_def.free_me]
|
||||
cmp eax,0
|
||||
je @f ;if (..!=0)
|
||||
jz @f ;if (..!=0)
|
||||
and dword[esi+png_info_def.valid], not PNG_INFO_tRNS
|
||||
stdcall png_free, edi, [esi+png_info_def.trans_alpha]
|
||||
mov dword[esi+png_info_def.trans_alpha],0
|
||||
@ -566,8 +564,7 @@ if PNG_sCAL_SUPPORTED eq 1
|
||||
mov eax,[mask]
|
||||
and eax,PNG_FREE_SCAL
|
||||
and eax,[esi+png_info_def.free_me]
|
||||
cmp eax,0
|
||||
je @f ;if (..!=0)
|
||||
jz @f ;if (..!=0)
|
||||
stdcall png_free, edi, [esi+png_info_def.scal_s_width]
|
||||
stdcall png_free, edi, [esi+png_info_def.scal_s_height]
|
||||
mov dword[esi+png_info_def.scal_s_width],0
|
||||
@ -604,8 +601,7 @@ if PNG_iCCP_SUPPORTED eq 1
|
||||
mov eax,[mask]
|
||||
and eax,PNG_FREE_ICCP
|
||||
and eax,[esi+png_info_def.free_me]
|
||||
cmp eax,0
|
||||
je @f ;if (..!=0)
|
||||
jz @f ;if (..!=0)
|
||||
stdcall png_free, edi, [esi+png_info_def.iccp_name]
|
||||
stdcall png_free, edi, [esi+png_info_def.iccp_profile]
|
||||
mov dword[esi+png_info_def.iccp_name],0
|
||||
@ -674,8 +670,7 @@ if PNG_hIST_SUPPORTED eq 1
|
||||
mov eax,[mask]
|
||||
and eax,PNG_FREE_HIST
|
||||
and eax,[esi+png_info_def.free_me]
|
||||
cmp eax,0
|
||||
je @f ;if (..!=0)
|
||||
jz @f ;if (..!=0)
|
||||
stdcall png_free, edi, [esi+png_info_def.hist]
|
||||
mov dword[esi+png_info_def.hist],0
|
||||
and dword[esi+png_info_def.valid], not PNG_INFO_hIST
|
||||
@ -686,8 +681,7 @@ end if
|
||||
mov eax,[mask]
|
||||
and eax,PNG_FREE_PLTE
|
||||
and eax,[esi+png_info_def.free_me]
|
||||
cmp eax,0
|
||||
je @f ;if (..!=0)
|
||||
jz @f ;if (..!=0)
|
||||
stdcall png_free, edi, [esi+png_info_def.palette]
|
||||
mov dword[esi+png_info_def.palette],0
|
||||
and dword[esi+png_info_def.valid],not PNG_INFO_PLTE
|
||||
|
@ -808,54 +808,12 @@ else
|
||||
end if
|
||||
}
|
||||
|
||||
; Allocate and initialize png_ptr struct for reading, and any other memory.
|
||||
;PNG_EXPORTA(4, png_structp, png_create_read_struct,
|
||||
; (charp user_png_ver, voidp error_ptr,
|
||||
; png_error_ptr error_fn, png_error_ptr warn_fn),
|
||||
; PNG_ALLOCATED);
|
||||
|
||||
; Moved from pngconf.h in 1.4.0 and modified to ensure setjmp/longjmp
|
||||
; match up.
|
||||
|
||||
; Read the information before the actual image data.
|
||||
PNG_EXPORT 22, void, png_read_info, '(png_structrp png_ptr, png_inforp info_ptr)'
|
||||
|
||||
; Convert to a US string format: there is no localization support in this
|
||||
; routine. The original implementation used a 29 character buffer in
|
||||
; png_struct, this will be removed in future versions.
|
||||
|
||||
;#if PNG_LIBPNG_VER < 10700
|
||||
; To do: remove this from libpng17 (and from libpng17/png.c and pngstruct.h)
|
||||
;PNG_EXPORTA(23, charp, png_convert_to_rfc1123, (png_structrp png_ptr,
|
||||
; png_const_timep ptime),PNG_DEPRECATED);
|
||||
;end if
|
||||
|
||||
; Expand data to 24-bit RGB, or 8-bit grayscale, with alpha if available.
|
||||
PNG_EXPORT 26, void, png_set_expand, '(png_structrp png_ptr)'
|
||||
PNG_EXPORT 27, void, png_set_expand_gray_1_2_4_to_8, '(png_structrp png_ptr)'
|
||||
PNG_EXPORT 28, void, png_set_palette_to_rgb, '(png_structrp png_ptr)'
|
||||
PNG_EXPORT 29, void, png_set_tRNS_to_alpha, '(png_structrp png_ptr)'
|
||||
|
||||
; Expand to 16-bit channels, forces conversion of palette to RGB and expansion
|
||||
; of a tRNS chunk if present.
|
||||
PNG_EXPORT 221, void, png_set_expand_16, '(png_structrp png_ptr)'
|
||||
|
||||
; Expand the grayscale to 24-bit RGB if necessary.
|
||||
PNG_EXPORT 31, void, png_set_gray_to_rgb, '(png_structrp png_ptr)'
|
||||
|
||||
; Reduce RGB to grayscale.
|
||||
PNG_ERROR_ACTION_NONE equ 1
|
||||
PNG_ERROR_ACTION_WARN equ 2
|
||||
PNG_ERROR_ACTION_ERROR equ 3
|
||||
PNG_RGB_TO_GRAY_DEFAULT equ (-1) ;for red/green coefficients
|
||||
|
||||
PNG_EXPORT 32, void, png_set_rgb_to_gray, '(png_structrp png_ptr, int error_action, double red, double green)'
|
||||
PNG_EXPORT 33, void, png_set_rgb_to_gray_fixed, '(png_structrp png_ptr, int error_action, png_fixed_point red, png_fixed_point green)'
|
||||
|
||||
PNG_EXPORT 34, byte, png_get_rgb_to_gray_status, '(png_const_structrp png_ptr)'
|
||||
|
||||
PNG_EXPORT 35, void, png_build_grayscale_palette, '(int bit_depth, png_colorp palette)'
|
||||
|
||||
; How the alpha channel is interpreted - this affects how the color channels
|
||||
; of a PNG file are returned to the calling application when an alpha channel,
|
||||
; or a tRNS chunk in a palette file, is present.
|
||||
@ -897,9 +855,6 @@ PNG_ALPHA_PREMULTIPLIED equ 1 ;as above
|
||||
PNG_ALPHA_OPTIMIZED equ 2 ;'PNG' for opaque pixels, else 'STANDARD'
|
||||
PNG_ALPHA_BROKEN equ 3 ;the alpha channel is gamma encoded
|
||||
|
||||
PNG_EXPORT 227, void, png_set_alpha_mode, '(png_structrp png_ptr, int mode, double output_gamma)'
|
||||
PNG_EXPORT 228, void, png_set_alpha_mode_fixed, '(png_structrp png_ptr, int mode, png_fixed_point output_gamma)'
|
||||
|
||||
if (PNG_GAMMA_SUPPORTED eq 1) | (PNG_READ_ALPHA_MODE_SUPPORTED eq 1)
|
||||
; The output_gamma value is a screen gamma in libpng terminology: it expresses
|
||||
; how to decode the output values, not how they are encoded.
|
||||
@ -910,83 +865,6 @@ PNG_GAMMA_sRGB equ 220000 ;Television standards--matches sRGB gamma
|
||||
PNG_GAMMA_LINEAR equ PNG_FP_1 ;Linear
|
||||
end if
|
||||
|
||||
; The following are examples of calls to png_set_alpha_mode to achieve the
|
||||
; required overall gamma correction and, where necessary, alpha
|
||||
; premultiplication.
|
||||
|
||||
; png_set_alpha_mode(pp, PNG_ALPHA_PNG, PNG_DEFAULT_sRGB);
|
||||
; This is the default libpng handling of the alpha channel - it is not
|
||||
; pre-multiplied into the color components. In addition the call states
|
||||
; that the output is for a sRGB system and causes all PNG files without gAMA
|
||||
; chunks to be assumed to be encoded using sRGB.
|
||||
|
||||
; png_set_alpha_mode(pp, PNG_ALPHA_PNG, PNG_GAMMA_MAC);
|
||||
; In this case the output is assumed to be something like an sRGB conformant
|
||||
; display preceeded by a power-law lookup table of power 1.45. This is how
|
||||
; early Mac systems behaved.
|
||||
|
||||
; png_set_alpha_mode(pp, PNG_ALPHA_STANDARD, PNG_GAMMA_LINEAR);
|
||||
; This is the classic Jim Blinn approach and will work in academic
|
||||
; environments where everything is done by the book. It has the shortcoming
|
||||
; of assuming that input PNG data with no gamma information is linear - this
|
||||
; is unlikely to be correct unless the PNG files where generated locally.
|
||||
; Most of the time the output precision will be so low as to show
|
||||
; significant banding in dark areas of the image.
|
||||
|
||||
; png_set_expand_16(pp);
|
||||
; png_set_alpha_mode(pp, PNG_ALPHA_STANDARD, PNG_DEFAULT_sRGB);
|
||||
; This is a somewhat more realistic Jim Blinn inspired approach. PNG files
|
||||
; are assumed to have the sRGB encoding if not marked with a gamma value and
|
||||
; the output is always 16 bits per component. This permits accurate scaling
|
||||
; and processing of the data. If you know that your input PNG files were
|
||||
; generated locally you might need to replace PNG_DEFAULT_sRGB with the
|
||||
; correct value for your system.
|
||||
|
||||
; png_set_alpha_mode(pp, PNG_ALPHA_OPTIMIZED, PNG_DEFAULT_sRGB);
|
||||
; If you just need to composite the PNG image onto an existing background
|
||||
; and if you control the code that does this you can use the optimization
|
||||
; setting. In this case you just copy completely opaque pixels to the
|
||||
; output. For pixels that are not completely transparent (you just skip
|
||||
; those) you do the composition math using png_composite or png_composite_16
|
||||
; below then encode the resultant 8-bit or 16-bit values to match the output
|
||||
; encoding.
|
||||
|
||||
; Other cases
|
||||
; If neither the PNG nor the standard linear encoding work for you because
|
||||
; of the software or hardware you use then you have a big problem. The PNG
|
||||
; case will probably result in halos around the image. The linear encoding
|
||||
; will probably result in a washed out, too bright, image (it's actually too
|
||||
; contrasty.) Try the ALPHA_OPTIMIZED mode above - this will probably
|
||||
; substantially reduce the halos. Alternatively try:
|
||||
|
||||
; png_set_alpha_mode(pp, PNG_ALPHA_BROKEN, PNG_DEFAULT_sRGB);
|
||||
; This option will also reduce the halos, but there will be slight dark
|
||||
; halos round the opaque parts of the image where the background is light.
|
||||
; In the OPTIMIZED mode the halos will be light halos where the background
|
||||
; is dark. Take your pick - the halos are unavoidable unless you can get
|
||||
; your hardware/software fixed! (The OPTIMIZED approach is slightly
|
||||
; faster.)
|
||||
|
||||
; When the default gamma of PNG files doesn't match the output gamma.
|
||||
; If you have PNG files with no gamma information png_set_alpha_mode allows
|
||||
; you to provide a default gamma, but it also sets the ouput gamma to the
|
||||
; matching value. If you know your PNG files have a gamma that doesn't
|
||||
; match the output you can take advantage of the fact that
|
||||
; png_set_alpha_mode always sets the output gamma but only sets the PNG
|
||||
; default if it is not already set:
|
||||
|
||||
; png_set_alpha_mode(pp, PNG_ALPHA_PNG, PNG_DEFAULT_sRGB);
|
||||
; png_set_alpha_mode(pp, PNG_ALPHA_PNG, PNG_GAMMA_MAC);
|
||||
; The first call sets both the default and the output gamma values, the
|
||||
; second call overrides the output gamma without changing the default. This
|
||||
; is easier than achieving the same effect with png_set_gamma. You must use
|
||||
; PNG_ALPHA_PNG for the first call - internal checking in png_set_alpha will
|
||||
; fire if more than one call to png_set_alpha_mode and png_set_background is
|
||||
; made in the same read operation, however multiple calls with PNG_ALPHA_PNG
|
||||
; are ignored.
|
||||
|
||||
PNG_EXPORT 36, void, png_set_strip_alpha, '(png_structrp png_ptr)'
|
||||
|
||||
; The values of the PNG_FILLER_ defines should NOT be changed
|
||||
PNG_FILLER_BEFORE equ 0
|
||||
PNG_FILLER_AFTER equ 1
|
||||
@ -998,9 +876,6 @@ PNG_FILLER_AFTER equ 1
|
||||
; read. Doing so will result in unexpected behavior and possible warnings or
|
||||
; errors if the PNG file contains a bKGD chunk.
|
||||
|
||||
PNG_EXPORT 47, void, png_set_background, '(png_structrp png_ptr, png_const_color_16p background_color, int background_gamma_code, int need_expand, double background_gamma)'
|
||||
PNG_EXPORT 215, void, png_set_background_fixed, '(png_structrp png_ptr, png_const_color_16p background_color, int background_gamma_code, int need_expand, png_fixed_point background_gamma)'
|
||||
|
||||
if PNG_READ_BACKGROUND_SUPPORTED eq 1
|
||||
PNG_BACKGROUND_GAMMA_UNKNOWN equ 0
|
||||
PNG_BACKGROUND_GAMMA_SCREEN equ 1
|
||||
@ -1008,22 +883,12 @@ PNG_BACKGROUND_GAMMA_FILE equ 2
|
||||
PNG_BACKGROUND_GAMMA_UNIQUE equ 3
|
||||
end if
|
||||
|
||||
; Scale a 16-bit depth file down to 8-bit, accurately.
|
||||
PNG_EXPORT 229, void, png_set_scale_16, '(png_structrp png_ptr)'
|
||||
|
||||
;#define PNG_READ_16_TO_8_SUPPORTED /* Name prior to 1.5.4 */
|
||||
; Strip the second byte of information from a 16-bit depth file.
|
||||
PNG_EXPORT 48, void, png_set_strip_16, '(png_structrp png_ptr)'
|
||||
|
||||
; Turn on quantizing, and reduce the palette to the number of colors
|
||||
; available.
|
||||
|
||||
PNG_EXPORT 49, void, png_set_quantize, '(png_structrp png_ptr, png_colorp palette, int num_palette, int maximum_colors, png_const_uint_16p histogram, int full_quantize)'
|
||||
;PNG_READ_16_TO_8_SUPPORTED equ 1 ;Name prior to 1.5.4
|
||||
|
||||
; The threshold on gamma processing is configurable but hard-wired into the
|
||||
; library. The following is the floating point variant.
|
||||
|
||||
;#define PNG_GAMMA_THRESHOLD (PNG_GAMMA_THRESHOLD_FIXED*.00001)
|
||||
PNG_GAMMA_THRESHOLD equ (PNG_GAMMA_THRESHOLD_FIXED*.00001)
|
||||
|
||||
; Handle gamma correction. Screen_gamma=(display_exponent).
|
||||
; NOTE: this API simply sets the screen and file gamma values. It will
|
||||
@ -1031,37 +896,6 @@ PNG_EXPORT 49, void, png_set_quantize, '(png_structrp png_ptr, png_colorp palett
|
||||
; the file header has been read - use with care - call before reading the PNG
|
||||
; file for best results!
|
||||
|
||||
; These routines accept the same gamma values as png_set_alpha_mode (described
|
||||
; above). The PNG_GAMMA_ defines and PNG_DEFAULT_sRGB can be passed to either
|
||||
; API (floating point or fixed.) Notice, however, that the 'file_gamma' value
|
||||
; is the inverse of a 'screen gamma' value.
|
||||
|
||||
PNG_EXPORT 50, void, png_set_gamma, '(png_structrp png_ptr, double screen_gamma, double override_file_gamma)'
|
||||
PNG_EXPORT 208, void, png_set_gamma_fixed, '(png_structrp png_ptr, png_fixed_point screen_gamma, png_fixed_point override_file_gamma)'
|
||||
|
||||
; Optional update palette with requested transformations
|
||||
PNG_EXPORT 53, void, png_start_read_image, '(png_structrp png_ptr)'
|
||||
|
||||
; Optional call to update the users info structure
|
||||
PNG_EXPORT 54, void, png_read_update_info, '(png_structrp png_ptr, png_inforp info_ptr)'
|
||||
|
||||
; Read one or more rows of image data.
|
||||
PNG_EXPORT 55, void, png_read_rows, '(png_structrp png_ptr, bytepp row, bytepp display_row, uint_32 num_rows)'
|
||||
|
||||
; Read a row of data.
|
||||
PNG_EXPORT 56, void, png_read_row, '(png_structrp png_ptr, bytep row, bytep display_row)'
|
||||
|
||||
; Read the whole image into memory at once.
|
||||
PNG_EXPORT 57, void, png_read_image, '(png_structrp png_ptr, bytepp image)'
|
||||
|
||||
; Read the end of the PNG file.
|
||||
PNG_EXPORT 62, void, png_read_end, '(png_structrp png_ptr, png_inforp info_ptr)'
|
||||
|
||||
; Free any memory associated with the png_struct and the png_info_structs
|
||||
PNG_EXPORT 64, void, png_destroy_read_struct, '(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr, png_infopp end_info_ptr_ptr)'
|
||||
|
||||
; Set the libpng method of handling chunk CRC errors
|
||||
PNG_EXPORT 66, void, png_set_crc_action, '(png_structrp png_ptr, int crit_action, int ancil_action)'
|
||||
|
||||
; Values for png_set_crc_action() say how to handle CRC errors in
|
||||
; ancillary and critical chunks, and whether to use the data contained
|
||||
@ -1121,46 +955,6 @@ PNG_FILTER_HEURISTIC_LAST equ 3 ;Not a valid value
|
||||
; Replace the default data input function with a user supplied one.
|
||||
PNG_EXPORT 78, void, png_set_read_fn, '(png_structrp png_ptr, voidp io_ptr, png_rw_ptr read_data_fn)'
|
||||
|
||||
PNG_EXPORT 80, void, png_set_read_status_fn, '(png_structrp png_ptr, png_read_status_ptr read_row_fn)'
|
||||
|
||||
PNG_EXPORT 84, void, png_set_read_user_transform_fn, '(png_structrp png_ptr, png_user_transform_ptr read_user_transform_fn)'
|
||||
|
||||
if PNG_PROGRESSIVE_READ_SUPPORTED eq 1
|
||||
; Sets the function callbacks for the push reader, and a pointer to a
|
||||
; user-defined structure available to the callback functions.
|
||||
|
||||
PNG_EXPORT 90, void, png_set_progressive_read_fn, '(png_structrp png_ptr, voidp progressive_ptr, png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn, png_progressive_end_ptr end_fn)'
|
||||
|
||||
; Returns the user pointer associated with the push read functions
|
||||
PNG_EXPORT 91, voidp, png_get_progressive_ptr, '(png_const_structrp png_ptr)'
|
||||
|
||||
; Function to be called when data becomes available
|
||||
PNG_EXPORT 92, void, png_process_data, '(png_structrp png_ptr, png_inforp info_ptr, bytep buffer, png_size_t buffer_size)'
|
||||
|
||||
; A function which may be called *only* within png_process_data to stop the
|
||||
; processing of any more data. The function returns the number of bytes
|
||||
; remaining, excluding any that libpng has cached internally. A subsequent
|
||||
; call to png_process_data must supply these bytes again. If the argument
|
||||
; 'save' is set to true the routine will first save all the pending data and
|
||||
; will always return 0.
|
||||
|
||||
PNG_EXPORT 219, png_size_t, png_process_data_pause, '(png_structrp, int save)'
|
||||
|
||||
; A function which may be called *only* outside (after) a call to
|
||||
; png_process_data. It returns the number of bytes of data to skip in the
|
||||
; input. Normally it will return 0, but if it returns a non-zero value the
|
||||
; application must skip than number of bytes of input data and pass the
|
||||
; following data to the next call to png_process_data.
|
||||
|
||||
PNG_EXPORT 220, uint_32, png_process_data_skip, '(png_structrp)'
|
||||
|
||||
; Function that combines rows. 'new_row' is a flag that should come from
|
||||
; the callback and be non-NULL if anything needs to be done; the library
|
||||
; stores its own version of the new data internally and ignores the passed
|
||||
; in value.
|
||||
|
||||
PNG_EXPORT 93, void, png_progressive_combine_row, '(png_const_structrp png_ptr, bytep old_row, bytep new_row)'
|
||||
end if ;PROGRESSIVE_READ
|
||||
|
||||
; Reassign responsibility for freeing existing data, whether allocated
|
||||
; by libpng or by the application; this works on the png_info structure passed
|
||||
@ -1228,61 +1022,6 @@ macro png_benign_error h,txt
|
||||
;# endif
|
||||
;end if
|
||||
|
||||
; Returns number of color channels in image.
|
||||
PNG_EXPORT 114, byte, png_get_channels, '(png_const_structrp png_ptr, png_const_inforp info_ptr)'
|
||||
|
||||
; Returns pixel aspect ratio, computed from pHYs chunk data.
|
||||
PNG_EXPORT 125, float, png_get_pixel_aspect_ratio, '(png_const_structrp png_ptr, png_const_inforp info_ptr)'
|
||||
PNG_EXPORT 210, png_fixed_point, png_get_pixel_aspect_ratio_fixed, '(png_const_structrp png_ptr, png_const_inforp info_ptr)'
|
||||
|
||||
; Returns image x, y offset in pixels or microns, from oFFs chunk data.
|
||||
PNG_EXPORT 126, int_32, png_get_x_offset_pixels, '(png_const_structrp png_ptr, png_const_inforp info_ptr)'
|
||||
PNG_EXPORT 127, int_32, png_get_y_offset_pixels, '(png_const_structrp png_ptr, png_const_inforp info_ptr)'
|
||||
PNG_EXPORT 128, int_32, png_get_x_offset_microns, '(png_const_structrp png_ptr, png_const_inforp info_ptr)'
|
||||
PNG_EXPORT 129, int_32, png_get_y_offset_microns, '(png_const_structrp png_ptr, png_const_inforp info_ptr)'
|
||||
|
||||
; Returns pointer to signature string read from PNG header
|
||||
PNG_EXPORT 130, bytep, png_get_signature, '(png_const_structrp png_ptr, png_const_inforp info_ptr)'
|
||||
|
||||
PNG_EXPORT 131, uint_32, png_get_bKGD, '(png_const_structrp png_ptr, png_inforp info_ptr, png_color_16p *background)'
|
||||
|
||||
PNG_EXPORT 133, uint_32, png_get_cHRM, '(png_const_structrp png_ptr, png_const_inforp info_ptr, double *white_x, double *white_y, double *red_x, double *red_y, double *green_x, double *green_y, double *blue_x, double *blue_y)'
|
||||
PNG_EXPORT 230, uint_32, png_get_cHRM_XYZ, '(png_const_structrp png_ptr, png_const_inforp info_ptr, double *red_X, double *red_Y, double *red_Z, double *green_X, double *green_Y, double *green_Z, double *blue_X, double *blue_Y, double *blue_Z)'
|
||||
PNG_EXPORT 134, uint_32, png_get_cHRM_fixed, '(png_const_structrp png_ptr, png_const_inforp info_ptr, png_fixed_point *int_white_x, png_fixed_point *int_white_y, png_fixed_point *int_red_x, png_fixed_point *int_red_y, png_fixed_point *int_green_x, png_fixed_point *int_green_y, png_fixed_point *int_blue_x, png_fixed_point *int_blue_y)'
|
||||
|
||||
PNG_EXPORT 137, uint_32, png_get_gAMA, '(png_const_structrp png_ptr, png_const_inforp info_ptr, double *file_gamma)'
|
||||
PNG_EXPORT 138, uint_32, png_get_gAMA_fixed, '(png_const_structrp png_ptr, png_const_inforp info_ptr, png_fixed_point *int_file_gamma)'
|
||||
|
||||
PNG_EXPORT 145, uint_32, png_get_oFFs, '(png_const_structrp png_ptr, png_const_inforp info_ptr, int_32 *offset_x, int_32 *offset_y, int *unit_type)'
|
||||
|
||||
PNG_EXPORT 147, uint_32, png_get_pCAL, '(png_const_structrp png_ptr, png_inforp info_ptr, charp *purpose, int_32 *X0, int_32 *X1, int *type, int *nparams, charp *units, charpp *params)'
|
||||
|
||||
PNG_EXPORT 149, uint_32, png_get_pHYs, '(png_const_structrp png_ptr, png_const_inforp info_ptr, uint_32 *res_x, uint_32 *res_y, int *unit_type)'
|
||||
|
||||
PNG_EXPORT 151, uint_32, png_get_PLTE, '(png_const_structrp png_ptr, png_inforp info_ptr, png_colorp *palette, int *num_palette)'
|
||||
|
||||
PNG_EXPORT 153, uint_32, png_get_sBIT, '(png_const_structrp png_ptr, png_inforp info_ptr, png_color_8p *sig_bit)'
|
||||
|
||||
PNG_EXPORT 155, uint_32, png_get_sRGB, '(png_const_structrp png_ptr, png_const_inforp info_ptr, int *file_srgb_intent)'
|
||||
|
||||
; png_get_text also returns the number of text chunks in *num_text
|
||||
PNG_EXPORT 162, int, png_get_text, '(png_const_structrp png_ptr, png_inforp info_ptr, png_textp *text_ptr, int *num_text)'
|
||||
|
||||
PNG_EXPORT 164, uint_32, png_get_tIME, '(png_const_structrp png_ptr, png_inforp info_ptr, png_timep *mod_time)'
|
||||
|
||||
PNG_EXPORT 166, uint_32, png_get_tRNS, '(png_const_structrp png_ptr, png_inforp info_ptr, bytep *trans_alpha, int *num_trans, png_color_16p *trans_color)'
|
||||
|
||||
PNG_EXPORT 168, uint_32, png_get_sCAL, '(png_const_structrp png_ptr, png_const_inforp info_ptr, int *unit, double *width, double *height)'
|
||||
|
||||
; NOTE: this API is currently implemented using floating point arithmetic,
|
||||
; consequently it can only be used on systems with floating point support.
|
||||
; In any case the range of values supported by png_fixed_point is small and it
|
||||
; is highly recommended that png_get_sCAL_s be used instead.
|
||||
|
||||
PNG_EXPORT 214, uint_32, png_get_sCAL_fixed, '(png_const_structrp png_ptr, png_const_inforp info_ptr, int *unit, png_fixed_point *width, png_fixed_point *height)'
|
||||
|
||||
PNG_EXPORT 170, void, png_set_sCAL, '(png_const_structrp png_ptr, png_inforp info_ptr, int unit, double width, double height)'
|
||||
PNG_EXPORT 171, void, png_set_sCAL_s, '(png_const_structrp png_ptr, png_inforp info_ptr, int unit, charp swidth, charp sheight)'
|
||||
|
||||
; Provide the default handling for all unknown chunks or, optionally, for
|
||||
; specific unknown chunks.
|
||||
@ -1383,9 +1122,6 @@ PNG_EXPORT 171, void, png_set_sCAL_s, '(png_const_structrp png_ptr, png_inforp i
|
||||
; be processed by libpng.
|
||||
|
||||
|
||||
; The "params" pointer is currently not used and is for future expansion.
|
||||
PNG_EXPORT 178, void, png_read_png, '(png_structrp png_ptr, png_inforp info_ptr, int transforms, voidp params)'
|
||||
|
||||
; For use in png_set_keep_unknown, added to version 1.2.6
|
||||
PNG_HANDLE_CHUNK_AS_DEFAULT equ 0
|
||||
PNG_HANDLE_CHUNK_NEVER equ 1
|
||||
@ -1413,7 +1149,7 @@ PNG_IO_MASK_LOC equ 0x00f0 ; current location: sig/hdr/data/crc
|
||||
; libpng interlace handling is turned off the macros may be used to handle
|
||||
; interlaced images within the application.
|
||||
|
||||
;#define PNG_INTERLACE_ADAM7_PASSES 7
|
||||
PNG_INTERLACE_ADAM7_PASSES equ 7
|
||||
|
||||
; Two macros to return the first row and first column of the original,
|
||||
; full, image which appears in a given pass. 'pass' is in the range 0
|
||||
@ -1423,8 +1159,8 @@ macro PNG_PASS_START_ROW pass
|
||||
{
|
||||
push ebx ecx
|
||||
mov eax,pass
|
||||
mov ebx,eax
|
||||
not eax
|
||||
mov ebx,pass
|
||||
and eax,1
|
||||
shr ebx,1
|
||||
mov ecx,3
|
||||
@ -1437,7 +1173,7 @@ macro PNG_PASS_START_COL pass
|
||||
{
|
||||
push ebx ecx
|
||||
mov eax,pass
|
||||
mov ebx,pass
|
||||
mov ebx,eax
|
||||
and eax,1
|
||||
inc ebx
|
||||
shr ebx,1
|
||||
@ -1597,14 +1333,7 @@ pop ecx
|
||||
; 32767) / 65535))
|
||||
;end if /* READ_COMPOSITE_NODIV */
|
||||
|
||||
PNG_EXPORT 201, uint_32, png_get_uint_32, '(bytep buf)'
|
||||
PNG_EXPORT 202, uint_16, png_get_uint_16, '(bytep buf)'
|
||||
PNG_EXPORT 203, int_32, png_get_int_32, '(bytep buf)'
|
||||
|
||||
PNG_EXPORT 204, uint_32, png_get_uint_31, '(png_const_structrp png_ptr, bytep buf)'
|
||||
; No png_get_int_16 -- may be added if there's a real need for it.
|
||||
|
||||
;if PNG_USE_READ_MACROS
|
||||
if PNG_USE_READ_MACROS eq 1
|
||||
; Inline macros to do direct reads of bytes from the input buffer.
|
||||
; The png_get_int_32() routine assumes we are using two's complement
|
||||
; format for negative values, which is almost certainly true.
|
||||
@ -1627,23 +1356,7 @@ PNG_EXPORT 204, uint_32, png_get_uint_31, '(png_const_structrp png_ptr, bytep bu
|
||||
; ((int_32)((*(buf) & 0x80) \
|
||||
; ? -((int_32)(((png_get_uint_32(buf)^0xffffffffU)+1U)&0x7fffffffU)) \
|
||||
; : (int_32)png_get_uint_32(buf)))
|
||||
|
||||
; If PNG_PREFIX is defined the same thing as below happens in pnglibconf.h,
|
||||
; but defining a macro name prefixed with PNG_PREFIX.
|
||||
|
||||
;# ifndef PNG_PREFIX
|
||||
;# define png_get_uint_32(buf) PNG_get_uint_32(buf)
|
||||
;# define png_get_uint_16(buf) PNG_get_uint_16(buf)
|
||||
;# define png_get_int_32(buf) PNG_get_int_32(buf)
|
||||
;# endif
|
||||
;#else
|
||||
;# ifdef PNG_PREFIX
|
||||
; No macros; revert to the (redefined) function
|
||||
;# define PNG_get_uint_32 (png_get_uint_32)
|
||||
;# define PNG_get_uint_16 (png_get_uint_16)
|
||||
;# define PNG_get_int_32 (png_get_int_32)
|
||||
;# endif
|
||||
;end if
|
||||
end if
|
||||
|
||||
;/*******************************************************************************
|
||||
; Section 5: SIMPLIFIED API
|
||||
@ -1804,13 +1517,9 @@ PNG_FORMAT_FLAG_COLOR equ 0x02 ;color format: otherwise grayscale
|
||||
PNG_FORMAT_FLAG_LINEAR equ 0x04 ;2-byte channels else 1-byte
|
||||
PNG_FORMAT_FLAG_COLORMAP equ 0x08 ;image data is color-mapped
|
||||
|
||||
;if PNG_FORMAT_BGR_SUPPORTED
|
||||
PNG_FORMAT_FLAG_BGR equ 0x10 ;BGR colors, else order is RGB
|
||||
;end if
|
||||
|
||||
;if PNG_FORMAT_AFIRST_SUPPORTED
|
||||
PNG_FORMAT_FLAG_AFIRST equ 0x20 ;alpha channel comes first
|
||||
;end if
|
||||
|
||||
; Commonly used formats have predefined macros.
|
||||
|
||||
@ -2007,63 +1716,8 @@ PNG_IMAGE_FLAG_16BIT_sRGB equ 0x04
|
||||
; NOTE: the flag can only be set after the png_image_begin_read_ call,
|
||||
; because that call initializes the 'flags' field.
|
||||
|
||||
|
||||
;if PNG_SIMPLIFIED_READ_SUPPORTED
|
||||
; READ APIs
|
||||
; ---------
|
||||
|
||||
; The png_image passed to the read APIs must have been initialized by setting
|
||||
; the png_controlp field 'opaque' to NULL (or, safer, memset the whole thing.)
|
||||
|
||||
if PNG_STDIO_SUPPORTED eq 1
|
||||
PNG_EXPORT 234, int, png_image_begin_read_from_file, '(png_imagep image, const char *file_name)'
|
||||
; The named file is opened for read and the image header is filled in
|
||||
; from the PNG header in the file.
|
||||
|
||||
PNG_EXPORT 235, int, png_image_begin_read_from_stdio, '(png_imagep image, FILE* file)'
|
||||
; The PNG header is read from the stdio FILE object.
|
||||
end if ;STDIO
|
||||
|
||||
PNG_EXPORT 236, int, png_image_begin_read_from_memory, '(png_imagep image, png_const_voidp memory, png_size_t size)'
|
||||
; The PNG header is read from the given memory buffer.
|
||||
|
||||
PNG_EXPORT 237, int, png_image_finish_read, '(png_imagep image, png_const_colorp background, void *buffer, int_32 row_stride, void *colormap)'
|
||||
; Finish reading the image into the supplied buffer and clean up the
|
||||
; png_image structure.
|
||||
|
||||
; row_stride is the step, in byte or 2-byte units as appropriate,
|
||||
; between adjacent rows. A positive stride indicates that the top-most row
|
||||
; is first in the buffer - the normal top-down arrangement. A negative
|
||||
; stride indicates that the bottom-most row is first in the buffer.
|
||||
|
||||
; background need only be supplied if an alpha channel must be removed from
|
||||
; a byte format and the removal is to be done by compositing on a solid
|
||||
; color; otherwise it may be NULL and any composition will be done directly
|
||||
; onto the buffer. The value is an sRGB color to use for the background,
|
||||
; for grayscale output the green channel is used.
|
||||
|
||||
; background must be supplied when an alpha channel must be removed from a
|
||||
; single byte color-mapped output format, in other words if:
|
||||
|
||||
; 1) The original format from png_image_begin_read_from_* had
|
||||
; PNG_FORMAT_FLAG_ALPHA set.
|
||||
; 2) The format set by the application does not.
|
||||
; 3) The format set by the application has PNG_FORMAT_FLAG_COLORMAP set and
|
||||
; PNG_FORMAT_FLAG_LINEAR *not* set.
|
||||
|
||||
; For linear output removing the alpha channel is always done by compositing
|
||||
; on black and background is ignored.
|
||||
|
||||
; colormap must be supplied when PNG_FORMAT_FLAG_COLORMAP is set. It must
|
||||
; be at least the size (in bytes) returned by PNG_IMAGE_COLORMAP_SIZE.
|
||||
; image->colormap_entries will be updated to the actual number of entries
|
||||
; written to the colormap; this may be less than the original value.
|
||||
|
||||
|
||||
;end if /* SIMPLIFIED_READ */
|
||||
|
||||
;if PNG_SIMPLIFIED_WRITE_SUPPORTED
|
||||
;/* WRITE APIS
|
||||
if PNG_SIMPLIFIED_WRITE_SUPPORTED eq 1
|
||||
; WRITE APIS
|
||||
; ----------
|
||||
; For write you must initialize a png_image structure to describe the image to
|
||||
; be written. To do this use memset to set the whole structure to 0 then
|
||||
@ -2140,8 +1794,8 @@ PNG_EXPORT 237, int, png_image_finish_read, '(png_imagep image, png_const_colorp
|
||||
|
||||
;#define PNG_IMAGE_COMPRESSED_SIZE_MAX(image)\
|
||||
; PNG_ZLIB_MAX_SIZE((png_alloc_size_t)PNG_IMAGE_DATA_SIZE(image))
|
||||
; /* An upper bound on the size of the data in the PNG IDAT chunks. */
|
||||
;
|
||||
; An upper bound on the size of the data in the PNG IDAT chunks.
|
||||
|
||||
;#define PNG_IMAGE_PNG_SIZE_MAX_(image, image_size)\
|
||||
; ((8U/*sig*/+25U/*IHDR*/+16U/*gAMA*/+44U/*cHRM*/+12U/*IEND*/+\
|
||||
; (((image).format&PNG_FORMAT_FLAG_COLORMAP)?/*colormap: PLTE, tRNS*/\
|
||||
@ -2149,12 +1803,12 @@ PNG_EXPORT 237, int, png_image_finish_read, '(png_imagep image, png_const_colorp
|
||||
; (((image).format&PNG_FORMAT_FLAG_ALPHA)?\
|
||||
; 12U/*tRNS*/+(image).colormap_entries:0U):0U)+\
|
||||
; 12U)+(12U*((image_size)/PNG_ZBUF_SIZE))/*IDAT*/+(image_size))
|
||||
; /* A helper for the following macro; if your compiler cannot handle the
|
||||
|
||||
; A helper for the following macro; if your compiler cannot handle the
|
||||
; following macro use this one with the result of
|
||||
; PNG_IMAGE_COMPRESSED_SIZE_MAX(image) as the second argument (most
|
||||
; compilers should handle this just fine.)
|
||||
|
||||
|
||||
;#define PNG_IMAGE_PNG_SIZE_MAX(image)\
|
||||
; PNG_IMAGE_PNG_SIZE_MAX_(image, PNG_IMAGE_COMPRESSED_SIZE_MAX(image))
|
||||
; An upper bound on the total length of the PNG data stream for 'image'.
|
||||
@ -2162,7 +1816,7 @@ PNG_EXPORT 237, int, png_image_finish_read, '(png_imagep image, png_const_colorp
|
||||
; overflow even though PNG_IMAGE_DATA_SIZE does not overflow; the write will
|
||||
; run out of buffer space but return a corrected size which should work.
|
||||
|
||||
;end if /* SIMPLIFIED_WRITE */
|
||||
end if ;SIMPLIFIED_WRITE
|
||||
;/*******************************************************************************
|
||||
; END OF SIMPLIFIED API
|
||||
; ******************************************************************************/
|
||||
|
@ -16,20 +16,28 @@
|
||||
; info struct and allows us to change the structure in the future.
|
||||
|
||||
|
||||
;void (png_structrp png_ptr, png_inforp info_ptr, png_const_color_16p background)
|
||||
;void (png_structrp png_ptr, png_inforp info_ptr, png_color_16p background)
|
||||
align 4
|
||||
proc png_set_bKGD, png_ptr:dword, info_ptr:dword, background:dword
|
||||
proc png_set_bKGD uses ecx edi esi, png_ptr:dword, info_ptr:dword, background:dword
|
||||
png_debug1 1, 'in %s storage function', 'bKGD'
|
||||
|
||||
; if (png_ptr == NULL || info_ptr == NULL || background == NULL)
|
||||
; return;
|
||||
cmp dword[png_ptr],0
|
||||
je .end_f
|
||||
mov edi,[info_ptr]
|
||||
cmp edi,0
|
||||
je .end_f
|
||||
mov esi,[background]
|
||||
cmp esi,0
|
||||
je .end_f ;if (..==0 || ..==0 || ..==0) return
|
||||
|
||||
; info_ptr->background = *background;
|
||||
; info_ptr->valid |= PNG_INFO_bKGD;
|
||||
or dword[edi+png_info_def.valid],PNG_INFO_bKGD
|
||||
add edi,png_info_def.background
|
||||
mov ecx,sizeof.png_color_16
|
||||
rep movsb
|
||||
.end_f:
|
||||
ret
|
||||
endp
|
||||
|
||||
;if PNG_cHRM_SUPPORTED
|
||||
;void (png_structrp png_ptr, png_inforp info_ptr,
|
||||
; png_fixed_point white_x, png_fixed_point white_y, png_fixed_point red_x,
|
||||
; png_fixed_point red_y, png_fixed_point green_x, png_fixed_point green_y,
|
||||
@ -99,7 +107,7 @@ proc png_set_cHRM_XYZ_fixed uses edi esi, png_ptr:dword, info_ptr:dword,\
|
||||
; &XYZ, 2) != 0)
|
||||
; info_ptr->colorspace.flags |= PNG_COLORSPACE_FROM_cHRM;
|
||||
|
||||
stdcall png_colorspace_sync_info, edi, esi;
|
||||
stdcall png_colorspace_sync_info, edi, esi
|
||||
.end_f:
|
||||
ret
|
||||
endp
|
||||
@ -141,8 +149,6 @@ proc png_set_cHRM_XYZ, png_ptr:dword, info_ptr:dword, red_X:dword, red_Y:dword,
|
||||
ret
|
||||
endp
|
||||
|
||||
;end if /* cHRM */
|
||||
|
||||
;void (png_structrp png_ptr, png_inforp info_ptr, png_fixed_point file_gamma)
|
||||
align 4
|
||||
proc png_set_gAMA_fixed uses eax edi esi, png_ptr:dword, info_ptr:dword, file_gamma:dword
|
||||
@ -172,8 +178,7 @@ proc png_set_gAMA uses eax, png_ptr:dword, info_ptr:dword, file_gamma:dword
|
||||
ret
|
||||
endp
|
||||
|
||||
;void (png_structrp png_ptr, png_inforp info_ptr,
|
||||
; png_const_uint_16p hist)
|
||||
;void (png_structrp png_ptr, png_inforp info_ptr, png_uint_16p hist)
|
||||
align 4
|
||||
proc png_set_hIST uses edi esi, png_ptr:dword, info_ptr:dword, hist:dword
|
||||
; int i;
|
||||
@ -352,17 +357,15 @@ proc png_set_pCAL uses edi esi, png_ptr:dword, info_ptr:dword, purpose:dword, X0
|
||||
cmp dword[type],0
|
||||
jl @f
|
||||
cmp dword[type],3
|
||||
jg @f ;if (..<0 || ..>3)
|
||||
jmp .end0
|
||||
jle .end0 ;if (..<0 || ..>3)
|
||||
@@:
|
||||
png_error edi, 'Invalid pCAL equation type'
|
||||
.end0:
|
||||
|
||||
cmp dword[type],0
|
||||
cmp dword[nparams],0
|
||||
jl @f
|
||||
cmp dword[type],255
|
||||
jg @f ;if (..<0 || ..>255)
|
||||
jmp .end1
|
||||
cmp dword[nparams],255
|
||||
jle .end1 ;if (..<0 || ..>255)
|
||||
@@:
|
||||
png_error edi, 'Invalid pCAL parameter count'
|
||||
.end1:
|
||||
@ -588,8 +591,7 @@ proc png_set_pHYs, png_ptr:dword, info_ptr:dword, res_x:dword, res_y:dword, unit
|
||||
ret
|
||||
endp
|
||||
|
||||
;void (png_structrp png_ptr, png_inforp info_ptr,
|
||||
; png_const_colorp palette, int num_palette)
|
||||
;void (png_structrp png_ptr, png_inforp info_ptr, png_colorp palette, int num_palette)
|
||||
align 4
|
||||
proc png_set_PLTE uses eax edi esi, png_ptr:dword, info_ptr:dword, palette:dword, num_palette:dword
|
||||
; uint_32 max_palette_length;
|
||||
@ -657,8 +659,7 @@ end if
|
||||
ret
|
||||
endp
|
||||
|
||||
;void (png_structrp png_ptr, png_inforp info_ptr,
|
||||
; png_const_color_8p sig_bit)
|
||||
;void (png_structrp png_ptr, png_inforp info_ptr, png_color_8p sig_bit)
|
||||
align 4
|
||||
proc png_set_sBIT, png_ptr:dword, info_ptr:dword, sig_bit:dword
|
||||
png_debug1 1, 'in %s storage function', 'sBIT'
|
||||
@ -783,8 +784,7 @@ proc png_set_iCCP uses edi esi, png_ptr:dword, info_ptr:dword, name:dword, compr
|
||||
ret
|
||||
endp
|
||||
|
||||
;void (png_structrp png_ptr, png_inforp info_ptr,
|
||||
; png_const_textp text_ptr, int num_text)
|
||||
;void (png_structrp png_ptr, png_inforp info_ptr, png_textp text_ptr, int num_text)
|
||||
align 4
|
||||
proc png_set_text uses eax edi, png_ptr:dword, info_ptr:dword, text_ptr:dword, num_text:dword
|
||||
mov edi,[png_ptr]
|
||||
@ -798,7 +798,7 @@ proc png_set_text uses eax edi, png_ptr:dword, info_ptr:dword, text_ptr:dword, n
|
||||
endp
|
||||
|
||||
;int (png_structrp png_ptr, png_inforp info_ptr,
|
||||
; png_const_textp text_ptr, int num_text)
|
||||
; png_textp text_ptr, int num_text)
|
||||
align 4
|
||||
proc png_set_text_2, png_ptr:dword, info_ptr:dword, text_ptr:dword, num_text:dword
|
||||
; int i;
|
||||
@ -991,7 +991,7 @@ end if
|
||||
ret
|
||||
endp
|
||||
|
||||
;void (png_structrp png_ptr, png_inforp info_ptr, png_const_timep mod_time)
|
||||
;void (png_structrp png_ptr, png_inforp info_ptr, png_timep mod_time)
|
||||
align 4
|
||||
proc png_set_tIME uses eax ebx ecx edi esi, png_ptr:dword, info_ptr:dword, mod_time:dword
|
||||
png_debug1 1, 'in %s storage function', 'tIME'
|
||||
@ -1040,7 +1040,7 @@ proc png_set_tIME uses eax ebx ecx edi esi, png_ptr:dword, info_ptr:dword, mod_t
|
||||
endp
|
||||
|
||||
;void (png_structrp png_ptr, png_inforp info_ptr,
|
||||
; bytep trans_alpha, int num_trans, png_const_color_16p trans_color)
|
||||
; bytep trans_alpha, int num_trans, png_color_16p trans_color)
|
||||
align 4
|
||||
proc png_set_tRNS, png_ptr:dword, info_ptr:dword, trans_alpha:dword, num_trans:dword, trans_color:dword
|
||||
png_debug1 1, 'in %s storage function', 'tRNS'
|
||||
@ -1106,7 +1106,7 @@ endp
|
||||
|
||||
;if PNG_sPLT_SUPPORTED
|
||||
;void (png_structrp png_ptr,
|
||||
; png_inforp info_ptr, png_const_sPLT_tp entries, int nentries)
|
||||
; png_inforp info_ptr, png_sPLT_tp entries, int nentries)
|
||||
|
||||
; entries - array of png_sPLT_t structures
|
||||
; to be added to the list of palettes
|
||||
@ -1190,7 +1190,7 @@ proc png_set_sPLT, png_ptr:dword, info_ptr:dword, entries:dword, nentries:dword
|
||||
; memcpy(np->entries, entries->entries,
|
||||
; entries->nentries * sizeof (png_sPLT_entry));
|
||||
|
||||
; /* Note that 'continue' skips the advance of the out pointer and out
|
||||
; Note that 'continue' skips the advance of the out pointer and out
|
||||
; count, so an invalid entry is not added.
|
||||
|
||||
; info_ptr->valid |= PNG_INFO_sPLT;
|
||||
@ -1211,7 +1211,7 @@ align 4
|
||||
proc check_location, png_ptr:dword, location:dword
|
||||
; location &= (PNG_HAVE_IHDR|PNG_HAVE_PLTE|PNG_AFTER_IDAT);
|
||||
|
||||
; /* New in 1.6.0; copy the location and check it. This is an API
|
||||
; New in 1.6.0; copy the location and check it. This is an API
|
||||
; change; previously the app had to use the
|
||||
; png_set_unknown_chunk_location API below for each chunk.
|
||||
|
||||
@ -1225,13 +1225,13 @@ proc check_location, png_ptr:dword, location:dword
|
||||
; (PNG_HAVE_IHDR|PNG_HAVE_PLTE|PNG_AFTER_IDAT));
|
||||
; }
|
||||
|
||||
; /* This need not be an internal error - if the app calls
|
||||
; This need not be an internal error - if the app calls
|
||||
; png_set_unknown_chunks on a read pointer it must get the location right.
|
||||
|
||||
; if (location == 0)
|
||||
; png_error(png_ptr, "invalid location in png_set_unknown_chunks");
|
||||
|
||||
; /* Now reduce the location to the top-most set bit by removing each least
|
||||
; Now reduce the location to the top-most set bit by removing each least
|
||||
; significant bit in turn.
|
||||
|
||||
; while (location != (location & -location))
|
||||
@ -1245,7 +1245,7 @@ proc check_location, png_ptr:dword, location:dword
|
||||
endp
|
||||
|
||||
;void (png_structrp png_ptr,
|
||||
; png_inforp info_ptr, png_const_unknown_chunkp unknowns, int num_unknowns)
|
||||
; png_inforp info_ptr, png_unknown_chunkp unknowns, int num_unknowns)
|
||||
align 4
|
||||
proc png_set_unknown_chunks uses edi esi, png_ptr:dword, info_ptr:dword, unknowns:dword, num_unknowns:dword
|
||||
; png_unknown_chunkp np;
|
||||
@ -1657,7 +1657,7 @@ if PNG_WRITE_SUPPORTED eq 1
|
||||
; }
|
||||
|
||||
;#ifndef __COVERITY__
|
||||
; /* Some compilers complain that this is always false. However, it
|
||||
; Some compilers complain that this is always false. However, it
|
||||
; can be true when integer overflow happens.
|
||||
|
||||
; if (size > ZLIB_IO_MAX)
|
||||
@ -1834,7 +1834,7 @@ proc png_check_keyword, png_ptr:dword, key:dword, new_key:dword
|
||||
; bad_character = 32;
|
||||
; }
|
||||
|
||||
; /* Terminate the keyword */
|
||||
; Terminate the keyword
|
||||
; *new_key = 0;
|
||||
|
||||
; if (key_len == 0)
|
||||
|
@ -822,7 +822,7 @@ if PNG_READ_USER_TRANSFORM_SUPPORTED eq 1
|
||||
cmp eax,0
|
||||
je @f ;if (..!=0 && ..!=0)
|
||||
cStr ,'info change after png_start_read_image or png_read_update_info'
|
||||
stdcall png_app_error edi, eax
|
||||
stdcall png_app_error, edi, eax
|
||||
jmp .end_f
|
||||
@@:
|
||||
end if
|
||||
|
@ -32,8 +32,7 @@ pushad
|
||||
jge .end_f
|
||||
movzx eax,byte[ecx+png_unknown_chunk.location]
|
||||
and eax,[where]
|
||||
cmp eax,0
|
||||
je .end0 ;if (..!=0)
|
||||
jz .end0 ;if (..!=0)
|
||||
; If per-chunk unknown chunk handling is enabled use it, otherwise
|
||||
; just write the chunks the application has set.
|
||||
|
||||
@ -108,8 +107,7 @@ pushad
|
||||
|
||||
mov eax,[edi+png_struct.mode]
|
||||
and eax,PNG_WROTE_INFO_BEFORE_PLTE
|
||||
cmp eax,0
|
||||
jne .end_f ;if (..==0)
|
||||
jnz .end_f ;if (..==0)
|
||||
|
||||
; Write PNG signature
|
||||
stdcall png_write_sig, edi
|
||||
@ -117,8 +115,7 @@ pushad
|
||||
if PNG_MNG_FEATURES_SUPPORTED eq 1
|
||||
mov eax,[edi+png_struct.mode]
|
||||
and eax,PNG_HAVE_PNG_SIGNATURE
|
||||
cmp eax,0
|
||||
je @f
|
||||
jz @f
|
||||
cmp dword[edi+png_struct.mng_features_permitted],0
|
||||
je @f ;if(..!=0 && ..!=0)
|
||||
png_warning edi, 'MNG features are not allowed in a PNG datastream'
|
||||
@ -161,16 +158,13 @@ if PNG_GAMMA_SUPPORTED eq 1
|
||||
if PNG_WRITE_gAMA_SUPPORTED eq 1
|
||||
movzx eax,word[esi+png_info_def.colorspace.flags]
|
||||
and eax,PNG_COLORSPACE_INVALID
|
||||
cmp eax,0
|
||||
jne @f
|
||||
jnz @f
|
||||
movzx eax,word[esi+png_info_def.colorspace.flags]
|
||||
and eax,PNG_COLORSPACE_FROM_gAMA
|
||||
cmp eax,0
|
||||
je @f
|
||||
jz @f
|
||||
mov eax,[esi+png_info_def.valid]
|
||||
and eax,PNG_INFO_gAMA
|
||||
cmp eax,0
|
||||
je @f ;if (..==0 && ..!=0 && ..!=0)
|
||||
jz @f ;if (..==0 && ..!=0 && ..!=0)
|
||||
stdcall png_write_gAMA_fixed, edi, [esi+png_info_def.colorspace.gamma]
|
||||
@@:
|
||||
end if
|
||||
@ -183,17 +177,14 @@ if PNG_COLORSPACE_SUPPORTED eq 1
|
||||
if PNG_WRITE_iCCP_SUPPORTED eq 1
|
||||
movzx eax,word[esi+png_info_def.colorspace.flags]
|
||||
and eax,PNG_COLORSPACE_INVALID
|
||||
cmp eax,0
|
||||
jne .end0
|
||||
jnz .end0
|
||||
mov eax,[esi+png_info_def.valid]
|
||||
and eax,PNG_INFO_iCCP
|
||||
cmp eax,0
|
||||
je .end0 ;if (..==0 && ..!=0)
|
||||
jz .end0 ;if (..==0 && ..!=0)
|
||||
if PNG_WRITE_sRGB_SUPPORTED eq 1
|
||||
mov eax,[esi+png_info_def.valid]
|
||||
and eax,PNG_INFO_sRGB
|
||||
cmp eax,0
|
||||
je @f ;if (..!=0)
|
||||
jz @f ;if (..!=0)
|
||||
png_app_warning edi, 'profile matches sRGB but writing iCCP instead'
|
||||
@@:
|
||||
end if
|
||||
@ -208,12 +199,10 @@ end if
|
||||
if PNG_WRITE_sRGB_SUPPORTED eq 1
|
||||
movzx eax,word[esi+png_info_def.colorspace.flags]
|
||||
and eax,PNG_COLORSPACE_INVALID
|
||||
cmp eax,0
|
||||
jne .end1
|
||||
jnz .end1
|
||||
mov eax,[esi+png_info_def.valid]
|
||||
and eax,PNG_INFO_sRGB
|
||||
cmp eax,0
|
||||
je .end1 ;if (..==0 && ..!=0)
|
||||
jz .end1 ;if (..==0 && ..!=0)
|
||||
movzx eax,word[esi+png_info_def.colorspace.rendering_intent]
|
||||
stdcall png_write_sRGB, edi, eax
|
||||
.end1:
|
||||
@ -223,8 +212,7 @@ end if ;COLORSPACE
|
||||
if PNG_WRITE_sBIT_SUPPORTED eq 1
|
||||
mov eax,[esi+png_info_def.valid]
|
||||
and eax,PNG_INFO_sBIT
|
||||
cmp eax,0
|
||||
je @f ;if (..!=0)
|
||||
jz @f ;if (..!=0)
|
||||
movzx eax,byte[esi+png_info_def.color_type]
|
||||
push eax
|
||||
mov eax,esi
|
||||
@ -237,16 +225,13 @@ if PNG_COLORSPACE_SUPPORTED eq 1
|
||||
if PNG_WRITE_cHRM_SUPPORTED eq 1
|
||||
movzx eax,word[esi+png_info_def.colorspace.flags]
|
||||
and eax,PNG_COLORSPACE_INVALID
|
||||
cmp eax,0
|
||||
jne @f
|
||||
jnz @f
|
||||
movzx eax,word[esi+png_info_def.colorspace.flags]
|
||||
and eax,PNG_COLORSPACE_FROM_cHRM
|
||||
cmp eax,0
|
||||
je @f
|
||||
jz @f
|
||||
mov eax,[esi+png_info_def.valid]
|
||||
and eax,PNG_INFO_cHRM
|
||||
cmp eax,0
|
||||
je @f ;if (..==0 && ..!=0 && ..!=0)
|
||||
jz @f ;if (..==0 && ..!=0 && ..!=0)
|
||||
stdcall png_write_cHRM_fixed, edi, [esi+png_info_def.colorspace.end_points_xy]
|
||||
@@:
|
||||
end if
|
||||
@ -281,8 +266,7 @@ pushad
|
||||
|
||||
mov eax,[esi+png_info_def.valid]
|
||||
and eax,PNG_INFO_PLTE
|
||||
cmp eax,0
|
||||
je @f ;if (..!=0)
|
||||
jz @f ;if (..!=0)
|
||||
movzx eax,word[esi+png_info_def.num_palette]
|
||||
stdcall png_write_PLTE, edi, [esi+png_info_def.palette], eax
|
||||
jmp .end_0
|
||||
@ -296,8 +280,7 @@ pushad
|
||||
if PNG_WRITE_tRNS_SUPPORTED eq 1
|
||||
mov eax,[esi+png_info_def.valid]
|
||||
and eax,PNG_INFO_tRNS
|
||||
cmp eax,0
|
||||
je .end_1 ;if (..!=0)
|
||||
jz .end_1 ;if (..!=0)
|
||||
if PNG_WRITE_INVERT_ALPHA_SUPPORTED eq 1
|
||||
; Invert the alpha channel (in tRNS)
|
||||
; if ((png_ptr->transformations & PNG_INVERT_ALPHA) != 0 &&
|
||||
@ -324,8 +307,7 @@ end if
|
||||
if PNG_WRITE_bKGD_SUPPORTED eq 1
|
||||
mov eax,[esi+png_info_def.valid]
|
||||
and eax,PNG_INFO_bKGD
|
||||
cmp eax,0
|
||||
je @f ;if (..!=0)
|
||||
jz @f ;if (..!=0)
|
||||
mov eax,esi
|
||||
add eax,png_info_def.background
|
||||
movzx ebx,byte[esi+png_info_def.color_type]
|
||||
@ -336,8 +318,7 @@ end if
|
||||
if PNG_WRITE_hIST_SUPPORTED eq 1
|
||||
mov eax,[esi+png_info_def.valid]
|
||||
and eax,PNG_INFO_hIST
|
||||
cmp eax,0
|
||||
je @f ;if (..!=0)
|
||||
jz @f ;if (..!=0)
|
||||
movzx ebx,word[esi+png_info_def.num_palette]
|
||||
stdcall png_write_hIST, edi, [esi+png_info_def.hist], ebx
|
||||
@@:
|
||||
@ -346,8 +327,7 @@ end if
|
||||
if PNG_WRITE_oFFs_SUPPORTED eq 1
|
||||
mov eax,[esi+png_info_def.valid]
|
||||
and eax,PNG_INFO_oFFs
|
||||
cmp eax,0
|
||||
je @f ;if (..!=0)
|
||||
jz @f ;if (..!=0)
|
||||
movzx ebx,byte[esi+png_info_def.offset_unit_type]
|
||||
stdcall png_write_oFFs, edi, [esi+png_info_def.x_offset], [esi+png_info_def.y_offset], ebx
|
||||
@@:
|
||||
@ -356,8 +336,7 @@ end if
|
||||
if PNG_WRITE_pCAL_SUPPORTED eq 1
|
||||
mov eax,[esi+png_info_def.valid]
|
||||
and eax,PNG_INFO_pCAL
|
||||
cmp eax,0
|
||||
je @f ;if (..!=0)
|
||||
jz @f ;if (..!=0)
|
||||
movzx ebx,byte[esi+png_info_def.pcal_type]
|
||||
movzx ecx,byte[esi+png_info_def.pcal_nparams]
|
||||
stdcall png_write_pCAL, edi, [esi+png_info_def.pcal_purpose], [esi+png_info_def.pcal_X0], [esi+png_info_def.pcal_X1], ebx, ecx, [esi+png_info_def.pcal_units], [esi+png_info_def.pcal_params]
|
||||
@ -367,8 +346,7 @@ end if
|
||||
if PNG_WRITE_sCAL_SUPPORTED eq 1
|
||||
mov eax,[esi+png_info_def.valid]
|
||||
and eax,PNG_INFO_sCAL
|
||||
cmp eax,0
|
||||
je @f ;if (..!=0)
|
||||
jz @f ;if (..!=0)
|
||||
movzx ebx,byte[esi+png_info_def.scal_unit]
|
||||
stdcall png_write_sCAL_s, edi, ebx, [esi+png_info_def.scal_s_width], [esi+png_info_def.scal_s_height]
|
||||
@@:
|
||||
@ -377,8 +355,7 @@ end if ;sCAL
|
||||
if PNG_WRITE_pHYs_SUPPORTED eq 1
|
||||
mov eax,[esi+png_info_def.valid]
|
||||
and eax,PNG_INFO_pHYs
|
||||
cmp eax,0
|
||||
je @f ;if (..!=0)
|
||||
jz @f ;if (..!=0)
|
||||
movzx ebx,byte[esi+png_info_def.phys_unit_type]
|
||||
stdcall png_write_pHYs, edi, [esi+png_info_def.x_pixels_per_unit], [esi+png_info_def.y_pixels_per_unit], ebx
|
||||
@@:
|
||||
@ -387,8 +364,7 @@ end if ;pHYs
|
||||
if PNG_WRITE_tIME_SUPPORTED eq 1
|
||||
mov eax,[esi+png_info_def.valid]
|
||||
and eax,PNG_INFO_tIME
|
||||
cmp eax,0
|
||||
je @f ;if (..!=0)
|
||||
jz @f ;if (..!=0)
|
||||
mov eax,esi
|
||||
add eax,png_info_def.mod_time
|
||||
stdcall png_write_tIME, edi, eax
|
||||
@ -399,8 +375,7 @@ end if ;tIME
|
||||
if PNG_WRITE_sPLT_SUPPORTED eq 1
|
||||
mov eax,[esi+png_info_def.valid]
|
||||
and eax,PNG_INFO_sPLT
|
||||
cmp eax,0
|
||||
je @f ;if (..!=0)
|
||||
jz @f ;if (..!=0)
|
||||
mov eax,[esi+png_info_def.splt_palettes]
|
||||
mov ecx,[esi+png_info_def.splt_palettes_num]
|
||||
cmp ecx,1
|
||||
@ -495,8 +470,7 @@ pushad
|
||||
|
||||
mov eax,[edi+png_struct.mode]
|
||||
and eax,PNG_HAVE_IDAT
|
||||
cmp eax,0
|
||||
jne @f ;if (..==0)
|
||||
jnz @f ;if (..==0)
|
||||
png_error edi, 'No IDATs written into file'
|
||||
@@:
|
||||
|
||||
@ -519,12 +493,10 @@ if PNG_WRITE_tIME_SUPPORTED eq 1
|
||||
; Check to see if user has supplied a time chunk
|
||||
mov eax,[esi+png_info_def.valid]
|
||||
and eax,PNG_INFO_tIME
|
||||
cmp eax,0
|
||||
je @f
|
||||
jz @f
|
||||
mov eax,[edi+png_struct.mode]
|
||||
and eax,PNG_WROTE_tIME
|
||||
cmp eax,0
|
||||
jne @f ;if (..!=0 && ..==0)
|
||||
jnz @f ;if (..!=0 && ..==0)
|
||||
mov eax,esi
|
||||
add eax,png_info_def.mod_time
|
||||
stdcall png_write_tIME, edi, eax
|
||||
@ -652,8 +624,7 @@ proc png_convert_from_time_t, ptime:dword, ttime:dword
|
||||
endp
|
||||
|
||||
; Initialize png_ptr structure, and allocate any memory needed
|
||||
;png_structp (charp user_png_ver, voidp error_ptr,
|
||||
; png_error_ptr error_fn, png_error_ptr warn_fn)
|
||||
;png_structp (charp user_png_ver, voidp error_ptr, png_error_ptr error_fn, png_error_ptr warn_fn)
|
||||
align 4
|
||||
proc png_create_write_struct, user_png_ver:dword, error_ptr:dword, error_fn:dword, warn_fn:dword
|
||||
if PNG_USER_MEM_SUPPORTED eq 1
|
||||
@ -801,8 +772,7 @@ proc png_do_write_intrapixel uses eax ebx ecx edx edi, row_info:dword, row:dword
|
||||
mov ebx,[row_info]
|
||||
movzx eax,byte[ebx+png_row_info.color_type]
|
||||
and eax,PNG_COLOR_MASK_COLOR
|
||||
cmp eax,0
|
||||
je .end_f ;if (..!=0)
|
||||
jz .end_f ;if (..!=0)
|
||||
;edx = bytes_per_pixel
|
||||
mov ecx,[ebx+png_row_info.width] ;ecx = row_width
|
||||
cmp byte[ebx+png_row_info.bit_depth],8 ;if (..==8)
|
||||
@ -904,8 +874,7 @@ png_debug1 1, 'in png_write_row (row %u)',[edi+png_struct.row_number]
|
||||
; Make sure we wrote the header info
|
||||
mov eax,[edi+png_struct.mode]
|
||||
and eax,PNG_WROTE_INFO_BEFORE_PLTE
|
||||
cmp eax,0
|
||||
jne @f ;if(..==0)
|
||||
jnz @f ;if(..==0)
|
||||
png_error edi, 'png_write_info was never called before png_write_row'
|
||||
@@:
|
||||
|
||||
@ -913,8 +882,7 @@ png_debug1 1, 'in png_write_row (row %u)',[edi+png_struct.row_number]
|
||||
if (PNG_WRITE_INVERT_SUPPORTED eq 0) & (PNG_READ_INVERT_SUPPORTED eq 1)
|
||||
mov eax,[edi+png_struct.transformations]
|
||||
and eax,PNG_INVERT_MONO
|
||||
cmp eax,0
|
||||
je @f ;if(..!=0)
|
||||
jz @f ;if(..!=0)
|
||||
png_warning edi, 'PNG_WRITE_INVERT_SUPPORTED is not defined'
|
||||
@@:
|
||||
end if
|
||||
@ -922,8 +890,7 @@ end if
|
||||
if (PNG_WRITE_FILLER_SUPPORTED eq 0) & (PNG_READ_FILLER_SUPPORTED eq 1)
|
||||
mov eax,[edi+png_struct.transformations]
|
||||
and eax,PNG_FILLER
|
||||
cmp eax,0
|
||||
je @f ;if(..!=0)
|
||||
jz @f ;if(..!=0)
|
||||
png_warning edi, 'PNG_WRITE_FILLER_SUPPORTED is not defined'
|
||||
@@:
|
||||
end if
|
||||
@ -931,8 +898,7 @@ end if
|
||||
if (PNG_WRITE_PACKSWAP_SUPPORTED eq 0) & (PNG_READ_PACKSWAP_SUPPORTED eq 1)
|
||||
mov eax,[edi+png_struct.transformations]
|
||||
and eax,PNG_PACKSWAP
|
||||
cmp eax,0
|
||||
je @f ;if(..!=0)
|
||||
jz @f ;if(..!=0)
|
||||
png_warning edi, 'PNG_WRITE_PACKSWAP_SUPPORTED is not defined'
|
||||
@@:
|
||||
end if
|
||||
@ -940,8 +906,7 @@ end if
|
||||
if (PNG_WRITE_PACK_SUPPORTED eq 0) & (PNG_READ_PACK_SUPPORTED eq 1)
|
||||
mov eax,[edi+png_struct.transformations]
|
||||
and eax,PNG_PACK
|
||||
cmp eax,0
|
||||
je @f ;if(..!=0)
|
||||
jz @f ;if(..!=0)
|
||||
png_warning edi, 'PNG_WRITE_PACK_SUPPORTED is not defined'
|
||||
@@:
|
||||
end if
|
||||
@ -949,8 +914,7 @@ end if
|
||||
if (PNG_WRITE_SHIFT_SUPPORTED eq 0) & (PNG_READ_SHIFT_SUPPORTED eq 1)
|
||||
mov eax,[edi+png_struct.transformations]
|
||||
and eax,PNG_SHIFT
|
||||
cmp eax,0
|
||||
je @f ;if(..!=0)
|
||||
jz @f ;if(..!=0)
|
||||
png_warning edi, 'PNG_WRITE_SHIFT_SUPPORTED is not defined'
|
||||
@@:
|
||||
end if
|
||||
@ -958,8 +922,7 @@ end if
|
||||
if (PNG_WRITE_BGR_SUPPORTED eq 0) & (PNG_READ_BGR_SUPPORTED eq 1)
|
||||
mov eax,[edi+png_struct.transformations]
|
||||
and eax,PNG_BGR
|
||||
cmp eax,0
|
||||
je @f ;if(..!=0)
|
||||
jz @f ;if(..!=0)
|
||||
png_warning edi, 'PNG_WRITE_BGR_SUPPORTED is not defined'
|
||||
@@:
|
||||
end if
|
||||
@ -967,8 +930,7 @@ end if
|
||||
if (PNG_WRITE_SWAP_SUPPORTED eq 0) & (PNG_READ_SWAP_SUPPORTED eq 1)
|
||||
mov eax,[edi+png_struct.transformations]
|
||||
and eax,PNG_SWAP_BYTES
|
||||
cmp eax,0
|
||||
je @f ;if(..!=0)
|
||||
jz @f ;if(..!=0)
|
||||
png_warning edi, 'PNG_WRITE_SWAP_SUPPORTED is not defined'
|
||||
@@:
|
||||
end if
|
||||
@ -982,14 +944,12 @@ if PNG_WRITE_INTERLACING_SUPPORTED eq 1
|
||||
je .end1
|
||||
mov eax,[edi+png_struct.transformations]
|
||||
and eax,PNG_INTERLACE
|
||||
cmp eax,0
|
||||
je .end1 ;if(..!=0 && ..!=0)
|
||||
jz .end1 ;if(..!=0 && ..!=0)
|
||||
cmp byte[edi+png_struct.pass],0
|
||||
jne @f
|
||||
mov eax,[edi+png_struct.row_number]
|
||||
and eax,0x07
|
||||
cmp eax,0
|
||||
je .end1 ;if (..!=0)
|
||||
jz .end1 ;if (..!=0)
|
||||
stdcall png_write_finish_row, edi
|
||||
jmp .end_f
|
||||
@@:
|
||||
@ -997,8 +957,7 @@ if PNG_WRITE_INTERLACING_SUPPORTED eq 1
|
||||
jne @f
|
||||
mov eax,[edi+png_struct.row_number]
|
||||
and eax,0x07
|
||||
cmp eax,0
|
||||
jne .end2
|
||||
jnz .end2
|
||||
cmp dword[edi+png_struct.width],5
|
||||
jge .end1 ;if (..!=0 || ..<..)
|
||||
.end2:
|
||||
@ -1018,8 +977,7 @@ if PNG_WRITE_INTERLACING_SUPPORTED eq 1
|
||||
jne @f
|
||||
mov eax,[edi+png_struct.row_number]
|
||||
and eax,0x03
|
||||
cmp eax,0
|
||||
jne .end3
|
||||
jnz .end3
|
||||
cmp dword[edi+png_struct.width],3
|
||||
jge .end1 ;if (..!=0 || ..<..)
|
||||
.end3:
|
||||
@ -1039,8 +997,7 @@ if PNG_WRITE_INTERLACING_SUPPORTED eq 1
|
||||
jne @f
|
||||
mov eax,[edi+png_struct.row_number]
|
||||
and eax,0x01
|
||||
cmp eax,0
|
||||
jne .end4
|
||||
jnz .end4
|
||||
cmp dword[edi+png_struct.width],2
|
||||
jge .end1 ;if (..!=0 || ..<..)
|
||||
.end4:
|
||||
@ -1051,8 +1008,7 @@ if PNG_WRITE_INTERLACING_SUPPORTED eq 1
|
||||
jne .end1
|
||||
mov eax,[edi+png_struct.row_number]
|
||||
and eax,0x01
|
||||
cmp eax,0
|
||||
jne .end1 ;if (..==0)
|
||||
jnz .end1 ;if (..==0)
|
||||
stdcall png_write_finish_row, edi
|
||||
jmp .end_f
|
||||
.end1:
|
||||
@ -1104,8 +1060,7 @@ if PNG_WRITE_INTERLACING_SUPPORTED eq 1
|
||||
jge @f
|
||||
mov eax,[edi+png_struct.transformations]
|
||||
and eax,PNG_INTERLACE
|
||||
cmp eax,0
|
||||
je @f ;if (.. && ..<.. && ..!=0)
|
||||
jz @f ;if (.. && ..<.. && ..!=0)
|
||||
movzx eax,byte[edi+png_struct.pass]
|
||||
push eax
|
||||
mov eax,[edi+png_struct.row_buf]
|
||||
@ -1151,8 +1106,7 @@ if PNG_MNG_FEATURES_SUPPORTED eq 1
|
||||
|
||||
mov eax,[edi+png_struct.mng_features_permitted]
|
||||
and eax,PNG_FLAG_MNG_FILTER_64
|
||||
cmp eax,0
|
||||
je @f
|
||||
jz @f
|
||||
cmp byte[edi+png_struct.filter_type],PNG_INTRAPIXEL_DIFFERENCING
|
||||
jne @f ;if (..!=0 && ..==..)
|
||||
; Intrapixel differencing
|
||||
@ -1240,8 +1194,7 @@ proc png_write_destroy uses eax edi, png_ptr:dword
|
||||
mov edi,[png_ptr]
|
||||
mov eax,[edi+png_struct.flags]
|
||||
and eax,PNG_FLAG_ZSTREAM_INITIALIZED
|
||||
cmp eax,0
|
||||
je @f ;if (..!=0)
|
||||
jz @f ;if (..!=0)
|
||||
mov eax,edi
|
||||
add eax,png_struct.zstream
|
||||
stdcall [deflateEnd], eax
|
||||
@ -1408,8 +1361,7 @@ if PNG_WRITE_FILTER_SUPPORTED eq 1
|
||||
@@:
|
||||
mov eax,[filters]
|
||||
and eax,PNG_FILTER_UP or PNG_FILTER_AVG or PNG_FILTER_PAETH
|
||||
cmp eax,0
|
||||
je @f
|
||||
jz @f
|
||||
cmp dword[edi+png_struct.prev_row],0
|
||||
je @f;if (..!=0 && ..==0)
|
||||
; This is the error case, however it is benign - the previous row
|
||||
@ -1423,26 +1375,22 @@ if PNG_WRITE_FILTER_SUPPORTED eq 1
|
||||
|
||||
mov eax,[filters]
|
||||
and eax,PNG_FILTER_SUB
|
||||
cmp eax,0
|
||||
je @f ;if (..)
|
||||
jz @f ;if (..)
|
||||
inc ebx
|
||||
@@:
|
||||
mov eax,[filters]
|
||||
and eax,PNG_FILTER_UP
|
||||
cmp eax,0
|
||||
je @f ;if (..)
|
||||
jz @f ;if (..)
|
||||
inc ebx
|
||||
@@:
|
||||
mov eax,[filters]
|
||||
and eax,PNG_FILTER_AVG
|
||||
cmp eax,0
|
||||
je @f ;if (..)
|
||||
jz @f ;if (..)
|
||||
inc ebx
|
||||
@@:
|
||||
mov eax,[filters]
|
||||
and eax,PNG_FILTER_PAETH
|
||||
cmp eax,0
|
||||
je @f ;if (..)
|
||||
jz @f ;if (..)
|
||||
inc ebx
|
||||
@@:
|
||||
; Allocate needed row buffers if they have not already been
|
||||
@ -1741,8 +1689,7 @@ pushad
|
||||
; Invert monochrome pixels
|
||||
mov eax,[transforms]
|
||||
and eax,PNG_TRANSFORM_INVERT_MONO
|
||||
cmp eax,0
|
||||
je @f ;if(..!=0)
|
||||
jz @f ;if(..!=0)
|
||||
if PNG_WRITE_INVERT_SUPPORTED eq 1
|
||||
stdcall png_set_invert_mono,edi
|
||||
else
|
||||
@ -1756,13 +1703,11 @@ end if
|
||||
|
||||
mov eax,[transforms]
|
||||
and eax,PNG_TRANSFORM_SHIFT
|
||||
cmp eax,0
|
||||
je @f ;if(..!=0)
|
||||
jz @f ;if(..!=0)
|
||||
if PNG_WRITE_SHIFT_SUPPORTED eq 1
|
||||
mov eax,[esi+png_info_def.valid]
|
||||
and eax,PNG_INFO_sBIT
|
||||
cmp eax,0
|
||||
je @f ;if(..!=0)
|
||||
jz @f ;if(..!=0)
|
||||
mov eax,esi
|
||||
add eax,png_info_def.sig_bit
|
||||
stdcall png_set_shift, edi, eax
|
||||
@ -1775,8 +1720,7 @@ end if
|
||||
; Pack pixels into bytes
|
||||
mov eax,[transforms]
|
||||
and eax,PNG_TRANSFORM_PACKING
|
||||
cmp eax,0
|
||||
je @f ;if(..!=0)
|
||||
jz @f ;if(..!=0)
|
||||
if PNG_WRITE_PACK_SUPPORTED eq 1
|
||||
stdcall png_set_packing, edi
|
||||
else
|
||||
@ -1788,8 +1732,7 @@ end if
|
||||
; Swap location of alpha bytes from ARGB to RGBA
|
||||
mov eax,[transforms]
|
||||
and eax,PNG_TRANSFORM_SWAP_ALPHA
|
||||
cmp eax,0
|
||||
je @f ;if(..!=0)
|
||||
jz @f ;if(..!=0)
|
||||
if PNG_WRITE_SWAP_ALPHA_SUPPORTED eq 1
|
||||
stdcall png_set_swap_alpha, edi
|
||||
else
|
||||
@ -1804,16 +1747,13 @@ end if
|
||||
|
||||
mov eax,[transforms]
|
||||
and eax,PNG_TRANSFORM_STRIP_FILLER_AFTER or PNG_TRANSFORM_STRIP_FILLER_BEFORE
|
||||
cmp eax,0
|
||||
je .end_0 ;if(..!=0)
|
||||
jz .end_0 ;if(..!=0)
|
||||
if PNG_WRITE_FILLER_SUPPORTED eq 1
|
||||
and eax,PNG_TRANSFORM_STRIP_FILLER_AFTER
|
||||
cmp eax,0
|
||||
je .end_1 ;if(..!=0)
|
||||
jz .end_1 ;if(..!=0)
|
||||
mov eax,[transforms]
|
||||
and eax,PNG_TRANSFORM_STRIP_FILLER_BEFORE
|
||||
cmp eax,0
|
||||
je @f ;if(..!=0)
|
||||
jz @f ;if(..!=0)
|
||||
cStr ,'PNG_TRANSFORM_STRIP_FILLER: BEFORE+AFTER not supported'
|
||||
stdcall png_app_error edi, eax
|
||||
@@:
|
||||
@ -1832,8 +1772,7 @@ end if
|
||||
; Flip BGR pixels to RGB
|
||||
mov eax,[transforms]
|
||||
and eax,PNG_TRANSFORM_BGR
|
||||
cmp eax,0
|
||||
je @f ;if(..!=0)
|
||||
jz @f ;if(..!=0)
|
||||
if PNG_WRITE_BGR_SUPPORTED eq 1
|
||||
stdcall png_set_bgr, edi
|
||||
else
|
||||
@ -1845,8 +1784,7 @@ end if
|
||||
; Swap bytes of 16-bit files to most significant byte first
|
||||
mov eax,[transforms]
|
||||
and eax,PNG_TRANSFORM_SWAP_ENDIAN
|
||||
cmp eax,0
|
||||
je @f ;if(..!=0)
|
||||
jz @f ;if(..!=0)
|
||||
if PNG_WRITE_SWAP_SUPPORTED eq 1
|
||||
stdcall png_set_swap, edi
|
||||
else
|
||||
@ -1858,8 +1796,7 @@ end if
|
||||
; Swap bits of 1-bit, 2-bit, 4-bit packed pixel formats
|
||||
mov eax,[transforms]
|
||||
and eax,PNG_TRANSFORM_PACKSWAP
|
||||
cmp eax,0
|
||||
je @f ;if(..!=0)
|
||||
jz @f ;if(..!=0)
|
||||
if PNG_WRITE_PACKSWAP_SUPPORTED eq 1
|
||||
stdcall png_set_packswap, edi
|
||||
else
|
||||
@ -1871,8 +1808,7 @@ end if
|
||||
; Invert the alpha channel from opacity to transparency
|
||||
mov eax,[transforms]
|
||||
and eax,PNG_TRANSFORM_INVERT_ALPHA
|
||||
cmp eax,0
|
||||
je @f ;if(..!=0)
|
||||
jz @f ;if(..!=0)
|
||||
if PNG_WRITE_INVERT_ALPHA_SUPPORTED eq 1
|
||||
stdcall png_set_invert_alpha, edi
|
||||
else
|
||||
@ -2001,11 +1937,10 @@ endl
|
||||
mov ecx,[ebx+png_image_write_control.local_row]
|
||||
mov [output_row],ecx
|
||||
|
||||
mov ecx,1
|
||||
mov eax,[edx+png_image.format]
|
||||
and eax,PNG_FORMAT_FLAG_COLOR
|
||||
mov ecx,1
|
||||
cmp eax,0
|
||||
je @f
|
||||
jz @f
|
||||
mov ecx,3
|
||||
@@:
|
||||
mov [channels],ecx
|
||||
@ -2014,13 +1949,11 @@ endl
|
||||
|
||||
mov eax,[edx+png_image.format]
|
||||
and eax,PNG_FORMAT_FLAG_ALPHA
|
||||
cmp eax,0
|
||||
je .end0 ;if (..!=0)
|
||||
jz .end0 ;if (..!=0)
|
||||
if PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED eq 1
|
||||
mov eax,[edx+png_image.format]
|
||||
and eax,PNG_FORMAT_FLAG_AFIRST
|
||||
cmp eax,0
|
||||
je @f ;if (..!=0)
|
||||
jz @f ;if (..!=0)
|
||||
mov dword[aindex],-1
|
||||
inc dword[input_row] ;To point to the first component
|
||||
inc dword[output_row]
|
||||
@ -2197,11 +2130,10 @@ endl
|
||||
mov ecx,[ebx+png_image_write_control.local_row]
|
||||
mov [output_row],ecx
|
||||
|
||||
mov ecx,1
|
||||
mov eax,[edx+png_image.format]
|
||||
and eax,PNG_FORMAT_FLAG_COLOR
|
||||
mov ecx,1
|
||||
cmp eax,0
|
||||
je @f
|
||||
jz @f
|
||||
mov ecx,3
|
||||
@@:
|
||||
mov [channels],ecx
|
||||
@ -2210,8 +2142,7 @@ endl
|
||||
|
||||
mov eax,[edx+png_image.format]
|
||||
and eax,PNG_FORMAT_FLAG_ALPHA
|
||||
cmp eax,0
|
||||
je .end0 ;if (..!=0)
|
||||
jz .end0 ;if (..!=0)
|
||||
; bytep row_end;
|
||||
; int aindex;
|
||||
|
||||
@ -2345,12 +2276,10 @@ pushad
|
||||
if (PNG_FORMAT_BGR_SUPPORTED eq 1) & (PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED eq 1)
|
||||
mov eax,ecx
|
||||
and eax,PNG_FORMAT_FLAG_AFIRST
|
||||
cmp eax,0
|
||||
je @f
|
||||
jz @f
|
||||
mov eax,ecx
|
||||
and eax,PNG_FORMAT_FLAG_ALPHA
|
||||
cmp eax,0
|
||||
je @f
|
||||
jz @f
|
||||
mov dword[afirst],-1
|
||||
@@:
|
||||
end if
|
||||
@ -2358,8 +2287,7 @@ end if
|
||||
if PNG_FORMAT_BGR_SUPPORTED eq 1
|
||||
mov eax,ecx
|
||||
and eax,PNG_FORMAT_FLAG_BGR
|
||||
cmp eax,0
|
||||
je @f
|
||||
jz @f
|
||||
mov dword[bgr],2
|
||||
@@:
|
||||
end if
|
||||
@ -2604,8 +2532,7 @@ end if
|
||||
; Set the required transforms then write the rows in the correct order.
|
||||
mov eax,[format]
|
||||
and eax,PNG_FORMAT_FLAG_COLORMAP
|
||||
cmp eax,0
|
||||
je .end4 ;if (..!=0)
|
||||
jz .end4 ;if (..!=0)
|
||||
cmp dword[edx+png_image_write_control.colormap],0
|
||||
je .end6
|
||||
mov eax,[ebx+png_image.colormap_entries]
|
||||
@ -2639,14 +2566,12 @@ end if
|
||||
xor ecx,ecx
|
||||
mov eax,[format]
|
||||
and eax,PNG_FORMAT_FLAG_COLOR
|
||||
cmp eax,0
|
||||
je @f
|
||||
jz @f
|
||||
or ecx,PNG_COLOR_MASK_COLOR
|
||||
@@:
|
||||
mov eax,[format]
|
||||
and eax,PNG_FORMAT_FLAG_ALPHA
|
||||
cmp eax,0
|
||||
je @f
|
||||
jz @f
|
||||
or ecx,PNG_COLOR_MASK_ALPHA
|
||||
@@:
|
||||
mov eax,8
|
||||
@ -2670,8 +2595,7 @@ end if
|
||||
|
||||
mov eax,[ebx+png_image.flags]
|
||||
and eax,PNG_IMAGE_FLAG_COLORSPACE_NOT_sRGB
|
||||
cmp eax,0
|
||||
jne @f ;if (..==0)
|
||||
jnz @f ;if (..==0)
|
||||
stdcall png_set_cHRM_fixed, edi, esi,\
|
||||
31270, 32900,\ ;white
|
||||
64000, 33000,\ ;red
|
||||
@ -2681,8 +2605,7 @@ end if
|
||||
@@:
|
||||
mov eax,[ebx+png_image.flags]
|
||||
and eax,PNG_IMAGE_FLAG_COLORSPACE_NOT_sRGB
|
||||
cmp eax,0
|
||||
jne @f ;else if (..==0)
|
||||
jnz @f ;else if (..==0)
|
||||
stdcall png_set_sRGB, edi, esi, PNG_sRGB_INTENT_PERCEPTUAL
|
||||
jmp .end7
|
||||
@@: ;else
|
||||
@ -2710,14 +2633,12 @@ end if
|
||||
if PNG_SIMPLIFIED_WRITE_BGR_SUPPORTED eq 1
|
||||
mov eax,[format]
|
||||
and eax,PNG_FORMAT_FLAG_BGR
|
||||
cmp eax,0
|
||||
je .end12 ;if (..!=0)
|
||||
jz .end12 ;if (..!=0)
|
||||
cmp dword[colormap],0
|
||||
jne @f
|
||||
mov eax,[format]
|
||||
and eax,PNG_FORMAT_FLAG_COLOR
|
||||
cmp eax,0
|
||||
je @f ;if (..==0 && ..!=0)
|
||||
jz @f ;if (..==0 && ..!=0)
|
||||
stdcall png_set_bgr, edi
|
||||
@@:
|
||||
and dword[format], not PNG_FORMAT_FLAG_BGR
|
||||
@ -2727,14 +2648,12 @@ end if
|
||||
if PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED eq 1
|
||||
mov eax,[format]
|
||||
and eax,PNG_FORMAT_FLAG_AFIRST
|
||||
cmp eax,0
|
||||
je .end13 ;if (..!=0)
|
||||
jz .end13 ;if (..!=0)
|
||||
cmp dword[colormap],0
|
||||
jne @f
|
||||
mov eax,[format]
|
||||
and eax,PNG_FORMAT_FLAG_ALPHA
|
||||
cmp eax,0
|
||||
je @f ;if (..==0 && ..!=0)
|
||||
jz @f ;if (..==0 && ..!=0)
|
||||
stdcall png_set_swap_alpha, edi
|
||||
@@:
|
||||
and dword[format], not PNG_FORMAT_FLAG_AFIRST
|
||||
@ -2754,8 +2673,7 @@ end if
|
||||
; That should have handled all (both) the transforms.
|
||||
mov eax,[format]
|
||||
and eax, not (PNG_FORMAT_FLAG_COLOR or PNG_FORMAT_FLAG_LINEAR or PNG_FORMAT_FLAG_ALPHA or PNG_FORMAT_FLAG_COLORMAP)
|
||||
cmp eax,0
|
||||
je @f ;if (..!=0)
|
||||
jz @f ;if (..!=0)
|
||||
png_error edi, 'png_write_image: unsupported transformation'
|
||||
@@:
|
||||
|
||||
@ -2783,8 +2701,7 @@ end if
|
||||
; Apply 'fast' options if the flag is set.
|
||||
mov eax,[ebx+png_image.flags]
|
||||
and eax,PNG_IMAGE_FLAG_FAST
|
||||
cmp eax,0
|
||||
je @f ;if (..!=0)
|
||||
jz @f ;if (..!=0)
|
||||
stdcall png_set_filter, edi, PNG_FILTER_TYPE_BASE, PNG_NO_FILTERS
|
||||
; NOTE: determined by experiment using pngstest, this reflects some
|
||||
; balance between the time to write the image once and the time to read
|
||||
@ -2919,12 +2836,19 @@ align 4
|
||||
mov esi,[width]
|
||||
imul esi,3 ;esi - rowbytes
|
||||
|
||||
inc esi
|
||||
mov edi,[png_ptr]
|
||||
cmp dword[edi+png_struct.try_row],0
|
||||
jne @f ;if (..==0)
|
||||
stdcall png_malloc, edi, esi
|
||||
mov [edi+png_struct.try_row],eax
|
||||
@@:
|
||||
cmp dword[edi+png_struct.tst_row],0
|
||||
jne @f ;if (..==0)
|
||||
stdcall png_malloc, edi, esi
|
||||
mov [edi+png_struct.tst_row],eax
|
||||
@@:
|
||||
dec esi
|
||||
|
||||
mov edi,[buf_f]
|
||||
add edi,[len]
|
||||
@ -2956,22 +2880,47 @@ align 4
|
||||
pop esi
|
||||
mov [mins],ebx
|
||||
|
||||
push edx edi esi
|
||||
push edx
|
||||
mov edx,[png_ptr]
|
||||
mov eax,[edx+png_struct.tst_row]
|
||||
mov byte[eax],0 ;not filter
|
||||
|
||||
; Up filter
|
||||
stdcall png_setup_up_row, edx, esi, [mins]
|
||||
cmp eax,[mins]
|
||||
jge .end2 ;if (..<..)
|
||||
;png_debug 3, '(Up)'
|
||||
mov eax,[edx+png_struct.try_row]
|
||||
cmp eax,0
|
||||
je .end2 ;if (..!=0)
|
||||
mov ecx,esi
|
||||
inc ecx
|
||||
mov esi,eax
|
||||
rep movsb ;copy row
|
||||
.end2:
|
||||
pop esi edi edx
|
||||
jge @f ;if (..<..)
|
||||
mov [mins],eax
|
||||
stdcall copy_row_mins, [edx+png_struct.tst_row], [edx+png_struct.try_row]
|
||||
@@:
|
||||
|
||||
; Find out how many bytes offset each pixel is
|
||||
movzx ebx,byte[edx+png_struct.pixel_depth]
|
||||
add ebx,7
|
||||
shr ebx,3
|
||||
|
||||
; Sub filter
|
||||
stdcall png_setup_sub_row, edx, ebx, esi, [mins]
|
||||
cmp eax,[mins]
|
||||
jge @f ;if (..<..)
|
||||
mov [mins],eax
|
||||
stdcall copy_row_mins, [edx+png_struct.tst_row], [edx+png_struct.try_row]
|
||||
@@:
|
||||
|
||||
; Avg filter
|
||||
stdcall png_setup_avg_row, edx, ebx, esi, [mins]
|
||||
cmp eax,[mins]
|
||||
jge @f ;if (..<..)
|
||||
mov [mins],eax
|
||||
stdcall copy_row_mins, [edx+png_struct.tst_row], [edx+png_struct.try_row]
|
||||
@@:
|
||||
|
||||
; Copy best row
|
||||
mov eax,[edx+png_struct.tst_row]
|
||||
cmp byte[eax],0
|
||||
je @f
|
||||
stdcall copy_row_mins, edi, [edx+png_struct.tst_row]
|
||||
@@:
|
||||
pop edx
|
||||
jmp .cycle3
|
||||
.cycle3end:
|
||||
|
||||
@ -3011,8 +2960,7 @@ end if
|
||||
if PNG_WRITE_OPTIMIZE_CMF_SUPPORTED eq 1
|
||||
mov eax,[edi+png_struct.mode]
|
||||
and eax,PNG_HAVE_IDAT
|
||||
cmp eax,0
|
||||
jne @f
|
||||
jnz @f
|
||||
cmp byte[edi+png_struct.compression_type],PNG_COMPRESSION_TYPE_BASE
|
||||
jne @f ;if (..==0 && ..==..)
|
||||
stdcall png_image_size, edi
|
||||
@ -3034,6 +2982,11 @@ end if
|
||||
stdcall png_free, edi, [edi+png_struct.try_row]
|
||||
mov dword[edi+png_struct.try_row],0
|
||||
@@:
|
||||
cmp dword[edi+png_struct.tst_row],0
|
||||
je @f ;if (..!=0)
|
||||
stdcall png_free, edi, [edi+png_struct.tst_row]
|
||||
mov dword[edi+png_struct.tst_row],0
|
||||
@@:
|
||||
stdcall png_free, edi, [m1]
|
||||
.end0:
|
||||
stdcall png_free, edi, [buf_f]
|
||||
@ -3042,6 +2995,18 @@ popad
|
||||
ret
|
||||
endp
|
||||
|
||||
;input:
|
||||
; esi - rowbytes
|
||||
align 4
|
||||
proc copy_row_mins uses edi esi, dest:dword, sour:dword
|
||||
mov ecx,esi
|
||||
inc ecx
|
||||
mov edi,[dest]
|
||||
mov esi,[sour]
|
||||
rep movsb
|
||||
ret
|
||||
endp
|
||||
|
||||
;void (png_structp png_ptr, bytep/*const*/ data, png_size_t size)
|
||||
align 4
|
||||
proc image_memory_write uses eax ebx ecx edi esi, png_ptr:dword, p2data:dword, size:dword
|
||||
|
@ -501,11 +501,10 @@ proc png_do_write_transformations uses eax ebx edi esi, png_ptr:dword, row_info:
|
||||
if PNG_WRITE_USER_TRANSFORM_SUPPORTED eq 1
|
||||
mov eax,[edi+png_struct.transformations]
|
||||
and eax,PNG_USER_TRANSFORM
|
||||
cmp eax,0
|
||||
je @f ;if (..!=0)
|
||||
jz @f ;if (..!=0)
|
||||
mov eax,[edi+png_struct.write_user_transform_fn]
|
||||
cmp eax,0
|
||||
je @f ;if (..!=0)
|
||||
test eax,eax
|
||||
jz @f ;if (..!=0)
|
||||
stdcall eax, edi, esi, ebx ;User write transform function
|
||||
; row_info:
|
||||
; uint_32 width ;width of row
|
||||
@ -520,8 +519,7 @@ end if
|
||||
if PNG_WRITE_FILLER_SUPPORTED eq 1
|
||||
mov eax,[edi+png_struct.transformations]
|
||||
and eax,PNG_FILLER
|
||||
cmp eax,0
|
||||
je @f ;if (..!=0)
|
||||
jz @f ;if (..!=0)
|
||||
mov eax,[edi+png_struct.flags]
|
||||
and eax,PNG_FLAG_FILLER_AFTER
|
||||
not eax
|
||||
@ -532,8 +530,7 @@ end if
|
||||
if PNG_WRITE_PACKSWAP_SUPPORTED eq 1
|
||||
mov eax,[edi+png_struct.transformations]
|
||||
and eax,PNG_PACKSWAP
|
||||
cmp eax,0
|
||||
je @f ;if (..!=0)
|
||||
jz @f ;if (..!=0)
|
||||
stdcall png_do_packswap, esi, ebx
|
||||
@@:
|
||||
end if
|
||||
@ -541,8 +538,7 @@ end if
|
||||
if PNG_WRITE_PACK_SUPPORTED eq 1
|
||||
mov eax,[edi+png_struct.transformations]
|
||||
and eax,PNG_PACK
|
||||
cmp eax,0
|
||||
je @f ;if (..!=0)
|
||||
jz @f ;if (..!=0)
|
||||
movzx eax,byte[edi+png_struct.bit_depth]
|
||||
stdcall png_do_pack, esi, ebx, eax
|
||||
@@:
|
||||
@ -552,8 +548,7 @@ if PNG_WRITE_SWAP_SUPPORTED eq 1
|
||||
if PNG_16BIT_SUPPORTED eq 1
|
||||
mov eax,[edi+png_struct.transformations]
|
||||
and eax,PNG_SWAP_BYTES
|
||||
cmp eax,0
|
||||
je @f ;if (..!=0)
|
||||
jz @f ;if (..!=0)
|
||||
stdcall png_do_swap, esi, ebx
|
||||
@@:
|
||||
end if
|
||||
@ -562,8 +557,7 @@ end if
|
||||
if PNG_WRITE_SHIFT_SUPPORTED eq 1
|
||||
mov eax,[edi+png_struct.transformations]
|
||||
and eax,PNG_SHIFT
|
||||
cmp eax,0
|
||||
je @f ;if (..!=0)
|
||||
jz @f ;if (..!=0)
|
||||
mov eax,edi
|
||||
add eax,png_struct.shift
|
||||
stdcall png_do_shift, esi, ebx, eax
|
||||
@ -573,8 +567,7 @@ end if
|
||||
if PNG_WRITE_SWAP_ALPHA_SUPPORTED eq 1
|
||||
mov eax,[edi+png_struct.transformations]
|
||||
and eax,PNG_SWAP_ALPHA
|
||||
cmp eax,0
|
||||
je @f ;if (..!=0)
|
||||
jz @f ;if (..!=0)
|
||||
stdcall png_do_write_swap_alpha, esi, ebx
|
||||
@@:
|
||||
end if
|
||||
@ -582,8 +575,7 @@ end if
|
||||
if PNG_WRITE_INVERT_ALPHA_SUPPORTED eq 1
|
||||
mov eax,[edi+png_struct.transformations]
|
||||
and eax,PNG_INVERT_ALPHA
|
||||
cmp eax,0
|
||||
je @f ;if (..!=0)
|
||||
jz @f ;if (..!=0)
|
||||
stdcall png_do_write_invert_alpha, esi, ebx
|
||||
@@:
|
||||
end if
|
||||
@ -591,8 +583,7 @@ end if
|
||||
if PNG_WRITE_BGR_SUPPORTED eq 1
|
||||
mov eax,[edi+png_struct.transformations]
|
||||
and eax,PNG_BGR
|
||||
cmp eax,0
|
||||
je @f ;if (..!=0)
|
||||
jz @f ;if (..!=0)
|
||||
stdcall png_do_bgr, esi, ebx
|
||||
@@:
|
||||
end if
|
||||
@ -600,8 +591,7 @@ end if
|
||||
if PNG_WRITE_INVERT_SUPPORTED eq 1
|
||||
mov eax,[edi+png_struct.transformations]
|
||||
and eax,PNG_INVERT_MONO
|
||||
cmp eax,0
|
||||
je @f ;if (..!=0)
|
||||
jz @f ;if (..!=0)
|
||||
stdcall png_do_invert, esi, ebx
|
||||
@@:
|
||||
end if
|
||||
|
@ -2887,11 +2887,14 @@ endl
|
||||
inc edx
|
||||
.cycle1:
|
||||
lodsb
|
||||
mov ah,byte[ebx]
|
||||
shr ah,1
|
||||
sub al,ah
|
||||
mov ah,byte[edx]
|
||||
shr ah,1
|
||||
shl eax,24
|
||||
movzx ax,byte[ebx]
|
||||
add al,byte[edx]
|
||||
jnc @f
|
||||
mov ah,1
|
||||
@@:
|
||||
shr ax,1
|
||||
rol eax,8
|
||||
sub al,ah
|
||||
stosb
|
||||
png_setup_abs [sum]
|
||||
|
Loading…
Reference in New Issue
Block a user