laag-libpng 1.6.34.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (452) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +57 -0
  3. data/LICENSE.txt +133 -0
  4. data/README.org +34 -0
  5. data/ext/laag/libpng/extconf.rb +13 -0
  6. data/laag-libpng.gemspec +20 -0
  7. data/lib/laag/libpng.rb +29 -0
  8. data/vendor/git.code.sf.net/p/libpng/code/ANNOUNCE +35 -0
  9. data/vendor/git.code.sf.net/p/libpng/code/CHANGES +6051 -0
  10. data/vendor/git.code.sf.net/p/libpng/code/CMakeLists.txt +945 -0
  11. data/vendor/git.code.sf.net/p/libpng/code/INSTALL +465 -0
  12. data/vendor/git.code.sf.net/p/libpng/code/LICENSE +133 -0
  13. data/vendor/git.code.sf.net/p/libpng/code/Makefile.am +392 -0
  14. data/vendor/git.code.sf.net/p/libpng/code/README +222 -0
  15. data/vendor/git.code.sf.net/p/libpng/code/TODO +30 -0
  16. data/vendor/git.code.sf.net/p/libpng/code/arm/arm_init.c +135 -0
  17. data/vendor/git.code.sf.net/p/libpng/code/arm/filter_neon.S +253 -0
  18. data/vendor/git.code.sf.net/p/libpng/code/arm/filter_neon_intrinsics.c +387 -0
  19. data/vendor/git.code.sf.net/p/libpng/code/autogen.sh +225 -0
  20. data/vendor/git.code.sf.net/p/libpng/code/configure.ac +533 -0
  21. data/vendor/git.code.sf.net/p/libpng/code/contrib/README.txt +5 -0
  22. data/vendor/git.code.sf.net/p/libpng/code/contrib/arm-neon/README +83 -0
  23. data/vendor/git.code.sf.net/p/libpng/code/contrib/arm-neon/android-ndk.c +39 -0
  24. data/vendor/git.code.sf.net/p/libpng/code/contrib/arm-neon/linux-auxv.c +120 -0
  25. data/vendor/git.code.sf.net/p/libpng/code/contrib/arm-neon/linux.c +161 -0
  26. data/vendor/git.code.sf.net/p/libpng/code/contrib/conftest/README +49 -0
  27. data/vendor/git.code.sf.net/p/libpng/code/contrib/conftest/pngcp.dfa +57 -0
  28. data/vendor/git.code.sf.net/p/libpng/code/contrib/conftest/read.dfa +58 -0
  29. data/vendor/git.code.sf.net/p/libpng/code/contrib/conftest/s_read.dfa +35 -0
  30. data/vendor/git.code.sf.net/p/libpng/code/contrib/conftest/s_write.dfa +33 -0
  31. data/vendor/git.code.sf.net/p/libpng/code/contrib/conftest/simple.dfa +36 -0
  32. data/vendor/git.code.sf.net/p/libpng/code/contrib/conftest/write.dfa +45 -0
  33. data/vendor/git.code.sf.net/p/libpng/code/contrib/examples/README.txt +24 -0
  34. data/vendor/git.code.sf.net/p/libpng/code/contrib/examples/iccfrompng.c +185 -0
  35. data/vendor/git.code.sf.net/p/libpng/code/contrib/examples/pngpixel.c +371 -0
  36. data/vendor/git.code.sf.net/p/libpng/code/contrib/examples/pngtopng.c +98 -0
  37. data/vendor/git.code.sf.net/p/libpng/code/contrib/examples/simpleover.c +648 -0
  38. data/vendor/git.code.sf.net/p/libpng/code/contrib/gregbook/COPYING +340 -0
  39. data/vendor/git.code.sf.net/p/libpng/code/contrib/gregbook/LICENSE +50 -0
  40. data/vendor/git.code.sf.net/p/libpng/code/contrib/gregbook/Makefile.mingw32 +131 -0
  41. data/vendor/git.code.sf.net/p/libpng/code/contrib/gregbook/Makefile.sgi +105 -0
  42. data/vendor/git.code.sf.net/p/libpng/code/contrib/gregbook/Makefile.unx +134 -0
  43. data/vendor/git.code.sf.net/p/libpng/code/contrib/gregbook/Makefile.w32 +114 -0
  44. data/vendor/git.code.sf.net/p/libpng/code/contrib/gregbook/README +186 -0
  45. data/vendor/git.code.sf.net/p/libpng/code/contrib/gregbook/makevms.com +132 -0
  46. data/vendor/git.code.sf.net/p/libpng/code/contrib/gregbook/readpng.c +323 -0
  47. data/vendor/git.code.sf.net/p/libpng/code/contrib/gregbook/readpng.h +88 -0
  48. data/vendor/git.code.sf.net/p/libpng/code/contrib/gregbook/readpng2.c +521 -0
  49. data/vendor/git.code.sf.net/p/libpng/code/contrib/gregbook/readpng2.h +116 -0
  50. data/vendor/git.code.sf.net/p/libpng/code/contrib/gregbook/readppm.c +188 -0
  51. data/vendor/git.code.sf.net/p/libpng/code/contrib/gregbook/rpng-win.c +735 -0
  52. data/vendor/git.code.sf.net/p/libpng/code/contrib/gregbook/rpng-x.c +911 -0
  53. data/vendor/git.code.sf.net/p/libpng/code/contrib/gregbook/rpng2-win.c +1261 -0
  54. data/vendor/git.code.sf.net/p/libpng/code/contrib/gregbook/rpng2-x.c +2143 -0
  55. data/vendor/git.code.sf.net/p/libpng/code/contrib/gregbook/toucan.png +0 -0
  56. data/vendor/git.code.sf.net/p/libpng/code/contrib/gregbook/wpng.c +865 -0
  57. data/vendor/git.code.sf.net/p/libpng/code/contrib/gregbook/writepng.c +401 -0
  58. data/vendor/git.code.sf.net/p/libpng/code/contrib/gregbook/writepng.h +133 -0
  59. data/vendor/git.code.sf.net/p/libpng/code/contrib/libtests/fakepng.c +65 -0
  60. data/vendor/git.code.sf.net/p/libpng/code/contrib/libtests/gentests.sh +102 -0
  61. data/vendor/git.code.sf.net/p/libpng/code/contrib/libtests/makepng.c +1941 -0
  62. data/vendor/git.code.sf.net/p/libpng/code/contrib/libtests/pngimage.c +1712 -0
  63. data/vendor/git.code.sf.net/p/libpng/code/contrib/libtests/pngstest-errors.h +165 -0
  64. data/vendor/git.code.sf.net/p/libpng/code/contrib/libtests/pngstest.c +3829 -0
  65. data/vendor/git.code.sf.net/p/libpng/code/contrib/libtests/pngunknown.c +1294 -0
  66. data/vendor/git.code.sf.net/p/libpng/code/contrib/libtests/pngvalid.c +12230 -0
  67. data/vendor/git.code.sf.net/p/libpng/code/contrib/libtests/readpng.c +115 -0
  68. data/vendor/git.code.sf.net/p/libpng/code/contrib/libtests/tarith.c +999 -0
  69. data/vendor/git.code.sf.net/p/libpng/code/contrib/libtests/timepng.c +608 -0
  70. data/vendor/git.code.sf.net/p/libpng/code/contrib/mips-msa/README +83 -0
  71. data/vendor/git.code.sf.net/p/libpng/code/contrib/mips-msa/linux.c +64 -0
  72. data/vendor/git.code.sf.net/p/libpng/code/contrib/oss-fuzz/Dockerfile +24 -0
  73. data/vendor/git.code.sf.net/p/libpng/code/contrib/oss-fuzz/README.txt +37 -0
  74. data/vendor/git.code.sf.net/p/libpng/code/contrib/oss-fuzz/build.sh +50 -0
  75. data/vendor/git.code.sf.net/p/libpng/code/contrib/oss-fuzz/libpng_read_fuzzer.cc +180 -0
  76. data/vendor/git.code.sf.net/p/libpng/code/contrib/oss-fuzz/libpng_read_fuzzer.options +2 -0
  77. data/vendor/git.code.sf.net/p/libpng/code/contrib/oss-fuzz/newcc +190 -0
  78. data/vendor/git.code.sf.net/p/libpng/code/contrib/oss-fuzz/png.dict +39 -0
  79. data/vendor/git.code.sf.net/p/libpng/code/contrib/pngminim/README +5 -0
  80. data/vendor/git.code.sf.net/p/libpng/code/contrib/pngminim/decoder/README +10 -0
  81. data/vendor/git.code.sf.net/p/libpng/code/contrib/pngminim/decoder/makefile +151 -0
  82. data/vendor/git.code.sf.net/p/libpng/code/contrib/pngminim/decoder/pngusr.dfa +40 -0
  83. data/vendor/git.code.sf.net/p/libpng/code/contrib/pngminim/decoder/pngusr.h +23 -0
  84. data/vendor/git.code.sf.net/p/libpng/code/contrib/pngminim/encoder/README +10 -0
  85. data/vendor/git.code.sf.net/p/libpng/code/contrib/pngminim/encoder/makefile +150 -0
  86. data/vendor/git.code.sf.net/p/libpng/code/contrib/pngminim/encoder/pngusr.dfa +39 -0
  87. data/vendor/git.code.sf.net/p/libpng/code/contrib/pngminim/encoder/pngusr.h +23 -0
  88. data/vendor/git.code.sf.net/p/libpng/code/contrib/pngminim/preader/README +15 -0
  89. data/vendor/git.code.sf.net/p/libpng/code/contrib/pngminim/preader/makefile +166 -0
  90. data/vendor/git.code.sf.net/p/libpng/code/contrib/pngminim/preader/pngusr.dfa +40 -0
  91. data/vendor/git.code.sf.net/p/libpng/code/contrib/pngminim/preader/pngusr.h +23 -0
  92. data/vendor/git.code.sf.net/p/libpng/code/contrib/pngminus/README +153 -0
  93. data/vendor/git.code.sf.net/p/libpng/code/contrib/pngminus/makefile.std +66 -0
  94. data/vendor/git.code.sf.net/p/libpng/code/contrib/pngminus/makefile.tc3 +38 -0
  95. data/vendor/git.code.sf.net/p/libpng/code/contrib/pngminus/makevms.com +92 -0
  96. data/vendor/git.code.sf.net/p/libpng/code/contrib/pngminus/png2pnm.bat +41 -0
  97. data/vendor/git.code.sf.net/p/libpng/code/contrib/pngminus/png2pnm.c +460 -0
  98. data/vendor/git.code.sf.net/p/libpng/code/contrib/pngminus/png2pnm.sh +42 -0
  99. data/vendor/git.code.sf.net/p/libpng/code/contrib/pngminus/pngminus.bat +4 -0
  100. data/vendor/git.code.sf.net/p/libpng/code/contrib/pngminus/pngminus.sh +5 -0
  101. data/vendor/git.code.sf.net/p/libpng/code/contrib/pngminus/pnm2png.bat +41 -0
  102. data/vendor/git.code.sf.net/p/libpng/code/contrib/pngminus/pnm2png.c +638 -0
  103. data/vendor/git.code.sf.net/p/libpng/code/contrib/pngminus/pnm2png.sh +42 -0
  104. data/vendor/git.code.sf.net/p/libpng/code/contrib/pngsuite/README +105 -0
  105. data/vendor/git.code.sf.net/p/libpng/code/contrib/pngsuite/basn0g01.png +0 -0
  106. data/vendor/git.code.sf.net/p/libpng/code/contrib/pngsuite/basn0g02.png +0 -0
  107. data/vendor/git.code.sf.net/p/libpng/code/contrib/pngsuite/basn0g04.png +0 -0
  108. data/vendor/git.code.sf.net/p/libpng/code/contrib/pngsuite/basn0g08.png +0 -0
  109. data/vendor/git.code.sf.net/p/libpng/code/contrib/pngsuite/basn0g16.png +0 -0
  110. data/vendor/git.code.sf.net/p/libpng/code/contrib/pngsuite/basn2c08.png +0 -0
  111. data/vendor/git.code.sf.net/p/libpng/code/contrib/pngsuite/basn2c16.png +0 -0
  112. data/vendor/git.code.sf.net/p/libpng/code/contrib/pngsuite/basn3p01.png +0 -0
  113. data/vendor/git.code.sf.net/p/libpng/code/contrib/pngsuite/basn3p02.png +0 -0
  114. data/vendor/git.code.sf.net/p/libpng/code/contrib/pngsuite/basn3p04.png +0 -0
  115. data/vendor/git.code.sf.net/p/libpng/code/contrib/pngsuite/basn3p08.png +0 -0
  116. data/vendor/git.code.sf.net/p/libpng/code/contrib/pngsuite/basn4a08.png +0 -0
  117. data/vendor/git.code.sf.net/p/libpng/code/contrib/pngsuite/basn4a16.png +0 -0
  118. data/vendor/git.code.sf.net/p/libpng/code/contrib/pngsuite/basn6a08.png +0 -0
  119. data/vendor/git.code.sf.net/p/libpng/code/contrib/pngsuite/basn6a16.png +0 -0
  120. data/vendor/git.code.sf.net/p/libpng/code/contrib/pngsuite/ftbbn0g01.png +0 -0
  121. data/vendor/git.code.sf.net/p/libpng/code/contrib/pngsuite/ftbbn0g02.png +0 -0
  122. data/vendor/git.code.sf.net/p/libpng/code/contrib/pngsuite/ftbbn0g04.png +0 -0
  123. data/vendor/git.code.sf.net/p/libpng/code/contrib/pngsuite/ftbbn2c16.png +0 -0
  124. data/vendor/git.code.sf.net/p/libpng/code/contrib/pngsuite/ftbbn3p08.png +0 -0
  125. data/vendor/git.code.sf.net/p/libpng/code/contrib/pngsuite/ftbgn2c16.png +0 -0
  126. data/vendor/git.code.sf.net/p/libpng/code/contrib/pngsuite/ftbgn3p08.png +0 -0
  127. data/vendor/git.code.sf.net/p/libpng/code/contrib/pngsuite/ftbrn2c08.png +0 -0
  128. data/vendor/git.code.sf.net/p/libpng/code/contrib/pngsuite/ftbwn0g16.png +0 -0
  129. data/vendor/git.code.sf.net/p/libpng/code/contrib/pngsuite/ftbwn3p08.png +0 -0
  130. data/vendor/git.code.sf.net/p/libpng/code/contrib/pngsuite/ftbyn3p08.png +0 -0
  131. data/vendor/git.code.sf.net/p/libpng/code/contrib/pngsuite/ftp0n0g08.png +0 -0
  132. data/vendor/git.code.sf.net/p/libpng/code/contrib/pngsuite/ftp0n2c08.png +0 -0
  133. data/vendor/git.code.sf.net/p/libpng/code/contrib/pngsuite/ftp0n3p08.png +0 -0
  134. data/vendor/git.code.sf.net/p/libpng/code/contrib/pngsuite/ftp1n3p08.png +0 -0
  135. data/vendor/git.code.sf.net/p/libpng/code/contrib/powerpc-vsx/README +81 -0
  136. data/vendor/git.code.sf.net/p/libpng/code/contrib/powerpc-vsx/linux.c +57 -0
  137. data/vendor/git.code.sf.net/p/libpng/code/contrib/powerpc-vsx/linux_aux.c +36 -0
  138. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/crashers/bad_iCCP.png +0 -0
  139. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/crashers/badadler.png +0 -0
  140. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/crashers/badcrc.png +0 -0
  141. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/crashers/empty_ancillary_chunks.png +0 -0
  142. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/crashers/huge_IDAT.png +0 -0
  143. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/crashers/huge_bKGD_chunk.png +0 -0
  144. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/crashers/huge_cHRM_chunk.png +0 -0
  145. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/crashers/huge_eXIf_chunk.png +0 -0
  146. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/crashers/huge_gAMA_chunk.png +0 -0
  147. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/crashers/huge_hIST_chunk.png +0 -0
  148. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/crashers/huge_iCCP_chunk.png +0 -0
  149. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/crashers/huge_iTXt_chunk.png +0 -0
  150. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/crashers/huge_juNK_unsafe_to_copy.png +0 -0
  151. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/crashers/huge_juNk_safe_to_copy.png +0 -0
  152. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/crashers/huge_pCAL_chunk.png +0 -0
  153. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/crashers/huge_pHYs_chunk.png +0 -0
  154. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/crashers/huge_sCAL_chunk.png +0 -0
  155. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/crashers/huge_sPLT_chunk.png +0 -0
  156. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/crashers/huge_sRGB_chunk.png +0 -0
  157. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/crashers/huge_sTER_chunk.png +0 -0
  158. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/crashers/huge_tEXt_chunk.png +0 -0
  159. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/crashers/huge_tIME_chunk.png +0 -0
  160. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/crashers/huge_zTXt_chunk.png +0 -0
  161. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/gray-1-1.8-tRNS.png +0 -0
  162. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/gray-1-1.8.png +0 -0
  163. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/gray-1-linear-tRNS.png +0 -0
  164. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/gray-1-linear.png +0 -0
  165. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/gray-1-sRGB-tRNS.png +0 -0
  166. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/gray-1-sRGB.png +0 -0
  167. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/gray-1-tRNS.png +0 -0
  168. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/gray-1.png +0 -0
  169. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/gray-16-1.8-tRNS.png +0 -0
  170. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/gray-16-1.8.png +0 -0
  171. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/gray-16-linear-tRNS.png +0 -0
  172. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/gray-16-linear.png +0 -0
  173. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/gray-16-sRGB-tRNS.png +0 -0
  174. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/gray-16-sRGB.png +0 -0
  175. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/gray-16-tRNS.png +0 -0
  176. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/gray-16.png +0 -0
  177. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/gray-2-1.8-tRNS.png +0 -0
  178. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/gray-2-1.8.png +0 -0
  179. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/gray-2-linear-tRNS.png +0 -0
  180. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/gray-2-linear.png +0 -0
  181. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/gray-2-sRGB-tRNS.png +0 -0
  182. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/gray-2-sRGB.png +0 -0
  183. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/gray-2-tRNS.png +0 -0
  184. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/gray-2.png +0 -0
  185. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/gray-4-1.8-tRNS.png +0 -0
  186. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/gray-4-1.8.png +0 -0
  187. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/gray-4-linear-tRNS.png +0 -0
  188. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/gray-4-linear.png +0 -0
  189. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/gray-4-sRGB-tRNS.png +0 -0
  190. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/gray-4-sRGB.png +0 -0
  191. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/gray-4-tRNS.png +0 -0
  192. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/gray-4.png +0 -0
  193. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/gray-8-1.8-tRNS.png +0 -0
  194. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/gray-8-1.8.png +0 -0
  195. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/gray-8-linear-tRNS.png +0 -0
  196. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/gray-8-linear.png +0 -0
  197. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/gray-8-sRGB-tRNS.png +0 -0
  198. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/gray-8-sRGB.png +0 -0
  199. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/gray-8-tRNS.png +0 -0
  200. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/gray-8.png +0 -0
  201. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/gray-alpha-16-1.8.png +0 -0
  202. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/gray-alpha-16-linear.png +0 -0
  203. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/gray-alpha-16-sRGB.png +0 -0
  204. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/gray-alpha-16.png +0 -0
  205. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/gray-alpha-8-1.8.png +0 -0
  206. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/gray-alpha-8-linear.png +0 -0
  207. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/gray-alpha-8-sRGB.png +0 -0
  208. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/gray-alpha-8.png +0 -0
  209. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/makepngs.sh +94 -0
  210. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/palette-1-1.8-tRNS.png +0 -0
  211. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/palette-1-1.8.png +0 -0
  212. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/palette-1-linear-tRNS.png +0 -0
  213. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/palette-1-linear.png +0 -0
  214. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/palette-1-sRGB-tRNS.png +0 -0
  215. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/palette-1-sRGB.png +0 -0
  216. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/palette-1-tRNS.png +0 -0
  217. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/palette-1.png +0 -0
  218. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/palette-2-1.8-tRNS.png +0 -0
  219. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/palette-2-1.8.png +0 -0
  220. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/palette-2-linear-tRNS.png +0 -0
  221. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/palette-2-linear.png +0 -0
  222. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/palette-2-sRGB-tRNS.png +0 -0
  223. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/palette-2-sRGB.png +0 -0
  224. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/palette-2-tRNS.png +0 -0
  225. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/palette-2.png +0 -0
  226. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/palette-4-1.8-tRNS.png +0 -0
  227. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/palette-4-1.8.png +0 -0
  228. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/palette-4-linear-tRNS.png +0 -0
  229. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/palette-4-linear.png +0 -0
  230. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/palette-4-sRGB-tRNS.png +0 -0
  231. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/palette-4-sRGB.png +0 -0
  232. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/palette-4-tRNS.png +0 -0
  233. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/palette-4.png +0 -0
  234. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/palette-8-1.8-tRNS.png +0 -0
  235. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/palette-8-1.8.png +0 -0
  236. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/palette-8-linear-tRNS.png +0 -0
  237. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/palette-8-linear.png +0 -0
  238. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/palette-8-sRGB-tRNS.png +0 -0
  239. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/palette-8-sRGB.png +0 -0
  240. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/palette-8-tRNS.png +0 -0
  241. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/palette-8.png +0 -0
  242. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/rgb-16-1.8-tRNS.png +0 -0
  243. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/rgb-16-1.8.png +0 -0
  244. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/rgb-16-linear-tRNS.png +0 -0
  245. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/rgb-16-linear.png +0 -0
  246. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/rgb-16-sRGB-tRNS.png +0 -0
  247. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/rgb-16-sRGB.png +0 -0
  248. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/rgb-16-tRNS.png +0 -0
  249. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/rgb-16.png +0 -0
  250. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/rgb-8-1.8-tRNS.png +0 -0
  251. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/rgb-8-1.8.png +0 -0
  252. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/rgb-8-linear-tRNS.png +0 -0
  253. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/rgb-8-linear.png +0 -0
  254. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/rgb-8-sRGB-tRNS.png +0 -0
  255. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/rgb-8-sRGB.png +0 -0
  256. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/rgb-8-tRNS.png +0 -0
  257. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/rgb-8.png +0 -0
  258. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/rgb-alpha-16-1.8.png +0 -0
  259. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/rgb-alpha-16-linear.png +0 -0
  260. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/rgb-alpha-16-sRGB.png +0 -0
  261. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/rgb-alpha-16.png +0 -0
  262. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/rgb-alpha-8-1.8.png +0 -0
  263. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/rgb-alpha-8-linear.png +0 -0
  264. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/rgb-alpha-8-sRGB.png +0 -0
  265. data/vendor/git.code.sf.net/p/libpng/code/contrib/testpngs/rgb-alpha-8.png +0 -0
  266. data/vendor/git.code.sf.net/p/libpng/code/contrib/tools/README.txt +27 -0
  267. data/vendor/git.code.sf.net/p/libpng/code/contrib/tools/checksum-icc.c +102 -0
  268. data/vendor/git.code.sf.net/p/libpng/code/contrib/tools/chkfmt +144 -0
  269. data/vendor/git.code.sf.net/p/libpng/code/contrib/tools/cvtcolor.c +188 -0
  270. data/vendor/git.code.sf.net/p/libpng/code/contrib/tools/genpng.c +881 -0
  271. data/vendor/git.code.sf.net/p/libpng/code/contrib/tools/intgamma.sh +110 -0
  272. data/vendor/git.code.sf.net/p/libpng/code/contrib/tools/makesRGB.c +430 -0
  273. data/vendor/git.code.sf.net/p/libpng/code/contrib/tools/png-fix-itxt.c +164 -0
  274. data/vendor/git.code.sf.net/p/libpng/code/contrib/tools/pngcp.c +2453 -0
  275. data/vendor/git.code.sf.net/p/libpng/code/contrib/tools/pngfix.c +4049 -0
  276. data/vendor/git.code.sf.net/p/libpng/code/contrib/tools/reindent +25 -0
  277. data/vendor/git.code.sf.net/p/libpng/code/contrib/tools/sRGB.h +48 -0
  278. data/vendor/git.code.sf.net/p/libpng/code/contrib/visupng/PngFile.c +455 -0
  279. data/vendor/git.code.sf.net/p/libpng/code/contrib/visupng/PngFile.h +30 -0
  280. data/vendor/git.code.sf.net/p/libpng/code/contrib/visupng/README.txt +61 -0
  281. data/vendor/git.code.sf.net/p/libpng/code/contrib/visupng/VisualPng.c +978 -0
  282. data/vendor/git.code.sf.net/p/libpng/code/contrib/visupng/VisualPng.dsp +147 -0
  283. data/vendor/git.code.sf.net/p/libpng/code/contrib/visupng/VisualPng.dsw +29 -0
  284. data/vendor/git.code.sf.net/p/libpng/code/contrib/visupng/VisualPng.ico +0 -0
  285. data/vendor/git.code.sf.net/p/libpng/code/contrib/visupng/VisualPng.png +0 -0
  286. data/vendor/git.code.sf.net/p/libpng/code/contrib/visupng/VisualPng.rc +152 -0
  287. data/vendor/git.code.sf.net/p/libpng/code/contrib/visupng/cexcept.h +248 -0
  288. data/vendor/git.code.sf.net/p/libpng/code/contrib/visupng/resource.h +23 -0
  289. data/vendor/git.code.sf.net/p/libpng/code/example.c +1066 -0
  290. data/vendor/git.code.sf.net/p/libpng/code/intel/filter_sse2_intrinsics.c +406 -0
  291. data/vendor/git.code.sf.net/p/libpng/code/intel/intel_init.c +53 -0
  292. data/vendor/git.code.sf.net/p/libpng/code/libpng-config.in +127 -0
  293. data/vendor/git.code.sf.net/p/libpng/code/libpng-manual.txt +5464 -0
  294. data/vendor/git.code.sf.net/p/libpng/code/libpng.3 +6249 -0
  295. data/vendor/git.code.sf.net/p/libpng/code/libpng.pc.in +12 -0
  296. data/vendor/git.code.sf.net/p/libpng/code/libpngpf.3 +18 -0
  297. data/vendor/git.code.sf.net/p/libpng/code/mips/filter_msa_intrinsics.c +807 -0
  298. data/vendor/git.code.sf.net/p/libpng/code/mips/mips_init.c +129 -0
  299. data/vendor/git.code.sf.net/p/libpng/code/png.5 +74 -0
  300. data/vendor/git.code.sf.net/p/libpng/code/png.c +4614 -0
  301. data/vendor/git.code.sf.net/p/libpng/code/png.h +3278 -0
  302. data/vendor/git.code.sf.net/p/libpng/code/pngbar.jpg +0 -0
  303. data/vendor/git.code.sf.net/p/libpng/code/pngbar.png +0 -0
  304. data/vendor/git.code.sf.net/p/libpng/code/pngconf.h +622 -0
  305. data/vendor/git.code.sf.net/p/libpng/code/pngdebug.h +153 -0
  306. data/vendor/git.code.sf.net/p/libpng/code/pngerror.c +963 -0
  307. data/vendor/git.code.sf.net/p/libpng/code/pngget.c +1248 -0
  308. data/vendor/git.code.sf.net/p/libpng/code/pnginfo.h +267 -0
  309. data/vendor/git.code.sf.net/p/libpng/code/pngmem.c +284 -0
  310. data/vendor/git.code.sf.net/p/libpng/code/pngnow.png +0 -0
  311. data/vendor/git.code.sf.net/p/libpng/code/pngpread.c +1096 -0
  312. data/vendor/git.code.sf.net/p/libpng/code/pngpriv.h +2120 -0
  313. data/vendor/git.code.sf.net/p/libpng/code/pngread.c +4219 -0
  314. data/vendor/git.code.sf.net/p/libpng/code/pngrio.c +120 -0
  315. data/vendor/git.code.sf.net/p/libpng/code/pngrtran.c +5010 -0
  316. data/vendor/git.code.sf.net/p/libpng/code/pngrutil.c +4661 -0
  317. data/vendor/git.code.sf.net/p/libpng/code/pngset.c +1802 -0
  318. data/vendor/git.code.sf.net/p/libpng/code/pngstruct.h +483 -0
  319. data/vendor/git.code.sf.net/p/libpng/code/pngtest.c +2156 -0
  320. data/vendor/git.code.sf.net/p/libpng/code/pngtest.png +0 -0
  321. data/vendor/git.code.sf.net/p/libpng/code/pngtrans.c +864 -0
  322. data/vendor/git.code.sf.net/p/libpng/code/pngusr.dfa +14 -0
  323. data/vendor/git.code.sf.net/p/libpng/code/pngwio.c +168 -0
  324. data/vendor/git.code.sf.net/p/libpng/code/pngwrite.c +2396 -0
  325. data/vendor/git.code.sf.net/p/libpng/code/pngwtran.c +576 -0
  326. data/vendor/git.code.sf.net/p/libpng/code/pngwutil.c +2784 -0
  327. data/vendor/git.code.sf.net/p/libpng/code/powerpc/filter_vsx_intrinsics.c +767 -0
  328. data/vendor/git.code.sf.net/p/libpng/code/powerpc/powerpc_init.c +125 -0
  329. data/vendor/git.code.sf.net/p/libpng/code/projects/owatcom/libpng.tgt +383 -0
  330. data/vendor/git.code.sf.net/p/libpng/code/projects/owatcom/libpng.wpj +112 -0
  331. data/vendor/git.code.sf.net/p/libpng/code/projects/owatcom/pngconfig.mak +160 -0
  332. data/vendor/git.code.sf.net/p/libpng/code/projects/owatcom/pngstest.tgt +219 -0
  333. data/vendor/git.code.sf.net/p/libpng/code/projects/owatcom/pngtest.tgt +179 -0
  334. data/vendor/git.code.sf.net/p/libpng/code/projects/owatcom/pngvalid.tgt +210 -0
  335. data/vendor/git.code.sf.net/p/libpng/code/projects/visualc71/PRJ0041.mak +21 -0
  336. data/vendor/git.code.sf.net/p/libpng/code/projects/visualc71/README.txt +58 -0
  337. data/vendor/git.code.sf.net/p/libpng/code/projects/visualc71/README_zlib.txt +44 -0
  338. data/vendor/git.code.sf.net/p/libpng/code/projects/visualc71/libpng.sln +60 -0
  339. data/vendor/git.code.sf.net/p/libpng/code/projects/visualc71/libpng.vcproj +419 -0
  340. data/vendor/git.code.sf.net/p/libpng/code/projects/visualc71/pngtest.vcproj +267 -0
  341. data/vendor/git.code.sf.net/p/libpng/code/projects/visualc71/zlib.vcproj +391 -0
  342. data/vendor/git.code.sf.net/p/libpng/code/projects/vstudio/README.txt +97 -0
  343. data/vendor/git.code.sf.net/p/libpng/code/projects/vstudio/libpng/libpng.vcxproj +234 -0
  344. data/vendor/git.code.sf.net/p/libpng/code/projects/vstudio/pnglibconf/pnglibconf.vcxproj +61 -0
  345. data/vendor/git.code.sf.net/p/libpng/code/projects/vstudio/pngstest/pngstest.vcxproj +219 -0
  346. data/vendor/git.code.sf.net/p/libpng/code/projects/vstudio/pngtest/pngtest.vcxproj +220 -0
  347. data/vendor/git.code.sf.net/p/libpng/code/projects/vstudio/pngunknown/pngunknown.vcxproj +219 -0
  348. data/vendor/git.code.sf.net/p/libpng/code/projects/vstudio/pngvalid/pngvalid.vcxproj +219 -0
  349. data/vendor/git.code.sf.net/p/libpng/code/projects/vstudio/vstudio.sln +109 -0
  350. data/vendor/git.code.sf.net/p/libpng/code/projects/vstudio/zlib/zlib.vcxproj +175 -0
  351. data/vendor/git.code.sf.net/p/libpng/code/projects/vstudio/zlib.props +58 -0
  352. data/vendor/git.code.sf.net/p/libpng/code/scripts/README.txt +86 -0
  353. data/vendor/git.code.sf.net/p/libpng/code/scripts/SCOPTIONS.ppc +7 -0
  354. data/vendor/git.code.sf.net/p/libpng/code/scripts/checksym.awk +173 -0
  355. data/vendor/git.code.sf.net/p/libpng/code/scripts/def.c +29 -0
  356. data/vendor/git.code.sf.net/p/libpng/code/scripts/descrip.mms +52 -0
  357. data/vendor/git.code.sf.net/p/libpng/code/scripts/dfn.awk +203 -0
  358. data/vendor/git.code.sf.net/p/libpng/code/scripts/genchk.cmake.in +37 -0
  359. data/vendor/git.code.sf.net/p/libpng/code/scripts/genout.cmake.in +93 -0
  360. data/vendor/git.code.sf.net/p/libpng/code/scripts/gensrc.cmake.in +138 -0
  361. data/vendor/git.code.sf.net/p/libpng/code/scripts/intprefix.c +22 -0
  362. data/vendor/git.code.sf.net/p/libpng/code/scripts/libpng-config-body.in +96 -0
  363. data/vendor/git.code.sf.net/p/libpng/code/scripts/libpng-config-head.in +24 -0
  364. data/vendor/git.code.sf.net/p/libpng/code/scripts/libpng.pc.in +10 -0
  365. data/vendor/git.code.sf.net/p/libpng/code/scripts/macro.lst +3 -0
  366. data/vendor/git.code.sf.net/p/libpng/code/scripts/makefile.32sunu +244 -0
  367. data/vendor/git.code.sf.net/p/libpng/code/scripts/makefile.64sunu +244 -0
  368. data/vendor/git.code.sf.net/p/libpng/code/scripts/makefile.acorn +57 -0
  369. data/vendor/git.code.sf.net/p/libpng/code/scripts/makefile.aix +116 -0
  370. data/vendor/git.code.sf.net/p/libpng/code/scripts/makefile.amiga +58 -0
  371. data/vendor/git.code.sf.net/p/libpng/code/scripts/makefile.atari +71 -0
  372. data/vendor/git.code.sf.net/p/libpng/code/scripts/makefile.bc32 +158 -0
  373. data/vendor/git.code.sf.net/p/libpng/code/scripts/makefile.beos +222 -0
  374. data/vendor/git.code.sf.net/p/libpng/code/scripts/makefile.bor +170 -0
  375. data/vendor/git.code.sf.net/p/libpng/code/scripts/makefile.cegcc +116 -0
  376. data/vendor/git.code.sf.net/p/libpng/code/scripts/makefile.darwin +225 -0
  377. data/vendor/git.code.sf.net/p/libpng/code/scripts/makefile.dec +210 -0
  378. data/vendor/git.code.sf.net/p/libpng/code/scripts/makefile.dj2 +72 -0
  379. data/vendor/git.code.sf.net/p/libpng/code/scripts/makefile.freebsd +69 -0
  380. data/vendor/git.code.sf.net/p/libpng/code/scripts/makefile.gcc +87 -0
  381. data/vendor/git.code.sf.net/p/libpng/code/scripts/makefile.hp64 +231 -0
  382. data/vendor/git.code.sf.net/p/libpng/code/scripts/makefile.hpgcc +234 -0
  383. data/vendor/git.code.sf.net/p/libpng/code/scripts/makefile.hpux +229 -0
  384. data/vendor/git.code.sf.net/p/libpng/code/scripts/makefile.ibmc +90 -0
  385. data/vendor/git.code.sf.net/p/libpng/code/scripts/makefile.intel +115 -0
  386. data/vendor/git.code.sf.net/p/libpng/code/scripts/makefile.knr +116 -0
  387. data/vendor/git.code.sf.net/p/libpng/code/scripts/makefile.linux +247 -0
  388. data/vendor/git.code.sf.net/p/libpng/code/scripts/makefile.linux-opt +265 -0
  389. data/vendor/git.code.sf.net/p/libpng/code/scripts/makefile.mips +103 -0
  390. data/vendor/git.code.sf.net/p/libpng/code/scripts/makefile.msc +100 -0
  391. data/vendor/git.code.sf.net/p/libpng/code/scripts/makefile.msys +201 -0
  392. data/vendor/git.code.sf.net/p/libpng/code/scripts/makefile.ne12bsd +56 -0
  393. data/vendor/git.code.sf.net/p/libpng/code/scripts/makefile.netbsd +56 -0
  394. data/vendor/git.code.sf.net/p/libpng/code/scripts/makefile.openbsd +88 -0
  395. data/vendor/git.code.sf.net/p/libpng/code/scripts/makefile.sco +226 -0
  396. data/vendor/git.code.sf.net/p/libpng/code/scripts/makefile.sggcc +236 -0
  397. data/vendor/git.code.sf.net/p/libpng/code/scripts/makefile.sgi +237 -0
  398. data/vendor/git.code.sf.net/p/libpng/code/scripts/makefile.so9 +247 -0
  399. data/vendor/git.code.sf.net/p/libpng/code/scripts/makefile.solaris +244 -0
  400. data/vendor/git.code.sf.net/p/libpng/code/scripts/makefile.solaris-x86 +243 -0
  401. data/vendor/git.code.sf.net/p/libpng/code/scripts/makefile.std +134 -0
  402. data/vendor/git.code.sf.net/p/libpng/code/scripts/makefile.sunos +115 -0
  403. data/vendor/git.code.sf.net/p/libpng/code/scripts/makefile.tc3 +100 -0
  404. data/vendor/git.code.sf.net/p/libpng/code/scripts/makefile.vcwin32 +113 -0
  405. data/vendor/git.code.sf.net/p/libpng/code/scripts/makevms.com +142 -0
  406. data/vendor/git.code.sf.net/p/libpng/code/scripts/options.awk +898 -0
  407. data/vendor/git.code.sf.net/p/libpng/code/scripts/pnglibconf.dfa +919 -0
  408. data/vendor/git.code.sf.net/p/libpng/code/scripts/pnglibconf.h.prebuilt +220 -0
  409. data/vendor/git.code.sf.net/p/libpng/code/scripts/pnglibconf.mak +55 -0
  410. data/vendor/git.code.sf.net/p/libpng/code/scripts/pngwin.rc +112 -0
  411. data/vendor/git.code.sf.net/p/libpng/code/scripts/prefix.c +24 -0
  412. data/vendor/git.code.sf.net/p/libpng/code/scripts/smakefile.ppc +34 -0
  413. data/vendor/git.code.sf.net/p/libpng/code/scripts/sym.c +15 -0
  414. data/vendor/git.code.sf.net/p/libpng/code/scripts/symbols.c +58 -0
  415. data/vendor/git.code.sf.net/p/libpng/code/scripts/symbols.def +256 -0
  416. data/vendor/git.code.sf.net/p/libpng/code/scripts/test.cmake.in +31 -0
  417. data/vendor/git.code.sf.net/p/libpng/code/scripts/vers.c +19 -0
  418. data/vendor/git.code.sf.net/p/libpng/code/tests/pngimage-full +2 -0
  419. data/vendor/git.code.sf.net/p/libpng/code/tests/pngimage-quick +2 -0
  420. data/vendor/git.code.sf.net/p/libpng/code/tests/pngstest +54 -0
  421. data/vendor/git.code.sf.net/p/libpng/code/tests/pngstest-1.8 +2 -0
  422. data/vendor/git.code.sf.net/p/libpng/code/tests/pngstest-1.8-alpha +2 -0
  423. data/vendor/git.code.sf.net/p/libpng/code/tests/pngstest-linear +2 -0
  424. data/vendor/git.code.sf.net/p/libpng/code/tests/pngstest-linear-alpha +2 -0
  425. data/vendor/git.code.sf.net/p/libpng/code/tests/pngstest-none +2 -0
  426. data/vendor/git.code.sf.net/p/libpng/code/tests/pngstest-none-alpha +2 -0
  427. data/vendor/git.code.sf.net/p/libpng/code/tests/pngstest-sRGB +2 -0
  428. data/vendor/git.code.sf.net/p/libpng/code/tests/pngstest-sRGB-alpha +2 -0
  429. data/vendor/git.code.sf.net/p/libpng/code/tests/pngtest +2 -0
  430. data/vendor/git.code.sf.net/p/libpng/code/tests/pngtest-badpngs +13 -0
  431. data/vendor/git.code.sf.net/p/libpng/code/tests/pngunknown-IDAT +2 -0
  432. data/vendor/git.code.sf.net/p/libpng/code/tests/pngunknown-discard +2 -0
  433. data/vendor/git.code.sf.net/p/libpng/code/tests/pngunknown-if-safe +2 -0
  434. data/vendor/git.code.sf.net/p/libpng/code/tests/pngunknown-sAPI +2 -0
  435. data/vendor/git.code.sf.net/p/libpng/code/tests/pngunknown-sTER +2 -0
  436. data/vendor/git.code.sf.net/p/libpng/code/tests/pngunknown-save +2 -0
  437. data/vendor/git.code.sf.net/p/libpng/code/tests/pngunknown-vpAg +2 -0
  438. data/vendor/git.code.sf.net/p/libpng/code/tests/pngvalid-gamma-16-to-8 +2 -0
  439. data/vendor/git.code.sf.net/p/libpng/code/tests/pngvalid-gamma-alpha-mode +2 -0
  440. data/vendor/git.code.sf.net/p/libpng/code/tests/pngvalid-gamma-background +2 -0
  441. data/vendor/git.code.sf.net/p/libpng/code/tests/pngvalid-gamma-expand16-alpha-mode +2 -0
  442. data/vendor/git.code.sf.net/p/libpng/code/tests/pngvalid-gamma-expand16-background +2 -0
  443. data/vendor/git.code.sf.net/p/libpng/code/tests/pngvalid-gamma-expand16-transform +2 -0
  444. data/vendor/git.code.sf.net/p/libpng/code/tests/pngvalid-gamma-sbit +2 -0
  445. data/vendor/git.code.sf.net/p/libpng/code/tests/pngvalid-gamma-threshold +2 -0
  446. data/vendor/git.code.sf.net/p/libpng/code/tests/pngvalid-gamma-transform +2 -0
  447. data/vendor/git.code.sf.net/p/libpng/code/tests/pngvalid-progressive-interlace-standard +2 -0
  448. data/vendor/git.code.sf.net/p/libpng/code/tests/pngvalid-progressive-size +2 -0
  449. data/vendor/git.code.sf.net/p/libpng/code/tests/pngvalid-progressive-standard +2 -0
  450. data/vendor/git.code.sf.net/p/libpng/code/tests/pngvalid-standard +2 -0
  451. data/vendor/git.code.sf.net/p/libpng/code/tests/pngvalid-transform +2 -0
  452. metadata +515 -0
