~ubuntu-branches/ubuntu/vivid/libicns/vivid

« back to all changes in this revision

Viewing changes to icnsutils/png2icns.c

  • Committer: Package Import Robot
  • Author(s): Paul Wise, Mathew Eis, Paul Wise
  • Date: 2012-06-14 10:16:49 UTC
  • mfrom: (1.1.3)
  • mto: This revision was merged to the branch mainline in revision 7.
  • Revision ID: package-import@ubuntu.com-20120614101649-7e9vuqyd686l0h3z
[ Mathew Eis ]
* New upstream release
  - No longer crashes on ARM/SPARC (Closes: #612698)
  - Understands 'odrp' type (Closes: #614031)
  - Fails with non-zero return code (Closes: #614028)
  - Fixes FTBFS with newer libpng (Closes: #635952)
* debian/control
  - Bump to 3.9.3 Standards-Version (no change needed).

[ Paul Wise ]
* Include changes from Debian NMU
* Wrap and sort various files using wrap-and-sort -s
* Compile against libjpeg-dev instead of the old version (Closes: #643316)
* Compile against libpng-dev instead of the old version (Closes: #662403)
* Adjust the watch file to only look for release versions
* Switch to debhelper compat 9 and dh tiny rules
* Drop autotools_dev and use dh-autoreconf
* Switch to dpkg-source v3
* Use multi-arch paths and fields
* Add myself to uploaders
* Add Vcs-* headers
* Also install the API docs, drop from lib package
* Switch to Debian copyright format 1.0 for the source Debian copyright file

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 * png2icns
3
3
 *
4
4
 * Copyright (C) 2008 Julien BLACHE <jb@jblache.org>
5
 
 * Copyright (C) 2008 Mathew Eis <mathew@eisbox.net>
 
5
 * Copyright (C) 2012 Mathew Eis <mathew@eisbox.net>
6
6
 *
7
7
 * This program is free software; you can redistribute it and/or modify
8
8
 * it under the terms of the GNU General Public License as published by
31
31
#define FALSE   0
32
32
#define TRUE    1
33
33
 
 
34
#if PNG_LIBPNG_VER >= 10209
 
35
 #define PNG2ICNS_EXPAND_GRAY 1
 
36
#endif
 
37
 
34
38
static int read_png(FILE *fp, png_bytepp buffer, int32_t *bpp, int32_t *width, int32_t *height)
35
39
{
36
40
        png_structp png_ptr;
70
74
        switch (color_type)
71
75
        {
72
76
                case PNG_COLOR_TYPE_GRAY:
 
77
                        #ifdef PNG2ICNS_EXPAND_GRAY
 
78
                        png_set_expand_gray_1_2_4_to_8(png_ptr);
 
79
                        #else
73
80
                        png_set_gray_1_2_4_to_8(png_ptr);
 
81
                        #endif
74
82
 
75
83
                        if (bit_depth == 16) {
76
84
                                png_set_strip_16(png_ptr);
82
90
                        break;
83
91
 
84
92
                case PNG_COLOR_TYPE_GRAY_ALPHA:
 
93
                        #ifdef PNG2ICNS_EXPAND_GRAY
 
94
                        png_set_expand_gray_1_2_4_to_8(png_ptr);
 
95
                        #else
85
96
                        png_set_gray_1_2_4_to_8(png_ptr);
 
97
                        #endif
86
98
 
87
99
                        if (bit_depth == 16) {
88
100
                                png_set_strip_16(png_ptr);
231
243
        
232
244
        icns_set_print_errors(1);
233
245
        
234
 
        if( (iconType != ICNS_512x512_32BIT_ARGB_DATA) && (iconType != ICNS_256x256_32BIT_ARGB_DATA) )
 
246
        if( (iconType != ICNS_1024x1024_32BIT_ARGB_DATA) && (iconType != ICNS_512x512_32BIT_ARGB_DATA) && (iconType != ICNS_256x256_32BIT_ARGB_DATA) )
235
247
        {
236
248
                printf("Using icns type '%s', mask '%s' for '%s'\n", iconStr, maskStr, pngname);
237
249
        }
251
263
                free(iconElement);
252
264
        }
253
265
 
254
 
        if( (iconType != ICNS_512x512_32BIT_ARGB_DATA) && (iconType != ICNS_256x256_32BIT_ARGB_DATA) )
 
266
        if( (iconType != ICNS_1024x1024_32BIT_ARGB_DATA) && (iconType != ICNS_512x512_32BIT_ARGB_DATA) && (iconType != ICNS_256x256_32BIT_ARGB_DATA) )
255
267
        {
256
268
                icns_init_image_for_type(maskType, &icnsMask);
257
269