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

Function ilSetPixels1D

DevIL/src-IL/src/il_manip.cpp:587–629  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

585
586
587ILboolean ilSetPixels1D(ILint XOff, ILuint Width, void *Data)
588{
589 ILuint c, SkipX = 0, PixBpp;
590 ILint x, NewWidth;
591 ILubyte *Temp = (ILubyte*)Data, *TempData = iCurImage->Data;
592
593 if (ilIsEnabled(IL_ORIGIN_SET)) {
594 if ((ILenum)ilGetInteger(IL_ORIGIN_MODE) != iCurImage->Origin) {
595 TempData = iGetFlipped(iCurImage);
596 if (TempData == NULL)
597 return IL_FALSE;
598 }
599 }
600
601 PixBpp = iCurImage->Bpp * iCurImage->Bpc;
602
603 if (XOff < 0) {
604 SkipX = abs(XOff);
605 XOff = 0;
606 }
607
608 if (iCurImage->Width < XOff + Width) {
609 NewWidth = iCurImage->Width - XOff;
610 }
611 else {
612 NewWidth = Width;
613 }
614
615 NewWidth -= SkipX;
616
617 for (x = 0; x < NewWidth; x++) {
618 for (c = 0; c < PixBpp; c++) {
619 TempData[(x + XOff) * PixBpp + c] = Temp[(x + SkipX) * PixBpp + c];
620 }
621 }
622
623 if (TempData != iCurImage->Data) {
624 ifree(iCurImage->Data);
625 iCurImage->Data = TempData;
626 }
627
628 return IL_TRUE;
629}
630
631
632ILboolean ilSetPixels2D(ILint XOff, ILint YOff, ILuint Width, ILuint Height, void *Data)

Callers 1

ILAPIENTRY ilSetPixelsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected