info_ptr->rowbytes = ((info_ptr->width * info_ptr->pixel_depth + 7) >> 3);
info_ptr->rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth,info_ptr->width);
png_read_transform_info(png_structp png_ptr, png_infop info_ptr){   png_debug(1, "in png_read_transform_info\n");#if defined(PNG_READ_EXPAND_SUPPORTED)   if (png_ptr->transformations & PNG_EXPAND)   {      if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)      {         if (png_ptr->num_trans)            info_ptr->color_type = PNG_COLOR_TYPE_RGB_ALPHA;         else            info_ptr->color_type = PNG_COLOR_TYPE_RGB;         info_ptr->bit_depth = 8;         info_ptr->num_trans = 0;      }      else      {         if (png_ptr->num_trans)            info_ptr->color_type |= PNG_COLOR_MASK_ALPHA;         if (info_ptr->bit_depth < 8)            info_ptr->bit_depth = 8;         info_ptr->num_trans = 0;      }   }#endif#if defined(PNG_READ_BACKGROUND_SUPPORTED)   if (png_ptr->transformations & PNG_BACKGROUND)   {      info_ptr->color_type &= ~PNG_COLOR_MASK_ALPHA;      info_ptr->num_trans = 0;      info_ptr->background = png_ptr->background;   }#endif#if defined(PNG_READ_GAMMA_SUPPORTED)   if (png_ptr->transformations & PNG_GAMMA)   {#ifdef PNG_FLOATING_POINT_SUPPORTED      info_ptr->gamma = png_ptr->gamma;#endif#ifdef PNG_FIXED_POINT_SUPPORTED      info_ptr->int_gamma = png_ptr->int_gamma;#endif   }#endif#if defined(PNG_READ_16_TO_8_SUPPORTED)   if ((png_ptr->transformations & PNG_16_TO_8) && (info_ptr->bit_depth == 16))      info_ptr->bit_depth = 8;#endif#if defined(PNG_READ_DITHER_SUPPORTED)   if (png_ptr->transformations & PNG_DITHER)   {      if (((info_ptr->color_type == PNG_COLOR_TYPE_RGB) ||         (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)) &&         png_ptr->palette_lookup && info_ptr->bit_depth == 8)      {         info_ptr->color_type = PNG_COLOR_TYPE_PALETTE;      }   }#endif#if defined(PNG_READ_PACK_SUPPORTED)   if ((png_ptr->transformations & PNG_PACK) && (info_ptr->bit_depth < 8))      info_ptr->bit_depth = 8;#endif#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED)   if (png_ptr->transformations & PNG_GRAY_TO_RGB)      info_ptr->color_type |= PNG_COLOR_MASK_COLOR;#endif#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)   if (png_ptr->transformations & PNG_RGB_TO_GRAY)      info_ptr->color_type &= ~PNG_COLOR_MASK_COLOR;#endif   if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)      info_ptr->channels = 1;   else if (info_ptr->color_type & PNG_COLOR_MASK_COLOR)      info_ptr->channels = 3;   else      info_ptr->channels = 1;#if defined(PNG_READ_STRIP_ALPHA_SUPPORTED)   if (png_ptr->transformations & PNG_STRIP_ALPHA)      info_ptr->color_type &= ~PNG_COLOR_MASK_ALPHA;#endif   if (info_ptr->color_type & PNG_COLOR_MASK_ALPHA)      info_ptr->channels++;#if defined(PNG_READ_FILLER_SUPPORTED)   /* STRIP_ALPHA and FILLER allowed:  MASK_ALPHA bit stripped above */   if ((png_ptr->transformations & PNG_FILLER) &&       ((info_ptr->color_type == PNG_COLOR_TYPE_RGB) ||       (info_ptr->color_type == PNG_COLOR_TYPE_GRAY)))   {      info_ptr->channels++;#if 0 /* if adding a true alpha channel not just filler */      info_ptr->color_type |= PNG_COLOR_MASK_ALPHA;#endif   }#endif#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED) && \defined(PNG_READ_USER_TRANSFORM_SUPPORTED)   if(png_ptr->transformations & PNG_USER_TRANSFORM)     {       if(info_ptr->bit_depth < png_ptr->user_transform_depth)         info_ptr->bit_depth = png_ptr->user_transform_depth;       if(info_ptr->channels < png_ptr->user_transform_channels)         info_ptr->channels = png_ptr->user_transform_channels;     }#endif   info_ptr->pixel_depth = (png_byte)(info_ptr->channels *      info_ptr->bit_depth);   info_ptr->rowbytes = ((info_ptr->width * info_ptr->pixel_depth + 7) >> 3);#if !defined(PNG_READ_EXPAND_SUPPORTED)   if(png_ptr)      return;#endif}