MCPcopy Create free account
hub / github.com/DentonW/DevIL / GetCompChanLen

Function GetCompChanLen

DevIL/src-IL/src/il_psd.cpp:528–561  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

526
527
528ILuint *GetCompChanLen(PSDHEAD *Head)
529{
530 ILushort *RleTable;
531 ILuint *ChanLen, c, i, j;
532
533 RleTable = (ILushort*)ialloc(Head->Height * ChannelNum * sizeof(ILushort));
534 ChanLen = (ILuint*)ialloc(ChannelNum * sizeof(ILuint));
535 if (RleTable == NULL || ChanLen == NULL) {
536 return NULL;
537 }
538
539 if (iread(RleTable, sizeof(ILushort), Head->Height * ChannelNum) != Head->Height * ChannelNum) {
540 ifree(RleTable);
541 ifree(ChanLen);
542 return NULL;
543 }
544#ifdef __LITTLE_ENDIAN__
545 for (i = 0; i < Head->Height * ChannelNum; i++) {
546 iSwapUShort(&RleTable[i]);
547 }
548#endif
549
550 imemclear(ChanLen, ChannelNum * sizeof(ILuint));
551 for (c = 0; c < ChannelNum; c++) {
552 j = c * Head->Height;
553 for (i = 0; i < Head->Height; i++) {
554 ChanLen[c] += RleTable[i + j];
555 }
556 }
557
558 ifree(RleTable);
559
560 return ChanLen;
561}
562
563
564

Callers 1

PsdGetDataFunction · 0.85

Calls 1

iSwapUShortFunction · 0.85

Tested by

no test coverage detected