return type is a LodePNG error code*/
| 2511 | |
| 2512 | /*return type is a LodePNG error code*/ |
| 2513 | static unsigned checkColorValidity(LodePNGColorType colortype, unsigned bd) /*bd = bitdepth*/ |
| 2514 | { |
| 2515 | switch(colortype) |
| 2516 | { |
| 2517 | case 0: if(!(bd == 1 || bd == 2 || bd == 4 || bd == 8 || bd == 16)) return 37; break; /*grey*/ |
| 2518 | case 2: if(!( bd == 8 || bd == 16)) return 37; break; /*RGB*/ |
| 2519 | case 3: if(!(bd == 1 || bd == 2 || bd == 4 || bd == 8 )) return 37; break; /*palette*/ |
| 2520 | case 4: if(!( bd == 8 || bd == 16)) return 37; break; /*grey + alpha*/ |
| 2521 | case 6: if(!( bd == 8 || bd == 16)) return 37; break; /*RGBA*/ |
| 2522 | default: return 31; |
| 2523 | } |
| 2524 | return 0; /*allowed color type / bits combination*/ |
| 2525 | } |
| 2526 | |
| 2527 | static unsigned getNumColorChannels(LodePNGColorType colortype) |
| 2528 | { |
no outgoing calls
no test coverage detected