src/share/native/sun/awt/splashscreen/splashscreen_png.c

Print this page
rev 9959 : 8026385: [macosx] (awt) setjmp/longjmp changes the process signal mask on OS X
Reviewed-by:
Contributed-by: David DeHaven <david.dehaven@oracle.com>


  54     double gamma;
  55 
  56     png_structp png_ptr = NULL;
  57     png_infop info_ptr = NULL;
  58 
  59     png_uint_32 width, height;
  60     int bit_depth, color_type;
  61 
  62     ImageRect srcRect, dstRect;
  63 
  64     png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
  65     if (!png_ptr) {
  66         goto done;
  67     }
  68 
  69     info_ptr = png_create_info_struct(png_ptr);
  70     if (!info_ptr) {
  71         goto done;
  72     }
  73 




  74     if (setjmp(png_jmpbuf(png_ptr))) {

  75         goto done;
  76     }
  77 
  78     png_set_read_fn(png_ptr, io_ptr, read_func);
  79 
  80     png_set_sig_bytes(png_ptr, SIG_BYTES);      /* we already read the 8 signature bytes */
  81 
  82     png_read_info(png_ptr, info_ptr);   /* read all PNG info up to image data */
  83 
  84     png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
  85         NULL, NULL, NULL);
  86 
  87     /* expand palette images to RGB, low-bit-depth grayscale images to 8 bits,
  88      * transparency chunks to full alpha channel; strip 16-bit-per-sample
  89      * images to 8 bits per sample; and convert grayscale to RGB[A]
  90      * this may be sub-optimal but this simplifies implementation */
  91 
  92     png_set_expand(png_ptr);
  93     png_set_tRNS_to_alpha(png_ptr);
  94     png_set_filler(png_ptr, 0xff, PNG_FILLER_AFTER);




  54     double gamma;
  55 
  56     png_structp png_ptr = NULL;
  57     png_infop info_ptr = NULL;
  58 
  59     png_uint_32 width, height;
  60     int bit_depth, color_type;
  61 
  62     ImageRect srcRect, dstRect;
  63 
  64     png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
  65     if (!png_ptr) {
  66         goto done;
  67     }
  68 
  69     info_ptr = png_create_info_struct(png_ptr);
  70     if (!info_ptr) {
  71         goto done;
  72     }
  73 
  74 #ifdef __APPLE__
  75     /* use setjmp/longjmp versions that do not save/restore the signal mask */
  76     if (_setjmp(png_set_longjmp_fn(png_ptr, _longjmp, sizeof(jmp_buf)))) {
  77 #else
  78     if (setjmp(png_jmpbuf(png_ptr))) {
  79 #endif
  80         goto done;
  81     }
  82 
  83     png_set_read_fn(png_ptr, io_ptr, read_func);
  84 
  85     png_set_sig_bytes(png_ptr, SIG_BYTES);      /* we already read the 8 signature bytes */
  86 
  87     png_read_info(png_ptr, info_ptr);   /* read all PNG info up to image data */
  88 
  89     png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
  90         NULL, NULL, NULL);
  91 
  92     /* expand palette images to RGB, low-bit-depth grayscale images to 8 bits,
  93      * transparency chunks to full alpha channel; strip 16-bit-per-sample
  94      * images to 8 bits per sample; and convert grayscale to RGB[A]
  95      * this may be sub-optimal but this simplifies implementation */
  96 
  97     png_set_expand(png_ptr);
  98     png_set_tRNS_to_alpha(png_ptr);
  99     png_set_filler(png_ptr, 0xff, PNG_FILLER_AFTER);