~ubuntu-branches/ubuntu/saucy/amsn/saucy

« back to all changes in this revision

Viewing changes to utils/TkCximage/src/CxImage/ximapng.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Devid Antonio Filoni
  • Date: 2010-04-13 23:21:29 UTC
  • mfrom: (1.1.11 upstream) (3.1.8 sid)
  • Revision ID: james.westby@ubuntu.com-20100413232129-vgpx20brdd2qavs7
Tags: 0.98.3-0ubuntu1
* Merge from Debian unstable (LP: #449072), remaining Ubuntu changes:
  - add 08_use_aplay_for_sound.dpatch patch by Festor Wailon Dacoba to use
    aplay to play sounds
  + debian/control:
    - modify iceweasel to firefox | abrowser in amsn Suggests field
    - add xdg-utils and gstreamer0.10-nice to amsn Depends field
    - mofify sox to alsa-utils in amsn Suggests field as we are now using
      aplay
* New upstream release (LP: #562619), tarball repacked according to
  debian/README.source.
* Fix missing-debian-source-format lintian warning.

Show diffs side-by-side

added added

removed removed

Lines of Context:
142
142
        if (info_ptr->num_trans!=0){ //palette transparency
143
143
                if (info_ptr->num_trans==1){
144
144
                        if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE){
 
145
#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4
 
146
                                info.nBkgndIndex = info_ptr->trans_color.index;
 
147
#else
145
148
                                info.nBkgndIndex = info_ptr->trans_values.index;
 
149
#endif
146
150
                        } else{
 
151
#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4
 
152
                                info.nBkgndIndex = info_ptr->trans_color.gray>>nshift;
 
153
#else
147
154
                                info.nBkgndIndex = info_ptr->trans_values.gray>>nshift;
 
155
#endif
148
156
                        }
149
157
                }
150
158
                if (info_ptr->num_trans>1){
152
160
                        if (pal){
153
161
                                DWORD ip;
154
162
                                for (ip=0;ip<min(head.biClrUsed,(unsigned long)info_ptr->num_trans);ip++)
 
163
#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4
 
164
                                        pal[ip].rgbReserved=info_ptr->trans_alpha[ip];
 
165
#else
155
166
                                        pal[ip].rgbReserved=info_ptr->trans[ip];
 
167
#endif
156
168
                                for (ip=info_ptr->num_trans;ip<head.biClrUsed;ip++){
157
169
                                        pal[ip].rgbReserved=255;
158
170
                                }
166
178
                int num_trans;
167
179
                png_color_16 *image_background;
168
180
                if (png_get_tRNS(png_ptr, info_ptr, &trans, &num_trans, &image_background)){
 
181
#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4
 
182
                        info.nBkgndColor.rgbRed   = (BYTE)(info_ptr->trans_color.red>>nshift);
 
183
                        info.nBkgndColor.rgbGreen = (BYTE)(info_ptr->trans_color.green>>nshift);
 
184
                        info.nBkgndColor.rgbBlue  = (BYTE)(info_ptr->trans_color.blue>>nshift);
 
185
#else
169
186
                        info.nBkgndColor.rgbRed   = (BYTE)(info_ptr->trans_values.red>>nshift);
170
187
                        info.nBkgndColor.rgbGreen = (BYTE)(info_ptr->trans_values.green>>nshift);
171
188
                        info.nBkgndColor.rgbBlue  = (BYTE)(info_ptr->trans_values.blue>>nshift);
 
189
#endif
172
190
                        info.nBkgndColor.rgbReserved = 0;
173
191
                        info.nBkgndIndex = 0;
174
192
                }
293
311
        }
294
312
 
295
313
        delete [] row_pointers;
 
314
        row_pointers = NULL;
296
315
 
297
316
        /* read the rest of the file, getting any additional chunks in info_ptr */
298
317
        png_read_end(png_ptr, info_ptr);
417
436
        if (info.nBkgndIndex >= 0){
418
437
                info_ptr->num_trans = 1;
419
438
                info_ptr->valid |= PNG_INFO_tRNS;
 
439
#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4
 
440
                info_ptr->trans_alpha = trans;
 
441
                info_ptr->trans_color.index = (BYTE)info.nBkgndIndex;
 
442
                info_ptr->trans_color.red   = tc.rgbRed;
 
443
                info_ptr->trans_color.green = tc.rgbGreen;
 
444
                info_ptr->trans_color.blue  = tc.rgbBlue;
 
445
                info_ptr->trans_color.gray  = info_ptr->trans_color.index;
 
446
#else
420
447
                info_ptr->trans = trans;
421
448
                info_ptr->trans_values.index = (BYTE)info.nBkgndIndex;
422
449
                info_ptr->trans_values.red   = tc.rgbRed;
423
450
                info_ptr->trans_values.green = tc.rgbGreen;
424
451
                info_ptr->trans_values.blue  = tc.rgbBlue;
425
452
                info_ptr->trans_values.gray  = info_ptr->trans_values.index;
 
453
#endif
426
454
 
427
455
                // the transparency indexes start from 0 for non grayscale palette
428
456
                if (!bGrayScale && head.biClrUsed && info.nBkgndIndex)
443
471
                                trans[ip]=GetPaletteColor((BYTE)ip).rgbReserved;
444
472
                        info_ptr->num_trans = (WORD)nc;
445
473
                        info_ptr->valid |= PNG_INFO_tRNS;
 
474
#if PNG_LIBPNG_VER_MAJOR >= 1 && PNG_LIBPNG_VER_MINOR >= 4
 
475
                        info_ptr->trans_alpha = trans;
 
476
#else
446
477
                        info_ptr->trans = trans;
 
478
#endif
447
479
                }
448
480
 
449
481
                // copy the palette colors
506
538
        }
507
539
 
508
540
        delete [] row_pointers;
 
541
        row_pointers = NULL;
509
542
 
510
543
        //if necessary, restore the original palette
511
544
        if (!bGrayScale && head.biClrUsed && info.nBkgndIndex>0)