Subversion Repositories Kolibri OS

Rev

Rev 6881 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1.  
  2. ; pngget.asm - retrieval of values from info struct
  3.  
  4. ; Last changed in libpng 1.6.24 [August 4, 2016]
  5. ; Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
  6. ; (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  7. ; (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  8.  
  9. ; This code is released under the libpng license.
  10. ; For conditions of distribution and use, see the disclaimer
  11. ; and license in png.inc
  12.  
  13.  
  14. ;uint_32 (png_structrp png_ptr, png_inforp info_ptr, uint_32 flag)
  15. align 4
  16. proc png_get_valid, png_ptr:dword, info_ptr:dword, flag:dword
  17.         mov eax,[png_ptr]
  18.         cmp eax,0
  19.         je @f
  20.         mov eax,[info_ptr]
  21.         cmp eax,0
  22.         je @f ;if (..!=0 || ..!=0)
  23.                 mov eax,[eax+png_info_def.valid]
  24.                 and eax,[flag]
  25.         @@:
  26.         ret
  27. endp
  28.  
  29. ;png_size_t (png_structrp png_ptr, png_inforp info_ptr)
  30. align 4
  31. proc png_get_rowbytes, png_ptr:dword, info_ptr:dword
  32.         mov eax,[png_ptr]
  33.         cmp eax,0
  34.         je @f
  35.         mov eax,[info_ptr]
  36.         cmp eax,0
  37.         je @f ;if (..!=0 || ..!=0)
  38.                 mov eax,[eax+png_info_def.rowbytes]
  39.         @@:
  40.         ret
  41. endp
  42.  
  43. ;bytepp (png_structrp png_ptr, png_inforp info_ptr)
  44. align 4
  45. proc png_get_rows, png_ptr:dword, info_ptr:dword
  46.         mov eax,[png_ptr]
  47.         cmp eax,0
  48.         je @f
  49.         mov eax,[info_ptr]
  50.         cmp eax,0
  51.         je @f ;if (..!=0 || ..!=0)
  52.                 mov eax,[eax+png_info_def.row_pointers]
  53.         @@:
  54.         ret
  55. endp
  56.  
  57. ; Easy access to info, added in libpng-0.99
  58. ;uint_32 (png_structrp png_ptr, png_inforp info_ptr)
  59. align 4
  60. proc png_get_image_width, png_ptr:dword, info_ptr:dword
  61.         mov eax,[png_ptr]
  62.         cmp eax,0
  63.         je @f
  64.         mov eax,[info_ptr]
  65.         cmp eax,0
  66.         je @f ;if (..!=0 || ..!=0)
  67.                 mov eax,[eax+png_info_def.width]
  68.         @@:
  69.         ret
  70. endp
  71.  
  72. ;uint_32 (png_structrp png_ptr, png_inforp info_ptr)
  73. align 4
  74. proc png_get_image_height, png_ptr:dword, info_ptr:dword
  75.         mov eax,[png_ptr]
  76.         cmp eax,0
  77.         je @f
  78.         mov eax,[info_ptr]
  79.         cmp eax,0
  80.         je @f ;if (..!=0 || ..!=0)
  81.                 mov eax,[eax+png_info_def.height]
  82.         @@:
  83.         ret
  84. endp
  85.  
  86. ;byte (png_structrp png_ptr, png_inforp info_ptr)
  87. align 4
  88. proc png_get_bit_depth, png_ptr:dword, info_ptr:dword
  89.         mov eax,[png_ptr]
  90.         cmp eax,0
  91.         je @f
  92.         mov eax,[info_ptr]
  93.         cmp eax,0
  94.         je @f ;if (..!=0 || ..!=0)
  95.                 movzx eax,byte[eax+png_info_def.bit_depth]
  96.         @@:
  97.         ret
  98. endp
  99.  
  100. ;byte (png_structrp png_ptr, png_inforp info_ptr)
  101. align 4
  102. proc png_get_color_type, png_ptr:dword, info_ptr:dword
  103.         mov eax,[png_ptr]
  104.         cmp eax,0
  105.         je @f
  106.         mov eax,[info_ptr]
  107.         cmp eax,0
  108.         je @f ;if (..!=0 || ..!=0)
  109.                 movzx eax,byte[eax+png_info_def.color_type]
  110.         @@:
  111.         ret
  112. endp
  113.  
  114. ;byte (png_structrp png_ptr, png_inforp info_ptr)
  115. align 4
  116. proc png_get_filter_type, png_ptr:dword, info_ptr:dword
  117.         mov eax,[png_ptr]
  118.         cmp eax,0
  119.         je @f
  120.         mov eax,[info_ptr]
  121.         cmp eax,0
  122.         je @f ;if (..!=0 || ..!=0)
  123.                 movzx eax,byte[eax+png_info_def.filter_type]
  124.         @@:
  125.         ret
  126. endp
  127.  
  128. ;byte (png_structrp png_ptr, png_inforp info_ptr)
  129. align 4
  130. proc png_get_interlace_type, png_ptr:dword, info_ptr:dword
  131.         mov eax,[png_ptr]
  132.         cmp eax,0
  133.         je @f
  134.         mov eax,[info_ptr]
  135.         cmp eax,0
  136.         je @f ;if (..!=0 || ..!=0)
  137.                 movzx eax,byte[eax+png_info_def.interlace_type]
  138.         @@:
  139.         ret
  140. endp
  141.  
  142. ;byte (png_structrp png_ptr, png_inforp info_ptr)
  143. align 4
  144. proc png_get_compression_type, png_ptr:dword, info_ptr:dword
  145.         mov eax,[png_ptr]
  146.         cmp eax,0
  147.         je @f
  148.         mov eax,[info_ptr]
  149.         cmp eax,0
  150.         je @f ;if (..!=0 || ..!=0)
  151.                 mov eax,[eax+png_info_def.compression_type]
  152.         @@:
  153.         ret
  154. endp
  155.  
  156. ;uint_32 (png_structrp png_ptr, png_inforp info_ptr)
  157. align 4
  158. proc png_get_x_pixels_per_meter, png_ptr:dword, info_ptr:dword
  159. if PNG_pHYs_SUPPORTED eq 1
  160.         mov eax,[png_ptr]
  161.         cmp eax,0
  162.         je @f
  163.         mov esi,[info_ptr]
  164.         cmp esi,0
  165.         je @f
  166.         mov eax,[esi+png_info_def.valid]
  167.         and eax,PNG_INFO_pHYs
  168.         cmp eax,0
  169.         je @f ;if (..!=0 && ..!=0 && ..!=0)
  170.                 png_debug1 1, 'in %s retrieval function', 'png_get_x_pixels_per_meter'
  171.  
  172.                 cmp dword[esi+png_info_def.phys_unit_type],PNG_RESOLUTION_METER
  173.                 jne @f ;if (..==..)
  174.                         mov eax,[esi+png_info_def.x_pixels_per_unit]
  175.                         jmp .end_f
  176.         @@:
  177. end if
  178.         xor eax,eax
  179. .end_f:
  180.         ret
  181. endp
  182.  
  183. ;uint_32 (png_structrp png_ptr, png_inforp info_ptr)
  184. align 4
  185. proc png_get_y_pixels_per_meter, png_ptr:dword, info_ptr:dword
  186. if PNG_pHYs_SUPPORTED eq 1
  187.         mov eax,[png_ptr]
  188.         cmp eax,0
  189.         je @f
  190.         mov esi,[info_ptr]
  191.         cmp esi,0
  192.         je @f
  193.         mov eax,[esi+png_info_def.valid]
  194.         and eax,PNG_INFO_pHYs
  195.         cmp eax,0
  196.         je @f ;if (..!=0 && ..!=0 && ..!=0)
  197.                 png_debug1 1, 'in %s retrieval function', 'png_get_y_pixels_per_meter'
  198.  
  199.                 cmp dword[esi+png_info_def.phys_unit_type],PNG_RESOLUTION_METER
  200.                 jne @f ;if (..==..)
  201.                         mov eax,[esi+png_info_def.y_pixels_per_unit]
  202.                         jmp .end_f
  203.         @@:
  204. end if
  205.         xor eax,eax
  206. .end_f:
  207.         ret
  208. endp
  209.  
  210. ;uint_32 (png_structrp png_ptr, png_inforp info_ptr)
  211. align 4
  212. proc png_get_pixels_per_meter uses esi, png_ptr:dword, info_ptr:dword
  213. if PNG_pHYs_SUPPORTED eq 1
  214.         mov eax,[png_ptr]
  215.         cmp eax,0
  216.         je @f
  217.         mov esi,[info_ptr]
  218.         cmp esi,0
  219.         je @f
  220.         mov eax,[esi+png_info_def.valid]
  221.         and eax,PNG_INFO_pHYs
  222.         cmp eax,0
  223.         je @f ;if (..!=0 && ..!=0 && ..!=0)
  224.                 png_debug1 1, 'in %s retrieval function', 'png_get_pixels_per_meter'
  225.  
  226.                 cmp dword[esi+png_info_def.phys_unit_type],PNG_RESOLUTION_METER
  227.                 jne @f
  228.                 mov eax,[esi+png_info_def.x_pixels_per_unit]
  229.                 cmp eax,[esi+png_info_def.y_pixels_per_unit]
  230.                 jne @f ;if (..==.. && ..==..)
  231.                         jmp .end_f
  232.         @@:
  233. end if
  234.         xor eax,eax
  235. .end_f:
  236.         ret
  237. endp
  238.  
  239. ;float (png_structrp png_ptr, png_inforp info_ptr)
  240. align 4
  241. proc png_get_pixel_aspect_ratio, png_ptr:dword, info_ptr:dword
  242. if PNG_READ_pHYs_SUPPORTED eq 1
  243. ;   if (png_ptr != NULL && info_ptr != NULL &&
  244. ;       (info_ptr->valid & PNG_INFO_pHYs) != 0)
  245. ;   {
  246.                 png_debug1 1, 'in %s retrieval function', 'png_get_aspect_ratio'
  247.  
  248. ;      if (info_ptr->x_pixels_per_unit != 0)
  249. ;         return ((float)((float)info_ptr->y_pixels_per_unit
  250. ;             /(float)info_ptr->x_pixels_per_unit));
  251. ;   }
  252. end if
  253.  
  254. ;   return ((float)0.0);
  255.         ret
  256. endp
  257.  
  258. ;png_fixed_point (png_structrp png_ptr, png_inforp info_ptr)
  259. align 4
  260. proc png_get_pixel_aspect_ratio_fixed, png_ptr:dword, info_ptr:dword
  261. if PNG_READ_pHYs_SUPPORTED eq 1
  262. ;   if (png_ptr != NULL && info_ptr != NULL &&
  263. ;       (info_ptr->valid & PNG_INFO_pHYs) != 0 &&
  264. ;       info_ptr->x_pixels_per_unit > 0 && info_ptr->y_pixels_per_unit > 0 &&
  265. ;       info_ptr->x_pixels_per_unit <= PNG_UINT_31_MAX &&
  266. ;       info_ptr->y_pixels_per_unit <= PNG_UINT_31_MAX)
  267. ;   {
  268. ;      png_fixed_point res;
  269.  
  270.                 png_debug1 1, 'in %s retrieval function', 'png_get_aspect_ratio_fixed'
  271.  
  272.         ; The following casts work because a PNG 4 byte integer only has a valid
  273.         ; range of 0..2^31-1; otherwise the cast might overflow.
  274.  
  275. ;      if (png_muldiv(&res, (int_32)info_ptr->y_pixels_per_unit, PNG_FP_1,
  276. ;          (int_32)info_ptr->x_pixels_per_unit) != 0)
  277. ;         return res;
  278. ;   }
  279. end if
  280.  
  281. ;   return 0;
  282.         ret
  283. endp
  284.  
  285. ;int_32 (png_structrp png_ptr, png_inforp info_ptr)
  286. align 4
  287. proc png_get_x_offset_microns, png_ptr:dword, info_ptr:dword
  288. if PNG_oFFs_SUPPORTED eq 1
  289. ;   if (png_ptr != NULL && info_ptr != NULL &&
  290. ;       (info_ptr->valid & PNG_INFO_oFFs) != 0)
  291. ;   {
  292.                 png_debug1 1, 'in %s retrieval function', 'png_get_x_offset_microns'
  293.  
  294. ;      if (info_ptr->offset_unit_type == PNG_OFFSET_MICROMETER)
  295. ;         return (info_ptr->x_offset);
  296. ;   }
  297. end if
  298.  
  299.         xor eax,eax
  300.         ret
  301. endp
  302.  
  303. ;int_32 (png_structrp png_ptr, png_inforp info_ptr)
  304. align 4
  305. proc png_get_y_offset_microns, png_ptr:dword, info_ptr:dword
  306. if PNG_oFFs_SUPPORTED eq 1
  307. ;   if (png_ptr != NULL && info_ptr != NULL &&
  308. ;       (info_ptr->valid & PNG_INFO_oFFs) != 0)
  309. ;   {
  310.                 png_debug1 1, 'in %s retrieval function', 'png_get_y_offset_microns'
  311.  
  312. ;      if (info_ptr->offset_unit_type == PNG_OFFSET_MICROMETER)
  313. ;         return (info_ptr->y_offset);
  314. ;   }
  315. end if
  316.  
  317.         xor eax,eax
  318.         ret
  319. endp
  320.  
  321. ;int_32 (png_structrp png_ptr, png_inforp info_ptr)
  322. align 4
  323. proc png_get_x_offset_pixels, png_ptr:dword, info_ptr:dword
  324. if PNG_oFFs_SUPPORTED eq 1
  325. ;   if (png_ptr != NULL && info_ptr != NULL &&
  326. ;       (info_ptr->valid & PNG_INFO_oFFs) != 0)
  327. ;   {
  328.                 png_debug1 1, 'in %s retrieval function', 'png_get_x_offset_pixels'
  329.  
  330. ;      if (info_ptr->offset_unit_type == PNG_OFFSET_PIXEL)
  331. ;         return (info_ptr->x_offset);
  332. ;   }
  333. end if
  334.  
  335.         xor eax,eax
  336.         ret
  337. endp
  338.  
  339. ;int_32 (png_structrp png_ptr, png_inforp info_ptr)
  340. align 4
  341. proc png_get_y_offset_pixels, png_ptr:dword, info_ptr:dword
  342. if PNG_oFFs_SUPPORTED eq 1
  343. ;   if (png_ptr != NULL && info_ptr != NULL &&
  344. ;       (info_ptr->valid & PNG_INFO_oFFs) != 0)
  345. ;   {
  346.                 png_debug1 1, 'in %s retrieval function', 'png_get_y_offset_pixels'
  347.  
  348. ;      if (info_ptr->offset_unit_type == PNG_OFFSET_PIXEL)
  349. ;         return (info_ptr->y_offset);
  350. ;   }
  351. end if
  352.  
  353.         xor eax,eax
  354.         ret
  355. endp
  356.  
  357. ;uint_32 (uint_32 ppm)
  358. align 4
  359. proc ppi_from_ppm, ppm:dword
  360. ;#if 0
  361.         ; The conversion is *(2.54/100), in binary (32 digits):
  362.         ; .00000110100000001001110101001001
  363.  
  364. ;   uint_32 t1001, t1101;
  365. ;   ppm >>= 1;                  /* .1 */
  366. ;   t1001 = ppm + (ppm >> 3);   /* .1001 */
  367. ;   t1101 = t1001 + (ppm >> 1); /* .1101 */
  368. ;   ppm >>= 20;                 /* .000000000000000000001 */
  369. ;   t1101 += t1101 >> 15;       /* .1101000000000001101 */
  370. ;   t1001 >>= 11;               /* .000000000001001 */
  371. ;   t1001 += t1001 >> 12;       /* .000000000001001000000001001 */
  372. ;   ppm += t1001;               /* .000000000001001000001001001 */
  373. ;   ppm += t1101;               /* .110100000001001110101001001 */
  374. ;   return (ppm + 16) >> 5;/* .00000110100000001001110101001001 */
  375. ;#else
  376.         ; The argument is a PNG unsigned integer, so it is not permitted
  377.         ; to be bigger than 2^31.
  378.  
  379. ;   png_fixed_point result;
  380. ;   if (ppm <= PNG_UINT_31_MAX && png_muldiv(&result, (int_32)ppm, 127,
  381. ;       5000) != 0)
  382. ;      return result;
  383.  
  384.         ; Overflow.
  385. ;   return 0;
  386. ;end if
  387.         ret
  388. endp
  389.  
  390. ;uint_32 (png_structrp png_ptr, png_inforp info_ptr)
  391. align 4
  392. proc png_get_pixels_per_inch, png_ptr:dword, info_ptr:dword
  393.         stdcall png_get_pixels_per_meter, [png_ptr], [info_ptr]
  394.         stdcall ppi_from_ppm, eax
  395.         ret
  396. endp
  397.  
  398. ;uint_32 (png_structrp png_ptr, png_inforp info_ptr)
  399. align 4
  400. proc png_get_x_pixels_per_inch, png_ptr:dword, info_ptr:dword
  401.         stdcall png_get_x_pixels_per_meter, [png_ptr], [info_ptr]
  402.         stdcall ppi_from_ppm, eax
  403.         ret
  404. endp
  405.  
  406. ;uint_32 (png_structrp png_ptr, png_inforp info_ptr)
  407. align 4
  408. proc png_get_y_pixels_per_inch, png_ptr:dword, info_ptr:dword
  409.         stdcall png_get_y_pixels_per_meter, [png_ptr], [info_ptr]
  410.         stdcall ppi_from_ppm, eax
  411.         ret
  412. endp
  413.  
  414. ;png_fixed_point (png_structrp png_ptr, int_32 microns)
  415. align 4
  416. proc png_fixed_inches_from_microns, png_ptr:dword, microns:dword
  417.         ; Convert from metres * 1,000,000 to inches * 100,000, meters to
  418.         ; inches is simply *(100/2.54), so we want *(10/2.54) == 500/127.
  419.         ; Notice that this can overflow - a warning is output and 0 is
  420.         ; returned.
  421.  
  422.         stdcall png_muldiv_warn, [png_ptr], [microns], 500, 127
  423.         ret
  424. endp
  425.  
  426. ;png_fixed_point (png_structrp png_ptr, png_inforp info_ptr)
  427. align 4
  428. proc png_get_x_offset_inches_fixed, png_ptr:dword, info_ptr:dword
  429.         stdcall png_get_x_offset_microns, [png_ptr], [info_ptr]
  430.         stdcall png_fixed_inches_from_microns, [png_ptr], eax
  431.         ret
  432. endp
  433.  
  434. ;png_fixed_point (png_structrp png_ptr, png_inforp info_ptr)
  435. align 4
  436. proc png_get_y_offset_inches_fixed, png_ptr:dword, info_ptr:dword
  437.         stdcall png_get_y_offset_microns, [png_ptr], [info_ptr]
  438.         stdcall png_fixed_inches_from_microns, [png_ptr], eax
  439.         ret
  440. endp
  441.  
  442. ;float (png_structrp png_ptr, png_inforp info_ptr)
  443. align 4
  444. proc png_get_x_offset_inches, png_ptr:dword, info_ptr:dword
  445.         ; To avoid the overflow do the conversion directly in floating
  446.         ; point.
  447.  
  448. ;   return (float)(png_get_x_offset_microns(png_ptr, info_ptr) * .00003937);
  449.         ret
  450. endp
  451.  
  452. ;float (png_structrp png_ptr, png_inforp info_ptr)
  453. align 4
  454. proc png_get_y_offset_inches, png_ptr:dword, info_ptr:dword
  455.         ; To avoid the overflow do the conversion directly in floating
  456.         ; point.
  457.  
  458. ;   return (float)(png_get_y_offset_microns(png_ptr, info_ptr) * .00003937);
  459.         ret
  460. endp
  461.  
  462. ;uint_32 (png_structrp png_ptr, png_inforp info_ptr,
  463. ;    uint_32 *res_x, uint_32 *res_y, int *unit_type)
  464. align 4
  465. proc png_get_pHYs_dpi, png_ptr:dword, info_ptr:dword, res_x:dword, res_y:dword, unit_type:dword
  466. ;   uint_32 retval = 0;
  467.  
  468. ;   if (png_ptr != NULL && info_ptr != NULL &&
  469. ;       (info_ptr->valid & PNG_INFO_pHYs) != 0)
  470. ;   {
  471.                 png_debug1 1, 'in %s retrieval function', 'pHYs'
  472.  
  473. ;      if (res_x != NULL)
  474. ;      {
  475. ;         *res_x = info_ptr->x_pixels_per_unit;
  476. ;         retval |= PNG_INFO_pHYs;
  477. ;      }
  478.  
  479. ;      if (res_y != NULL)
  480. ;      {
  481. ;         *res_y = info_ptr->y_pixels_per_unit;
  482. ;         retval |= PNG_INFO_pHYs;
  483. ;      }
  484.  
  485. ;      if (unit_type != NULL)
  486. ;      {
  487. ;         *unit_type = (int)info_ptr->phys_unit_type;
  488. ;         retval |= PNG_INFO_pHYs;
  489.  
  490. ;         if (*unit_type == 1)
  491. ;         {
  492. ;            if (res_x != NULL) *res_x = (uint_32)(*res_x * .0254 + .50);
  493. ;            if (res_y != NULL) *res_y = (uint_32)(*res_y * .0254 + .50);
  494. ;         }
  495. ;      }
  496. ;   }
  497.  
  498. ;   return (retval);
  499.         ret
  500. endp
  501.  
  502. ; png_get_channels really belongs in here, too, but it's been around longer
  503.  
  504. ;byte (png_structrp png_ptr, png_inforp info_ptr)
  505. align 4
  506. proc png_get_channels, png_ptr:dword, info_ptr:dword
  507.         mov eax,[png_ptr]
  508.         cmp eax,0
  509.         je @f
  510.         mov eax,[info_ptr]
  511.         cmp eax,0
  512.         je @f ;if (..!=0 || ..!=0)
  513.                 movzx eax,byte[eax+png_info_def.channels]
  514.         @@:
  515.         ret
  516. endp
  517.  
  518. ;bytep (png_structrp png_ptr, png_inforp info_ptr)
  519. align 4
  520. proc png_get_signature, png_ptr:dword, info_ptr:dword
  521.         mov eax,[png_ptr]
  522.         cmp eax,0
  523.         je @f
  524.         mov eax,[info_ptr]
  525.         cmp eax,0
  526.         je @f ;if (..!=0 || ..!=0)
  527.                 movzx eax,byte[eax+png_info_def.signature]
  528.         @@:
  529.         ret
  530. endp
  531.  
  532. ;uint_32 (png_structrp png_ptr, png_inforp info_ptr,
  533. ;    png_color_16p *background)
  534. align 4
  535. proc png_get_bKGD, png_ptr:dword, info_ptr:dword, background:dword
  536. ;   if (png_ptr != NULL && info_ptr != NULL &&
  537. ;       (info_ptr->valid & PNG_INFO_bKGD) != 0 &&
  538. ;       background != NULL)
  539. ;   {
  540.                 png_debug1 1, 'in %s retrieval function', 'bKGD'
  541.  
  542. ;      *background = &(info_ptr->background);
  543. ;      return (PNG_INFO_bKGD);
  544. ;   }
  545.  
  546.         xor eax,eax
  547.         ret
  548. endp
  549.  
  550. ;if PNG_cHRM_SUPPORTED
  551. ; The XYZ APIs were added in 1.5.5 to take advantage of the code added at the
  552. ; same time to correct the rgb grayscale coefficient defaults obtained from the
  553. ; cHRM chunk in 1.5.4
  554.  
  555. ;uint_32 (png_structrp png_ptr, png_inforp info_ptr,
  556. ;    double *white_x, double *white_y, double *red_x, double *red_y,
  557. ;    double *green_x, double *green_y, double *blue_x, double *blue_y)
  558. align 4
  559. proc png_get_cHRM, png_ptr:dword, info_ptr:dword, white_x:dword, white_y:dword, red_x:dword, red_y:dword, green_x:dword, green_y:dword, blue_x:dword, blue_y:dword
  560.         ; Quiet API change: this code used to only return the end points if a cHRM
  561.         ; chunk was present, but the end points can also come from iCCP or sRGB
  562.         ; chunks, so in 1.6.0 the png_get_ APIs return the end points regardless and
  563.         ; the png_set_ APIs merely check that set end points are mutually
  564.         ; consistent.
  565.  
  566. ;   if (png_ptr != NULL && info_ptr != NULL &&
  567. ;      (info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
  568. ;   {
  569.                 png_debug1 1, 'in %s retrieval function', 'cHRM'
  570.  
  571. ;      if (white_x != NULL)
  572. ;         *white_x = png_float(png_ptr,
  573. ;             info_ptr->colorspace.end_points_xy.whitex, "cHRM white X");
  574. ;      if (white_y != NULL)
  575. ;         *white_y = png_float(png_ptr,
  576. ;             info_ptr->colorspace.end_points_xy.whitey, "cHRM white Y");
  577. ;      if (red_x != NULL)
  578. ;         *red_x = png_float(png_ptr, info_ptr->colorspace.end_points_xy.redx,
  579. ;             "cHRM red X");
  580. ;      if (red_y != NULL)
  581. ;         *red_y = png_float(png_ptr, info_ptr->colorspace.end_points_xy.redy,
  582. ;             "cHRM red Y");
  583. ;      if (green_x != NULL)
  584. ;         *green_x = png_float(png_ptr,
  585. ;             info_ptr->colorspace.end_points_xy.greenx, "cHRM green X");
  586. ;      if (green_y != NULL)
  587. ;         *green_y = png_float(png_ptr,
  588. ;             info_ptr->colorspace.end_points_xy.greeny, "cHRM green Y");
  589. ;      if (blue_x != NULL)
  590. ;         *blue_x = png_float(png_ptr, info_ptr->colorspace.end_points_xy.bluex,
  591. ;             "cHRM blue X");
  592. ;      if (blue_y != NULL)
  593. ;         *blue_y = png_float(png_ptr, info_ptr->colorspace.end_points_xy.bluey,
  594. ;             "cHRM blue Y");
  595. ;      return (PNG_INFO_cHRM);
  596. ;   }
  597.  
  598.         xor eax,eax
  599.         ret
  600. endp
  601.  
  602. ;uint_32 (png_structrp png_ptr, png_inforp info_ptr,
  603. ;    double *red_X, double *red_Y, double *red_Z, double *green_X,
  604. ;    double *green_Y, double *green_Z, double *blue_X, double *blue_Y,
  605. ;    double *blue_Z)
  606. align 4
  607. proc png_get_cHRM_XYZ, png_ptr:dword, info_ptr:dword, red_X:dword, red_Y:dword, red_Z:dword, green_X:dword, green_Y:dword, green_Z:dword, blue_X:dword, blue_Y:dword, blue_Z:dword
  608. ;   if (png_ptr != NULL && info_ptr != NULL &&
  609. ;       (info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
  610. ;   {
  611.                 png_debug1 1, 'in %s retrieval function', 'cHRM_XYZ(float)'
  612.  
  613. ;      if (red_X != NULL)
  614. ;         *red_X = png_float(png_ptr, info_ptr->colorspace.end_points_XYZ.red_X,
  615. ;             "cHRM red X");
  616. ;      if (red_Y != NULL)
  617. ;         *red_Y = png_float(png_ptr, info_ptr->colorspace.end_points_XYZ.red_Y,
  618. ;             "cHRM red Y");
  619. ;      if (red_Z != NULL)
  620. ;         *red_Z = png_float(png_ptr, info_ptr->colorspace.end_points_XYZ.red_Z,
  621. ;             "cHRM red Z");
  622. ;      if (green_X != NULL)
  623. ;         *green_X = png_float(png_ptr,
  624. ;             info_ptr->colorspace.end_points_XYZ.green_X, "cHRM green X");
  625. ;      if (green_Y != NULL)
  626. ;         *green_Y = png_float(png_ptr,
  627. ;             info_ptr->colorspace.end_points_XYZ.green_Y, "cHRM green Y");
  628. ;      if (green_Z != NULL)
  629. ;         *green_Z = png_float(png_ptr,
  630. ;             info_ptr->colorspace.end_points_XYZ.green_Z, "cHRM green Z");
  631. ;      if (blue_X != NULL)
  632. ;         *blue_X = png_float(png_ptr,
  633. ;             info_ptr->colorspace.end_points_XYZ.blue_X, "cHRM blue X");
  634. ;      if (blue_Y != NULL)
  635. ;         *blue_Y = png_float(png_ptr,
  636. ;             info_ptr->colorspace.end_points_XYZ.blue_Y, "cHRM blue Y");
  637. ;      if (blue_Z != NULL)
  638. ;         *blue_Z = png_float(png_ptr,
  639. ;             info_ptr->colorspace.end_points_XYZ.blue_Z, "cHRM blue Z");
  640. ;      return (PNG_INFO_cHRM);
  641. ;   }
  642.  
  643.         xor eax,eax
  644.         ret
  645. endp
  646.  
  647. ;uint_32 (png_structrp png_ptr, png_inforp info_ptr,
  648. ;    png_fixed_point *int_red_X, png_fixed_point *int_red_Y,
  649. ;    png_fixed_point *int_red_Z, png_fixed_point *int_green_X,
  650. ;    png_fixed_point *int_green_Y, png_fixed_point *int_green_Z,
  651. ;    png_fixed_point *int_blue_X, png_fixed_point *int_blue_Y,
  652. ;    png_fixed_point *int_blue_Z)
  653. align 4
  654. proc png_get_cHRM_XYZ_fixed, png_ptr:dword, info_ptr:dword, int_red_X:dword, int_red_Y:dword, int_red_Z:dword, int_green_X:dword, int_green_Y:dword, int_green_Z:dword, int_blue_X:dword, int_blue_Y:dword, int_blue_Z:dword
  655. ;   if (png_ptr != NULL && info_ptr != NULL &&
  656. ;      (info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
  657. ;   {
  658.         png_debug1 1, 'in %s retrieval function', 'cHRM_XYZ'
  659.  
  660. ;      if (int_red_X != NULL)
  661. ;         *int_red_X = info_ptr->colorspace.end_points_XYZ.red_X;
  662. ;      if (int_red_Y != NULL)
  663. ;         *int_red_Y = info_ptr->colorspace.end_points_XYZ.red_Y;
  664. ;      if (int_red_Z != NULL)
  665. ;         *int_red_Z = info_ptr->colorspace.end_points_XYZ.red_Z;
  666. ;      if (int_green_X != NULL)
  667. ;         *int_green_X = info_ptr->colorspace.end_points_XYZ.green_X;
  668. ;      if (int_green_Y != NULL)
  669. ;         *int_green_Y = info_ptr->colorspace.end_points_XYZ.green_Y;
  670. ;      if (int_green_Z != NULL)
  671. ;         *int_green_Z = info_ptr->colorspace.end_points_XYZ.green_Z;
  672. ;      if (int_blue_X != NULL)
  673. ;         *int_blue_X = info_ptr->colorspace.end_points_XYZ.blue_X;
  674. ;      if (int_blue_Y != NULL)
  675. ;         *int_blue_Y = info_ptr->colorspace.end_points_XYZ.blue_Y;
  676. ;      if (int_blue_Z != NULL)
  677. ;         *int_blue_Z = info_ptr->colorspace.end_points_XYZ.blue_Z;
  678. ;      return (PNG_INFO_cHRM);
  679. ;   }
  680.  
  681.         xor eax,eax
  682. .end_f:
  683.         ret
  684. endp
  685.  
  686. ;uint_32 (png_structrp png_ptr, png_inforp info_ptr,
  687. ;    png_fixed_point *white_x, png_fixed_point *white_y, png_fixed_point *red_x,
  688. ;    png_fixed_point *red_y, png_fixed_point *green_x, png_fixed_point *green_y,
  689. ;    png_fixed_point *blue_x, png_fixed_point *blue_y)
  690. align 4
  691. proc png_get_cHRM_fixed, png_ptr:dword, info_ptr:dword, white_x:dword, white_y:dword, red_x:dword, red_y:dword, green_x:dword, green_y:dword, blue_x:dword, blue_y:dword
  692.         png_debug1 1, 'in %s retrieval function', 'cHRM'
  693.  
  694. ;   if (png_ptr != NULL && info_ptr != NULL &&
  695. ;      (info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
  696. ;   {
  697. ;      if (white_x != NULL)
  698. ;         *white_x = info_ptr->colorspace.end_points_xy.whitex;
  699. ;      if (white_y != NULL)
  700. ;         *white_y = info_ptr->colorspace.end_points_xy.whitey;
  701. ;      if (red_x != NULL)
  702. ;         *red_x = info_ptr->colorspace.end_points_xy.redx;
  703. ;      if (red_y != NULL)
  704. ;         *red_y = info_ptr->colorspace.end_points_xy.redy;
  705. ;      if (green_x != NULL)
  706. ;         *green_x = info_ptr->colorspace.end_points_xy.greenx;
  707. ;      if (green_y != NULL)
  708. ;         *green_y = info_ptr->colorspace.end_points_xy.greeny;
  709. ;      if (blue_x != NULL)
  710. ;         *blue_x = info_ptr->colorspace.end_points_xy.bluex;
  711. ;      if (blue_y != NULL)
  712. ;         *blue_y = info_ptr->colorspace.end_points_xy.bluey;
  713. ;      return (PNG_INFO_cHRM);
  714. ;   }
  715.  
  716.         xor eax,eax
  717.         ret
  718. endp
  719. ;end if
  720.  
  721. ;uint_32 (png_structrp png_ptr, png_inforp info_ptr,
  722. ;    png_fixed_point *file_gamma)
  723. align 4
  724. proc png_get_gAMA_fixed, png_ptr:dword, info_ptr:dword, file_gamma:dword
  725.         png_debug1 1, 'in %s retrieval function', 'gAMA'
  726.  
  727. ;   if (png_ptr != NULL && info_ptr != NULL &&
  728. ;       (info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_GAMMA) != 0 &&
  729. ;       file_gamma != NULL)
  730. ;   {
  731. ;      *file_gamma = info_ptr->colorspace.gamma;
  732. ;      return (PNG_INFO_gAMA);
  733. ;   }
  734.  
  735.         xor eax,eax
  736.         ret
  737. endp
  738.  
  739. ;uint_32 (png_structrp png_ptr, png_inforp info_ptr, double *file_gamma)
  740. align 4
  741. proc png_get_gAMA, png_ptr:dword, info_ptr:dword, file_gamma:dword
  742.         png_debug1 1, 'in %s retrieval function', 'gAMA(float)'
  743.  
  744. ;   if (png_ptr != NULL && info_ptr != NULL &&
  745. ;      (info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_GAMMA) != 0 &&
  746. ;      file_gamma != NULL)
  747. ;   {
  748. ;      *file_gamma = png_float(png_ptr, info_ptr->colorspace.gamma,
  749. ;          "png_get_gAMA");
  750. ;      return (PNG_INFO_gAMA);
  751. ;   }
  752.  
  753.         xor eax,eax
  754.         ret
  755. endp
  756.  
  757. ;uint_32 (png_structrp png_ptr, png_inforp info_ptr, int *file_srgb_intent)
  758. align 4
  759. proc png_get_sRGB, png_ptr:dword, info_ptr:dword, file_srgb_intent:dword
  760.         png_debug1 1, 'in %s retrieval function', 'sRGB'
  761.  
  762. ;   if (png_ptr != NULL && info_ptr != NULL &&
  763. ;      (info_ptr->valid & PNG_INFO_sRGB) != 0 && file_srgb_intent != NULL)
  764. ;   {
  765. ;      *file_srgb_intent = info_ptr->colorspace.rendering_intent;
  766. ;      return (PNG_INFO_sRGB);
  767. ;   }
  768.  
  769.         xor eax,eax
  770.         ret
  771. endp
  772.  
  773. ;uint_32 (png_structrp png_ptr, png_inforp info_ptr,
  774. ;    png_charpp name, int *compression_type, bytepp profile, uint_32 *proflen)
  775. align 4
  776. proc png_get_iCCP, png_ptr:dword, info_ptr:dword, name:dword, compression_type:dword, profile:dword, proflen:dword
  777.         png_debug1 1, 'in %s retrieval function', 'iCCP'
  778.  
  779. ;   if (png_ptr != NULL && info_ptr != NULL &&
  780. ;       (info_ptr->valid & PNG_INFO_iCCP) != 0 &&
  781. ;       name != NULL && compression_type != NULL && profile != NULL &&
  782. ;           proflen != NULL)
  783. ;   {
  784. ;      *name = info_ptr->iccp_name;
  785. ;      *profile = info_ptr->iccp_profile;
  786. ;      *proflen = png_get_uint_32(info_ptr->iccp_profile);
  787.         ; This is somewhat irrelevant since the profile data returned has
  788.         ; actually been uncompressed.
  789.  
  790. ;      *compression_type = PNG_COMPRESSION_TYPE_BASE;
  791. ;      return (PNG_INFO_iCCP);
  792. ;   }
  793.  
  794.         xor eax,eax
  795.         ret
  796. endp
  797.  
  798. ;int (png_structrp png_ptr, png_inforp info_ptr,
  799. ;    png_sPLT_tpp spalettes)
  800. align 4
  801. proc png_get_sPLT, png_ptr:dword, info_ptr:dword, spalettes:dword
  802. ;   if (png_ptr != NULL && info_ptr != NULL && spalettes != NULL)
  803. ;   {
  804. ;      *spalettes = info_ptr->splt_palettes;
  805. ;      return info_ptr->splt_palettes_num;
  806. ;   }
  807.  
  808.         xor eax,eax
  809.         ret
  810. endp
  811.  
  812. ;uint_32 (png_structrp png_ptr, png_inforp info_ptr,
  813. ;    uint_16p hist)
  814. align 4
  815. proc png_get_hIST, png_ptr:dword, info_ptr:dword, hist:dword
  816.         png_debug1 1, 'in %s retrieval function', 'hIST'
  817.  
  818. ;   if (png_ptr != NULL && info_ptr != NULL &&
  819. ;       (info_ptr->valid & PNG_INFO_hIST) != 0 && hist != NULL)
  820. ;   {
  821. ;      *hist = info_ptr->hist;
  822. ;      return (PNG_INFO_hIST);
  823. ;   }
  824.  
  825.         xor eax,eax
  826.         ret
  827. endp
  828.  
  829. ;uint_32 (png_structrp png_ptr, png_inforp info_ptr,
  830. ;    uint_32 *width, uint_32 *height, int *bit_depth,
  831. ;    int *color_type, int *interlace_type, int *compression_type,
  832. ;    int *filter_type)
  833. align 4
  834. proc png_get_IHDR, png_ptr:dword, info_ptr:dword,\
  835.         width:dword, height:dword, bit_depth:dword, color_type:dword,\
  836.         interlace_type:dword, compression_type:dword, filter_type:dword
  837.         png_debug1 1, 'in %s retrieval function', 'IHDR'
  838.  
  839. ;   if (png_ptr == NULL || info_ptr == NULL)
  840. ;      return (0);
  841.  
  842. ;   if (width != NULL)
  843. ;       *width = info_ptr->width;
  844.  
  845. ;   if (height != NULL)
  846. ;       *height = info_ptr->height;
  847.  
  848. ;   if (bit_depth != NULL)
  849. ;       *bit_depth = info_ptr->bit_depth;
  850.  
  851. ;   if (color_type != NULL)
  852. ;       *color_type = info_ptr->color_type;
  853.  
  854. ;   if (compression_type != NULL)
  855. ;      *compression_type = info_ptr->compression_type;
  856.  
  857. ;   if (filter_type != NULL)
  858. ;      *filter_type = info_ptr->filter_type;
  859.  
  860. ;   if (interlace_type != NULL)
  861. ;      *interlace_type = info_ptr->interlace_type;
  862.  
  863.         ; This is redundant if we can be sure that the info_ptr values were all
  864.         ; assigned in png_set_IHDR().  We do the check anyhow in case an
  865.         ; application has ignored our advice not to mess with the members
  866.         ; of info_ptr directly.
  867.  
  868. ;   png_check_IHDR(png_ptr, info_ptr->width, info_ptr->height,
  869. ;       info_ptr->bit_depth, info_ptr->color_type, info_ptr->interlace_type,
  870. ;       info_ptr->compression_type, info_ptr->filter_type);
  871.  
  872.         xor eax,eax
  873.         inc eax
  874.         ret
  875. endp
  876.  
  877. ;uint_32 (png_structrp png_ptr, png_inforp info_ptr,
  878. ;    int_32 *offset_x, int_32 *offset_y, int *unit_type)
  879. align 4
  880. proc png_get_oFFs, png_ptr:dword, info_ptr:dword, offset_x:dword, offset_y:dword, unit_type:dword
  881.         png_debug1 1, 'in %s retrieval function', 'oFFs'
  882.  
  883. ;   if (png_ptr != NULL && info_ptr != NULL &&
  884. ;       (info_ptr->valid & PNG_INFO_oFFs) != 0 &&
  885. ;       offset_x != NULL && offset_y != NULL && unit_type != NULL)
  886. ;   {
  887. ;      *offset_x = info_ptr->x_offset;
  888. ;      *offset_y = info_ptr->y_offset;
  889. ;      *unit_type = (int)info_ptr->offset_unit_type;
  890. ;      return (PNG_INFO_oFFs);
  891. ;   }
  892.  
  893.         xor eax,eax
  894.         ret
  895. endp
  896.  
  897. ;uint_32 (png_structrp png_ptr, png_inforp info_ptr,
  898. ;    charp *purpose, int_32 *X0, int_32 *X1, int *type, int *nparams,
  899. ;    charp *units, charpp *params)
  900. align 4
  901. proc png_get_pCAL, png_ptr:dword, info_ptr:dword, purpose:dword, X0:dword, X1:dword, type:dword, nparams:dword, units:dword, params:dword
  902.         png_debug1 1, 'in %s retrieval function', 'pCAL'
  903.  
  904. ;   if (png_ptr != NULL && info_ptr != NULL &&
  905. ;       (info_ptr->valid & PNG_INFO_pCAL) != 0 &&
  906. ;       purpose != NULL && X0 != NULL && X1 != NULL && type != NULL &&
  907. ;       nparams != NULL && units != NULL && params != NULL)
  908. ;   {
  909. ;      *purpose = info_ptr->pcal_purpose;
  910. ;      *X0 = info_ptr->pcal_X0;
  911. ;      *X1 = info_ptr->pcal_X1;
  912. ;      *type = (int)info_ptr->pcal_type;
  913. ;      *nparams = (int)info_ptr->pcal_nparams;
  914. ;      *units = info_ptr->pcal_units;
  915. ;      *params = info_ptr->pcal_params;
  916. ;      return (PNG_INFO_pCAL);
  917. ;   }
  918.  
  919.         xor eax,eax
  920.         ret
  921. endp
  922.  
  923. ;uint_32 (png_structrp png_ptr, png_inforp info_ptr,
  924. ;    int *unit, png_fixed_point *width, png_fixed_point *height)
  925. align 4
  926. proc png_get_sCAL_fixed, png_ptr:dword, info_ptr:dword, unit:dword, width:dword, height:dword
  927. ;   if (png_ptr != NULL && info_ptr != NULL &&
  928. ;       (info_ptr->valid & PNG_INFO_sCAL) != 0)
  929. ;   {
  930. ;      *unit = info_ptr->scal_unit;
  931.         ;TODO: make this work without FP support; the API is currently eliminated
  932.         ; if neither floating point APIs nor internal floating point arithmetic
  933.         ; are enabled.
  934.  
  935. ;      *width = png_fixed(png_ptr, atof(info_ptr->scal_s_width), "sCAL width");
  936. ;      *height = png_fixed(png_ptr, atof(info_ptr->scal_s_height),
  937. ;          "sCAL height");
  938. ;      return (PNG_INFO_sCAL);
  939. ;   }
  940.  
  941. ;   return(0);
  942.         ret
  943. endp
  944.  
  945. ;uint_32 (png_structrp png_ptr, png_inforp info_ptr,
  946. ;    int *unit, double *width, double *height)
  947. align 4
  948. proc png_get_sCAL, png_ptr:dword, info_ptr:dword, unit:dword, width:dword, height:dword
  949. ;   if (png_ptr != NULL && info_ptr != NULL &&
  950. ;       (info_ptr->valid & PNG_INFO_sCAL) != 0)
  951. ;   {
  952. ;      *unit = info_ptr->scal_unit;
  953. ;      *width = atof(info_ptr->scal_s_width);
  954. ;      *height = atof(info_ptr->scal_s_height);
  955. ;      return (PNG_INFO_sCAL);
  956. ;   }
  957.  
  958. ;   return(0);
  959.         ret
  960. endp
  961.  
  962. ;uint_32 (png_structrp png_ptr, png_inforp info_ptr,
  963. ;    int *unit, charpp width, charpp height)
  964. align 4
  965. proc png_get_sCAL_s, png_ptr:dword, info_ptr:dword, unit:dword, width:dword, height:dword
  966. ;   if (png_ptr != NULL && info_ptr != NULL &&
  967. ;       (info_ptr->valid & PNG_INFO_sCAL) != 0)
  968. ;   {
  969. ;      *unit = info_ptr->scal_unit;
  970. ;      *width = info_ptr->scal_s_width;
  971. ;      *height = info_ptr->scal_s_height;
  972. ;      return (PNG_INFO_sCAL);
  973. ;   }
  974.  
  975.         xor eax,eax
  976. .end_f:
  977.         ret
  978. endp
  979.  
  980. ;uint_32 (png_structrp png_ptr, png_inforp info_ptr,
  981. ;    uint_32 *res_x, uint_32 *res_y, int *unit_type)
  982. align 4
  983. proc png_get_pHYs, png_ptr:dword, info_ptr:dword, res_x:dword, res_y:dword, unit_type:dword
  984. ;   uint_32 retval = 0;
  985.  
  986.         png_debug1 1, 'in %s retrieval function', 'pHYs'
  987.  
  988. ;   if (png_ptr != NULL && info_ptr != NULL &&
  989. ;       (info_ptr->valid & PNG_INFO_pHYs) != 0)
  990. ;   {
  991. ;      if (res_x != NULL)
  992. ;      {
  993. ;         *res_x = info_ptr->x_pixels_per_unit;
  994. ;         retval |= PNG_INFO_pHYs;
  995. ;      }
  996.  
  997. ;      if (res_y != NULL)
  998. ;      {
  999. ;         *res_y = info_ptr->y_pixels_per_unit;
  1000. ;         retval |= PNG_INFO_pHYs;
  1001. ;      }
  1002.  
  1003. ;      if (unit_type != NULL)
  1004. ;      {
  1005. ;         *unit_type = (int)info_ptr->phys_unit_type;
  1006. ;         retval |= PNG_INFO_pHYs;
  1007. ;      }
  1008. ;   }
  1009.  
  1010. ;   return (retval);
  1011.         ret
  1012. endp
  1013.  
  1014. ;uint_32 (png_structrp png_ptr, png_inforp info_ptr,
  1015. ;    png_colorp *palette, int *num_palette)
  1016. align 4
  1017. proc png_get_PLTE, png_ptr:dword, info_ptr:dword, palette:dword, num_palette:dword
  1018.         png_debug1 1, 'in %s retrieval function', 'PLTE'
  1019.  
  1020. ;   if (png_ptr != NULL && info_ptr != NULL &&
  1021. ;       (info_ptr->valid & PNG_INFO_PLTE) != 0 && palette != NULL)
  1022. ;   {
  1023. ;      *palette = info_ptr->palette;
  1024. ;      *num_palette = info_ptr->num_palette;
  1025. ;      png_debug1(3, "num_palette = %d", *num_palette);
  1026. ;      return (PNG_INFO_PLTE);
  1027. ;   }
  1028.  
  1029.         xor eax,eax
  1030.         ret
  1031. endp
  1032.  
  1033. ;uint_32 (png_structrp png_ptr, png_inforp info_ptr, png_color_8p *sig_bit)
  1034. align 4
  1035. proc png_get_sBIT, png_ptr:dword, info_ptr:dword, sig_bit:dword
  1036.         png_debug1 1, 'in %s retrieval function', 'sBIT'
  1037.  
  1038. ;   if (png_ptr != NULL && info_ptr != NULL &&
  1039. ;       (info_ptr->valid & PNG_INFO_sBIT) != 0 && sig_bit != NULL)
  1040. ;   {
  1041. ;      *sig_bit = &(info_ptr->sig_bit);
  1042. ;      return (PNG_INFO_sBIT);
  1043. ;   }
  1044.  
  1045.         xor eax,eax
  1046.         ret
  1047. endp
  1048.  
  1049. ;int (png_structrp png_ptr, png_inforp info_ptr, png_textp *text_ptr, int *num_text)
  1050. align 4
  1051. proc png_get_text, png_ptr:dword, info_ptr:dword, text_ptr:dword, num_text:dword
  1052. ;   if (png_ptr != NULL && info_ptr != NULL && info_ptr->num_text > 0)
  1053. ;   {
  1054. ;      png_debug1(1, "in 0x%lx retrieval function",
  1055. ;         (unsigned long)png_ptr->chunk_name);
  1056.  
  1057. ;      if (text_ptr != NULL)
  1058. ;         *text_ptr = info_ptr->text;
  1059.  
  1060. ;      if (num_text != NULL)
  1061. ;         *num_text = info_ptr->num_text;
  1062.  
  1063. ;      return info_ptr->num_text;
  1064. ;   }
  1065.  
  1066. ;   if (num_text != NULL)
  1067. ;      *num_text = 0;
  1068.  
  1069. ;   return(0);
  1070.         ret
  1071. endp
  1072.  
  1073. ;uint_32 (png_structrp png_ptr, png_inforp info_ptr,
  1074. ;    png_timep *mod_time)
  1075. align 4
  1076. proc png_get_tIME, png_ptr:dword, info_ptr:dword, mod_time:dword
  1077.         png_debug1 1, 'in %s retrieval function', 'tIME'
  1078.  
  1079. ;   if (png_ptr != NULL && info_ptr != NULL &&
  1080. ;       (info_ptr->valid & PNG_INFO_tIME) != 0 && mod_time != NULL)
  1081. ;   {
  1082. ;      *mod_time = &(info_ptr->mod_time);
  1083. ;      return (PNG_INFO_tIME);
  1084. ;   }
  1085.  
  1086.         xor eax,eax
  1087.         ret
  1088. endp
  1089.  
  1090. ;uint_32 (png_structrp png_ptr, png_inforp info_ptr,
  1091. ;    bytep *trans_alpha, int *num_trans, png_color_16p *trans_color)
  1092. align 4
  1093. proc png_get_tRNS, png_ptr:dword, info_ptr:dword, trans_alpha:dword, num_trans:dword, trans_color:dword
  1094. ;   uint_32 retval = 0;
  1095. ;   if (png_ptr != NULL && info_ptr != NULL &&
  1096. ;       (info_ptr->valid & PNG_INFO_tRNS) != 0)
  1097. ;   {
  1098.                 png_debug1 1, 'in %s retrieval function', 'tRNS'
  1099.  
  1100. ;      if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
  1101. ;      {
  1102. ;         if (trans_alpha != NULL)
  1103. ;         {
  1104. ;            *trans_alpha = info_ptr->trans_alpha;
  1105. ;            retval |= PNG_INFO_tRNS;
  1106. ;         }
  1107.  
  1108. ;         if (trans_color != NULL)
  1109. ;            *trans_color = &(info_ptr->trans_color);
  1110. ;      }
  1111.  
  1112. ;      else /* if (info_ptr->color_type != PNG_COLOR_TYPE_PALETTE) */
  1113. ;      {
  1114. ;         if (trans_color != NULL)
  1115. ;         {
  1116. ;            *trans_color = &(info_ptr->trans_color);
  1117. ;            retval |= PNG_INFO_tRNS;
  1118. ;         }
  1119.  
  1120. ;         if (trans_alpha != NULL)
  1121. ;            *trans_alpha = NULL;
  1122. ;      }
  1123.  
  1124. ;      if (num_trans != NULL)
  1125. ;      {
  1126. ;         *num_trans = info_ptr->num_trans;
  1127. ;         retval |= PNG_INFO_tRNS;
  1128. ;      }
  1129. ;   }
  1130.  
  1131. ;   return (retval);
  1132.         ret
  1133. endp
  1134.  
  1135. ;int (png_structrp png_ptr, png_inforp info_ptr,
  1136. ;    png_unknown_chunkpp unknowns)
  1137. align 4
  1138. proc png_get_unknown_chunks, png_ptr:dword, info_ptr:dword, unknowns:dword
  1139. ;   if (png_ptr != NULL && info_ptr != NULL && unknowns != NULL)
  1140. ;   {
  1141. ;      *unknowns = info_ptr->unknown_chunks;
  1142. ;      return info_ptr->unknown_chunks_num;
  1143. ;   }
  1144.  
  1145.         xor eax,eax
  1146.         ret
  1147. endp
  1148.  
  1149. ;byte (png_structrp png_ptr)
  1150. align 4
  1151. proc png_get_rgb_to_gray_status, png_ptr:dword
  1152.         mov eax,[png_ptr]
  1153.         cmp eax,0
  1154.         je @f
  1155.                 mov eax,[eax+png_struct.rgb_to_gray_status]
  1156.         @@:
  1157.         ret
  1158. endp
  1159.  
  1160. ;voidp (png_structrp png_ptr)
  1161. align 4
  1162. proc png_get_user_chunk_ptr, png_ptr:dword
  1163.         mov eax,[png_ptr]
  1164.         cmp eax,0
  1165.         je @f
  1166.                 mov eax,[eax+png_struct.user_chunk_ptr]
  1167.         @@:
  1168.         ret
  1169. endp
  1170.  
  1171. ;png_size_t (png_structrp png_ptr)
  1172. align 4
  1173. proc png_get_compression_buffer_size uses ebx, png_ptr:dword
  1174.         mov eax,[png_ptr]
  1175.         cmp eax,0
  1176.         je .end_f ;if (..==0) return 0
  1177.  
  1178. if PNG_WRITE_SUPPORTED eq 1
  1179.         mov ebx,[eax+png_struct.mode]
  1180.         and ebx,PNG_IS_READ_STRUCT
  1181.         cmp ebx,0
  1182. ;   if (..!=0)
  1183. end if
  1184. ;   {
  1185. if PNG_SEQUENTIAL_READ_SUPPORTED eq 1
  1186. ;      return png_ptr->IDAT_read_size;
  1187. else
  1188.                 mov eax,PNG_IDAT_READ_SIZE
  1189.                 jmp .end_f
  1190. end if
  1191. ;   }
  1192.  
  1193. if PNG_WRITE_SUPPORTED eq 1
  1194. ;   else
  1195. ;      return png_ptr->zbuffer_size;
  1196. end if
  1197. .end_f:
  1198.         ret
  1199. endp
  1200.  
  1201. ; These functions were added to libpng 1.2.6 and were enabled
  1202. ; by default in libpng-1.4.0
  1203. ;uint_32 (png_structrp png_ptr)
  1204. align 4
  1205. proc png_get_user_width_max, png_ptr:dword
  1206.         mov eax,[png_ptr]
  1207.         cmp eax,0
  1208.         je @f
  1209.                 mov eax,[eax+png_struct.user_width_max]
  1210.         @@:
  1211.         ret
  1212. endp
  1213.  
  1214. ;uint_32 (png_structrp png_ptr)
  1215. align 4
  1216. proc png_get_user_height_max, png_ptr:dword
  1217.         mov eax,[png_ptr]
  1218.         cmp eax,0
  1219.         je @f
  1220.                 mov eax,[eax+png_struct.user_height_max]
  1221.         @@:
  1222.         ret
  1223. endp
  1224.  
  1225. ; This function was added to libpng 1.4.0
  1226. ;uint_32 (png_structrp png_ptr)
  1227. align 4
  1228. proc png_get_chunk_cache_max, png_ptr:dword
  1229.         mov eax,[png_ptr]
  1230.         cmp eax,0
  1231.         je @f
  1232.                 mov eax,[eax+png_struct.user_chunk_cache_max]
  1233.         @@:
  1234.         ret
  1235. endp
  1236.  
  1237. ; This function was added to libpng 1.4.1
  1238. ;png_alloc_size_t (png_structrp png_ptr)
  1239. align 4
  1240. proc png_get_chunk_malloc_max, png_ptr:dword
  1241.         mov eax,[png_ptr]
  1242.         cmp eax,0
  1243.         je @f
  1244.                 mov eax,[eax+png_struct.user_chunk_malloc_max]
  1245.         @@:
  1246.         ret
  1247. endp
  1248.  
  1249. ; These functions were added to libpng 1.4.0
  1250. ;uint_32 (png_structrp png_ptr)
  1251. align 4
  1252. proc png_get_io_state, png_ptr:dword
  1253.         mov eax,[png_ptr]
  1254.         mov eax,[eax+png_struct.io_state]
  1255.         ret
  1256. endp
  1257.  
  1258. ;uint_32 (png_structrp png_ptr)
  1259. align 4
  1260. proc png_get_io_chunk_type, png_ptr:dword
  1261.         mov eax,[png_ptr]
  1262.         mov eax,[eax+png_struct.chunk_name]
  1263.         ret
  1264. endp
  1265.  
  1266. ;int (png_const_structp png_ptr, png_const_infop info_ptr)
  1267. align 4
  1268. proc png_get_palette_max, png_ptr:dword, info_ptr:dword
  1269.         mov eax,[png_ptr]
  1270.         cmp eax,0
  1271.         je @f
  1272.         cmp dword[info_ptr],0
  1273.         je @f ;if (..!=0 && ..!=0)
  1274.                 mov eax,[eax+png_struct.num_palette_max]
  1275.                 jmp .end_f
  1276.         @@:
  1277.         xor eax,eax
  1278.         dec eax
  1279. .end_f:
  1280.         ret
  1281. endp
  1282.  
  1283.