diff options
author | Jens Arnold <amiconn@rockbox.org> | 2007-10-28 13:16:05 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2007-10-28 13:16:05 +0000 |
commit | b77893e4d5636008ceee56929c7477f7dd064ca9 (patch) | |
tree | f6c56386cf4eb27c470bb7c28ace53df65fec10a | |
parent | 0e2852bca124770c4f81e9b0739c219312f266f7 (diff) | |
download | rockbox-b77893e4d5636008ceee56929c7477f7dd064ca9.tar.gz rockbox-b77893e4d5636008ceee56929c7477f7dd064ca9.zip |
C200: Reworked the LCD driver a bit, and fixed a bug with single column updates (was only visible in mandelbrot).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15343 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | firmware/target/arm/sandisk/sansa-c200/lcd-c200.c | 71 |
1 files changed, 35 insertions, 36 deletions
diff --git a/firmware/target/arm/sandisk/sansa-c200/lcd-c200.c b/firmware/target/arm/sandisk/sansa-c200/lcd-c200.c index fa8581f286..49e1268b54 100644 --- a/firmware/target/arm/sandisk/sansa-c200/lcd-c200.c +++ b/firmware/target/arm/sandisk/sansa-c200/lcd-c200.c | |||
@@ -291,43 +291,42 @@ void lcd_update(void) | |||
291 | } | 291 | } |
292 | 292 | ||
293 | /* Update a fraction of the display. */ | 293 | /* Update a fraction of the display. */ |
294 | void lcd_update_rect(int x0, int y0, int width, int height) | 294 | void lcd_update_rect(int x, int y, int width, int height) |
295 | { | 295 | { |
296 | unsigned short *addr; | 296 | const fb_data *addr; |
297 | int c, r; | 297 | |
298 | int x1 = (x0 + width) - 1; | 298 | if (x + width >= LCD_WIDTH) |
299 | int y1 = (y0 + height) - 1; | 299 | width = LCD_WIDTH - x; |
300 | 300 | if (y + height >= LCD_HEIGHT) | |
301 | if ((x1 <= 0) || (y1 <= 0)) | 301 | height = LCD_HEIGHT - y; |
302 | return; | 302 | |
303 | 303 | if ((width <= 0) || (height <= 0)) | |
304 | lcd_send_command(R_ENTRY_MODE); | 304 | return; /* Nothing left to do. */ |
305 | lcd_send_command(0x82); | 305 | |
306 | 306 | addr = &lcd_framebuffer[y][x]; | |
307 | if(y1 >= LCD_HEIGHT) | 307 | |
308 | y1 = LCD_HEIGHT - 1; | 308 | if (width <= 1) { |
309 | 309 | lcd_send_command(R_ENTRY_MODE); /* The X end address must be larger */ | |
310 | lcd_send_command(0x80); /* that the X start address, so we */ | ||
311 | lcd_send_command(R_X_ADDR_AREA); /* switch to vertical mode for */ | ||
312 | lcd_send_command(x); /* single column updates and set */ | ||
313 | lcd_send_command(x + 1); /* the window width to 2 */ | ||
314 | } else { | ||
315 | lcd_send_command(R_ENTRY_MODE); | ||
316 | lcd_send_command(0x82); | ||
317 | lcd_send_command(R_X_ADDR_AREA); | ||
318 | lcd_send_command(x); | ||
319 | lcd_send_command(x + width - 1); | ||
320 | } | ||
310 | lcd_send_command(R_Y_ADDR_AREA); | 321 | lcd_send_command(R_Y_ADDR_AREA); |
311 | lcd_send_command(y0 + 0x1a); | 322 | lcd_send_command(y + 0x1a); |
312 | lcd_send_command(y1 + 0x1a); | 323 | lcd_send_command(y + height - 1 + 0x1a); |
313 | 324 | ||
314 | if(x1 >= LCD_WIDTH) | 325 | do { |
315 | x1 = LCD_WIDTH - 1; | 326 | int w = width; |
316 | 327 | do { | |
317 | lcd_send_command(R_X_ADDR_AREA); | 328 | lcd_send_data(*addr++); |
318 | lcd_send_command(x0); | 329 | } while (--w > 0); |
319 | lcd_send_command(x1); | ||
320 | |||
321 | addr = (unsigned short*)&lcd_framebuffer[y0][x0]; | ||
322 | |||
323 | /* for each row */ | ||
324 | for (r = 0; r < height; r++) { | ||
325 | /* for each column */ | ||
326 | for (c = 0; c < width; c++) { | ||
327 | /* output 1 pixel */ | ||
328 | lcd_send_data(*(addr++)); | ||
329 | } | ||
330 | |||
331 | addr += LCD_WIDTH - width; | 330 | addr += LCD_WIDTH - width; |
332 | } | 331 | } while (--height > 0); |
333 | } | 332 | } |