MCPcopy Create free account
hub / github.com/OpenFodder/openfodder / stbi__psd_info

Function stbi__psd_info

Source/Utils/stb_image.h:7356–7389  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7354
7355#ifndef STBI_NO_PSD
7356static int stbi__psd_info(stbi__context *s, int *x, int *y, int *comp)
7357{
7358 int channelCount, dummy, depth;
7359 if (!x) x = &dummy;
7360 if (!y) y = &dummy;
7361 if (!comp) comp = &dummy;
7362 if (stbi__get32be(s) != 0x38425053) {
7363 stbi__rewind( s );
7364 return 0;
7365 }
7366 if (stbi__get16be(s) != 1) {
7367 stbi__rewind( s );
7368 return 0;
7369 }
7370 stbi__skip(s, 6);
7371 channelCount = stbi__get16be(s);
7372 if (channelCount < 0 || channelCount > 16) {
7373 stbi__rewind( s );
7374 return 0;
7375 }
7376 *y = stbi__get32be(s);
7377 *x = stbi__get32be(s);
7378 depth = stbi__get16be(s);
7379 if (depth != 8 && depth != 16) {
7380 stbi__rewind( s );
7381 return 0;
7382 }
7383 if (stbi__get16be(s) != 3) {
7384 stbi__rewind( s );
7385 return 0;
7386 }
7387 *comp = 4;
7388 return 1;
7389}
7390
7391static int stbi__psd_is16(stbi__context *s)
7392{

Callers 1

stbi__info_mainFunction · 0.85

Calls 4

stbi__get32beFunction · 0.85
stbi__rewindFunction · 0.85
stbi__get16beFunction · 0.85
stbi__skipFunction · 0.85

Tested by

no test coverage detected