* 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. */
| 195 | * @param colour The colour of the rectangle. |
| 196 | */ |
| 197 | void 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. |
no test coverage detected