MCPcopy Create free account
hub / github.com/ValveSoftware/openvr / checkColorValidity

Function checkColorValidity

samples/shared/lodepng.cpp:2513–2525  ·  view source on GitHub ↗

return type is a LodePNG error code*/

Source from the content-addressed store, hash-verified

2511
2512/*return type is a LodePNG error code*/
2513static 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
2527static unsigned getNumColorChannels(LodePNGColorType colortype)
2528{

Callers 2

lodepng_inspectFunction · 0.85
lodepng_encodeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected