Rev 3724 | Rev 3726 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3724 | Rev 3725 | ||
---|---|---|---|
Line 221... | Line 221... | ||
221 | { |
221 | { |
222 | *((uint8_t *) dst) |
222 | *((uint8_t *) dst) |
223 | = ~((RED(rgb, 3) << 5) | (GREEN(rgb, 2) << 3) | BLUE(rgb, 3)); |
223 | = ~((RED(rgb, 3) << 5) | (GREEN(rgb, 2) << 3) | BLUE(rgb, 3)); |
224 | } |
224 | } |
225 | 225 | ||
226 | /** Draw a filled rectangle. */ |
226 | /** Draw a filled rectangle. |
- | 227 | * |
|
- | 228 | * @note Need real implementation that does not access VRAM twice. |
|
- | 229 | */ |
|
227 | static void draw_filled_rect(unsigned int x0, unsigned int y0, unsigned int x1, |
230 | static void draw_filled_rect(unsigned int x0, unsigned int y0, unsigned int x1, |
228 | unsigned int y1, uint32_t color) |
231 | unsigned int y1, uint32_t color) |
229 | { |
232 | { |
230 | unsigned int x, y; |
233 | unsigned int x, y; |
- | 234 | unsigned int copy_bytes; |
|
- | 235 | ||
- | 236 | uint8_t *sp, *dp; |
|
231 | uint8_t cbuf[4]; |
237 | uint8_t cbuf[4]; |
232 | 238 | ||
- | 239 | if (y0 >= y1 || x0 >= x1) return; |
|
233 | screen.rgb_conv(cbuf, color); |
240 | screen.rgb_conv(cbuf, color); |
234 | 241 | ||
- | 242 | sp = &screen.fb_addr[FB_POS(x0, y0)]; |
|
- | 243 | dp = sp; |
|
- | 244 | ||
235 | for (y = y0; y < y1; y++) { |
245 | /* Draw the first line. */ |
236 | for (x = x0; x < x1; x++) { |
246 | for (x = x0; x < x1; x++) { |
237 | memcpy(&screen.fb_addr[FB_POS(x, y)], cbuf, |
247 | memcpy(dp, cbuf, screen.pixelbytes); |
238 | screen.pixelbytes); |
248 | dp += screen.pixelbytes; |
239 | } |
249 | } |
- | 250 | ||
- | 251 | dp = sp + screen.scanline; |
|
- | 252 | copy_bytes = (x1 - x0) * screen.pixelbytes; |
|
- | 253 | ||
- | 254 | /* Draw the remaining lines by copying. */ |
|
- | 255 | for (y = y0 + 1; y < y1; y++) { |
|
- | 256 | memcpy(dp, sp, copy_bytes); |
|
- | 257 | dp += screen.scanline; |
|
240 | } |
258 | } |
241 | } |
259 | } |
242 | 260 | ||
243 | /** Redraw viewport. |
261 | /** Redraw viewport. |
244 | * |
262 | * |