* Copy information from one screenbuffer to the other. * @param xSrc The X-coordinate on the source. * @param ySrc The Y-coordinate on the source. * @param xDst The X-coordinate on the destination. * @param yDst The Y-coordinate on the destination. * @param width The width. * @param height The height. * @param screenSrc The ID of the source screen. * @param screenDst The ID of the destinat
| 324 | * @param skipNull Wether to skip pixel colour 0. |
| 325 | */ |
| 326 | void GFX_Screen_Copy2(int16 xSrc, int16 ySrc, int16 xDst, int16 yDst, int16 width, int16 height, Screen screenSrc, Screen screenDst, bool skipNull) |
| 327 | { |
| 328 | uint8 *src; |
| 329 | uint8 *dst; |
| 330 | |
| 331 | if (xSrc >= SCREEN_WIDTH) return; |
| 332 | if (xSrc < 0) { |
| 333 | xDst += xSrc; |
| 334 | width += xSrc; |
| 335 | xSrc = 0; |
| 336 | } |
| 337 | |
| 338 | if (ySrc >= SCREEN_HEIGHT) return; |
| 339 | if (ySrc < 0) { |
| 340 | yDst += ySrc; |
| 341 | height += ySrc; |
| 342 | ySrc = 0; |
| 343 | } |
| 344 | |
| 345 | if (xDst >= SCREEN_WIDTH) return; |
| 346 | if (xDst < 0) { |
| 347 | xSrc += xDst; |
| 348 | width += xDst; |
| 349 | xDst = 0; |
| 350 | } |
| 351 | |
| 352 | if (yDst >= SCREEN_HEIGHT) return; |
| 353 | if (yDst < 0) { |
| 354 | ySrc += yDst; |
| 355 | height += yDst; |
| 356 | yDst = 0; |
| 357 | } |
| 358 | |
| 359 | if (SCREEN_WIDTH - xSrc - width < 0) width = SCREEN_WIDTH - xSrc; |
| 360 | if (SCREEN_HEIGHT - ySrc - height < 0) height = SCREEN_HEIGHT - ySrc; |
| 361 | if (SCREEN_WIDTH - xDst - width < 0) width = SCREEN_WIDTH - xDst; |
| 362 | if (SCREEN_HEIGHT - yDst - height < 0) height = SCREEN_HEIGHT - yDst; |
| 363 | |
| 364 | if (xSrc < 0 || xSrc >= SCREEN_WIDTH) return; |
| 365 | if (xDst < 0 || xDst >= SCREEN_WIDTH) return; |
| 366 | if (ySrc < 0 || ySrc >= SCREEN_HEIGHT) return; |
| 367 | if (yDst < 0 || yDst >= SCREEN_HEIGHT) return; |
| 368 | if (width < 0 || width >= SCREEN_WIDTH) return; |
| 369 | if (height < 0 || height >= SCREEN_HEIGHT) return; |
| 370 | |
| 371 | GFX_Screen_SetDirty(screenDst, xDst, yDst, xDst + width, yDst + height); |
| 372 | |
| 373 | src = GFX_Screen_Get_ByIndex(screenSrc); |
| 374 | dst = GFX_Screen_Get_ByIndex(screenDst); |
| 375 | |
| 376 | src += xSrc + ySrc * SCREEN_WIDTH; |
| 377 | dst += xDst + yDst * SCREEN_WIDTH; |
| 378 | |
| 379 | while (height-- != 0) { |
| 380 | if (skipNull) { |
| 381 | uint16 i; |
| 382 | for (i = 0; i < width; i++) { |
| 383 | if (src[i] != 0) dst[i] = src[i]; |
no test coverage detected