rEFIt_UEFI/libeg/lodepng.cpp
/*checks if the colortype is valid and the bitdepth bd is allowed for this colortype.
Return value is a LodePNG error code.*/
checks if the colortype is valid and the bitdepth bd is allowed for this colortype.
Return value is a LodePNG error code.
checks if the colortype is valid and the bitdepth bd is allowed for this colortype . Return value is a LodePNG error code .
static unsigned checkColorValidity(LodePNGColorType colortype, unsigned bd) {
  switch(colortype) {
    case LCT_GREY:       if(!(bd == 1 || bd == 2 || bd == 4 || bd == 8 || bd == 16)) return 37; break;
    case LCT_RGB:        if(!(                                 bd == 8 || bd == 16)) return 37; break;
    case LCT_PALETTE:    if(!(bd == 1 || bd == 2 || bd == 4 || bd == 8            )) return 37; break;
    case LCT_GREY_ALPHA: if(!(                                 bd == 8 || bd == 16)) return 37; break;
    case LCT_RGBA:       if(!(                                 bd == 8 || bd == 16)) return 37; break;
    case LCT_MAX_OCTET_VALUE: return 31; 
    default: return 31; 
  }
  return 0; 
}
static unsigned checkColorValidity ( LodePNGColorType colortype , unsigned bd ) { switch ( colortype ) { case LCT_GREY : if ( ! ( bd == 1 || bd == 2 || bd == 4 || bd == 8 || bd == 16 ) ) return 37 ; break ; case LCT_RGB : if ( ! ( bd == 8 || bd == 16 ) ) return 37 ; break ; case LCT_PALETTE : if ( ! ( bd == 1 || bd == 2 || bd == 4 || bd == 8 ) ) return 37 ; break ; case LCT_GREY_ALPHA : if ( ! ( bd == 8 || bd == 16 ) ) return 37 ; break ; case LCT_RGBA : if ( ! ( bd == 8 || bd == 16 ) ) return 37 ; break ; case LCT_MAX_OCTET_VALUE : return 31 ; default : return 31 ; } return 0 ; }
checks if the colortype is valid and the bitdepth bd is allowed for this colortype.
checks if the colortype is valid and the bitdepth bd is allowed for this colortype .
/* invalid color type */ /* invalid color type */ /*allowed color type / bits combination*/