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

Function GUI_DrawFilledRectangle

src/gui/gui.c:197–233  ·  view source on GitHub ↗

* Draw a filled rectangle. * @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

195 * @param colour The colour of the rectangle.
196 */
197void GUI_DrawFilledRectangle(int16 left, int16 top, int16 right, int16 bottom, uint8 colour)
198{
199 uint16 x;
200 uint16 y;
201 uint16 height;
202 uint16 width;
203
204 uint8 *screen = GFX_Screen_GetActive();
205
206 if (left >= SCREEN_WIDTH) return;
207 if (left < 0) left = 0;
208
209 if (top >= SCREEN_HEIGHT) return;
210 if (top < 0) top = 0;
211
212 if (right >= SCREEN_WIDTH) right = SCREEN_WIDTH - 1;
213 if (right < 0) right = 0;
214
215 if (bottom >= SCREEN_HEIGHT) bottom = SCREEN_HEIGHT - 1;
216 if (bottom < 0) bottom = 0;
217
218 if (left > right) return;
219 if (top > bottom) return;
220
221 screen += left + top * SCREEN_WIDTH;
222 width = right - left + 1;
223 height = bottom - top + 1;
224 for (y = 0; y < height; y++) {
225 /* TODO : use memset() */
226 for (x = 0; x < width; x++) {
227 *screen++ = colour;
228 }
229 screen += SCREEN_WIDTH - width;
230 }
231
232 GFX_Screen_SetDirty(SCREEN_ACTIVE, left, top, right + 1, bottom + 1);
233}
234
235/**
236 * Display a text.

Callers 15

GameLoop_PlaySubtitleFunction · 0.85
GameLoop_MainFunction · 0.85
GUI_DisplayTextFunction · 0.85
GUI_EndStats_ShowFunction · 0.85
GUI_DrawBorderFunction · 0.85
GUI_DrawProgressbarFunction · 0.85
GUI_FactoryWindow_InitFunction · 0.85
GUI_StrategicMap_ShowFunction · 0.85

Calls 2

GFX_Screen_GetActiveFunction · 0.85
GFX_Screen_SetDirtyFunction · 0.85

Tested by

no test coverage detected