MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / checkColorValidity

Function checkColorValidity

src/lodepng.cpp:2489–2501  ·  view source on GitHub ↗

return type is a LodePNG error code*/

Source from the content-addressed store, hash-verified

2487
2488/*return type is a LodePNG error code*/
2489static unsigned checkColorValidity(LodePNGColorType colortype, unsigned bd) /*bd = bitdepth*/
2490{
2491 switch(colortype)
2492 {
2493 case 0: if(!(bd == 1 || bd == 2 || bd == 4 || bd == 8 || bd == 16)) return 37; break; /*grey*/
2494 case 2: if(!( bd == 8 || bd == 16)) return 37; break; /*RGB*/
2495 case 3: if(!(bd == 1 || bd == 2 || bd == 4 || bd == 8 )) return 37; break; /*palette*/
2496 case 4: if(!( bd == 8 || bd == 16)) return 37; break; /*grey + alpha*/
2497 case 6: if(!( bd == 8 || bd == 16)) return 37; break; /*RGBA*/
2498 default: return 31;
2499 }
2500 return 0; /*allowed color type / bits combination*/
2501}
2502
2503static unsigned getNumColorChannels(LodePNGColorType colortype)
2504{

Callers 2

lodepng_inspectFunction · 0.85
lodepng_encodeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected