Should we add type to the parameter list? Copies a 1d block of pixels to the buffer pointed to by Data.
| 379 | // Should we add type to the parameter list? |
| 380 | // Copies a 1d block of pixels to the buffer pointed to by Data. |
| 381 | ILboolean ilCopyPixels1D(ILuint XOff, ILuint Width, void *Data) |
| 382 | { |
| 383 | ILuint x, c, NewBps, NewOff, PixBpp; |
| 384 | ILubyte *Temp = (ILubyte*)Data, *TempData = iCurImage->Data; |
| 385 | |
| 386 | if (ilIsEnabled(IL_ORIGIN_SET)) { |
| 387 | if ((ILenum)ilGetInteger(IL_ORIGIN_MODE) != iCurImage->Origin) { |
| 388 | TempData = iGetFlipped(iCurImage); |
| 389 | if (TempData == NULL) |
| 390 | return IL_FALSE; |
| 391 | } |
| 392 | } |
| 393 | |
| 394 | PixBpp = iCurImage->Bpp * iCurImage->Bpc; |
| 395 | |
| 396 | if (iCurImage->Width < XOff + Width) { |
| 397 | NewBps = (iCurImage->Width - XOff) * PixBpp; |
| 398 | } |
| 399 | else { |
| 400 | NewBps = Width * PixBpp; |
| 401 | } |
| 402 | NewOff = XOff * PixBpp; |
| 403 | |
| 404 | for (x = 0; x < NewBps; x += PixBpp) { |
| 405 | for (c = 0; c < PixBpp; c++) { |
| 406 | Temp[x + c] = TempData[(x + NewOff) + c]; |
| 407 | } |
| 408 | } |
| 409 | |
| 410 | if (TempData != iCurImage->Data) |
| 411 | ifree(TempData); |
| 412 | |
| 413 | return IL_TRUE; |
| 414 | } |
| 415 | |
| 416 | |
| 417 | // Copies a 2d block of pixels to the buffer pointed to by Data. |
no outgoing calls
no test coverage detected