return type is a LodePNG error code*/
| 2546 | |
| 2547 | /*return type is a LodePNG error code*/ |
| 2548 | static unsigned checkColorValidity(LodePNGColorType colortype, unsigned bd) /*bd = bitdepth*/ |
| 2549 | { |
| 2550 | switch(colortype) |
| 2551 | { |
| 2552 | case 0: if(!(bd == 1 || bd == 2 || bd == 4 || bd == 8 || bd == 16)) return 37; break; /*grey*/ |
| 2553 | case 2: if(!( bd == 8 || bd == 16)) return 37; break; /*RGB*/ |
| 2554 | case 3: if(!(bd == 1 || bd == 2 || bd == 4 || bd == 8 )) return 37; break; /*palette*/ |
| 2555 | case 4: if(!( bd == 8 || bd == 16)) return 37; break; /*grey + alpha*/ |
| 2556 | case 6: if(!( bd == 8 || bd == 16)) return 37; break; /*RGBA*/ |
| 2557 | default: return 31; |
| 2558 | } |
| 2559 | return 0; /*allowed color type / bits combination*/ |
| 2560 | } |
| 2561 | |
| 2562 | static unsigned getNumColorChannels(LodePNGColorType colortype) |
| 2563 | { |
no outgoing calls
no test coverage detected