@@ -0,0 +1,1261 @@
1
+ /*---------------------------------------------------------------------------
2
+
3
+ rpng2 - progressive-model PNG display program rpng2-win.c
4
+
5
+ This program decodes and displays PNG files progressively, as if it were
6
+ a web browser (though the front end is only set up to read from files).
7
+ It supports gamma correction, user-specified background colors, and user-
8
+ specified background patterns (for transparent images). This version is
9
+ for 32-bit Windows; it may compile under 16-bit Windows with a little
10
+ tweaking (or maybe not). Thanks to Adam Costello and Pieter S. van der
11
+ Meulen for the "diamond" and "radial waves" patterns, respectively.
12
+
13
+ to do (someday, maybe):
14
+ - handle quoted command-line args (especially filenames with spaces)
15
+ - finish resizable checkerboard-gradient (sizes 4-128?)
16
+ - use %.1023s to simplify truncation of title-bar string?
17
+ - have minimum window width: oh well
18
+
19
+ ---------------------------------------------------------------------------
20
+
21
+ Changelog:
22
+ - 1.01: initial public release
23
+ - 1.02: fixed cut-and-paste error in usage screen (oops...)
24
+ - 1.03: modified to allow abbreviated options
25
+ - 1.04: removed bogus extra argument from usage fprintf() [Glenn R-P?];
26
+ fixed command-line parsing bug
27
+ - 1.10: enabled "message window"/console (thanks to David Geldreich)
28
+ - 1.20: added runtime MMX-enabling/disabling and new -mmx* options
29
+ - 1.21: made minor tweak to usage screen to fit within 25-line console
30
+ - 1.22: added AMD64/EM64T support (__x86_64__)
31
+ - 2.00: dual-licensed (added GNU GPL)
32
+ - 2.01: fixed 64-bit typo in readpng2.c
33
+ - 2.02: fixed improper display of usage screen on PNG error(s); fixed
34
+ unexpected-EOF and file-read-error cases
35
+ - 2.03: removed runtime MMX-enabling/disabling and obsolete -mmx* options
36
+ - 2.04: check for integer overflow (Glenn R-P)
37
+
38
+ ---------------------------------------------------------------------------
39
+
40
+ Copyright (c) 1998-2008, 2017 Greg Roelofs. All rights reserved.
41
+
42
+ This software is provided "as is," without warranty of any kind,
43
+ express or implied. In no event shall the author or contributors
44
+ be held liable for any damages arising in any way from the use of
45
+ this software.
46
+
47
+ The contents of this file are DUAL-LICENSED. You may modify and/or
48
+ redistribute this software according to the terms of one of the
49
+ following two licenses (at your option):
50
+
51
+
52
+ LICENSE 1 ("BSD-like with advertising clause"):
53
+
54
+ Permission is granted to anyone to use this software for any purpose,
55
+ including commercial applications, and to alter it and redistribute
56
+ it freely, subject to the following restrictions:
57
+
58
+ 1. Redistributions of source code must retain the above copyright
59
+ notice, disclaimer, and this list of conditions.
60
+ 2. Redistributions in binary form must reproduce the above copyright
61
+ notice, disclaimer, and this list of conditions in the documenta-
62
+ tion and/or other materials provided with the distribution.
63
+ 3. All advertising materials mentioning features or use of this
64
+ software must display the following acknowledgment:
65
+
66
+ This product includes software developed by Greg Roelofs
67
+ and contributors for the book, "PNG: The Definitive Guide,"
68
+ published by O'Reilly and Associates.
69
+
70
+
71
+ LICENSE 2 (GNU GPL v2 or later):
72
+
73
+ This program is free software; you can redistribute it and/or modify
74
+ it under the terms of the GNU General Public License as published by
75
+ the Free Software Foundation; either version 2 of the License, or
76
+ (at your option) any later version.
77
+
78
+ This program is distributed in the hope that it will be useful,
79
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
80
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
81
+ GNU General Public License for more details.
82
+
83
+ You should have received a copy of the GNU General Public License
84
+ along with this program; if not, write to the Free Software Foundation,
85
+ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
86
+
87
+ ---------------------------------------------------------------------------*/
88
+
89
+ #define PROGNAME "rpng2-win"
90
+ #define LONGNAME "Progressive PNG Viewer for Windows"
91
+ #define VERSION "2.02 of 16 March 2008"
92
+
93
+ #include <stdio.h>
94
+ #include <stdlib.h>
95
+ #include <string.h>
96
+ #include <setjmp.h> /* for jmpbuf declaration in readpng2.h */
97
+ #include <time.h>
98
+ #include <math.h> /* only for PvdM background code */
99
+ #include <windows.h>
100
+ #ifdef __CYGWIN__
101
+ /* getch replacement. Turns out, we don't really need this,
102
+ * but leave it here if we ever enable any of the uses of
103
+ * _getch in the main code
104
+ */
105
+ #include <unistd.h>
106
+ #include <termio.h>
107
+ #include <sys/ioctl.h>
108
+ int repl_getch( void )
109
+ {
110
+ char ch;
111
+ int fd = fileno(stdin);
112
+ struct termio old_tty, new_tty;
113
+
114
+ ioctl(fd, TCGETA, &old_tty);
115
+ new_tty = old_tty;
116
+ new_tty.c_lflag &= ~(ICANON | ECHO | ISIG);
117
+ ioctl(fd, TCSETA, &new_tty);
118
+ fread(&ch, 1, sizeof(ch), stdin);
119
+ ioctl(fd, TCSETA, &old_tty);
120
+
121
+ return ch;
122
+ }
123
+ #define _getch repl_getch
124
+ #else
125
+ #include <conio.h> /* only for _getch() */
126
+ #endif
127
+
128
+ /* all for PvdM background code: */
129
+ #ifndef PI
130
+ # define PI 3.141592653589793238
131
+ #endif
132
+ #define PI_2 (PI*0.5)
133
+ #define INV_PI_360 (360.0 / PI)
134
+ #define MAX(a,b) (a>b?a:b)
135
+ #define MIN(a,b) (a<b?a:b)
136
+ #define CLIP(a,min,max) MAX(min,MIN((a),max))
137
+ #define ABS(a) ((a)<0?-(a):(a))
138
+ #define CLIP8P(c) MAX(0,(MIN((c),255))) /* 8-bit pos. integer (uch) */
139
+ #define ROUNDF(f) ((int)(f + 0.5))
140
+
141
+ #define rgb1_max bg_freq
142
+ #define rgb1_min bg_gray
143
+ #define rgb2_max bg_bsat
144
+ #define rgb2_min bg_brot
145
+
146
+ /* #define DEBUG */ /* this enables the Trace() macros */
147
+
148
+ #include "readpng2.h" /* typedefs, common macros, readpng2 prototypes */
149
+
150
+
151
+ /* could just include png.h, but this macro is the only thing we need
152
+ * (name and typedefs changed to local versions); note that side effects
153
+ * only happen with alpha (which could easily be avoided with
154
+ * "ush acopy = (alpha);") */
155
+
156
+ #define alpha_composite(composite, fg, alpha, bg) { \
157
+ ush temp = ((ush)(fg)*(ush)(alpha) + \
158
+ (ush)(bg)*(ush)(255 - (ush)(alpha)) + (ush)128); \
159
+ (composite) = (uch)((temp + (temp >> 8)) >> 8); \
160
+ }
161
+
162
+
163
+ #define INBUFSIZE 4096 /* with pseudo-timing on (1 sec delay/block), this
164
+ * block size corresponds roughly to a download
165
+ * speed 10% faster than theoretical 33.6K maximum
166
+ * (assuming 8 data bits, 1 stop bit and no other
167
+ * overhead) */
168
+
169
+ /* local prototypes */
170
+ static void rpng2_win_init(void);
171
+ static int rpng2_win_create_window(void);
172
+ static int rpng2_win_load_bg_image(void);
173
+ static void rpng2_win_display_row(ulg row);
174
+ static void rpng2_win_finish_display(void);
175
+ static void rpng2_win_cleanup(void);
176
+ LRESULT CALLBACK rpng2_win_wndproc(HWND, UINT, WPARAM, LPARAM);
177
+
178
+
179
+ static char titlebar[1024];
180
+ static char *progname = PROGNAME;
181
+ static char *appname = LONGNAME;
182
+ static char *filename;
183
+ static FILE *infile;
184
+
185
+ static mainprog_info rpng2_info;
186
+
187
+ static uch inbuf[INBUFSIZE];
188
+ static int incount;
189
+
190
+ static int pat = 6; /* must be less than num_bgpat */
191
+ static int bg_image = 0;
192
+ static int bgscale = 16;
193
+ static ulg bg_rowbytes;
194
+ static uch *bg_data;
195
+
196
+ static struct rgb_color {
197
+ uch r, g, b;
198
+ } rgb[] = {
199
+ { 0, 0, 0}, /* 0: black */
200
+ {255, 255, 255}, /* 1: white */
201
+ {173, 132, 57}, /* 2: tan */
202
+ { 64, 132, 0}, /* 3: medium green */
203
+ {189, 117, 1}, /* 4: gold */
204
+ {253, 249, 1}, /* 5: yellow */
205
+ { 0, 0, 255}, /* 6: blue */
206
+ { 0, 0, 120}, /* 7: medium blue */
207
+ {255, 0, 255}, /* 8: magenta */
208
+ { 64, 0, 64}, /* 9: dark magenta */
209
+ {255, 0, 0}, /* 10: red */
210
+ { 64, 0, 0}, /* 11: dark red */
211
+ {255, 127, 0}, /* 12: orange */
212
+ {192, 96, 0}, /* 13: darker orange */
213
+ { 24, 60, 0}, /* 14: dark green-yellow */
214
+ { 85, 125, 200} /* 15: ice blue */
215
+ };
216
+ /* not used for now, but should be for error-checking:
217
+ static int num_rgb = sizeof(rgb) / sizeof(struct rgb_color);
218
+ */
219
+
220
+ /*
221
+ This whole struct is a fairly cheesy way to keep the number of
222
+ command-line options to a minimum. The radial-waves background
223
+ type is a particularly poor fit to the integer elements of the
224
+ struct...but a few macros and a little fixed-point math will do
225
+ wonders for ya.
226
+
227
+ type bits:
228
+ F E D C B A 9 8 7 6 5 4 3 2 1 0
229
+ | | | | |
230
+ | | +-+-+-- 0 = sharp-edged checkerboard
231
+ | | 1 = soft diamonds
232
+ | | 2 = radial waves
233
+ | | 3-7 = undefined
234
+ | +-- gradient #2 inverted?
235
+ +-- alternating columns inverted?
236
+ */
237
+ static struct background_pattern {
238
+ ush type;
239
+ int rgb1_max, rgb1_min; /* or bg_freq, bg_gray */
240
+ int rgb2_max, rgb2_min; /* or bg_bsat, bg_brot (both scaled by 10)*/
241
+ } bg[] = {
242
+ {0+8, 2,0, 1,15}, /* checkered: tan/black vs. white/ice blue */
243
+ {0+24, 2,0, 1,0}, /* checkered: tan/black vs. white/black */
244
+ {0+8, 4,5, 0,2}, /* checkered: gold/yellow vs. black/tan */
245
+ {0+8, 4,5, 0,6}, /* checkered: gold/yellow vs. black/blue */
246
+ {0, 7,0, 8,9}, /* checkered: deep blue/black vs. magenta */
247
+ {0+8, 13,0, 5,14}, /* checkered: orange/black vs. yellow */
248
+ {0+8, 12,0, 10,11}, /* checkered: orange/black vs. red */
249
+ {1, 7,0, 8,0}, /* diamonds: deep blue/black vs. magenta */
250
+ {1, 12,0, 11,0}, /* diamonds: orange vs. dark red */
251
+ {1, 10,0, 7,0}, /* diamonds: red vs. medium blue */
252
+ {1, 4,0, 5,0}, /* diamonds: gold vs. yellow */
253
+ {1, 3,0, 0,0}, /* diamonds: medium green vs. black */
254
+ {2, 16, 100, 20, 0}, /* radial: ~hard radial color-beams */
255
+ {2, 18, 100, 10, 2}, /* radial: soft, curved radial color-beams */
256
+ {2, 16, 256, 100, 250}, /* radial: very tight spiral */
257
+ {2, 10000, 256, 11, 0} /* radial: dipole-moire' (almost fractal) */
258
+ };
259
+ static int num_bgpat = sizeof(bg) / sizeof(struct background_pattern);
260
+
261
+
262
+ /* Windows-specific global variables (could go in struct, but messy...) */
263
+ static ulg wimage_rowbytes;
264
+ static uch *dib;
265
+ static uch *wimage_data;
266
+ static BITMAPINFOHEADER *bmih;
267
+
268
+ static HWND global_hwnd;
269
+ static HINSTANCE global_hInst;
270
+ static int global_showmode;
271
+
272
+
273
+
274
+
275
+ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
276
+ {
277
+ char *args[1024]; /* arbitrary limit, but should suffice */
278
+ char **argv = args;
279
+ char *p, *q, *bgstr = NULL;
280
+ int argc = 0;
281
+ int rc, alen, flen;
282
+ int error = 0;
283
+ int timing = FALSE;
284
+ int have_bg = FALSE;
285
+ double LUT_exponent; /* just the lookup table */
286
+ double CRT_exponent = 2.2; /* just the monitor */
287
+ double default_display_exponent; /* whole display system */
288
+ MSG msg;
289
+
290
+
291
+ /* First initialize a few things, just to be sure--memset takes care of
292
+ * default background color (black), booleans (FALSE), pointers (NULL),
293
+ * etc. */
294
+
295
+ global_hInst = hInst;
296
+ global_showmode = showmode;
297
+ filename = (char *)NULL;
298
+ memset(&rpng2_info, 0, sizeof(mainprog_info));
299
+
300
+ #ifndef __CYGWIN__
301
+ /* Next reenable console output, which normally goes to the bit bucket
302
+ * for windowed apps. Closing the console window will terminate the
303
+ * app. Thanks to David.Geldreich at realviz.com for supplying the magical
304
+ * incantation. */
305
+
306
+ AllocConsole();
307
+ freopen("CONOUT$", "a", stderr);
308
+ freopen("CONOUT$", "a", stdout);
309
+ #endif
310
+
311
+ /* Set the default value for our display-system exponent, i.e., the
312
+ * product of the CRT exponent and the exponent corresponding to
313
+ * the frame-buffer's lookup table (LUT), if any. This is not an
314
+ * exhaustive list of LUT values (e.g., OpenStep has a lot of weird
315
+ * ones), but it should cover 99% of the current possibilities. And
316
+ * yes, these ifdefs are completely wasted in a Windows program... */
317
+
318
+ #if defined(NeXT)
319
+ /* third-party utilities can modify the default LUT exponent */
320
+ LUT_exponent = 1.0 / 2.2;
321
+ /*
322
+ if (some_next_function_that_returns_gamma(&next_gamma))
323
+ LUT_exponent = 1.0 / next_gamma;
324
+ */
325
+ #elif defined(sgi)
326
+ LUT_exponent = 1.0 / 1.7;
327
+ /* there doesn't seem to be any documented function to
328
+ * get the "gamma" value, so we do it the hard way */
329
+ infile = fopen("/etc/config/system.glGammaVal", "r");
330
+ if (infile) {
331
+ double sgi_gamma;
332
+
333
+ fgets(tmpline, 80, infile);
334
+ fclose(infile);
335
+ sgi_gamma = atof(tmpline);
336
+ if (sgi_gamma > 0.0)
337
+ LUT_exponent = 1.0 / sgi_gamma;
338
+ }
339
+ #elif defined(Macintosh)
340
+ LUT_exponent = 1.8 / 2.61;
341
+ /*
342
+ if (some_mac_function_that_returns_gamma(&mac_gamma))
343
+ LUT_exponent = mac_gamma / 2.61;
344
+ */
345
+ #else
346
+ LUT_exponent = 1.0; /* assume no LUT: most PCs */
347
+ #endif
348
+
349
+ /* the defaults above give 1.0, 1.3, 1.5 and 2.2, respectively: */
350
+ default_display_exponent = LUT_exponent * CRT_exponent;
351
+
352
+
353
+ /* If the user has set the SCREEN_GAMMA environment variable as suggested
354
+ * (somewhat imprecisely) in the libpng documentation, use that; otherwise
355
+ * use the default value we just calculated. Either way, the user may
356
+ * override this via a command-line option. */
357
+
358
+ if ((p = getenv("SCREEN_GAMMA")) != NULL)
359
+ rpng2_info.display_exponent = atof(p);
360
+ else
361
+ rpng2_info.display_exponent = default_display_exponent;
362
+
363
+
364
+ /* Windows really hates command lines, so we have to set up our own argv.
365
+ * Note that we do NOT bother with quoted arguments here, so don't use
366
+ * filenames with spaces in 'em! */
367
+
368
+ argv[argc++] = PROGNAME;
369
+ p = cmd;
370
+ for (;;) {
371
+ if (*p == ' ')
372
+ while (*++p == ' ')
373
+ ;
374
+ /* now p points at the first non-space after some spaces */
375
+ if (*p == '\0')
376
+ break; /* nothing after the spaces: done */
377
+ argv[argc++] = q = p;
378
+ while (*q && *q != ' ')
379
+ ++q;
380
+ /* now q points at a space or the end of the string */
381
+ if (*q == '\0')
382
+ break; /* last argv already terminated; quit */
383
+ *q = '\0'; /* change space to terminator */
384
+ p = q + 1;
385
+ }
386
+ argv[argc] = NULL; /* terminate the argv array itself */
387
+
388
+
389
+ /* Now parse the command line for options and the PNG filename. */
390
+
391
+ while (*++argv && !error) {
392
+ if (!strncmp(*argv, "-gamma", 2)) {
393
+ if (!*++argv)
394
+ ++error;
395
+ else {
396
+ rpng2_info.display_exponent = atof(*argv);
397
+ if (rpng2_info.display_exponent <= 0.0)
398
+ ++error;
399
+ }
400
+ } else if (!strncmp(*argv, "-bgcolor", 4)) {
401
+ if (!*++argv)
402
+ ++error;
403
+ else {
404
+ bgstr = *argv;
405
+ if (strlen(bgstr) != 7 || bgstr[0] != '#')
406
+ ++error;
407
+ else {
408
+ have_bg = TRUE;
409
+ bg_image = FALSE;
410
+ }
411
+ }
412
+ } else if (!strncmp(*argv, "-bgpat", 4)) {
413
+ if (!*++argv)
414
+ ++error;
415
+ else {
416
+ pat = atoi(*argv) - 1;
417
+ if (pat < 0 || pat >= num_bgpat)
418
+ ++error;
419
+ else {
420
+ bg_image = TRUE;
421
+ have_bg = FALSE;
422
+ }
423
+ }
424
+ } else if (!strncmp(*argv, "-timing", 2)) {
425
+ timing = TRUE;
426
+ } else {
427
+ if (**argv != '-') {
428
+ filename = *argv;
429
+ if (argv[1]) /* shouldn't be any more args after filename */
430
+ ++error;
431
+ } else
432
+ ++error; /* not expecting any other options */
433
+ }
434
+ }
435
+
436
+ if (!filename)
437
+ ++error;
438
+
439
+
440
+ /* print usage screen if any errors up to this point */
441
+
442
+ if (error) {
443
+ #ifndef __CYGWIN__
444
+ int ch;
445
+ #endif
446
+
447
+ fprintf(stderr, "\n%s %s: %s\n\n", PROGNAME, VERSION, appname);
448
+ readpng2_version_info();
449
+ fprintf(stderr, "\n"
450
+ "Usage: %s [-gamma exp] [-bgcolor bg | -bgpat pat] [-timing]\n"
451
+ " %*s file.png\n\n"
452
+ " exp \ttransfer-function exponent (``gamma'') of the display\n"
453
+ "\t\t system in floating-point format (e.g., ``%.1f''); equal\n"
454
+ "\t\t to the product of the lookup-table exponent (varies)\n"
455
+ "\t\t and the CRT exponent (usually 2.2); must be positive\n"
456
+ " bg \tdesired background color in 7-character hex RGB format\n"
457
+ "\t\t (e.g., ``#ff7700'' for orange: same as HTML colors);\n"
458
+ "\t\t used with transparent images; overrides -bgpat option\n"
459
+ " pat \tdesired background pattern number (1-%d); used with\n"
460
+ "\t\t transparent images; overrides -bgcolor option\n"
461
+ " -timing\tenables delay for every block read, to simulate modem\n"
462
+ "\t\t download of image (~36 Kbps)\n"
463
+ "\nPress Q, Esc or mouse button 1 after image is displayed to quit.\n"
464
+ #ifndef __CYGWIN__
465
+ "Press Q or Esc to quit this usage screen. ",
466
+ #else
467
+ ,
468
+ #endif
469
+ PROGNAME,
470
+ #if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__)) && \
471
+ !(defined(__CYGWIN__) || defined(__MINGW32__))
472
+ (int)strlen(PROGNAME), " ",
473
+ #endif
474
+ (int)strlen(PROGNAME), " ", default_display_exponent, num_bgpat);
475
+ fflush(stderr);
476
+ #ifndef __CYGWIN__
477
+ do
478
+ ch = _getch();
479
+ while (ch != 'q' && ch != 'Q' && ch != 0x1B);
480
+ #endif
481
+ exit(1);
482
+ }
483
+
484
+
485
+ if (!(infile = fopen(filename, "rb"))) {
486
+ fprintf(stderr, PROGNAME ": can't open PNG file [%s]\n", filename);
487
+ ++error;
488
+ } else {
489
+ incount = fread(inbuf, 1, INBUFSIZE, infile);
490
+ if (incount < 8 || !readpng2_check_sig(inbuf, 8)) {
491
+ fprintf(stderr, PROGNAME
492
+ ": [%s] is not a PNG file: incorrect signature\n",
493
+ filename);
494
+ ++error;
495
+ } else if ((rc = readpng2_init(&rpng2_info)) != 0) {
496
+ switch (rc) {
497
+ case 2:
498
+ fprintf(stderr, PROGNAME
499
+ ": [%s] has bad IHDR (libpng longjmp)\n", filename);
500
+ break;
501
+ case 4:
502
+ fprintf(stderr, PROGNAME ": insufficient memory\n");
503
+ break;
504
+ default:
505
+ fprintf(stderr, PROGNAME
506
+ ": unknown readpng2_init() error\n");
507
+ break;
508
+ }
509
+ ++error;
510
+ }
511
+ if (error)
512
+ fclose(infile);
513
+ }
514
+
515
+
516
+ if (error) {
517
+ #ifndef __CYGWIN__
518
+ int ch;
519
+ #endif
520
+
521
+ fprintf(stderr, PROGNAME ": aborting.\n");
522
+ #ifndef __CYGWIN__
523
+ do
524
+ ch = _getch();
525
+ while (ch != 'q' && ch != 'Q' && ch != 0x1B);
526
+ #endif
527
+ exit(2);
528
+ } else {
529
+ fprintf(stderr, "\n%s %s: %s\n", PROGNAME, VERSION, appname);
530
+ #ifndef __CYGWIN__
531
+ fprintf(stderr,
532
+ "\n [console window: closing this window will terminate %s]\n\n",
533
+ PROGNAME);
534
+ #endif
535
+ fflush(stderr);
536
+ }
537
+
538
+
539
+ /* set the title-bar string, but make sure buffer doesn't overflow */
540
+
541
+ alen = strlen(appname);
542
+ flen = strlen(filename);
543
+ if (alen + flen + 3 > 1023)
544
+ sprintf(titlebar, "%s: ...%s", appname, filename+(alen+flen+6-1023));
545
+ else
546
+ sprintf(titlebar, "%s: %s", appname, filename);
547
+
548
+
549
+ /* set some final rpng2_info variables before entering main data loop */
550
+
551
+ if (have_bg) {
552
+ unsigned r, g, b; /* this approach quiets compiler warnings */
553
+
554
+ sscanf(bgstr+1, "%2x%2x%2x", &r, &g, &b);
555
+ rpng2_info.bg_red = (uch)r;
556
+ rpng2_info.bg_green = (uch)g;
557
+ rpng2_info.bg_blue = (uch)b;
558
+ } else
559
+ rpng2_info.need_bgcolor = TRUE;
560
+
561
+ rpng2_info.state = kPreInit;
562
+ rpng2_info.mainprog_init = rpng2_win_init;
563
+ rpng2_info.mainprog_display_row = rpng2_win_display_row;
564
+ rpng2_info.mainprog_finish_display = rpng2_win_finish_display;
565
+
566
+
567
+ /* OK, this is the fun part: call readpng2_decode_data() at the start of
568
+ * the loop to deal with our first buffer of data (read in above to verify
569
+ * that the file is a PNG image), then loop through the file and continue
570
+ * calling the same routine to handle each chunk of data. It in turn
571
+ * passes the data to libpng, which will invoke one or more of our call-
572
+ * backs as decoded data become available. We optionally call Sleep() for
573
+ * one second per iteration to simulate downloading the image via an analog
574
+ * modem. */
575
+
576
+ for (;;) {
577
+ Trace((stderr, "about to call readpng2_decode_data()\n"))
578
+ if (readpng2_decode_data(&rpng2_info, inbuf, incount))
579
+ ++error;
580
+ Trace((stderr, "done with readpng2_decode_data()\n"))
581
+
582
+ if (error || incount != INBUFSIZE || rpng2_info.state == kDone) {
583
+ if (rpng2_info.state == kDone) {
584
+ Trace((stderr, "done decoding PNG image\n"))
585
+ } else if (ferror(infile)) {
586
+ fprintf(stderr, PROGNAME
587
+ ": error while reading PNG image file\n");
588
+ exit(3);
589
+ } else if (feof(infile)) {
590
+ fprintf(stderr, PROGNAME ": end of file reached "
591
+ "(unexpectedly) while reading PNG image file\n");
592
+ exit(3);
593
+ } else /* if (error) */ {
594
+ /* will print error message below */
595
+ }
596
+ break;
597
+ }
598
+
599
+ if (timing)
600
+ Sleep(1000L);
601
+
602
+ incount = fread(inbuf, 1, INBUFSIZE, infile);
603
+ }
604
+
605
+
606
+ /* clean up PNG stuff and report any decoding errors */
607
+
608
+ fclose(infile);
609
+ Trace((stderr, "about to call readpng2_cleanup()\n"))
610
+ readpng2_cleanup(&rpng2_info);
611
+
612
+ if (error) {
613
+ fprintf(stderr, PROGNAME ": libpng error while decoding PNG image\n");
614
+ exit(3);
615
+ }
616
+
617
+
618
+ /* wait for the user to tell us when to quit */
619
+
620
+ while (GetMessage(&msg, NULL, 0, 0)) {
621
+ TranslateMessage(&msg);
622
+ DispatchMessage(&msg);
623
+ }
624
+
625
+
626
+ /* we're done: clean up all image and Windows resources and go away */
627
+
628
+ Trace((stderr, "about to call rpng2_win_cleanup()\n"))
629
+ rpng2_win_cleanup();
630
+
631
+ return msg.wParam;
632
+ }
633
+
634
+
635
+
636
+
637
+
638
+ /* this function is called by readpng2_info_callback() in readpng2.c, which
639
+ * in turn is called by libpng after all of the pre-IDAT chunks have been
640
+ * read and processed--i.e., we now have enough info to finish initializing */
641
+
642
+ static void rpng2_win_init()
643
+ {
644
+ ulg i;
645
+ ulg rowbytes = rpng2_info.rowbytes;
646
+
647
+ Trace((stderr, "beginning rpng2_win_init()\n"))
648
+ Trace((stderr, " rowbytes = %d\n", rpng2_info.rowbytes))
649
+ Trace((stderr, " width = %ld\n", rpng2_info.width))
650
+ Trace((stderr, " height = %ld\n", rpng2_info.height))
651
+
652
+ /* Guard against integer overflow */
653
+ if (rpng2_info.height > ((size_t)(-1))/rowbytes) {
654
+ fprintf(stderr, PROGNAME ": image_data buffer would be too large\n",
655
+ readpng2_cleanup(&rpng2_info);
656
+ return;
657
+ }
658
+
659
+ rpng2_info.image_data = (uch *)malloc(rowbytes * rpng2_info.height);
660
+ if (!rpng2_info.image_data) {
661
+ readpng2_cleanup(&rpng2_info);
662
+ return;
663
+ }
664
+
665
+ rpng2_info.row_pointers = (uch **)malloc(rpng2_info.height * sizeof(uch *));
666
+ if (!rpng2_info.row_pointers) {
667
+ free(rpng2_info.image_data);
668
+ rpng2_info.image_data = NULL;
669
+ readpng2_cleanup(&rpng2_info);
670
+ return;
671
+ }
672
+
673
+ for (i = 0; i < rpng2_info.height; ++i)
674
+ rpng2_info.row_pointers[i] = rpng2_info.image_data + i*rowbytes;
675
+
676
+ /*---------------------------------------------------------------------------
677
+ Do the basic Windows initialization stuff, make the window, and fill it
678
+ with the user-specified, file-specified or default background color.
679
+ ---------------------------------------------------------------------------*/
680
+
681
+ if (rpng2_win_create_window()) {
682
+ readpng2_cleanup(&rpng2_info);
683
+ return;
684
+ }
685
+
686
+ rpng2_info.state = kWindowInit;
687
+ }
688
+
689
+
690
+
691
+
692
+
693
+ static int rpng2_win_create_window()
694
+ {
695
+ uch bg_red = rpng2_info.bg_red;
696
+ uch bg_green = rpng2_info.bg_green;
697
+ uch bg_blue = rpng2_info.bg_blue;
698
+ uch *dest;
699
+ int extra_width, extra_height;
700
+ ulg i, j;
701
+ WNDCLASSEX wndclass;
702
+ RECT rect;
703
+
704
+
705
+ /*---------------------------------------------------------------------------
706
+ Allocate memory for the display-specific version of the image (round up
707
+ to multiple of 4 for Windows DIB).
708
+ ---------------------------------------------------------------------------*/
709
+
710
+ wimage_rowbytes = ((3*rpng2_info.width + 3L) >> 2) << 2;
711
+
712
+ if (!(dib = (uch *)malloc(sizeof(BITMAPINFOHEADER) +
713
+ wimage_rowbytes*rpng2_info.height)))
714
+ {
715
+ return 4; /* fail */
716
+ }
717
+
718
+ /*---------------------------------------------------------------------------
719
+ Initialize the DIB. Negative height means to use top-down BMP ordering
720
+ (must be uncompressed, but that's what we want). Bit count of 1, 4 or 8
721
+ implies a colormap of RGBX quads, but 24-bit BMPs just use B,G,R values
722
+ directly => wimage_data begins immediately after BMP header.
723
+ ---------------------------------------------------------------------------*/
724
+
725
+ memset(dib, 0, sizeof(BITMAPINFOHEADER));
726
+ bmih = (BITMAPINFOHEADER *)dib;
727
+ bmih->biSize = sizeof(BITMAPINFOHEADER);
728
+ bmih->biWidth = rpng2_info.width;
729
+ bmih->biHeight = -((long)rpng2_info.height);
730
+ bmih->biPlanes = 1;
731
+ bmih->biBitCount = 24;
732
+ bmih->biCompression = 0;
733
+ wimage_data = dib + sizeof(BITMAPINFOHEADER);
734
+
735
+ /*---------------------------------------------------------------------------
736
+ Fill window with the specified background color (default is black), but
737
+ defer loading faked "background image" until window is displayed (may be
738
+ slow to compute). Data are in BGR order.
739
+ ---------------------------------------------------------------------------*/
740
+
741
+ if (bg_image) { /* just fill with black for now */
742
+ memset(wimage_data, 0, wimage_rowbytes*rpng2_info.height);
743
+ } else {
744
+ for (j = 0; j < rpng2_info.height; ++j) {
745
+ dest = wimage_data + j*wimage_rowbytes;
746
+ for (i = rpng2_info.width; i > 0; --i) {
747
+ *dest++ = bg_blue;
748
+ *dest++ = bg_green;
749
+ *dest++ = bg_red;
750
+ }
751
+ }
752
+ }
753
+
754
+ /*---------------------------------------------------------------------------
755
+ Set the window parameters.
756
+ ---------------------------------------------------------------------------*/
757
+
758
+ memset(&wndclass, 0, sizeof(wndclass));
759
+
760
+ wndclass.cbSize = sizeof(wndclass);
761
+ wndclass.style = CS_HREDRAW | CS_VREDRAW;
762
+ wndclass.lpfnWndProc = rpng2_win_wndproc;
763
+ wndclass.hInstance = global_hInst;
764
+ wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
765
+ wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
766
+ wndclass.hbrBackground = (HBRUSH)GetStockObject(DKGRAY_BRUSH);
767
+ wndclass.lpszMenuName = NULL;
768
+ wndclass.lpszClassName = progname;
769
+ wndclass.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
770
+
771
+ RegisterClassEx(&wndclass);
772
+
773
+ /*---------------------------------------------------------------------------
774
+ Finally, create the window.
775
+ ---------------------------------------------------------------------------*/
776
+
777
+ extra_width = 2*(GetSystemMetrics(SM_CXBORDER) +
778
+ GetSystemMetrics(SM_CXDLGFRAME));
779
+ extra_height = 2*(GetSystemMetrics(SM_CYBORDER) +
780
+ GetSystemMetrics(SM_CYDLGFRAME)) +
781
+ GetSystemMetrics(SM_CYCAPTION);
782
+
783
+ global_hwnd = CreateWindow(progname, titlebar, WS_OVERLAPPEDWINDOW,
784
+ CW_USEDEFAULT, CW_USEDEFAULT, rpng2_info.width+extra_width,
785
+ rpng2_info.height+extra_height, NULL, NULL, global_hInst, NULL);
786
+
787
+ ShowWindow(global_hwnd, global_showmode);
788
+ UpdateWindow(global_hwnd);
789
+
790
+ /*---------------------------------------------------------------------------
791
+ Now compute the background image and display it. If it fails (memory
792
+ allocation), revert to a plain background color.
793
+ ---------------------------------------------------------------------------*/
794
+
795
+ if (bg_image) {
796
+ static const char *msg = "Computing background image...";
797
+ int x, y, len = strlen(msg);
798
+ HDC hdc = GetDC(global_hwnd);
799
+ TEXTMETRIC tm;
800
+
801
+ GetTextMetrics(hdc, &tm);
802
+ x = (rpng2_info.width - len*tm.tmAveCharWidth)/2;
803
+ y = (rpng2_info.height - tm.tmHeight)/2;
804
+ SetBkMode(hdc, TRANSPARENT);
805
+ SetTextColor(hdc, GetSysColor(COLOR_HIGHLIGHTTEXT));
806
+ /* this can still begin out of bounds even if x is positive (???): */
807
+ TextOut(hdc, ((x < 0)? 0 : x), ((y < 0)? 0 : y), msg, len);
808
+ ReleaseDC(global_hwnd, hdc);
809
+
810
+ rpng2_win_load_bg_image(); /* resets bg_image if fails */
811
+ }
812
+
813
+ if (!bg_image) {
814
+ for (j = 0; j < rpng2_info.height; ++j) {
815
+ dest = wimage_data + j*wimage_rowbytes;
816
+ for (i = rpng2_info.width; i > 0; --i) {
817
+ *dest++ = bg_blue;
818
+ *dest++ = bg_green;
819
+ *dest++ = bg_red;
820
+ }
821
+ }
822
+ }
823
+
824
+ rect.left = 0L;
825
+ rect.top = 0L;
826
+ rect.right = (LONG)rpng2_info.width; /* possibly off by one? */
827
+ rect.bottom = (LONG)rpng2_info.height; /* possibly off by one? */
828
+ InvalidateRect(global_hwnd, &rect, FALSE);
829
+ UpdateWindow(global_hwnd); /* similar to XFlush() */
830
+
831
+ return 0;
832
+
833
+ } /* end function rpng2_win_create_window() */
834
+
835
+
836
+
837
+
838
+
839
+ static int rpng2_win_load_bg_image()
840
+ {
841
+ uch *src, *dest;
842
+ uch r1, r2, g1, g2, b1, b2;
843
+ uch r1_inv, r2_inv, g1_inv, g2_inv, b1_inv, b2_inv;
844
+ int k, hmax, max;
845
+ int xidx, yidx, yidx_max = (bgscale-1);
846
+ int even_odd_vert, even_odd_horiz, even_odd;
847
+ int invert_gradient2 = (bg[pat].type & 0x08);
848
+ int invert_column;
849
+ ulg i, row;
850
+
851
+ /*---------------------------------------------------------------------------
852
+ Allocate buffer for fake background image to be used with transparent
853
+ images; if this fails, revert to plain background color.
854
+ ---------------------------------------------------------------------------*/
855
+
856
+ bg_rowbytes = 3 * rpng2_info.width;
857
+ bg_data = (uch *)malloc(bg_rowbytes * rpng2_info.height);
858
+ if (!bg_data) {
859
+ fprintf(stderr, PROGNAME
860
+ ": unable to allocate memory for background image\n");
861
+ bg_image = 0;
862
+ return 1;
863
+ }
864
+
865
+ /*---------------------------------------------------------------------------
866
+ Vertical gradients (ramps) in NxN squares, alternating direction and
867
+ colors (N == bgscale).
868
+ ---------------------------------------------------------------------------*/
869
+
870
+ if ((bg[pat].type & 0x07) == 0) {
871
+ uch r1_min = rgb[bg[pat].rgb1_min].r;
872
+ uch g1_min = rgb[bg[pat].rgb1_min].g;
873
+ uch b1_min = rgb[bg[pat].rgb1_min].b;
874
+ uch r2_min = rgb[bg[pat].rgb2_min].r;
875
+ uch g2_min = rgb[bg[pat].rgb2_min].g;
876
+ uch b2_min = rgb[bg[pat].rgb2_min].b;
877
+ int r1_diff = rgb[bg[pat].rgb1_max].r - r1_min;
878
+ int g1_diff = rgb[bg[pat].rgb1_max].g - g1_min;
879
+ int b1_diff = rgb[bg[pat].rgb1_max].b - b1_min;
880
+ int r2_diff = rgb[bg[pat].rgb2_max].r - r2_min;
881
+ int g2_diff = rgb[bg[pat].rgb2_max].g - g2_min;
882
+ int b2_diff = rgb[bg[pat].rgb2_max].b - b2_min;
883
+
884
+ for (row = 0; row < rpng2_info.height; ++row) {
885
+ yidx = row % bgscale;
886
+ even_odd_vert = (row / bgscale) & 1;
887
+
888
+ r1 = r1_min + (r1_diff * yidx) / yidx_max;
889
+ g1 = g1_min + (g1_diff * yidx) / yidx_max;
890
+ b1 = b1_min + (b1_diff * yidx) / yidx_max;
891
+ r1_inv = r1_min + (r1_diff * (yidx_max-yidx)) / yidx_max;
892
+ g1_inv = g1_min + (g1_diff * (yidx_max-yidx)) / yidx_max;
893
+ b1_inv = b1_min + (b1_diff * (yidx_max-yidx)) / yidx_max;
894
+
895
+ r2 = r2_min + (r2_diff * yidx) / yidx_max;
896
+ g2 = g2_min + (g2_diff * yidx) / yidx_max;
897
+ b2 = b2_min + (b2_diff * yidx) / yidx_max;
898
+ r2_inv = r2_min + (r2_diff * (yidx_max-yidx)) / yidx_max;
899
+ g2_inv = g2_min + (g2_diff * (yidx_max-yidx)) / yidx_max;
900
+ b2_inv = b2_min + (b2_diff * (yidx_max-yidx)) / yidx_max;
901
+
902
+ dest = bg_data + row*bg_rowbytes;
903
+ for (i = 0; i < rpng2_info.width; ++i) {
904
+ even_odd_horiz = (i / bgscale) & 1;
905
+ even_odd = even_odd_vert ^ even_odd_horiz;
906
+ invert_column =
907
+ (even_odd_horiz && (bg[pat].type & 0x10));
908
+ if (even_odd == 0) { /* gradient #1 */
909
+ if (invert_column) {
910
+ *dest++ = r1_inv;
911
+ *dest++ = g1_inv;
912
+ *dest++ = b1_inv;
913
+ } else {
914
+ *dest++ = r1;
915
+ *dest++ = g1;
916
+ *dest++ = b1;
917
+ }
918
+ } else { /* gradient #2 */
919
+ if ((invert_column && invert_gradient2) ||
920
+ (!invert_column && !invert_gradient2))
921
+ {
922
+ *dest++ = r2; /* not inverted or */
923
+ *dest++ = g2; /* doubly inverted */
924
+ *dest++ = b2;
925
+ } else {
926
+ *dest++ = r2_inv;
927
+ *dest++ = g2_inv; /* singly inverted */
928
+ *dest++ = b2_inv;
929
+ }
930
+ }
931
+ }
932
+ }
933
+
934
+ /*---------------------------------------------------------------------------
935
+ Soft gradient-diamonds with scale = bgscale. Code contributed by Adam
936
+ M. Costello.
937
+ ---------------------------------------------------------------------------*/
938
+
939
+ } else if ((bg[pat].type & 0x07) == 1) {
940
+
941
+ hmax = (bgscale-1)/2; /* half the max weight of a color */
942
+ max = 2*hmax; /* the max weight of a color */
943
+
944
+ r1 = rgb[bg[pat].rgb1_max].r;
945
+ g1 = rgb[bg[pat].rgb1_max].g;
946
+ b1 = rgb[bg[pat].rgb1_max].b;
947
+ r2 = rgb[bg[pat].rgb2_max].r;
948
+ g2 = rgb[bg[pat].rgb2_max].g;
949
+ b2 = rgb[bg[pat].rgb2_max].b;
950
+
951
+ for (row = 0; row < rpng2_info.height; ++row) {
952
+ yidx = row % bgscale;
953
+ if (yidx > hmax)
954
+ yidx = bgscale-1 - yidx;
955
+ dest = bg_data + row*bg_rowbytes;
956
+ for (i = 0; i < rpng2_info.width; ++i) {
957
+ xidx = i % bgscale;
958
+ if (xidx > hmax)
959
+ xidx = bgscale-1 - xidx;
960
+ k = xidx + yidx;
961
+ *dest++ = (k*r1 + (max-k)*r2) / max;
962
+ *dest++ = (k*g1 + (max-k)*g2) / max;
963
+ *dest++ = (k*b1 + (max-k)*b2) / max;
964
+ }
965
+ }
966
+
967
+ /*---------------------------------------------------------------------------
968
+ Radial "starburst" with azimuthal sinusoids; [eventually number of sinu-
969
+ soids will equal bgscale?]. This one is slow but very cool. Code con-
970
+ tributed by Pieter S. van der Meulen (originally in Smalltalk).
971
+ ---------------------------------------------------------------------------*/
972
+
973
+ } else if ((bg[pat].type & 0x07) == 2) {
974
+ uch ch;
975
+ int ii, x, y, hw, hh, grayspot;
976
+ double freq, rotate, saturate, gray, intensity;
977
+ double angle=0.0, aoffset=0.0, maxDist, dist;
978
+ double red=0.0, green=0.0, blue=0.0, hue, s, v, f, p, q, t;
979
+
980
+ fprintf(stderr, "%s: computing radial background...",
981
+ PROGNAME);
982
+ fflush(stderr);
983
+
984
+ hh = rpng2_info.height / 2;
985
+ hw = rpng2_info.width / 2;
986
+
987
+ /* variables for radial waves:
988
+ * aoffset: number of degrees to rotate hue [CURRENTLY NOT USED]
989
+ * freq: number of color beams originating from the center
990
+ * grayspot: size of the graying center area (anti-alias)
991
+ * rotate: rotation of the beams as a function of radius
992
+ * saturate: saturation of beams' shape azimuthally
993
+ */
994
+ angle = CLIP(angle, 0.0, 360.0);
995
+ grayspot = CLIP(bg[pat].bg_gray, 1, (hh + hw));
996
+ freq = MAX((double)bg[pat].bg_freq, 0.0);
997
+ saturate = (double)bg[pat].bg_bsat * 0.1;
998
+ rotate = (double)bg[pat].bg_brot * 0.1;
999
+ gray = 0.0;
1000
+ intensity = 0.0;
1001
+ maxDist = (double)((hw*hw) + (hh*hh));
1002
+
1003
+ for (row = 0; row < rpng2_info.height; ++row) {
1004
+ y = row - hh;
1005
+ dest = bg_data + row*bg_rowbytes;
1006
+ for (i = 0; i < rpng2_info.width; ++i) {
1007
+ x = i - hw;
1008
+ angle = (x == 0)? PI_2 : atan((double)y / (double)x);
1009
+ gray = (double)MAX(ABS(y), ABS(x)) / grayspot;
1010
+ gray = MIN(1.0, gray);
1011
+ dist = (double)((x*x) + (y*y)) / maxDist;
1012
+ intensity = cos((angle+(rotate*dist*PI)) * freq) *
1013
+ gray * saturate;
1014
+ intensity = (MAX(MIN(intensity,1.0),-1.0) + 1.0) * 0.5;
1015
+ hue = (angle + PI) * INV_PI_360 + aoffset;
1016
+ s = gray * ((double)(ABS(x)+ABS(y)) / (double)(hw + hh));
1017
+ s = MIN(MAX(s,0.0), 1.0);
1018
+ v = MIN(MAX(intensity,0.0), 1.0);
1019
+
1020
+ if (s == 0.0) {
1021
+ ch = (uch)(v * 255.0);
1022
+ *dest++ = ch;
1023
+ *dest++ = ch;
1024
+ *dest++ = ch;
1025
+ } else {
1026
+ if ((hue < 0.0) || (hue >= 360.0))
1027
+ hue -= (((int)(hue / 360.0)) * 360.0);
1028
+ hue /= 60.0;
1029
+ ii = (int)hue;
1030
+ f = hue - (double)ii;
1031
+ p = (1.0 - s) * v;
1032
+ q = (1.0 - (s * f)) * v;
1033
+ t = (1.0 - (s * (1.0 - f))) * v;
1034
+ if (ii == 0) { red = v; green = t; blue = p; }
1035
+ else if (ii == 1) { red = q; green = v; blue = p; }
1036
+ else if (ii == 2) { red = p; green = v; blue = t; }
1037
+ else if (ii == 3) { red = p; green = q; blue = v; }
1038
+ else if (ii == 4) { red = t; green = p; blue = v; }
1039
+ else if (ii == 5) { red = v; green = p; blue = q; }
1040
+ *dest++ = (uch)(red * 255.0);
1041
+ *dest++ = (uch)(green * 255.0);
1042
+ *dest++ = (uch)(blue * 255.0);
1043
+ }
1044
+ }
1045
+ }
1046
+ fprintf(stderr, "done.\n");
1047
+ fflush(stderr);
1048
+ }
1049
+
1050
+ /*---------------------------------------------------------------------------
1051
+ Blast background image to display buffer before beginning PNG decode;
1052
+ calling function will handle invalidation and UpdateWindow() call.
1053
+ ---------------------------------------------------------------------------*/
1054
+
1055
+ for (row = 0; row < rpng2_info.height; ++row) {
1056
+ src = bg_data + row*bg_rowbytes;
1057
+ dest = wimage_data + row*wimage_rowbytes;
1058
+ for (i = rpng2_info.width; i > 0; --i) {
1059
+ r1 = *src++;
1060
+ g1 = *src++;
1061
+ b1 = *src++;
1062
+ *dest++ = b1;
1063
+ *dest++ = g1; /* note reverse order */
1064
+ *dest++ = r1;
1065
+ }
1066
+ }
1067
+
1068
+ return 0;
1069
+
1070
+ } /* end function rpng2_win_load_bg_image() */
1071
+
1072
+
1073
+
1074
+
1075
+
1076
+ static void rpng2_win_display_row(ulg row)
1077
+ {
1078
+ uch bg_red = rpng2_info.bg_red;
1079
+ uch bg_green = rpng2_info.bg_green;
1080
+ uch bg_blue = rpng2_info.bg_blue;
1081
+ uch *src, *src2=NULL, *dest;
1082
+ uch r, g, b, a;
1083
+ ulg i;
1084
+ static int rows=0;
1085
+ static ulg firstrow;
1086
+
1087
+ /*---------------------------------------------------------------------------
1088
+ rows and firstrow simply track how many rows (and which ones) have not
1089
+ yet been displayed; alternatively, we could call InvalidateRect() for
1090
+ every row and not bother with the records-keeping.
1091
+ ---------------------------------------------------------------------------*/
1092
+
1093
+ Trace((stderr, "beginning rpng2_win_display_row()\n"))
1094
+
1095
+ if (rows == 0)
1096
+ firstrow = row; /* first row not yet displayed */
1097
+
1098
+ ++rows; /* count of rows received but not yet displayed */
1099
+
1100
+ /*---------------------------------------------------------------------------
1101
+ Aside from the use of the rpng2_info struct and the lack of an outer
1102
+ loop (over rows), this routine is identical to rpng_win_display_image()
1103
+ in the non-progressive version of the program.
1104
+ ---------------------------------------------------------------------------*/
1105
+
1106
+ src = rpng2_info.image_data + row*rpng2_info.rowbytes;
1107
+ if (bg_image)
1108
+ src2 = bg_data + row*bg_rowbytes;
1109
+ dest = wimage_data + row*wimage_rowbytes;
1110
+
1111
+ if (rpng2_info.channels == 3) {
1112
+ for (i = rpng2_info.width; i > 0; --i) {
1113
+ r = *src++;
1114
+ g = *src++;
1115
+ b = *src++;
1116
+ *dest++ = b;
1117
+ *dest++ = g; /* note reverse order */
1118
+ *dest++ = r;
1119
+ }
1120
+ } else /* if (rpng2_info.channels == 4) */ {
1121
+ for (i = rpng2_info.width; i > 0; --i) {
1122
+ r = *src++;
1123
+ g = *src++;
1124
+ b = *src++;
1125
+ a = *src++;
1126
+ if (bg_image) {
1127
+ bg_red = *src2++;
1128
+ bg_green = *src2++;
1129
+ bg_blue = *src2++;
1130
+ }
1131
+ if (a == 255) {
1132
+ *dest++ = b;
1133
+ *dest++ = g;
1134
+ *dest++ = r;
1135
+ } else if (a == 0) {
1136
+ *dest++ = bg_blue;
1137
+ *dest++ = bg_green;
1138
+ *dest++ = bg_red;
1139
+ } else {
1140
+ /* this macro (copied from png.h) composites the
1141
+ * foreground and background values and puts the
1142
+ * result into the first argument; there are no
1143
+ * side effects with the first argument */
1144
+ alpha_composite(*dest++, b, a, bg_blue);
1145
+ alpha_composite(*dest++, g, a, bg_green);
1146
+ alpha_composite(*dest++, r, a, bg_red);
1147
+ }
1148
+ }
1149
+ }
1150
+
1151
+ /*---------------------------------------------------------------------------
1152
+ Display after every 16 rows or when on last row. (Region may include
1153
+ previously displayed lines due to interlacing--i.e., not contiguous.)
1154
+ ---------------------------------------------------------------------------*/
1155
+
1156
+ if ((rows & 0xf) == 0 || row == rpng2_info.height-1) {
1157
+ RECT rect;
1158
+
1159
+ rect.left = 0L;
1160
+ rect.top = (LONG)firstrow;
1161
+ rect.right = (LONG)rpng2_info.width; /* possibly off by one? */
1162
+ rect.bottom = (LONG)row + 1L; /* possibly off by one? */
1163
+ InvalidateRect(global_hwnd, &rect, FALSE);
1164
+ UpdateWindow(global_hwnd); /* similar to XFlush() */
1165
+ rows = 0;
1166
+ }
1167
+
1168
+ } /* end function rpng2_win_display_row() */
1169
+
1170
+
1171
+
1172
+
1173
+
1174
+ static void rpng2_win_finish_display()
1175
+ {
1176
+ Trace((stderr, "beginning rpng2_win_finish_display()\n"))
1177
+
1178
+ /* last row has already been displayed by rpng2_win_display_row(), so
1179
+ * we have nothing to do here except set a flag and let the user know
1180
+ * that the image is done */
1181
+
1182
+ rpng2_info.state = kDone;
1183
+ printf(
1184
+ #ifndef __CYGWIN__
1185
+ "Done. Press Q, Esc or mouse button 1 (within image window) to quit.\n"
1186
+ #else
1187
+ "Done. Press mouse button 1 (within image window) to quit.\n"
1188
+ #endif
1189
+ );
1190
+ fflush(stdout);
1191
+ }
1192
+
1193
+
1194
+
1195
+
1196
+
1197
+ static void rpng2_win_cleanup()
1198
+ {
1199
+ if (bg_image && bg_data) {
1200
+ free(bg_data);
1201
+ bg_data = NULL;
1202
+ }
1203
+
1204
+ if (rpng2_info.image_data) {
1205
+ free(rpng2_info.image_data);
1206
+ rpng2_info.image_data = NULL;
1207
+ }
1208
+
1209
+ if (rpng2_info.row_pointers) {
1210
+ free(rpng2_info.row_pointers);
1211
+ rpng2_info.row_pointers = NULL;
1212
+ }
1213
+
1214
+ if (dib) {
1215
+ free(dib);
1216
+ dib = NULL;
1217
+ }
1218
+ }
1219
+
1220
+
1221
+
1222
+
1223
+
1224
+ LRESULT CALLBACK rpng2_win_wndproc(HWND hwnd, UINT iMsg, WPARAM wP, LPARAM lP)
1225
+ {
1226
+ HDC hdc;
1227
+ PAINTSTRUCT ps;
1228
+ int rc;
1229
+
1230
+ switch (iMsg) {
1231
+ case WM_CREATE:
1232
+ /* one-time processing here, if any */
1233
+ return 0;
1234
+
1235
+ case WM_PAINT:
1236
+ hdc = BeginPaint(hwnd, &ps);
1237
+ rc = StretchDIBits(hdc, 0, 0, rpng2_info.width, rpng2_info.height,
1238
+ 0, 0, rpng2_info.width, rpng2_info.height,
1239
+ wimage_data, (BITMAPINFO *)bmih,
1240
+ 0, SRCCOPY);
1241
+ EndPaint(hwnd, &ps);
1242
+ return 0;
1243
+
1244
+ /* wait for the user to tell us when to quit */
1245
+ case WM_CHAR:
1246
+ switch (wP) { /* only need one, so ignore repeat count */
1247
+ case 'q':
1248
+ case 'Q':
1249
+ case 0x1B: /* Esc key */
1250
+ PostQuitMessage(0);
1251
+ }
1252
+ return 0;
1253
+
1254
+ case WM_LBUTTONDOWN: /* another way of quitting */
1255
+ case WM_DESTROY:
1256
+ PostQuitMessage(0);
1257
+ return 0;
1258
+ }
1259
+
1260
+ return DefWindowProc(hwnd, iMsg, wP, lP);
1261
+ }