diff options
Diffstat (limited to 'firmware/drivers/lcd-24bit.c')
-rw-r--r-- | firmware/drivers/lcd-24bit.c | 180 |
1 files changed, 91 insertions, 89 deletions
diff --git a/firmware/drivers/lcd-24bit.c b/firmware/drivers/lcd-24bit.c index 8820e632d4..65fa01f37f 100644 --- a/firmware/drivers/lcd-24bit.c +++ b/firmware/drivers/lcd-24bit.c | |||
@@ -39,7 +39,7 @@ | |||
39 | #include "bidi.h" | 39 | #include "bidi.h" |
40 | #include "scroll_engine.h" | 40 | #include "scroll_engine.h" |
41 | 41 | ||
42 | #define ROW_INC LCD_WIDTH | 42 | #define ROW_INC lcd_current_viewport->buffer->stride |
43 | #define COL_INC 1 | 43 | #define COL_INC 1 |
44 | 44 | ||
45 | extern lcd_fastpixelfunc_type* const lcd_fastpixelfuncs_backdrop[]; | 45 | extern lcd_fastpixelfunc_type* const lcd_fastpixelfuncs_backdrop[]; |
@@ -62,10 +62,10 @@ void lcd_clear_viewport(void) | |||
62 | int x, y, width, height; | 62 | int x, y, width, height; |
63 | int len, step; | 63 | int len, step; |
64 | 64 | ||
65 | x = current_vp->x; | 65 | x = lcd_current_viewport->x; |
66 | y = current_vp->y; | 66 | y = lcd_current_viewport->y; |
67 | width = current_vp->width; | 67 | width = lcd_current_viewport->width; |
68 | height = current_vp->height; | 68 | height = lcd_current_viewport->height; |
69 | 69 | ||
70 | #if defined(HAVE_VIEWPORT_CLIP) | 70 | #if defined(HAVE_VIEWPORT_CLIP) |
71 | /********************* Viewport on screen clipping ********************/ | 71 | /********************* Viewport on screen clipping ********************/ |
@@ -97,9 +97,9 @@ void lcd_clear_viewport(void) | |||
97 | dst = FBADDR(x, y); | 97 | dst = FBADDR(x, y); |
98 | dst_end = FBADDR(x + width - 1 , y + height - 1); | 98 | dst_end = FBADDR(x + width - 1 , y + height - 1); |
99 | 99 | ||
100 | if (current_vp->drawmode & DRMODE_INVERSEVID) | 100 | if (lcd_current_viewport->drawmode & DRMODE_INVERSEVID) |
101 | { | 101 | { |
102 | fb_data px = FB_SCALARPACK(current_vp->fg_pattern); | 102 | fb_data px = FB_SCALARPACK(lcd_current_viewport->fg_pattern); |
103 | do | 103 | do |
104 | { | 104 | { |
105 | fb_data *end = dst + len; | 105 | fb_data *end = dst + len; |
@@ -114,7 +114,7 @@ void lcd_clear_viewport(void) | |||
114 | { | 114 | { |
115 | if (!lcd_backdrop) | 115 | if (!lcd_backdrop) |
116 | { | 116 | { |
117 | fb_data px = FB_SCALARPACK(current_vp->bg_pattern); | 117 | fb_data px = FB_SCALARPACK(lcd_current_viewport->bg_pattern); |
118 | do | 118 | do |
119 | { | 119 | { |
120 | fb_data *end = dst + len; | 120 | fb_data *end = dst + len; |
@@ -137,22 +137,24 @@ void lcd_clear_viewport(void) | |||
137 | } | 137 | } |
138 | } | 138 | } |
139 | 139 | ||
140 | if (current_vp == &default_vp) | 140 | if (lcd_current_viewport == &default_vp) |
141 | lcd_scroll_stop(); | 141 | lcd_scroll_stop(); |
142 | else | 142 | else |
143 | lcd_scroll_stop_viewport(current_vp); | 143 | lcd_scroll_stop_viewport(lcd_current_viewport); |
144 | |||
145 | lcd_current_viewport->flags &= ~(VP_FLAG_VP_SET_CLEAN); | ||
144 | } | 146 | } |
145 | 147 | ||
146 | /*** low-level drawing functions ***/ | 148 | /*** low-level drawing functions ***/ |
147 | 149 | ||
148 | static void ICODE_ATTR setpixel(fb_data *address) | 150 | static void ICODE_ATTR setpixel(fb_data *address) |
149 | { | 151 | { |
150 | *address = FB_SCALARPACK(current_vp->fg_pattern); | 152 | *address = FB_SCALARPACK(lcd_current_viewport->fg_pattern); |
151 | } | 153 | } |
152 | 154 | ||
153 | static void ICODE_ATTR clearpixel(fb_data *address) | 155 | static void ICODE_ATTR clearpixel(fb_data *address) |
154 | { | 156 | { |
155 | *address = FB_SCALARPACK(current_vp->bg_pattern); | 157 | *address = FB_SCALARPACK(lcd_current_viewport->bg_pattern); |
156 | } | 158 | } |
157 | 159 | ||
158 | static void ICODE_ATTR clearimgpixel(fb_data *address) | 160 | static void ICODE_ATTR clearimgpixel(fb_data *address) |
@@ -194,8 +196,8 @@ void lcd_fillrect(int x, int y, int width, int height) | |||
194 | 196 | ||
195 | /******************** In viewport clipping **********************/ | 197 | /******************** In viewport clipping **********************/ |
196 | /* nothing to draw? */ | 198 | /* nothing to draw? */ |
197 | if ((width <= 0) || (height <= 0) || (x >= current_vp->width) || | 199 | if ((width <= 0) || (height <= 0) || (x >= lcd_current_viewport->width) || |
198 | (y >= current_vp->height) || (x + width <= 0) || (y + height <= 0)) | 200 | (y >= lcd_current_viewport->height) || (x + width <= 0) || (y + height <= 0)) |
199 | return; | 201 | return; |
200 | 202 | ||
201 | if (x < 0) | 203 | if (x < 0) |
@@ -208,14 +210,14 @@ void lcd_fillrect(int x, int y, int width, int height) | |||
208 | height += y; | 210 | height += y; |
209 | y = 0; | 211 | y = 0; |
210 | } | 212 | } |
211 | if (x + width > current_vp->width) | 213 | if (x + width > lcd_current_viewport->width) |
212 | width = current_vp->width - x; | 214 | width = lcd_current_viewport->width - x; |
213 | if (y + height > current_vp->height) | 215 | if (y + height > lcd_current_viewport->height) |
214 | height = current_vp->height - y; | 216 | height = lcd_current_viewport->height - y; |
215 | 217 | ||
216 | /* adjust for viewport */ | 218 | /* adjust for viewport */ |
217 | x += current_vp->x; | 219 | x += lcd_current_viewport->x; |
218 | y += current_vp->y; | 220 | y += lcd_current_viewport->y; |
219 | 221 | ||
220 | #if defined(HAVE_VIEWPORT_CLIP) | 222 | #if defined(HAVE_VIEWPORT_CLIP) |
221 | /********************* Viewport on screen clipping ********************/ | 223 | /********************* Viewport on screen clipping ********************/ |
@@ -242,14 +244,14 @@ void lcd_fillrect(int x, int y, int width, int height) | |||
242 | #endif | 244 | #endif |
243 | 245 | ||
244 | /* drawmode and optimisation */ | 246 | /* drawmode and optimisation */ |
245 | if (current_vp->drawmode & DRMODE_INVERSEVID) | 247 | if (lcd_current_viewport->drawmode & DRMODE_INVERSEVID) |
246 | { | 248 | { |
247 | if (current_vp->drawmode & DRMODE_BG) | 249 | if (lcd_current_viewport->drawmode & DRMODE_BG) |
248 | { | 250 | { |
249 | if (!lcd_backdrop) | 251 | if (!lcd_backdrop) |
250 | { | 252 | { |
251 | fillopt = OPT_SET; | 253 | fillopt = OPT_SET; |
252 | bits = FB_SCALARPACK(current_vp->bg_pattern); | 254 | bits = FB_SCALARPACK(lcd_current_viewport->bg_pattern); |
253 | } | 255 | } |
254 | else | 256 | else |
255 | fillopt = OPT_COPY; | 257 | fillopt = OPT_COPY; |
@@ -257,13 +259,13 @@ void lcd_fillrect(int x, int y, int width, int height) | |||
257 | } | 259 | } |
258 | else | 260 | else |
259 | { | 261 | { |
260 | if (current_vp->drawmode & DRMODE_FG) | 262 | if (lcd_current_viewport->drawmode & DRMODE_FG) |
261 | { | 263 | { |
262 | fillopt = OPT_SET; | 264 | fillopt = OPT_SET; |
263 | bits = FB_SCALARPACK(current_vp->fg_pattern); | 265 | bits = FB_SCALARPACK(lcd_current_viewport->fg_pattern); |
264 | } | 266 | } |
265 | } | 267 | } |
266 | if (fillopt == OPT_NONE && current_vp->drawmode != DRMODE_COMPLEMENT) | 268 | if (fillopt == OPT_NONE && lcd_current_viewport->drawmode != DRMODE_COMPLEMENT) |
267 | return; | 269 | return; |
268 | 270 | ||
269 | dst = FBADDR(x, y); | 271 | dst = FBADDR(x, y); |
@@ -327,13 +329,13 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x, | |||
327 | const unsigned char *src_end; | 329 | const unsigned char *src_end; |
328 | fb_data *dst, *dst_col; | 330 | fb_data *dst, *dst_col; |
329 | unsigned dmask = 0x100; /* bit 8 == sentinel */ | 331 | unsigned dmask = 0x100; /* bit 8 == sentinel */ |
330 | int drmode = current_vp->drawmode; | 332 | int drmode = lcd_current_viewport->drawmode; |
331 | int row; | 333 | int row; |
332 | 334 | ||
333 | /******************** Image in viewport clipping **********************/ | 335 | /******************** Image in viewport clipping **********************/ |
334 | /* nothing to draw? */ | 336 | /* nothing to draw? */ |
335 | if ((width <= 0) || (height <= 0) || (x >= current_vp->width) || | 337 | if ((width <= 0) || (height <= 0) || (x >= lcd_current_viewport->width) || |
336 | (y >= current_vp->height) || (x + width <= 0) || (y + height <= 0)) | 338 | (y >= lcd_current_viewport->height) || (x + width <= 0) || (y + height <= 0)) |
337 | return; | 339 | return; |
338 | 340 | ||
339 | if (x < 0) | 341 | if (x < 0) |
@@ -348,14 +350,14 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x, | |||
348 | src_y -= y; | 350 | src_y -= y; |
349 | y = 0; | 351 | y = 0; |
350 | } | 352 | } |
351 | if (x + width > current_vp->width) | 353 | if (x + width > lcd_current_viewport->width) |
352 | width = current_vp->width - x; | 354 | width = lcd_current_viewport->width - x; |
353 | if (y + height > current_vp->height) | 355 | if (y + height > lcd_current_viewport->height) |
354 | height = current_vp->height - y; | 356 | height = lcd_current_viewport->height - y; |
355 | 357 | ||
356 | /* adjust for viewport */ | 358 | /* adjust for viewport */ |
357 | x += current_vp->x; | 359 | x += lcd_current_viewport->x; |
358 | y += current_vp->y; | 360 | y += lcd_current_viewport->y; |
359 | 361 | ||
360 | #if defined(HAVE_VIEWPORT_CLIP) | 362 | #if defined(HAVE_VIEWPORT_CLIP) |
361 | /********************* Viewport on screen clipping ********************/ | 363 | /********************* Viewport on screen clipping ********************/ |
@@ -447,7 +449,7 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x, | |||
447 | break; | 449 | break; |
448 | 450 | ||
449 | case DRMODE_BG: | 451 | case DRMODE_BG: |
450 | bg = FB_SCALARPACK(current_vp->bg_pattern); | 452 | bg = FB_SCALARPACK(lcd_current_viewport->bg_pattern); |
451 | do | 453 | do |
452 | { | 454 | { |
453 | if (!(data & 0x01)) | 455 | if (!(data & 0x01)) |
@@ -460,7 +462,7 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x, | |||
460 | break; | 462 | break; |
461 | 463 | ||
462 | case DRMODE_FG: | 464 | case DRMODE_FG: |
463 | fg = FB_SCALARPACK(current_vp->fg_pattern); | 465 | fg = FB_SCALARPACK(lcd_current_viewport->fg_pattern); |
464 | do | 466 | do |
465 | { | 467 | { |
466 | if (data & 0x01) | 468 | if (data & 0x01) |
@@ -473,7 +475,7 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x, | |||
473 | break; | 475 | break; |
474 | 476 | ||
475 | case DRMODE_SOLID|DRMODE_INT_BD: | 477 | case DRMODE_SOLID|DRMODE_INT_BD: |
476 | fg = FB_SCALARPACK(current_vp->fg_pattern); | 478 | fg = FB_SCALARPACK(lcd_current_viewport->fg_pattern); |
477 | bo = lcd_backdrop_offset; | 479 | bo = lcd_backdrop_offset; |
478 | do | 480 | do |
479 | { | 481 | { |
@@ -486,8 +488,8 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x, | |||
486 | break; | 488 | break; |
487 | 489 | ||
488 | case DRMODE_SOLID: | 490 | case DRMODE_SOLID: |
489 | fg = FB_SCALARPACK(current_vp->fg_pattern); | 491 | fg = FB_SCALARPACK(lcd_current_viewport->fg_pattern); |
490 | bg = FB_SCALARPACK(current_vp->bg_pattern); | 492 | bg = FB_SCALARPACK(lcd_current_viewport->bg_pattern); |
491 | do | 493 | do |
492 | { | 494 | { |
493 | *dst = (data & 0x01) ? fg : bg; | 495 | *dst = (data & 0x01) ? fg : bg; |
@@ -559,10 +561,10 @@ static void ICODE_ATTR lcd_alpha_bitmap_part_mix(const fb_data* image, | |||
559 | { | 561 | { |
560 | fb_data *dst, *dst_row; | 562 | fb_data *dst, *dst_row; |
561 | unsigned dmask = 0x00000000; | 563 | unsigned dmask = 0x00000000; |
562 | int drmode = current_vp->drawmode; | 564 | int drmode = lcd_current_viewport->drawmode; |
563 | /* nothing to draw? */ | 565 | /* nothing to draw? */ |
564 | if ((width <= 0) || (height <= 0) || (x >= current_vp->width) || | 566 | if ((width <= 0) || (height <= 0) || (x >= lcd_current_viewport->width) || |
565 | (y >= current_vp->height) || (x + width <= 0) || (y + height <= 0)) | 567 | (y >= lcd_current_viewport->height) || (x + width <= 0) || (y + height <= 0)) |
566 | return; | 568 | return; |
567 | 569 | ||
568 | /* clipping */ | 570 | /* clipping */ |
@@ -578,14 +580,14 @@ static void ICODE_ATTR lcd_alpha_bitmap_part_mix(const fb_data* image, | |||
578 | src_y -= y; | 580 | src_y -= y; |
579 | y = 0; | 581 | y = 0; |
580 | } | 582 | } |
581 | if (x + width > current_vp->width) | 583 | if (x + width > lcd_current_viewport->width) |
582 | width = current_vp->width - x; | 584 | width = lcd_current_viewport->width - x; |
583 | if (y + height > current_vp->height) | 585 | if (y + height > lcd_current_viewport->height) |
584 | height = current_vp->height - y; | 586 | height = lcd_current_viewport->height - y; |
585 | 587 | ||
586 | /* adjust for viewport */ | 588 | /* adjust for viewport */ |
587 | x += current_vp->x; | 589 | x += lcd_current_viewport->x; |
588 | y += current_vp->y; | 590 | y += lcd_current_viewport->y; |
589 | 591 | ||
590 | #if defined(HAVE_VIEWPORT_CLIP) | 592 | #if defined(HAVE_VIEWPORT_CLIP) |
591 | /********************* Viewport on screen clipping ********************/ | 593 | /********************* Viewport on screen clipping ********************/ |
@@ -673,7 +675,7 @@ static void ICODE_ATTR lcd_alpha_bitmap_part_mix(const fb_data* image, | |||
673 | /* go through the rows and update each pixel */ | 675 | /* go through the rows and update each pixel */ |
674 | do | 676 | do |
675 | { | 677 | { |
676 | /* saving current_vp->fg/bg_pattern and lcd_backdrop_offset into these | 678 | /* saving lcd_current_viewport->fg/bg_pattern and lcd_backdrop_offset into these |
677 | * temp vars just before the loop helps gcc to opimize the loop better | 679 | * temp vars just before the loop helps gcc to opimize the loop better |
678 | * (testing showed ~15% speedup) */ | 680 | * (testing showed ~15% speedup) */ |
679 | unsigned fg, bg; | 681 | unsigned fg, bg; |
@@ -734,7 +736,7 @@ static void ICODE_ATTR lcd_alpha_bitmap_part_mix(const fb_data* image, | |||
734 | while (--col); | 736 | while (--col); |
735 | break; | 737 | break; |
736 | case DRMODE_BG: | 738 | case DRMODE_BG: |
737 | bg = current_vp->bg_pattern; | 739 | bg = lcd_current_viewport->bg_pattern; |
738 | do | 740 | do |
739 | { | 741 | { |
740 | unsigned px = FB_UNPACK_SCALAR_LCD(*dst); | 742 | unsigned px = FB_UNPACK_SCALAR_LCD(*dst); |
@@ -757,7 +759,7 @@ static void ICODE_ATTR lcd_alpha_bitmap_part_mix(const fb_data* image, | |||
757 | while (--col); | 759 | while (--col); |
758 | break; | 760 | break; |
759 | case DRMODE_FG: | 761 | case DRMODE_FG: |
760 | fg = current_vp->fg_pattern; | 762 | fg = lcd_current_viewport->fg_pattern; |
761 | do | 763 | do |
762 | { | 764 | { |
763 | unsigned px = FB_UNPACK_SCALAR_LCD(*dst); | 765 | unsigned px = FB_UNPACK_SCALAR_LCD(*dst); |
@@ -769,7 +771,7 @@ static void ICODE_ATTR lcd_alpha_bitmap_part_mix(const fb_data* image, | |||
769 | break; | 771 | break; |
770 | case DRMODE_SOLID|DRMODE_INT_BD: | 772 | case DRMODE_SOLID|DRMODE_INT_BD: |
771 | bo = lcd_backdrop_offset; | 773 | bo = lcd_backdrop_offset; |
772 | fg = current_vp->fg_pattern; | 774 | fg = lcd_current_viewport->fg_pattern; |
773 | do | 775 | do |
774 | { | 776 | { |
775 | unsigned c = FB_UNPACK_SCALAR_LCD(*(fb_data *)((uintptr_t)dst + bo)); | 777 | unsigned c = FB_UNPACK_SCALAR_LCD(*(fb_data *)((uintptr_t)dst + bo)); |
@@ -780,7 +782,7 @@ static void ICODE_ATTR lcd_alpha_bitmap_part_mix(const fb_data* image, | |||
780 | while (--col); | 782 | while (--col); |
781 | break; | 783 | break; |
782 | case DRMODE_SOLID|DRMODE_INT_IMG: | 784 | case DRMODE_SOLID|DRMODE_INT_IMG: |
783 | bg = current_vp->bg_pattern; | 785 | bg = lcd_current_viewport->bg_pattern; |
784 | img_offset = image - dst; | 786 | img_offset = image - dst; |
785 | do | 787 | do |
786 | { | 788 | { |
@@ -805,8 +807,8 @@ static void ICODE_ATTR lcd_alpha_bitmap_part_mix(const fb_data* image, | |||
805 | while (--col); | 807 | while (--col); |
806 | break; | 808 | break; |
807 | case DRMODE_SOLID: | 809 | case DRMODE_SOLID: |
808 | bg = current_vp->bg_pattern; | 810 | bg = lcd_current_viewport->bg_pattern; |
809 | fg = current_vp->fg_pattern; | 811 | fg = lcd_current_viewport->fg_pattern; |
810 | do | 812 | do |
811 | { | 813 | { |
812 | *dst = blend_two_colors(bg, fg, data & ALPHA_COLOR_LOOKUP_SIZE ); | 814 | *dst = blend_two_colors(bg, fg, data & ALPHA_COLOR_LOOKUP_SIZE ); |
@@ -855,7 +857,7 @@ void lcd_hline(int x1, int x2, int y) | |||
855 | { | 857 | { |
856 | int x, width; | 858 | int x, width; |
857 | fb_data *dst, *dst_end; | 859 | fb_data *dst, *dst_end; |
858 | lcd_fastpixelfunc_type *pfunc = lcd_fastpixelfuncs[current_vp->drawmode]; | 860 | lcd_fastpixelfunc_type *pfunc = lcd_fastpixelfuncs[lcd_current_viewport->drawmode]; |
859 | 861 | ||
860 | /* direction flip */ | 862 | /* direction flip */ |
861 | if (x2 < x1) | 863 | if (x2 < x1) |
@@ -867,20 +869,20 @@ void lcd_hline(int x1, int x2, int y) | |||
867 | 869 | ||
868 | /******************** In viewport clipping **********************/ | 870 | /******************** In viewport clipping **********************/ |
869 | /* nothing to draw? */ | 871 | /* nothing to draw? */ |
870 | if (((unsigned)y >= (unsigned)current_vp->height) || | 872 | if (((unsigned)y >= (unsigned)lcd_current_viewport->height) || |
871 | (x1 >= current_vp->width) || | 873 | (x1 >= lcd_current_viewport->width) || |
872 | (x2 < 0)) | 874 | (x2 < 0)) |
873 | return; | 875 | return; |
874 | 876 | ||
875 | if (x1 < 0) | 877 | if (x1 < 0) |
876 | x1 = 0; | 878 | x1 = 0; |
877 | if (x2 >= current_vp->width) | 879 | if (x2 >= lcd_current_viewport->width) |
878 | x2 = current_vp->width-1; | 880 | x2 = lcd_current_viewport->width-1; |
879 | 881 | ||
880 | /* Adjust x1 and y to viewport */ | 882 | /* Adjust x1 and y to viewport */ |
881 | x1 += current_vp->x; | 883 | x1 += lcd_current_viewport->x; |
882 | x2 += current_vp->x; | 884 | x2 += lcd_current_viewport->x; |
883 | y += current_vp->y; | 885 | y += lcd_current_viewport->y; |
884 | 886 | ||
885 | #if defined(HAVE_VIEWPORT_CLIP) | 887 | #if defined(HAVE_VIEWPORT_CLIP) |
886 | /********************* Viewport on screen clipping ********************/ | 888 | /********************* Viewport on screen clipping ********************/ |
@@ -912,7 +914,7 @@ void lcd_vline(int x, int y1, int y2) | |||
912 | { | 914 | { |
913 | int y; | 915 | int y; |
914 | fb_data *dst, *dst_end; | 916 | fb_data *dst, *dst_end; |
915 | lcd_fastpixelfunc_type *pfunc = lcd_fastpixelfuncs[current_vp->drawmode]; | 917 | lcd_fastpixelfunc_type *pfunc = lcd_fastpixelfuncs[lcd_current_viewport->drawmode]; |
916 | 918 | ||
917 | /* direction flip */ | 919 | /* direction flip */ |
918 | if (y2 < y1) | 920 | if (y2 < y1) |
@@ -924,20 +926,20 @@ void lcd_vline(int x, int y1, int y2) | |||
924 | 926 | ||
925 | /******************** In viewport clipping **********************/ | 927 | /******************** In viewport clipping **********************/ |
926 | /* nothing to draw? */ | 928 | /* nothing to draw? */ |
927 | if (((unsigned)x >= (unsigned)current_vp->width) || | 929 | if (((unsigned)x >= (unsigned)lcd_current_viewport->width) || |
928 | (y1 >= current_vp->height) || | 930 | (y1 >= lcd_current_viewport->height) || |
929 | (y2 < 0)) | 931 | (y2 < 0)) |
930 | return; | 932 | return; |
931 | 933 | ||
932 | if (y1 < 0) | 934 | if (y1 < 0) |
933 | y1 = 0; | 935 | y1 = 0; |
934 | if (y2 >= current_vp->height) | 936 | if (y2 >= lcd_current_viewport->height) |
935 | y2 = current_vp->height-1; | 937 | y2 = lcd_current_viewport->height-1; |
936 | 938 | ||
937 | /* adjust for viewport */ | 939 | /* adjust for viewport */ |
938 | x += current_vp->x; | 940 | x += lcd_current_viewport->x; |
939 | y1 += current_vp->y; | 941 | y1 += lcd_current_viewport->y; |
940 | y2 += current_vp->y; | 942 | y2 += lcd_current_viewport->y; |
941 | 943 | ||
942 | #if defined(HAVE_VIEWPORT_CLIP) | 944 | #if defined(HAVE_VIEWPORT_CLIP) |
943 | /********************* Viewport on screen clipping ********************/ | 945 | /********************* Viewport on screen clipping ********************/ |
@@ -973,8 +975,8 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y, | |||
973 | 975 | ||
974 | /******************** Image in viewport clipping **********************/ | 976 | /******************** Image in viewport clipping **********************/ |
975 | /* nothing to draw? */ | 977 | /* nothing to draw? */ |
976 | if ((width <= 0) || (height <= 0) || (x >= current_vp->width) || | 978 | if ((width <= 0) || (height <= 0) || (x >= lcd_current_viewport->width) || |
977 | (y >= current_vp->height) || (x + width <= 0) || (y + height <= 0)) | 979 | (y >= lcd_current_viewport->height) || (x + width <= 0) || (y + height <= 0)) |
978 | return; | 980 | return; |
979 | 981 | ||
980 | if (x < 0) | 982 | if (x < 0) |
@@ -990,14 +992,14 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y, | |||
990 | y = 0; | 992 | y = 0; |
991 | } | 993 | } |
992 | 994 | ||
993 | if (x + width > current_vp->width) | 995 | if (x + width > lcd_current_viewport->width) |
994 | width = current_vp->width - x; | 996 | width = lcd_current_viewport->width - x; |
995 | if (y + height > current_vp->height) | 997 | if (y + height > lcd_current_viewport->height) |
996 | height = current_vp->height - y; | 998 | height = lcd_current_viewport->height - y; |
997 | 999 | ||
998 | /* adjust for viewport */ | 1000 | /* adjust for viewport */ |
999 | x += current_vp->x; | 1001 | x += lcd_current_viewport->x; |
1000 | y += current_vp->y; | 1002 | y += lcd_current_viewport->y; |
1001 | 1003 | ||
1002 | #if defined(HAVE_VIEWPORT_CLIP) | 1004 | #if defined(HAVE_VIEWPORT_CLIP) |
1003 | /********************* Viewport on screen clipping ********************/ | 1005 | /********************* Viewport on screen clipping ********************/ |
@@ -1047,8 +1049,8 @@ void ICODE_ATTR lcd_bitmap_transparent_part(const fb_data *src, int src_x, | |||
1047 | 1049 | ||
1048 | /******************** Image in viewport clipping **********************/ | 1050 | /******************** Image in viewport clipping **********************/ |
1049 | /* nothing to draw? */ | 1051 | /* nothing to draw? */ |
1050 | if ((width <= 0) || (height <= 0) || (x >= current_vp->width) || | 1052 | if ((width <= 0) || (height <= 0) || (x >= lcd_current_viewport->width) || |
1051 | (y >= current_vp->height) || (x + width <= 0) || (y + height <= 0)) | 1053 | (y >= lcd_current_viewport->height) || (x + width <= 0) || (y + height <= 0)) |
1052 | return; | 1054 | return; |
1053 | 1055 | ||
1054 | if (x < 0) | 1056 | if (x < 0) |
@@ -1064,14 +1066,14 @@ void ICODE_ATTR lcd_bitmap_transparent_part(const fb_data *src, int src_x, | |||
1064 | y = 0; | 1066 | y = 0; |
1065 | } | 1067 | } |
1066 | 1068 | ||
1067 | if (x + width > current_vp->width) | 1069 | if (x + width > lcd_current_viewport->width) |
1068 | width = current_vp->width - x; | 1070 | width = lcd_current_viewport->width - x; |
1069 | if (y + height > current_vp->height) | 1071 | if (y + height > lcd_current_viewport->height) |
1070 | height = current_vp->height - y; | 1072 | height = lcd_current_viewport->height - y; |
1071 | 1073 | ||
1072 | /* adjust for viewport */ | 1074 | /* adjust for viewport */ |
1073 | x += current_vp->x; | 1075 | x += lcd_current_viewport->x; |
1074 | y += current_vp->y; | 1076 | y += lcd_current_viewport->y; |
1075 | 1077 | ||
1076 | #if defined(HAVE_VIEWPORT_CLIP) | 1078 | #if defined(HAVE_VIEWPORT_CLIP) |
1077 | /********************* Viewport on screen clipping ********************/ | 1079 | /********************* Viewport on screen clipping ********************/ |
@@ -1104,7 +1106,7 @@ void ICODE_ATTR lcd_bitmap_transparent_part(const fb_data *src, int src_x, | |||
1104 | 1106 | ||
1105 | transparent = FB_SCALARPACK(TRANSPARENT_COLOR); | 1107 | transparent = FB_SCALARPACK(TRANSPARENT_COLOR); |
1106 | replacewithfg = FB_SCALARPACK(REPLACEWITHFG_COLOR); | 1108 | replacewithfg = FB_SCALARPACK(REPLACEWITHFG_COLOR); |
1107 | fg = FB_SCALARPACK(current_vp->fg_pattern); | 1109 | fg = FB_SCALARPACK(lcd_current_viewport->fg_pattern); |
1108 | #define CMP(c1, c2) (c1.r == c2.r && c1.g == c2.g && c1.b == c2.b) | 1110 | #define CMP(c1, c2) (c1.r == c2.r && c1.g == c2.g && c1.b == c2.b) |
1109 | 1111 | ||
1110 | do | 1112 | do |