diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/drivers/lcd-16bit-vert.c | 47 |
1 files changed, 22 insertions, 25 deletions
diff --git a/firmware/drivers/lcd-16bit-vert.c b/firmware/drivers/lcd-16bit-vert.c index 3b05c09e44..396e6f88d8 100644 --- a/firmware/drivers/lcd-16bit-vert.c +++ b/firmware/drivers/lcd-16bit-vert.c | |||
@@ -207,10 +207,7 @@ int lcd_getstringsize(const unsigned char *str, int *w, int *h) | |||
207 | 207 | ||
208 | /*** low-level drawing functions ***/ | 208 | /*** low-level drawing functions ***/ |
209 | 209 | ||
210 | #define LCDADDR(x, y) (&lcd_framebuffer[0][0] + (LCD_HEIGHT*(LCD_WIDTH-1)) \ | 210 | #define LCDADDR(x, y) (&lcd_framebuffer[0][0] + LCD_HEIGHT*(x) + (y)) |
211 | - LCD_HEIGHT*(x) + (y)) | ||
212 | |||
213 | #define LCDBACKADDR(x, y) (lcd_backdrop + LCD_HEIGHT*(x) + (y)) | ||
214 | 211 | ||
215 | static void ICODE_ATTR setpixel(fb_data *address) | 212 | static void ICODE_ATTR setpixel(fb_data *address) |
216 | { | 213 | { |
@@ -277,16 +274,16 @@ void lcd_clear_viewport(void) | |||
277 | fb_data *dst, *dst_end; | 274 | fb_data *dst, *dst_end; |
278 | 275 | ||
279 | dst = LCDADDR(current_vp->x, current_vp->y); | 276 | dst = LCDADDR(current_vp->x, current_vp->y); |
280 | dst_end = dst - current_vp->width * LCD_HEIGHT; | 277 | dst_end = dst + current_vp->width * LCD_HEIGHT; |
281 | 278 | ||
282 | if (current_vp->drawmode & DRMODE_INVERSEVID) | 279 | if (current_vp->drawmode & DRMODE_INVERSEVID) |
283 | { | 280 | { |
284 | do | 281 | do |
285 | { | 282 | { |
286 | memset16(dst, current_vp->fg_pattern, current_vp->height); | 283 | memset16(dst, current_vp->fg_pattern, current_vp->height); |
287 | dst -= LCD_HEIGHT; | 284 | dst += LCD_HEIGHT; |
288 | } | 285 | } |
289 | while (dst > dst_end); | 286 | while (dst < dst_end); |
290 | } | 287 | } |
291 | else | 288 | else |
292 | { | 289 | { |
@@ -295,9 +292,9 @@ void lcd_clear_viewport(void) | |||
295 | do | 292 | do |
296 | { | 293 | { |
297 | memset16(dst, current_vp->bg_pattern, current_vp->height); | 294 | memset16(dst, current_vp->bg_pattern, current_vp->height); |
298 | dst -= LCD_HEIGHT; | 295 | dst += LCD_HEIGHT; |
299 | } | 296 | } |
300 | while (dst > dst_end); | 297 | while (dst < dst_end); |
301 | } | 298 | } |
302 | else | 299 | else |
303 | { | 300 | { |
@@ -305,9 +302,9 @@ void lcd_clear_viewport(void) | |||
305 | { | 302 | { |
306 | memcpy(dst, (void *)((long)dst + lcd_backdrop_offset), | 303 | memcpy(dst, (void *)((long)dst + lcd_backdrop_offset), |
307 | current_vp->height * sizeof(fb_data)); | 304 | current_vp->height * sizeof(fb_data)); |
308 | dst -= LCD_HEIGHT; | 305 | dst += LCD_HEIGHT; |
309 | } | 306 | } |
310 | while (dst > dst_end); | 307 | while (dst < dst_end); |
311 | } | 308 | } |
312 | } | 309 | } |
313 | 310 | ||
@@ -452,14 +449,14 @@ void lcd_hline(int x1, int x2, int y) | |||
452 | x2 = current_vp->width-1; | 449 | x2 = current_vp->width-1; |
453 | 450 | ||
454 | dst = LCDADDR(x1 + current_vp->x, y + current_vp->y); | 451 | dst = LCDADDR(x1 + current_vp->x, y + current_vp->y); |
455 | dst_end = dst - (x2 - x1) * LCD_HEIGHT; | 452 | dst_end = dst + (x2 - x1) * LCD_HEIGHT; |
456 | 453 | ||
457 | do | 454 | do |
458 | { | 455 | { |
459 | pfunc(dst); | 456 | pfunc(dst); |
460 | dst -= LCD_HEIGHT; | 457 | dst += LCD_HEIGHT; |
461 | } | 458 | } |
462 | while (dst >= dst_end); | 459 | while (dst <= dst_end); |
463 | } | 460 | } |
464 | 461 | ||
465 | /* Draw a vertical line (optimised) */ | 462 | /* Draw a vertical line (optimised) */ |
@@ -612,7 +609,7 @@ void lcd_fillrect(int x, int y, int width, int height) | |||
612 | height = current_vp->height - y; | 609 | height = current_vp->height - y; |
613 | 610 | ||
614 | dst = LCDADDR(current_vp->x + x, current_vp->y + y); | 611 | dst = LCDADDR(current_vp->x + x, current_vp->y + y); |
615 | dst_end = dst - width * LCD_HEIGHT; | 612 | dst_end = dst + width * LCD_HEIGHT; |
616 | 613 | ||
617 | do | 614 | do |
618 | { | 615 | { |
@@ -637,9 +634,9 @@ void lcd_fillrect(int x, int y, int width, int height) | |||
637 | while (++dst_col < col_end); | 634 | while (++dst_col < col_end); |
638 | break; | 635 | break; |
639 | } | 636 | } |
640 | dst-=LCD_HEIGHT; | 637 | dst+=LCD_HEIGHT; |
641 | } | 638 | } |
642 | while (dst > dst_end); | 639 | while (dst < dst_end); |
643 | } | 640 | } |
644 | 641 | ||
645 | /* About Rockbox' internal monochrome bitmap format: | 642 | /* About Rockbox' internal monochrome bitmap format: |
@@ -800,8 +797,8 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x, | |||
800 | break; | 797 | break; |
801 | } | 798 | } |
802 | 799 | ||
803 | dst -= LCD_HEIGHT; | 800 | dst += LCD_HEIGHT; |
804 | dst_end -= LCD_HEIGHT; | 801 | dst_end += LCD_HEIGHT; |
805 | } while (src < src_end); | 802 | } while (src < src_end); |
806 | } | 803 | } |
807 | /* Draw a full monochrome bitmap */ | 804 | /* Draw a full monochrome bitmap */ |
@@ -842,15 +839,15 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y, | |||
842 | 839 | ||
843 | src += stride * src_x + src_y; /* move starting point */ | 840 | src += stride * src_x + src_y; /* move starting point */ |
844 | dst = LCDADDR(current_vp->x + x, current_vp->y + y); | 841 | dst = LCDADDR(current_vp->x + x, current_vp->y + y); |
845 | dst_end = dst - width * LCD_HEIGHT; | 842 | dst_end = dst + width * LCD_HEIGHT; |
846 | 843 | ||
847 | do | 844 | do |
848 | { | 845 | { |
849 | memcpy(dst, src, height * sizeof(fb_data)); | 846 | memcpy(dst, src, height * sizeof(fb_data)); |
850 | src += stride; | 847 | src += stride; |
851 | dst -= LCD_HEIGHT; | 848 | dst += LCD_HEIGHT; |
852 | } | 849 | } |
853 | while (dst > dst_end); | 850 | while (dst < dst_end); |
854 | } | 851 | } |
855 | 852 | ||
856 | /* Draw a full native bitmap */ | 853 | /* Draw a full native bitmap */ |
@@ -893,7 +890,7 @@ void ICODE_ATTR lcd_bitmap_transparent_part(const fb_data *src, int src_x, | |||
893 | 890 | ||
894 | src += stride * src_x + src_y; /* move starting point */ | 891 | src += stride * src_x + src_y; /* move starting point */ |
895 | dst = LCDADDR(current_vp->x + x, current_vp->y + y); | 892 | dst = LCDADDR(current_vp->x + x, current_vp->y + y); |
896 | dst_end = dst - width * LCD_HEIGHT; | 893 | dst_end = dst + width * LCD_HEIGHT; |
897 | 894 | ||
898 | do | 895 | do |
899 | { | 896 | { |
@@ -906,9 +903,9 @@ void ICODE_ATTR lcd_bitmap_transparent_part(const fb_data *src, int src_x, | |||
906 | dst[i] = src[i]; | 903 | dst[i] = src[i]; |
907 | } | 904 | } |
908 | src += stride; | 905 | src += stride; |
909 | dst -= LCD_HEIGHT; | 906 | dst += LCD_HEIGHT; |
910 | } | 907 | } |
911 | while (dst > dst_end); | 908 | while (dst < dst_end); |
912 | } | 909 | } |
913 | #endif /* !defined(TOSHIBA_GIGABEAT_F) || defined(SIMULATOR) */ | 910 | #endif /* !defined(TOSHIBA_GIGABEAT_F) || defined(SIMULATOR) */ |
914 | 911 | ||