MCPcopy Create free account
hub / github.com/OpenDUNE/OpenDUNE / GUI_DrawXorFilledRectangle

Function GUI_DrawXorFilledRectangle

src/gui/gui.c:4491–4524  ·  view source on GitHub ↗

* Draw a filled rectangle using xor. * @param left The left position of the rectangle. * @param top The top position of the rectangle. * @param right The right position of the rectangle. * @param bottom The bottom position of the rectangle. * @param colour The colour of the rectangle. */

Source from the content-addressed store, hash-verified

4489 * @param colour The colour of the rectangle.
4490 */
4491void GUI_DrawXorFilledRectangle(int16 left, int16 top, int16 right, int16 bottom, uint8 colour)
4492{
4493 uint16 x;
4494 uint16 y;
4495 uint16 height;
4496 uint16 width;
4497
4498 uint8 *screen = GFX_Screen_GetActive();
4499
4500 if (left >= SCREEN_WIDTH) return;
4501 if (left < 0) left = 0;
4502
4503 if (top >= SCREEN_HEIGHT) return;
4504 if (top < 0) top = 0;
4505
4506 if (right >= SCREEN_WIDTH) right = SCREEN_WIDTH - 1;
4507 if (right < 0) right = 0;
4508
4509 if (bottom >= SCREEN_HEIGHT) bottom = SCREEN_HEIGHT - 1;
4510 if (bottom < 0) bottom = 0;
4511
4512 if (left > right) return;
4513 if (top > bottom) return;
4514
4515 screen += left + top * SCREEN_WIDTH;
4516 width = right - left + 1;
4517 height = bottom - top + 1;
4518 for (y = 0; y < height; y++) {
4519 for (x = 0; x < width; x++) {
4520 *screen++ ^= colour;
4521 }
4522 screen += SCREEN_WIDTH - width;
4523 }
4524}
4525
4526/**
4527 * Create the remap palette for the givern house.

Callers 1

GUI_Widget_DrawFunction · 0.85

Calls 1

GFX_Screen_GetActiveFunction · 0.85

Tested by

no test coverage detected