diff options
author | William Wilgus <wilgus.william@gmail.com> | 2020-10-26 12:38:22 -0400 |
---|---|---|
committer | William Wilgus <wilgus.william@gmail.com> | 2020-10-26 12:38:22 -0400 |
commit | 40e98a2e4915464b9306ab7b0f6feb173de095c5 (patch) | |
tree | 4e987640ae4ad201f029c4e26e51ebc61a4549b1 | |
parent | 3237ae4a4ff9296a377ff9194a11038da161208f (diff) | |
download | rockbox-40e98a2e4915464b9306ab7b0f6feb173de095c5.tar.gz rockbox-40e98a2e4915464b9306ab7b0f6feb173de095c5.zip |
Whitespace cleanup on fb_viewport Rewrite
Change-Id: I24aac41c8abecf7b78a44d7f59e842b791be4563
26 files changed, 348 insertions, 348 deletions
diff --git a/apps/gui/pitchscreen.c b/apps/gui/pitchscreen.c index b5b719ef02..a6e6e42c43 100644 --- a/apps/gui/pitchscreen.c +++ b/apps/gui/pitchscreen.c | |||
@@ -64,13 +64,13 @@ enum | |||
64 | }; | 64 | }; |
65 | 65 | ||
66 | 66 | ||
67 | /* This is a table of semitone percentage values of the appropriate | 67 | /* This is a table of semitone percentage values of the appropriate |
68 | precision (based on PITCH_SPEED_PRECISION). Note that these are | 68 | precision (based on PITCH_SPEED_PRECISION). Note that these are |
69 | all constant expressions, which will be evaluated at compile time, | 69 | all constant expressions, which will be evaluated at compile time, |
70 | so no need to worry about how complex the expressions look. | 70 | so no need to worry about how complex the expressions look. |
71 | That's just to get the precision right. | 71 | That's just to get the precision right. |
72 | 72 | ||
73 | I calculated these values, starting from 50, as | 73 | I calculated these values, starting from 50, as |
74 | 74 | ||
75 | x(n) = 50 * 2^(n/12) | 75 | x(n) = 50 * 2^(n/12) |
76 | 76 | ||
@@ -81,7 +81,7 @@ enum | |||
81 | */ | 81 | */ |
82 | #define TO_INT_WITH_PRECISION(x) \ | 82 | #define TO_INT_WITH_PRECISION(x) \ |
83 | ( (unsigned short)(((x) * PITCH_SPEED_PRECISION * 10 + 5) / 10) ) | 83 | ( (unsigned short)(((x) * PITCH_SPEED_PRECISION * 10 + 5) / 10) ) |
84 | 84 | ||
85 | static const unsigned short semitone_table[] = | 85 | static const unsigned short semitone_table[] = |
86 | { | 86 | { |
87 | TO_INT_WITH_PRECISION(50.00000000), /* Octave lower */ | 87 | TO_INT_WITH_PRECISION(50.00000000), /* Octave lower */ |
@@ -115,12 +115,12 @@ static const unsigned short semitone_table[] = | |||
115 | #define SEMITONE_END (NUM_SEMITONES/2) | 115 | #define SEMITONE_END (NUM_SEMITONES/2) |
116 | #define SEMITONE_START (-SEMITONE_END) | 116 | #define SEMITONE_START (-SEMITONE_END) |
117 | 117 | ||
118 | /* A table of values for approximating the cent curve with | 118 | /* A table of values for approximating the cent curve with |
119 | linear interpolation. Multipy the next lowest semitone | 119 | linear interpolation. Multipy the next lowest semitone |
120 | by this much to find the corresponding cent percentage. | 120 | by this much to find the corresponding cent percentage. |
121 | 121 | ||
122 | These values were calculated as | 122 | These values were calculated as |
123 | x(n) = 100 * 2^(n * 20/1200) | 123 | x(n) = 100 * 2^(n * 20/1200) |
124 | */ | 124 | */ |
125 | 125 | ||
126 | static const unsigned short cent_interp[] = | 126 | static const unsigned short cent_interp[] = |
@@ -308,16 +308,16 @@ static void pitchscreen_draw(struct screen *display, int max_lines, | |||
308 | { | 308 | { |
309 | snprintf(buf, sizeof(buf), "%s: %s%d.%02d", str(LANG_PITCH), | 309 | snprintf(buf, sizeof(buf), "%s: %s%d.%02d", str(LANG_PITCH), |
310 | semitone >= 0 ? "+" : "-", | 310 | semitone >= 0 ? "+" : "-", |
311 | abs(semitone / PITCH_SPEED_PRECISION), | 311 | abs(semitone / PITCH_SPEED_PRECISION), |
312 | abs((semitone % PITCH_SPEED_PRECISION) / | 312 | abs((semitone % PITCH_SPEED_PRECISION) / |
313 | (PITCH_SPEED_PRECISION / 100)) | 313 | (PITCH_SPEED_PRECISION / 100)) |
314 | ); | 314 | ); |
315 | } | 315 | } |
316 | else | 316 | else |
317 | { | 317 | { |
318 | snprintf(buf, sizeof(buf), "%s: %ld.%ld%%", str(LANG_PITCH), | 318 | snprintf(buf, sizeof(buf), "%s: %ld.%ld%%", str(LANG_PITCH), |
319 | pitch / PITCH_SPEED_PRECISION, | 319 | pitch / PITCH_SPEED_PRECISION, |
320 | (pitch % PITCH_SPEED_PRECISION) / | 320 | (pitch % PITCH_SPEED_PRECISION) / |
321 | (PITCH_SPEED_PRECISION / 10)); | 321 | (PITCH_SPEED_PRECISION / 10)); |
322 | } | 322 | } |
323 | } | 323 | } |
@@ -337,8 +337,8 @@ static void pitchscreen_draw(struct screen *display, int max_lines, | |||
337 | /* "Speed:XXX%" */ | 337 | /* "Speed:XXX%" */ |
338 | if(global_settings.pitch_mode_timestretch) | 338 | if(global_settings.pitch_mode_timestretch) |
339 | { | 339 | { |
340 | snprintf(buf, sizeof(buf), "%s: %ld.%ld%%", str(LANG_SPEED), | 340 | snprintf(buf, sizeof(buf), "%s: %ld.%ld%%", str(LANG_SPEED), |
341 | speed / PITCH_SPEED_PRECISION, | 341 | speed / PITCH_SPEED_PRECISION, |
342 | (speed % PITCH_SPEED_PRECISION) / (PITCH_SPEED_PRECISION / 10)); | 342 | (speed % PITCH_SPEED_PRECISION) / (PITCH_SPEED_PRECISION / 10)); |
343 | } | 343 | } |
344 | else | 344 | else |
@@ -347,23 +347,23 @@ static void pitchscreen_draw(struct screen *display, int max_lines, | |||
347 | { | 347 | { |
348 | snprintf(buf, sizeof(buf), "%s%d.%02d", | 348 | snprintf(buf, sizeof(buf), "%s%d.%02d", |
349 | semitone >= 0 ? "+" : "-", | 349 | semitone >= 0 ? "+" : "-", |
350 | abs(semitone / PITCH_SPEED_PRECISION), | 350 | abs(semitone / PITCH_SPEED_PRECISION), |
351 | abs((semitone % PITCH_SPEED_PRECISION) / | 351 | abs((semitone % PITCH_SPEED_PRECISION) / |
352 | (PITCH_SPEED_PRECISION / 100)) | 352 | (PITCH_SPEED_PRECISION / 100)) |
353 | ); | 353 | ); |
354 | } | 354 | } |
355 | else | 355 | else |
356 | { | 356 | { |
357 | snprintf(buf, sizeof(buf), "%ld.%ld%%", | 357 | snprintf(buf, sizeof(buf), "%ld.%ld%%", |
358 | pitch / PITCH_SPEED_PRECISION, | 358 | pitch / PITCH_SPEED_PRECISION, |
359 | (pitch % PITCH_SPEED_PRECISION) / (PITCH_SPEED_PRECISION / 10)); | 359 | (pitch % PITCH_SPEED_PRECISION) / (PITCH_SPEED_PRECISION / 10)); |
360 | } | 360 | } |
361 | } | 361 | } |
362 | 362 | ||
363 | display->getstringsize(buf, &w, &h); | 363 | display->getstringsize(buf, &w, &h); |
364 | display->putsxy((pitch_viewports[PITCH_MID].width / 2) - (w / 2), | 364 | display->putsxy((pitch_viewports[PITCH_MID].width / 2) - (w / 2), |
365 | show_lang_pitch ? (pitch_viewports[PITCH_MID].height / 2) : | 365 | show_lang_pitch ? (pitch_viewports[PITCH_MID].height / 2) : |
366 | (pitch_viewports[PITCH_MID].height / 2) - (h / 2), | 366 | (pitch_viewports[PITCH_MID].height / 2) - (h / 2), |
367 | buf); | 367 | buf); |
368 | if (w > width_used) | 368 | if (w > width_used) |
369 | width_used = w; | 369 | width_used = w; |
@@ -401,8 +401,8 @@ static void pitchscreen_draw(struct screen *display, int max_lines, | |||
401 | { | 401 | { |
402 | display->putsxy(0, (pitch_viewports[PITCH_MID].height / 2) - (h / 2), | 402 | display->putsxy(0, (pitch_viewports[PITCH_MID].height / 2) - (h / 2), |
403 | leftlabel); | 403 | leftlabel); |
404 | display->putsxy((pitch_viewports[PITCH_MID].width - w), | 404 | display->putsxy((pitch_viewports[PITCH_MID].width - w), |
405 | (pitch_viewports[PITCH_MID].height / 2) - (h / 2), | 405 | (pitch_viewports[PITCH_MID].height / 2) - (h / 2), |
406 | rightlabel); | 406 | rightlabel); |
407 | } | 407 | } |
408 | display->update_viewport(); | 408 | display->update_viewport(); |
@@ -421,7 +421,7 @@ static int32_t pitch_increase(int32_t pitch, int32_t pitch_delta, bool allow_cut | |||
421 | if (pitch_delta < 0) | 421 | if (pitch_delta < 0) |
422 | { | 422 | { |
423 | /* for large jumps, snap up to whole numbers */ | 423 | /* for large jumps, snap up to whole numbers */ |
424 | if(allow_cutoff && pitch_delta <= -PITCH_SPEED_PRECISION && | 424 | if(allow_cutoff && pitch_delta <= -PITCH_SPEED_PRECISION && |
425 | (pitch + pitch_delta) % PITCH_SPEED_PRECISION != 0) | 425 | (pitch + pitch_delta) % PITCH_SPEED_PRECISION != 0) |
426 | { | 426 | { |
427 | pitch_delta += PITCH_SPEED_PRECISION - ((pitch + pitch_delta) % PITCH_SPEED_PRECISION); | 427 | pitch_delta += PITCH_SPEED_PRECISION - ((pitch + pitch_delta) % PITCH_SPEED_PRECISION); |
@@ -442,7 +442,7 @@ static int32_t pitch_increase(int32_t pitch, int32_t pitch_delta, bool allow_cut | |||
442 | else if (pitch_delta > 0) | 442 | else if (pitch_delta > 0) |
443 | { | 443 | { |
444 | /* for large jumps, snap down to whole numbers */ | 444 | /* for large jumps, snap down to whole numbers */ |
445 | if(allow_cutoff && pitch_delta >= PITCH_SPEED_PRECISION && | 445 | if(allow_cutoff && pitch_delta >= PITCH_SPEED_PRECISION && |
446 | (pitch + pitch_delta) % PITCH_SPEED_PRECISION != 0) | 446 | (pitch + pitch_delta) % PITCH_SPEED_PRECISION != 0) |
447 | { | 447 | { |
448 | pitch_delta -= (pitch + pitch_delta) % PITCH_SPEED_PRECISION; | 448 | pitch_delta -= (pitch + pitch_delta) % PITCH_SPEED_PRECISION; |
@@ -480,7 +480,7 @@ static int32_t pitch_increase(int32_t pitch, int32_t pitch_delta, bool allow_cut | |||
480 | new_pitch = GET_PITCH(speed, STRETCH_MAX); | 480 | new_pitch = GET_PITCH(speed, STRETCH_MAX); |
481 | } | 481 | } |
482 | 482 | ||
483 | if(new_stretch >= STRETCH_MAX || | 483 | if(new_stretch >= STRETCH_MAX || |
484 | new_stretch <= STRETCH_MIN) | 484 | new_stretch <= STRETCH_MIN) |
485 | { | 485 | { |
486 | at_limit = true; | 486 | at_limit = true; |
@@ -505,7 +505,7 @@ static int32_t get_semitone_from_pitch(int32_t pitch) | |||
505 | 505 | ||
506 | 506 | ||
507 | /* now find the fractional part */ | 507 | /* now find the fractional part */ |
508 | while(pitch > (cent_interp[fractional_index + 1] * | 508 | while(pitch > (cent_interp[fractional_index + 1] * |
509 | semitone_table[semitone] / PITCH_SPEED_100)) | 509 | semitone_table[semitone] / PITCH_SPEED_100)) |
510 | { | 510 | { |
511 | /* Check to make sure fractional_index isn't too big */ | 511 | /* Check to make sure fractional_index isn't too big */ |
@@ -517,17 +517,17 @@ static int32_t get_semitone_from_pitch(int32_t pitch) | |||
517 | fractional_index++; | 517 | fractional_index++; |
518 | } | 518 | } |
519 | 519 | ||
520 | int32_t semitone_pitch_a = cent_interp[fractional_index] * | 520 | int32_t semitone_pitch_a = cent_interp[fractional_index] * |
521 | semitone_table[semitone] / | 521 | semitone_table[semitone] / |
522 | PITCH_SPEED_100; | 522 | PITCH_SPEED_100; |
523 | int32_t semitone_pitch_b = cent_interp[fractional_index + 1] * | 523 | int32_t semitone_pitch_b = cent_interp[fractional_index + 1] * |
524 | semitone_table[semitone] / | 524 | semitone_table[semitone] / |
525 | PITCH_SPEED_100; | 525 | PITCH_SPEED_100; |
526 | /* this will be the integer offset from the cent_interp entry */ | 526 | /* this will be the integer offset from the cent_interp entry */ |
527 | int32_t semitone_frac_ofs = (pitch - semitone_pitch_a) * CENT_INTERP_INTERVAL / | 527 | int32_t semitone_frac_ofs = (pitch - semitone_pitch_a) * CENT_INTERP_INTERVAL / |
528 | (semitone_pitch_b - semitone_pitch_a); | 528 | (semitone_pitch_b - semitone_pitch_a); |
529 | semitone = (semitone + SEMITONE_START) * PITCH_SPEED_PRECISION + | 529 | semitone = (semitone + SEMITONE_START) * PITCH_SPEED_PRECISION + |
530 | fractional_index * CENT_INTERP_INTERVAL + | 530 | fractional_index * CENT_INTERP_INTERVAL + |
531 | semitone_frac_ofs; | 531 | semitone_frac_ofs; |
532 | 532 | ||
533 | return semitone; | 533 | return semitone; |
@@ -543,14 +543,14 @@ static int32_t get_pitch_from_semitone(int32_t semitone) | |||
543 | /* set pitch to the semitone's integer part value */ | 543 | /* set pitch to the semitone's integer part value */ |
544 | int32_t pitch = semitone_table[semitone_index]; | 544 | int32_t pitch = semitone_table[semitone_index]; |
545 | /* get the range of the cent modification for future calculation */ | 545 | /* get the range of the cent modification for future calculation */ |
546 | int32_t pitch_mod_a = | 546 | int32_t pitch_mod_a = |
547 | cent_interp[(adjusted_semitone % PITCH_SPEED_PRECISION) / | 547 | cent_interp[(adjusted_semitone % PITCH_SPEED_PRECISION) / |
548 | CENT_INTERP_INTERVAL]; | 548 | CENT_INTERP_INTERVAL]; |
549 | int32_t pitch_mod_b = | 549 | int32_t pitch_mod_b = |
550 | cent_interp[(adjusted_semitone % PITCH_SPEED_PRECISION) / | 550 | cent_interp[(adjusted_semitone % PITCH_SPEED_PRECISION) / |
551 | CENT_INTERP_INTERVAL + 1]; | 551 | CENT_INTERP_INTERVAL + 1]; |
552 | /* figure out the cent mod amount based on the semitone fractional value */ | 552 | /* figure out the cent mod amount based on the semitone fractional value */ |
553 | int32_t pitch_mod = pitch_mod_a + (pitch_mod_b - pitch_mod_a) * | 553 | int32_t pitch_mod = pitch_mod_a + (pitch_mod_b - pitch_mod_a) * |
554 | (adjusted_semitone % CENT_INTERP_INTERVAL) / CENT_INTERP_INTERVAL; | 554 | (adjusted_semitone % CENT_INTERP_INTERVAL) / CENT_INTERP_INTERVAL; |
555 | 555 | ||
556 | /* modify pitch based on the mod amount we just calculated */ | 556 | /* modify pitch based on the mod amount we just calculated */ |
@@ -558,7 +558,7 @@ static int32_t get_pitch_from_semitone(int32_t semitone) | |||
558 | } | 558 | } |
559 | 559 | ||
560 | static int32_t pitch_increase_semitone(int32_t pitch, | 560 | static int32_t pitch_increase_semitone(int32_t pitch, |
561 | int32_t current_semitone, | 561 | int32_t current_semitone, |
562 | int32_t semitone_delta | 562 | int32_t semitone_delta |
563 | , int32_t speed | 563 | , int32_t speed |
564 | ) | 564 | ) |
@@ -618,7 +618,7 @@ static int32_t pitch_increase_semitone(int32_t pitch, | |||
618 | #ifdef HAVE_TOUCHSCREEN | 618 | #ifdef HAVE_TOUCHSCREEN |
619 | /* | 619 | /* |
620 | * Check for touchscreen presses as per sketch above in this file | 620 | * Check for touchscreen presses as per sketch above in this file |
621 | * | 621 | * |
622 | * goes through each row of the, checks whether the touchscreen | 622 | * goes through each row of the, checks whether the touchscreen |
623 | * was pressed in it. Then it looks the columns of each row for specific actions | 623 | * was pressed in it. Then it looks the columns of each row for specific actions |
624 | */ | 624 | */ |
@@ -638,7 +638,7 @@ static int pitchscreen_do_touchscreen(struct viewport vps[]) | |||
638 | if ((x < column || x > (2*column)) && (ret == BUTTON_REL)) | 638 | if ((x < column || x > (2*column)) && (ret == BUTTON_REL)) |
639 | return ACTION_PS_TOGGLE_MODE; | 639 | return ACTION_PS_TOGGLE_MODE; |
640 | 640 | ||
641 | 641 | ||
642 | else if (x >= column && x <= (2*column)) | 642 | else if (x >= column && x <= (2*column)) |
643 | { /* center column pressed */ | 643 | { /* center column pressed */ |
644 | if (ret == BUTTON_REPEAT) | 644 | if (ret == BUTTON_REPEAT) |
@@ -828,7 +828,7 @@ int gui_syncpitchscreen_run(void) | |||
828 | updated = 0; | 828 | updated = 0; |
829 | 829 | ||
830 | button = get_action(CONTEXT_PITCHSCREEN, HZ); | 830 | button = get_action(CONTEXT_PITCHSCREEN, HZ); |
831 | 831 | ||
832 | #ifdef HAVE_TOUCHSCREEN | 832 | #ifdef HAVE_TOUCHSCREEN |
833 | if (button == ACTION_TOUCHSCREEN) | 833 | if (button == ACTION_TOUCHSCREEN) |
834 | { | 834 | { |
@@ -841,7 +841,7 @@ int gui_syncpitchscreen_run(void) | |||
841 | case ACTION_PS_INC_SMALL: | 841 | case ACTION_PS_INC_SMALL: |
842 | if(global_settings.pitch_mode_semitone) | 842 | if(global_settings.pitch_mode_semitone) |
843 | pitch_delta = SEMITONE_SMALL_DELTA; | 843 | pitch_delta = SEMITONE_SMALL_DELTA; |
844 | else | 844 | else |
845 | pitch_delta = PITCH_SMALL_DELTA; | 845 | pitch_delta = PITCH_SMALL_DELTA; |
846 | updated = 1; | 846 | updated = 1; |
847 | break; | 847 | break; |
@@ -849,7 +849,7 @@ int gui_syncpitchscreen_run(void) | |||
849 | case ACTION_PS_INC_BIG: | 849 | case ACTION_PS_INC_BIG: |
850 | if(global_settings.pitch_mode_semitone) | 850 | if(global_settings.pitch_mode_semitone) |
851 | pitch_delta = SEMITONE_BIG_DELTA; | 851 | pitch_delta = SEMITONE_BIG_DELTA; |
852 | else | 852 | else |
853 | pitch_delta = PITCH_BIG_DELTA; | 853 | pitch_delta = PITCH_BIG_DELTA; |
854 | updated = 1; | 854 | updated = 1; |
855 | break; | 855 | break; |
@@ -857,7 +857,7 @@ int gui_syncpitchscreen_run(void) | |||
857 | case ACTION_PS_DEC_SMALL: | 857 | case ACTION_PS_DEC_SMALL: |
858 | if(global_settings.pitch_mode_semitone) | 858 | if(global_settings.pitch_mode_semitone) |
859 | pitch_delta = -SEMITONE_SMALL_DELTA; | 859 | pitch_delta = -SEMITONE_SMALL_DELTA; |
860 | else | 860 | else |
861 | pitch_delta = -PITCH_SMALL_DELTA; | 861 | pitch_delta = -PITCH_SMALL_DELTA; |
862 | updated = 1; | 862 | updated = 1; |
863 | break; | 863 | break; |
@@ -865,7 +865,7 @@ int gui_syncpitchscreen_run(void) | |||
865 | case ACTION_PS_DEC_BIG: | 865 | case ACTION_PS_DEC_BIG: |
866 | if(global_settings.pitch_mode_semitone) | 866 | if(global_settings.pitch_mode_semitone) |
867 | pitch_delta = -SEMITONE_BIG_DELTA; | 867 | pitch_delta = -SEMITONE_BIG_DELTA; |
868 | else | 868 | else |
869 | pitch_delta = -PITCH_BIG_DELTA; | 869 | pitch_delta = -PITCH_BIG_DELTA; |
870 | updated = 1; | 870 | updated = 1; |
871 | break; | 871 | break; |
@@ -1045,7 +1045,7 @@ int gui_syncpitchscreen_run(void) | |||
1045 | } | 1045 | } |
1046 | 1046 | ||
1047 | new_stretch = GET_STRETCH(pitch, new_speed); | 1047 | new_stretch = GET_STRETCH(pitch, new_speed); |
1048 | if(new_stretch >= STRETCH_MAX || | 1048 | if(new_stretch >= STRETCH_MAX || |
1049 | new_stretch <= STRETCH_MIN) | 1049 | new_stretch <= STRETCH_MIN) |
1050 | { | 1050 | { |
1051 | at_limit = true; | 1051 | at_limit = true; |
diff --git a/apps/gui/skin_engine/skin_display.c b/apps/gui/skin_engine/skin_display.c index bd3a2b40aa..c35b09eaac 100644 --- a/apps/gui/skin_engine/skin_display.c +++ b/apps/gui/skin_engine/skin_display.c | |||
@@ -80,14 +80,14 @@ void skin_update(enum skinnable_screens skin, enum screen_type screen, | |||
80 | unsigned int update_type) | 80 | unsigned int update_type) |
81 | { | 81 | { |
82 | struct gui_wps *gwps = skin_get_gwps(skin, screen); | 82 | struct gui_wps *gwps = skin_get_gwps(skin, screen); |
83 | /* This maybe shouldnt be here, | 83 | /* This maybe shouldnt be here, |
84 | * This is also safe for skined screen which dont use the id3 */ | 84 | * This is also safe for skined screen which dont use the id3 */ |
85 | struct mp3entry *id3 = skin_get_global_state()->id3; | 85 | struct mp3entry *id3 = skin_get_global_state()->id3; |
86 | bool cuesheet_update = (id3 != NULL ? cuesheet_subtrack_changed(id3) : false); | 86 | bool cuesheet_update = (id3 != NULL ? cuesheet_subtrack_changed(id3) : false); |
87 | if (cuesheet_update) | 87 | if (cuesheet_update) |
88 | skin_request_full_update(skin); | 88 | skin_request_full_update(skin); |
89 | 89 | ||
90 | skin_render(gwps, skin_do_full_update(skin, screen) ? | 90 | skin_render(gwps, skin_do_full_update(skin, screen) ? |
91 | SKIN_REFRESH_ALL : update_type); | 91 | SKIN_REFRESH_ALL : update_type); |
92 | } | 92 | } |
93 | 93 | ||
@@ -96,7 +96,7 @@ void skin_update(enum skinnable_screens skin, enum screen_type screen, | |||
96 | #define DIRECTION_RIGHT 1 | 96 | #define DIRECTION_RIGHT 1 |
97 | #define DIRECTION_LEFT -1 | 97 | #define DIRECTION_LEFT -1 |
98 | 98 | ||
99 | static int ab_calc_mark_x_pos(int mark, int capacity, | 99 | static int ab_calc_mark_x_pos(int mark, int capacity, |
100 | int offset, int size) | 100 | int offset, int size) |
101 | { | 101 | { |
102 | return offset + ( (size * mark) / capacity ); | 102 | return offset + ( (size * mark) / capacity ); |
@@ -124,7 +124,7 @@ static void ab_draw_arrow_mark(struct screen * screen, | |||
124 | } | 124 | } |
125 | } | 125 | } |
126 | 126 | ||
127 | void ab_draw_markers(struct screen * screen, int capacity, | 127 | void ab_draw_markers(struct screen * screen, int capacity, |
128 | int x, int y, int w, int h) | 128 | int x, int y, int w, int h) |
129 | { | 129 | { |
130 | bool a_set, b_set; | 130 | bool a_set, b_set; |
@@ -245,13 +245,13 @@ void draw_progressbar(struct gui_wps *gwps, int line, struct progressbar *pb) | |||
245 | length = 1; | 245 | length = 1; |
246 | end = 0; | 246 | end = 0; |
247 | } | 247 | } |
248 | 248 | ||
249 | if (!pb->horizontal) | 249 | if (!pb->horizontal) |
250 | { | 250 | { |
251 | /* we want to fill upwards which is technically inverted. */ | 251 | /* we want to fill upwards which is technically inverted. */ |
252 | flags = INVERTFILL; | 252 | flags = INVERTFILL; |
253 | } | 253 | } |
254 | 254 | ||
255 | if (pb->invert_fill_direction) | 255 | if (pb->invert_fill_direction) |
256 | { | 256 | { |
257 | flags ^= INVERTFILL; | 257 | flags ^= INVERTFILL; |
@@ -421,7 +421,7 @@ void wps_display_images(struct gui_wps *gwps, struct viewport* vp) | |||
421 | /* Evaluate the conditional that is at *token_index and return whether a skip | 421 | /* Evaluate the conditional that is at *token_index and return whether a skip |
422 | has ocurred. *token_index is updated with the new position. | 422 | has ocurred. *token_index is updated with the new position. |
423 | */ | 423 | */ |
424 | int evaluate_conditional(struct gui_wps *gwps, int offset, | 424 | int evaluate_conditional(struct gui_wps *gwps, int offset, |
425 | struct conditional *conditional, int num_options) | 425 | struct conditional *conditional, int num_options) |
426 | { | 426 | { |
427 | if (!gwps) | 427 | if (!gwps) |
@@ -641,7 +641,7 @@ bool skin_has_sbs(enum screen_type screen, struct wps_data *data) | |||
641 | } | 641 | } |
642 | 642 | ||
643 | /* do the button loop as often as required for the peak meters to update | 643 | /* do the button loop as often as required for the peak meters to update |
644 | * with a good refresh rate. | 644 | * with a good refresh rate. |
645 | */ | 645 | */ |
646 | int skin_wait_for_action(enum skinnable_screens skin, int context, int timeout) | 646 | int skin_wait_for_action(enum skinnable_screens skin, int context, int timeout) |
647 | { | 647 | { |
diff --git a/apps/gui/skin_engine/skin_render.c b/apps/gui/skin_engine/skin_render.c index 00981f5b67..ed2f783e7a 100644 --- a/apps/gui/skin_engine/skin_render.c +++ b/apps/gui/skin_engine/skin_render.c | |||
@@ -60,17 +60,17 @@ struct skin_draw_info { | |||
60 | int line_number; | 60 | int line_number; |
61 | unsigned long refresh_type; | 61 | unsigned long refresh_type; |
62 | struct line_desc line_desc; | 62 | struct line_desc line_desc; |
63 | 63 | ||
64 | char* cur_align_start; | 64 | char* cur_align_start; |
65 | struct align_pos align; | 65 | struct align_pos align; |
66 | bool no_line_break; | 66 | bool no_line_break; |
67 | bool line_scrolls; | 67 | bool line_scrolls; |
68 | bool force_redraw; | 68 | bool force_redraw; |
69 | bool viewport_change; | 69 | bool viewport_change; |
70 | 70 | ||
71 | char *buf; | 71 | char *buf; |
72 | size_t buf_size; | 72 | size_t buf_size; |
73 | 73 | ||
74 | int offset; /* used by the playlist viewer */ | 74 | int offset; /* used by the playlist viewer */ |
75 | }; | 75 | }; |
76 | 76 | ||
@@ -102,7 +102,7 @@ static bool do_non_text_tags(struct gui_wps *gwps, struct skin_draw_info *info, | |||
102 | bool do_refresh = (element->tag->flags & info->refresh_type) > 0; | 102 | bool do_refresh = (element->tag->flags & info->refresh_type) > 0; |
103 | 103 | ||
104 | switch (token->type) | 104 | switch (token->type) |
105 | { | 105 | { |
106 | #if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)) | 106 | #if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)) |
107 | case SKIN_TOKEN_VIEWPORT_FGCOLOUR: | 107 | case SKIN_TOKEN_VIEWPORT_FGCOLOUR: |
108 | { | 108 | { |
@@ -161,7 +161,7 @@ static bool do_non_text_tags(struct gui_wps *gwps, struct skin_draw_info *info, | |||
161 | while (viewport) | 161 | while (viewport) |
162 | { | 162 | { |
163 | struct skin_viewport *skinvp = SKINOFFSETTOPTR(skin_buffer, viewport->data); | 163 | struct skin_viewport *skinvp = SKINOFFSETTOPTR(skin_buffer, viewport->data); |
164 | 164 | ||
165 | char *vplabel = SKINOFFSETTOPTR(skin_buffer, skinvp->label); | 165 | char *vplabel = SKINOFFSETTOPTR(skin_buffer, skinvp->label); |
166 | if (skinvp->label == VP_DEFAULT_LABEL) | 166 | if (skinvp->label == VP_DEFAULT_LABEL) |
167 | vplabel = VP_DEFAULT_LABEL_STRING; | 167 | vplabel = VP_DEFAULT_LABEL_STRING; |
@@ -171,7 +171,7 @@ static bool do_non_text_tags(struct gui_wps *gwps, struct skin_draw_info *info, | |||
171 | if (skinvp->hidden_flags&VP_DRAW_HIDDEN) | 171 | if (skinvp->hidden_flags&VP_DRAW_HIDDEN) |
172 | { | 172 | { |
173 | temp |= VP_DRAW_WASHIDDEN; | 173 | temp |= VP_DRAW_WASHIDDEN; |
174 | } | 174 | } |
175 | skinvp->hidden_flags = temp; | 175 | skinvp->hidden_flags = temp; |
176 | } | 176 | } |
177 | viewport = SKINOFFSETTOPTR(skin_buffer, viewport->next); | 177 | viewport = SKINOFFSETTOPTR(skin_buffer, viewport->next); |
@@ -351,7 +351,7 @@ static void do_tags_in_hidden_conditional(struct skin_element* branch, | |||
351 | struct wps_data *data = gwps->data; | 351 | struct wps_data *data = gwps->data; |
352 | struct viewport *last_vp; | 352 | struct viewport *last_vp; |
353 | 353 | ||
354 | /* Tags here are ones which need to be "turned off" or cleared | 354 | /* Tags here are ones which need to be "turned off" or cleared |
355 | * if they are in a conditional branch which isnt being used */ | 355 | * if they are in a conditional branch which isnt being used */ |
356 | if (branch->type == LINE_ALTERNATOR) | 356 | if (branch->type == LINE_ALTERNATOR) |
357 | { | 357 | { |
@@ -387,7 +387,7 @@ static void do_tags_in_hidden_conditional(struct skin_element* branch, | |||
387 | if (token->type == SKIN_TOKEN_IMAGE_PRELOAD_DISPLAY) | 387 | if (token->type == SKIN_TOKEN_IMAGE_PRELOAD_DISPLAY) |
388 | { | 388 | { |
389 | struct image_display *id = SKINOFFSETTOPTR(skin_buffer, token->value.data); | 389 | struct image_display *id = SKINOFFSETTOPTR(skin_buffer, token->value.data); |
390 | struct gui_img *img = skin_find_item(SKINOFFSETTOPTR(skin_buffer, id->label), | 390 | struct gui_img *img = skin_find_item(SKINOFFSETTOPTR(skin_buffer, id->label), |
391 | SKIN_FIND_IMAGE, data); | 391 | SKIN_FIND_IMAGE, data); |
392 | clear_image_pos(gwps, img); | 392 | clear_image_pos(gwps, img); |
393 | } | 393 | } |
@@ -455,7 +455,7 @@ static void do_tags_in_hidden_conditional(struct skin_element* branch, | |||
455 | } | 455 | } |
456 | } | 456 | } |
457 | } | 457 | } |
458 | 458 | ||
459 | static void fix_line_alignment(struct skin_draw_info *info, struct skin_element *element) | 459 | static void fix_line_alignment(struct skin_draw_info *info, struct skin_element *element) |
460 | { | 460 | { |
461 | struct align_pos *align = &info->align; | 461 | struct align_pos *align = &info->align; |
@@ -497,16 +497,16 @@ static void fix_line_alignment(struct skin_draw_info *info, struct skin_element | |||
497 | break; | 497 | break; |
498 | } | 498 | } |
499 | } | 499 | } |
500 | 500 | ||
501 | /* Draw a LINE element onto the display */ | 501 | /* Draw a LINE element onto the display */ |
502 | static bool skin_render_line(struct skin_element* line, struct skin_draw_info *info) | 502 | static bool skin_render_line(struct skin_element* line, struct skin_draw_info *info) |
503 | { | 503 | { |
504 | bool needs_update = false; | 504 | bool needs_update = false; |
505 | int last_value, value; | 505 | int last_value, value; |
506 | 506 | ||
507 | if (line->children_count == 0) | 507 | if (line->children_count == 0) |
508 | return false; /* empty line, do nothing */ | 508 | return false; /* empty line, do nothing */ |
509 | 509 | ||
510 | struct skin_element *child = get_child(line->children, 0); | 510 | struct skin_element *child = get_child(line->children, 0); |
511 | struct conditional *conditional; | 511 | struct conditional *conditional; |
512 | skin_render_func func = skin_render_line; | 512 | skin_render_func func = skin_render_line; |
@@ -518,14 +518,14 @@ static bool skin_render_line(struct skin_element* line, struct skin_draw_info *i | |||
518 | case CONDITIONAL: | 518 | case CONDITIONAL: |
519 | conditional = SKINOFFSETTOPTR(skin_buffer, child->data); | 519 | conditional = SKINOFFSETTOPTR(skin_buffer, child->data); |
520 | last_value = conditional->last_value; | 520 | last_value = conditional->last_value; |
521 | value = evaluate_conditional(info->gwps, info->offset, | 521 | value = evaluate_conditional(info->gwps, info->offset, |
522 | conditional, child->children_count); | 522 | conditional, child->children_count); |
523 | conditional->last_value = value; | 523 | conditional->last_value = value; |
524 | if (child->children_count == 1) | 524 | if (child->children_count == 1) |
525 | { | 525 | { |
526 | /* special handling so | 526 | /* special handling so |
527 | * %?aa<true> and %?<true|false> need special handlng here */ | 527 | * %?aa<true> and %?<true|false> need special handlng here */ |
528 | 528 | ||
529 | if (value == -1) /* tag is false */ | 529 | if (value == -1) /* tag is false */ |
530 | { | 530 | { |
531 | /* we are in a false branch of a %?aa<true> conditional */ | 531 | /* we are in a false branch of a %?aa<true> conditional */ |
@@ -545,18 +545,18 @@ static bool skin_render_line(struct skin_element* line, struct skin_draw_info *i | |||
545 | } | 545 | } |
546 | else if (get_child(child->children, value)->type == LINE) | 546 | else if (get_child(child->children, value)->type == LINE) |
547 | func = skin_render_line; | 547 | func = skin_render_line; |
548 | 548 | ||
549 | if (value != last_value) | 549 | if (value != last_value) |
550 | { | 550 | { |
551 | info->refresh_type = SKIN_REFRESH_ALL; | 551 | info->refresh_type = SKIN_REFRESH_ALL; |
552 | info->force_redraw = true; | 552 | info->force_redraw = true; |
553 | } | 553 | } |
554 | 554 | ||
555 | if (func(get_child(child->children, value), info)) | 555 | if (func(get_child(child->children, value), info)) |
556 | needs_update = true; | 556 | needs_update = true; |
557 | else | 557 | else |
558 | needs_update = needs_update || (last_value != value); | 558 | needs_update = needs_update || (last_value != value); |
559 | 559 | ||
560 | info->refresh_type = old_refresh_mode; | 560 | info->refresh_type = old_refresh_mode; |
561 | break; | 561 | break; |
562 | case TAG: | 562 | case TAG: |
@@ -564,9 +564,9 @@ static bool skin_render_line(struct skin_element* line, struct skin_draw_info *i | |||
564 | info->no_line_break = true; | 564 | info->no_line_break = true; |
565 | if (child->tag->type == SKIN_TOKEN_SUBLINE_SCROLL) | 565 | if (child->tag->type == SKIN_TOKEN_SUBLINE_SCROLL) |
566 | info->line_scrolls = true; | 566 | info->line_scrolls = true; |
567 | 567 | ||
568 | fix_line_alignment(info, child); | 568 | fix_line_alignment(info, child); |
569 | 569 | ||
570 | if (!SKINOFFSETTOPTR(skin_buffer, child->data)) | 570 | if (!SKINOFFSETTOPTR(skin_buffer, child->data)) |
571 | { | 571 | { |
572 | break; | 572 | break; |
@@ -583,17 +583,17 @@ static bool skin_render_line(struct skin_element* line, struct skin_draw_info *i | |||
583 | if (child->tag->flags&SKIN_RTC_REFRESH) | 583 | if (child->tag->flags&SKIN_RTC_REFRESH) |
584 | needs_update = needs_update || info->refresh_type&SKIN_REFRESH_DYNAMIC; | 584 | needs_update = needs_update || info->refresh_type&SKIN_REFRESH_DYNAMIC; |
585 | #endif | 585 | #endif |
586 | needs_update = needs_update || | 586 | needs_update = needs_update || |
587 | ((child->tag->flags&info->refresh_type)!=0); | 587 | ((child->tag->flags&info->refresh_type)!=0); |
588 | strlcat(info->cur_align_start, valuestr, | 588 | strlcat(info->cur_align_start, valuestr, |
589 | info->buf_size - (info->cur_align_start-info->buf)); | 589 | info->buf_size - (info->cur_align_start-info->buf)); |
590 | } | 590 | } |
591 | } | 591 | } |
592 | break; | 592 | break; |
593 | case TEXT: | 593 | case TEXT: |
594 | strlcat(info->cur_align_start, SKINOFFSETTOPTR(skin_buffer, child->data), | 594 | strlcat(info->cur_align_start, SKINOFFSETTOPTR(skin_buffer, child->data), |
595 | info->buf_size - (info->cur_align_start-info->buf)); | 595 | info->buf_size - (info->cur_align_start-info->buf)); |
596 | needs_update = needs_update || | 596 | needs_update = needs_update || |
597 | (info->refresh_type&SKIN_REFRESH_STATIC) != 0; | 597 | (info->refresh_type&SKIN_REFRESH_STATIC) != 0; |
598 | break; | 598 | break; |
599 | case COMMENT: | 599 | case COMMENT: |
@@ -664,7 +664,7 @@ bool skin_render_alternator(struct skin_element* element, struct skin_draw_info | |||
664 | int try_line = start; | 664 | int try_line = start; |
665 | bool suitable = false; | 665 | bool suitable = false; |
666 | int rettimeout = DEFAULT_SUBLINE_TIME_MULTIPLIER*TIMEOUT_UNIT; | 666 | int rettimeout = DEFAULT_SUBLINE_TIME_MULTIPLIER*TIMEOUT_UNIT; |
667 | 667 | ||
668 | /* find a subline which has at least one token in it, | 668 | /* find a subline which has at least one token in it, |
669 | * and that line doesnt have a timeout set to 0 through conditionals */ | 669 | * and that line doesnt have a timeout set to 0 through conditionals */ |
670 | do { | 670 | do { |
@@ -674,7 +674,7 @@ bool skin_render_alternator(struct skin_element* element, struct skin_draw_info | |||
674 | if (get_child(element->children, try_line)->children_count != 0) | 674 | if (get_child(element->children, try_line)->children_count != 0) |
675 | { | 675 | { |
676 | current_line = get_child(element->children, try_line); | 676 | current_line = get_child(element->children, try_line); |
677 | rettimeout = get_subline_timeout(info->gwps, | 677 | rettimeout = get_subline_timeout(info->gwps, |
678 | get_child(current_line->children, 0)); | 678 | get_child(current_line->children, 0)); |
679 | if (rettimeout > 0) | 679 | if (rettimeout > 0) |
680 | { | 680 | { |
@@ -683,7 +683,7 @@ bool skin_render_alternator(struct skin_element* element, struct skin_draw_info | |||
683 | } | 683 | } |
684 | } | 684 | } |
685 | while (try_line != start && !suitable); | 685 | while (try_line != start && !suitable); |
686 | 686 | ||
687 | if (suitable) | 687 | if (suitable) |
688 | { | 688 | { |
689 | alternator->current_line = try_line; | 689 | alternator->current_line = try_line; |
@@ -749,14 +749,14 @@ void skin_render_viewport(struct skin_element* viewport, struct gui_wps *gwps, | |||
749 | if (++info.line_desc.line > info.line_desc.nlines) | 749 | if (++info.line_desc.line > info.line_desc.nlines) |
750 | info.line_desc.style = STYLE_DEFAULT; | 750 | info.line_desc.style = STYLE_DEFAULT; |
751 | } | 751 | } |
752 | #endif | 752 | #endif |
753 | #endif | 753 | #endif |
754 | info.cur_align_start = info.buf; | 754 | info.cur_align_start = info.buf; |
755 | align->left = info.buf; | 755 | align->left = info.buf; |
756 | align->center = NULL; | 756 | align->center = NULL; |
757 | align->right = NULL; | 757 | align->right = NULL; |
758 | 758 | ||
759 | 759 | ||
760 | if (line->type == LINE_ALTERNATOR) | 760 | if (line->type == LINE_ALTERNATOR) |
761 | func = skin_render_alternator; | 761 | func = skin_render_alternator; |
762 | else if (line->type == LINE) | 762 | else if (line->type == LINE) |
@@ -798,11 +798,11 @@ void skin_render(struct gui_wps *gwps, unsigned refresh_mode) | |||
798 | const int vp_is_appearing = (VP_DRAW_WASHIDDEN|VP_DRAW_HIDEABLE); | 798 | const int vp_is_appearing = (VP_DRAW_WASHIDDEN|VP_DRAW_HIDEABLE); |
799 | struct wps_data *data = gwps->data; | 799 | struct wps_data *data = gwps->data; |
800 | struct screen *display = gwps->display; | 800 | struct screen *display = gwps->display; |
801 | 801 | ||
802 | struct skin_element* viewport; | 802 | struct skin_element* viewport; |
803 | struct skin_viewport* skin_viewport; | 803 | struct skin_viewport* skin_viewport; |
804 | char *label; | 804 | char *label; |
805 | 805 | ||
806 | int old_refresh_mode = refresh_mode; | 806 | int old_refresh_mode = refresh_mode; |
807 | skin_buffer = get_skin_buffer(gwps->data); | 807 | skin_buffer = get_skin_buffer(gwps->data); |
808 | 808 | ||
@@ -828,7 +828,7 @@ void skin_render(struct gui_wps *gwps, unsigned refresh_mode) | |||
828 | if (label && SKINOFFSETTOPTR(skin_buffer, viewport->next) && | 828 | if (label && SKINOFFSETTOPTR(skin_buffer, viewport->next) && |
829 | !strcmp(label,VP_DEFAULT_LABEL_STRING)) | 829 | !strcmp(label,VP_DEFAULT_LABEL_STRING)) |
830 | refresh_mode = 0; | 830 | refresh_mode = 0; |
831 | 831 | ||
832 | for (viewport = SKINOFFSETTOPTR(skin_buffer, data->tree); | 832 | for (viewport = SKINOFFSETTOPTR(skin_buffer, data->tree); |
833 | viewport; | 833 | viewport; |
834 | viewport = SKINOFFSETTOPTR(skin_buffer, viewport->next)) | 834 | viewport = SKINOFFSETTOPTR(skin_buffer, viewport->next)) |
@@ -848,7 +848,7 @@ void skin_render(struct gui_wps *gwps, unsigned refresh_mode) | |||
848 | skin_backdrop_show(data->backdrop_id); | 848 | skin_backdrop_show(data->backdrop_id); |
849 | } | 849 | } |
850 | #endif | 850 | #endif |
851 | 851 | ||
852 | /* dont redraw the viewport if its disabled */ | 852 | /* dont redraw the viewport if its disabled */ |
853 | if (skin_viewport->hidden_flags&VP_NEVER_VISIBLE) | 853 | if (skin_viewport->hidden_flags&VP_NEVER_VISIBLE) |
854 | { /* don't draw anything into this one */ | 854 | { /* don't draw anything into this one */ |
@@ -864,7 +864,7 @@ void skin_render(struct gui_wps *gwps, unsigned refresh_mode) | |||
864 | vp_refresh_mode = SKIN_REFRESH_ALL; | 864 | vp_refresh_mode = SKIN_REFRESH_ALL; |
865 | skin_viewport->hidden_flags = VP_DRAW_HIDEABLE; | 865 | skin_viewport->hidden_flags = VP_DRAW_HIDEABLE; |
866 | } | 866 | } |
867 | 867 | ||
868 | display->set_viewport_ex(&skin_viewport->vp, VP_FLAG_VP_SET_CLEAN); | 868 | display->set_viewport_ex(&skin_viewport->vp, VP_FLAG_VP_SET_CLEAN); |
869 | 869 | ||
870 | if ((vp_refresh_mode&SKIN_REFRESH_ALL) == SKIN_REFRESH_ALL) | 870 | if ((vp_refresh_mode&SKIN_REFRESH_ALL) == SKIN_REFRESH_ALL) |
@@ -929,17 +929,17 @@ void skin_render_playlistviewer(struct playlistviewer* viewer, | |||
929 | else | 929 | else |
930 | #endif | 930 | #endif |
931 | { | 931 | { |
932 | struct cuesheet *cue = skin_get_global_state()->id3 ? | 932 | struct cuesheet *cue = skin_get_global_state()->id3 ? |
933 | skin_get_global_state()->id3->cuesheet : NULL; | 933 | skin_get_global_state()->id3->cuesheet : NULL; |
934 | cur_pos = playlist_get_display_index(); | 934 | cur_pos = playlist_get_display_index(); |
935 | max = playlist_amount()+1; | 935 | max = playlist_amount()+1; |
936 | if (cue) | 936 | if (cue) |
937 | max += cue->track_count; | 937 | max += cue->track_count; |
938 | start_item = MAX(0, cur_pos + viewer->start_offset); | 938 | start_item = MAX(0, cur_pos + viewer->start_offset); |
939 | } | 939 | } |
940 | if (max-start_item > nb_lines) | 940 | if (max-start_item > nb_lines) |
941 | max = start_item + nb_lines; | 941 | max = start_item + nb_lines; |
942 | 942 | ||
943 | line = SKINOFFSETTOPTR(skin_buffer, viewer->line); | 943 | line = SKINOFFSETTOPTR(skin_buffer, viewer->line); |
944 | while (start_item < max) | 944 | while (start_item < max) |
945 | { | 945 | { |
@@ -947,20 +947,20 @@ void skin_render_playlistviewer(struct playlistviewer* viewer, | |||
947 | info.no_line_break = false; | 947 | info.no_line_break = false; |
948 | info.line_scrolls = false; | 948 | info.line_scrolls = false; |
949 | info.force_redraw = false; | 949 | info.force_redraw = false; |
950 | 950 | ||
951 | info.cur_align_start = info.buf; | 951 | info.cur_align_start = info.buf; |
952 | align->left = info.buf; | 952 | align->left = info.buf; |
953 | align->center = NULL; | 953 | align->center = NULL; |
954 | align->right = NULL; | 954 | align->right = NULL; |
955 | 955 | ||
956 | 956 | ||
957 | if (line->type == LINE_ALTERNATOR) | 957 | if (line->type == LINE_ALTERNATOR) |
958 | func = skin_render_alternator; | 958 | func = skin_render_alternator; |
959 | else if (line->type == LINE) | 959 | else if (line->type == LINE) |
960 | func = skin_render_line; | 960 | func = skin_render_line; |
961 | 961 | ||
962 | needs_update = func(line, &info); | 962 | needs_update = func(line, &info); |
963 | 963 | ||
964 | /* only update if the line needs to be, and there is something to write */ | 964 | /* only update if the line needs to be, and there is something to write */ |
965 | if (refresh_type && needs_update) | 965 | if (refresh_type && needs_update) |
966 | { | 966 | { |
diff --git a/apps/gui/skin_engine/wps_internals.h b/apps/gui/skin_engine/wps_internals.h index bf7f52bdbf..48898483de 100644 --- a/apps/gui/skin_engine/wps_internals.h +++ b/apps/gui/skin_engine/wps_internals.h | |||
@@ -21,7 +21,7 @@ | |||
21 | 21 | ||
22 | /* This stuff is for the wps engine only.. anyone caught using this outside | 22 | /* This stuff is for the wps engine only.. anyone caught using this outside |
23 | * of apps/gui/wps_engine will be shot on site! */ | 23 | * of apps/gui/wps_engine will be shot on site! */ |
24 | 24 | ||
25 | #ifndef _WPS_ENGINE_INTERNALS_ | 25 | #ifndef _WPS_ENGINE_INTERNALS_ |
26 | #define _WPS_ENGINE_INTERNALS_ | 26 | #define _WPS_ENGINE_INTERNALS_ |
27 | 27 | ||
@@ -114,9 +114,9 @@ struct progressbar { | |||
114 | short width; | 114 | short width; |
115 | short height; | 115 | short height; |
116 | bool follow_lang_direction; | 116 | bool follow_lang_direction; |
117 | 117 | ||
118 | OFFSETTYPE(struct gui_img *) image; | 118 | OFFSETTYPE(struct gui_img *) image; |
119 | 119 | ||
120 | bool invert_fill_direction; | 120 | bool invert_fill_direction; |
121 | bool nofill; | 121 | bool nofill; |
122 | bool noborder; | 122 | bool noborder; |
@@ -125,7 +125,7 @@ struct progressbar { | |||
125 | bool horizontal; | 125 | bool horizontal; |
126 | OFFSETTYPE(struct gui_img *) backdrop; | 126 | OFFSETTYPE(struct gui_img *) backdrop; |
127 | int setting_id; /* for the setting bar type */ | 127 | int setting_id; /* for the setting bar type */ |
128 | 128 | ||
129 | }; | 129 | }; |
130 | 130 | ||
131 | struct draw_rectangle { | 131 | struct draw_rectangle { |
@@ -207,7 +207,7 @@ struct touchregion { | |||
207 | PRESS, /* quick press only */ | 207 | PRESS, /* quick press only */ |
208 | LONG_PRESS, /* Long press without repeat */ | 208 | LONG_PRESS, /* Long press without repeat */ |
209 | REPEAT, /* long press allowing repeats */ | 209 | REPEAT, /* long press allowing repeats */ |
210 | } press_length; | 210 | } press_length; |
211 | int action; /* action this button will return */ | 211 | int action; /* action this button will return */ |
212 | bool armed; /* A region is armed on press. Only armed regions are triggered | 212 | bool armed; /* A region is armed on press. Only armed regions are triggered |
213 | on repeat or release. */ | 213 | on repeat or release. */ |
@@ -264,12 +264,12 @@ struct skin_albumart { | |||
264 | unsigned char xalign; /* WPS_ALBUMART_ALIGN_LEFT, _CENTER, _RIGHT */ | 264 | unsigned char xalign; /* WPS_ALBUMART_ALIGN_LEFT, _CENTER, _RIGHT */ |
265 | unsigned char yalign; /* WPS_ALBUMART_ALIGN_TOP, _CENTER, _BOTTOM */ | 265 | unsigned char yalign; /* WPS_ALBUMART_ALIGN_TOP, _CENTER, _BOTTOM */ |
266 | unsigned char state; /* WPS_ALBUMART_NONE, _CHECK, _LOAD */ | 266 | unsigned char state; /* WPS_ALBUMART_NONE, _CHECK, _LOAD */ |
267 | 267 | ||
268 | OFFSETTYPE(struct viewport *) vp; | 268 | OFFSETTYPE(struct viewport *) vp; |
269 | int draw_handle; | 269 | int draw_handle; |
270 | }; | 270 | }; |
271 | #endif | 271 | #endif |
272 | 272 | ||
273 | 273 | ||
274 | struct line { | 274 | struct line { |
275 | unsigned update_mode; | 275 | unsigned update_mode; |
diff --git a/apps/gui/splash.c b/apps/gui/splash.c index 1415d47a70..b85e4693aa 100644 --- a/apps/gui/splash.c +++ b/apps/gui/splash.c | |||
@@ -120,7 +120,7 @@ static void splash_internal(struct screen * screen, const char *fmt, va_list ap) | |||
120 | vp.y += (vp.height - height) / 2; | 120 | vp.y += (vp.height - height) / 2; |
121 | vp.width = width; | 121 | vp.width = width; |
122 | vp.height = height; | 122 | vp.height = height; |
123 | 123 | ||
124 | vp.flags |= VP_FLAG_ALIGN_CENTER; | 124 | vp.flags |= VP_FLAG_ALIGN_CENTER; |
125 | #if LCD_DEPTH > 1 | 125 | #if LCD_DEPTH > 1 |
126 | if (screen->depth > 1) | 126 | if (screen->depth > 1) |
diff --git a/apps/gui/viewport.c b/apps/gui/viewport.c index 9fdf88e8f0..3dd8bca979 100644 --- a/apps/gui/viewport.c +++ b/apps/gui/viewport.c | |||
@@ -207,7 +207,7 @@ void viewportmanager_theme_undo(enum screen_type screen, bool force_redraw) | |||
207 | int top = --theme_stack_top[screen]; | 207 | int top = --theme_stack_top[screen]; |
208 | if (top < 0) | 208 | if (top < 0) |
209 | panicf("Stack underflow... viewportmanager"); | 209 | panicf("Stack underflow... viewportmanager"); |
210 | 210 | ||
211 | toggle_theme(screen, force_redraw); | 211 | toggle_theme(screen, force_redraw); |
212 | } | 212 | } |
213 | 213 | ||
diff --git a/apps/gui/viewport.h b/apps/gui/viewport.h index be80e44721..2810be2ac3 100644 --- a/apps/gui/viewport.h +++ b/apps/gui/viewport.h | |||
@@ -55,7 +55,7 @@ void viewportmanager_init(void) INIT_ATTR; | |||
55 | 55 | ||
56 | void viewportmanager_theme_enable(enum screen_type screen, bool enable, | 56 | void viewportmanager_theme_enable(enum screen_type screen, bool enable, |
57 | struct viewport *viewport); | 57 | struct viewport *viewport); |
58 | /* Force will cause a redraw even if the theme was previously and | 58 | /* Force will cause a redraw even if the theme was previously and |
59 | * currently enabled (i,e the undo doing nothing). | 59 | * currently enabled (i,e the undo doing nothing). |
60 | * Should almost always be set to false except coming out of fully skinned screens */ | 60 | * Should almost always be set to false except coming out of fully skinned screens */ |
61 | void viewportmanager_theme_undo(enum screen_type screen, bool force_redraw); | 61 | void viewportmanager_theme_undo(enum screen_type screen, bool force_redraw); |
diff --git a/apps/gui/yesno.c b/apps/gui/yesno.c index d70b66f230..e0d8ad457c 100644 --- a/apps/gui/yesno.c +++ b/apps/gui/yesno.c | |||
@@ -34,7 +34,7 @@ struct gui_yesno | |||
34 | { | 34 | { |
35 | const struct text_message * main_message; | 35 | const struct text_message * main_message; |
36 | const struct text_message * result_message[2]; | 36 | const struct text_message * result_message[2]; |
37 | 37 | ||
38 | struct viewport *vp; | 38 | struct viewport *vp; |
39 | struct screen * display; | 39 | struct screen * display; |
40 | }; | 40 | }; |
@@ -63,12 +63,12 @@ static int put_message(struct screen *display, | |||
63 | int i; | 63 | int i; |
64 | for(i=0; i<message->nb_lines && i+start<max_y; i++) | 64 | for(i=0; i<message->nb_lines && i+start<max_y; i++) |
65 | { | 65 | { |
66 | display->puts_scroll(0, i+start, | 66 | display->puts_scroll(0, i+start, |
67 | P2STR((unsigned char *)message->message_lines[i])); | 67 | P2STR((unsigned char *)message->message_lines[i])); |
68 | } | 68 | } |
69 | return i; | 69 | return i; |
70 | } | 70 | } |
71 | 71 | ||
72 | /* | 72 | /* |
73 | * Draws the yesno | 73 | * Draws the yesno |
74 | * - yn : the yesno structure | 74 | * - yn : the yesno structure |
@@ -87,7 +87,7 @@ static void gui_yesno_draw(struct gui_yesno * yn) | |||
87 | 87 | ||
88 | if(nb_lines+3< vp_lines) | 88 | if(nb_lines+3< vp_lines) |
89 | line_shift=1; | 89 | line_shift=1; |
90 | 90 | ||
91 | line_shift += put_message(display, yn->main_message, | 91 | line_shift += put_message(display, yn->main_message, |
92 | line_shift, vp_lines); | 92 | line_shift, vp_lines); |
93 | #ifdef HAVE_TOUCHSCREEN | 93 | #ifdef HAVE_TOUCHSCREEN |
@@ -216,7 +216,7 @@ enum yesno_res gui_syncyesno_run(const struct text_message * main_message, | |||
216 | 216 | ||
217 | if (global_settings.talk_menu) | 217 | if (global_settings.talk_menu) |
218 | { | 218 | { |
219 | talk_text_message((result == YESNO_YES) ? yes_message | 219 | talk_text_message((result == YESNO_YES) ? yes_message |
220 | : no_message, false); | 220 | : no_message, false); |
221 | talk_force_enqueue_next(); | 221 | talk_force_enqueue_next(); |
222 | } | 222 | } |
diff --git a/apps/plugins/lib/xlcd_draw.c b/apps/plugins/lib/xlcd_draw.c index 0bd1c7a9e2..debdff6f04 100644 --- a/apps/plugins/lib/xlcd_draw.c +++ b/apps/plugins/lib/xlcd_draw.c | |||
@@ -356,10 +356,10 @@ void xlcd_gray_bitmap_part(const unsigned char *src, int src_x, int src_y, | |||
356 | fb_data *dst; | 356 | fb_data *dst; |
357 | 357 | ||
358 | /* nothing to draw? */ | 358 | /* nothing to draw? */ |
359 | if ((width <= 0) || (height <= 0) || (x >= LCD_WIDTH) || (y >= LCD_HEIGHT) | 359 | if ((width <= 0) || (height <= 0) || (x >= LCD_WIDTH) || (y >= LCD_HEIGHT) |
360 | || (x + width <= 0) || (y + height <= 0)) | 360 | || (x + width <= 0) || (y + height <= 0)) |
361 | return; | 361 | return; |
362 | 362 | ||
363 | /* clipping */ | 363 | /* clipping */ |
364 | if (x < 0) | 364 | if (x < 0) |
365 | { | 365 | { |
@@ -426,10 +426,10 @@ void xlcd_color_bitmap_part(const unsigned char *src, int src_x, int src_y, | |||
426 | fb_data *dst; | 426 | fb_data *dst; |
427 | 427 | ||
428 | /* nothing to draw? */ | 428 | /* nothing to draw? */ |
429 | if ((width <= 0) || (height <= 0) || (x >= LCD_WIDTH) || (y >= LCD_HEIGHT) | 429 | if ((width <= 0) || (height <= 0) || (x >= LCD_WIDTH) || (y >= LCD_HEIGHT) |
430 | || (x + width <= 0) || (y + height <= 0)) | 430 | || (x + width <= 0) || (y + height <= 0)) |
431 | return; | 431 | return; |
432 | 432 | ||
433 | /* clipping */ | 433 | /* clipping */ |
434 | if (x < 0) | 434 | if (x < 0) |
435 | { | 435 | { |
diff --git a/apps/plugins/lib/xlcd_scroll.c b/apps/plugins/lib/xlcd_scroll.c index 89427b6118..5ac4a366e8 100644 --- a/apps/plugins/lib/xlcd_scroll.c +++ b/apps/plugins/lib/xlcd_scroll.c | |||
@@ -74,7 +74,7 @@ void xlcd_scroll_right(int count) | |||
74 | 74 | ||
75 | length = (LCD_WIDTH-count)*LCD_FBHEIGHT; | 75 | length = (LCD_WIDTH-count)*LCD_FBHEIGHT; |
76 | 76 | ||
77 | rb->memmove(lcd_fb + LCD_HEIGHT*count, | 77 | rb->memmove(lcd_fb + LCD_HEIGHT*count, |
78 | lcd_fb, length * sizeof(fb_data)); | 78 | lcd_fb, length * sizeof(fb_data)); |
79 | 79 | ||
80 | oldmode = rb->lcd_get_drawmode(); | 80 | oldmode = rb->lcd_get_drawmode(); |
@@ -92,7 +92,7 @@ void xlcd_scroll_up(int count) | |||
92 | 92 | ||
93 | 93 | ||
94 | int width, length, oldmode; | 94 | int width, length, oldmode; |
95 | 95 | ||
96 | fb_data *data; | 96 | fb_data *data; |
97 | 97 | ||
98 | if ((unsigned)count >= LCD_HEIGHT) | 98 | if ((unsigned)count >= LCD_HEIGHT) |
@@ -102,10 +102,10 @@ void xlcd_scroll_up(int count) | |||
102 | } | 102 | } |
103 | 103 | ||
104 | length = LCD_HEIGHT - count; | 104 | length = LCD_HEIGHT - count; |
105 | 105 | ||
106 | width = LCD_WIDTH-1; | 106 | width = LCD_WIDTH-1; |
107 | data = lcd_fb; | 107 | data = lcd_fb; |
108 | 108 | ||
109 | do { | 109 | do { |
110 | rb->memmove(data,data + count,length * sizeof(fb_data)); | 110 | rb->memmove(data,data + count,length * sizeof(fb_data)); |
111 | data += LCD_HEIGHT; | 111 | data += LCD_HEIGHT; |
@@ -126,7 +126,7 @@ void xlcd_scroll_down(int count) | |||
126 | 126 | ||
127 | 127 | ||
128 | int width, length, oldmode; | 128 | int width, length, oldmode; |
129 | 129 | ||
130 | fb_data *data; | 130 | fb_data *data; |
131 | 131 | ||
132 | if ((unsigned)count >= LCD_HEIGHT) | 132 | if ((unsigned)count >= LCD_HEIGHT) |
@@ -139,7 +139,7 @@ void xlcd_scroll_down(int count) | |||
139 | 139 | ||
140 | width = LCD_WIDTH-1; | 140 | width = LCD_WIDTH-1; |
141 | data = lcd_fb; | 141 | data = lcd_fb; |
142 | 142 | ||
143 | do { | 143 | do { |
144 | rb->memmove(data + count, data, length * sizeof(fb_data)); | 144 | rb->memmove(data + count, data, length * sizeof(fb_data)); |
145 | data += LCD_HEIGHT; | 145 | data += LCD_HEIGHT; |
@@ -408,7 +408,7 @@ void xlcd_scroll_down(int count) | |||
408 | rb->lcd_set_drawmode(oldmode); | 408 | rb->lcd_set_drawmode(oldmode); |
409 | } | 409 | } |
410 | 410 | ||
411 | #else /* LCD_PIXELFORMAT == VERTICAL_PACKING, | 411 | #else /* LCD_PIXELFORMAT == VERTICAL_PACKING, |
412 | LCD_PIXELFORMAT == VERTICAL_INTERLEAVED */ | 412 | LCD_PIXELFORMAT == VERTICAL_INTERLEAVED */ |
413 | 413 | ||
414 | /* Scroll up */ | 414 | /* Scroll up */ |
@@ -426,7 +426,7 @@ void xlcd_scroll_up(int count) | |||
426 | rb->lcd_clear_display(); | 426 | rb->lcd_clear_display(); |
427 | return; | 427 | return; |
428 | } | 428 | } |
429 | 429 | ||
430 | #if (LCD_DEPTH == 1) \ | 430 | #if (LCD_DEPTH == 1) \ |
431 | || (LCD_DEPTH == 2) && (LCD_PIXELFORMAT == VERTICAL_INTERLEAVED) | 431 | || (LCD_DEPTH == 2) && (LCD_PIXELFORMAT == VERTICAL_INTERLEAVED) |
432 | blockcount = count >> 3; | 432 | blockcount = count >> 3; |
@@ -554,7 +554,7 @@ void xlcd_scroll_down(int count) | |||
554 | rb->lcd_clear_display(); | 554 | rb->lcd_clear_display(); |
555 | return; | 555 | return; |
556 | } | 556 | } |
557 | 557 | ||
558 | #if (LCD_DEPTH == 1) \ | 558 | #if (LCD_DEPTH == 1) \ |
559 | || (LCD_DEPTH == 2) && (LCD_PIXELFORMAT == VERTICAL_INTERLEAVED) | 559 | || (LCD_DEPTH == 2) && (LCD_PIXELFORMAT == VERTICAL_INTERLEAVED) |
560 | blockcount = count >> 3; | 560 | blockcount = count >> 3; |
@@ -638,7 +638,7 @@ void xlcd_scroll_down(int count) | |||
638 | int x, by; | 638 | int x, by; |
639 | fb_data *addr = lcd_fb + blockcount * LCD_FBWIDTH; | 639 | fb_data *addr = lcd_fb + blockcount * LCD_FBWIDTH; |
640 | unsigned fill, mask; | 640 | unsigned fill, mask; |
641 | 641 | ||
642 | fill = patterns[rb->lcd_get_background() & 3] >> (8 - bitcount); | 642 | fill = patterns[rb->lcd_get_background() & 3] >> (8 - bitcount); |
643 | mask = (0xFFu >> bitcount) << bitcount; | 643 | mask = (0xFFu >> bitcount) << bitcount; |
644 | mask |= mask << 8; | 644 | mask |= mask << 8; |
diff --git a/apps/plugins/lua/rocklib_img.c b/apps/plugins/lua/rocklib_img.c index 887ef984d0..13e5503f75 100644 --- a/apps/plugins/lua/rocklib_img.c +++ b/apps/plugins/lua/rocklib_img.c | |||
@@ -1400,7 +1400,7 @@ RB_WRAP(lcd_setfont) | |||
1400 | static void checkint_arr(lua_State *L, int *val, int narg, int elems) | 1400 | static void checkint_arr(lua_State *L, int *val, int narg, int elems) |
1401 | { | 1401 | { |
1402 | /* fills passed array of integers with lua integers from stack */ | 1402 | /* fills passed array of integers with lua integers from stack */ |
1403 | for (int i = 0; i < elems; i++) | 1403 | for (int i = 0; i < elems; i++) |
1404 | val[i] = luaL_checkint(L, narg + i); | 1404 | val[i] = luaL_checkint(L, narg + i); |
1405 | } | 1405 | } |
1406 | 1406 | ||
@@ -1538,7 +1538,7 @@ RB_WRAP(lcd_bitmap_transparent_part) | |||
1538 | int v[eCNT]; | 1538 | int v[eCNT]; |
1539 | checkint_arr(L, v, 2, eCNT); | 1539 | checkint_arr(L, v, 2, eCNT); |
1540 | 1540 | ||
1541 | RB_SCREENS(L, 9, transparent_bitmap_part, src->data, | 1541 | RB_SCREENS(L, 9, transparent_bitmap_part, src->data, |
1542 | v[src_x], v[src_y], v[stride], v[x], v[y], v[w], v[h]); | 1542 | v[src_x], v[src_y], v[stride], v[x], v[y], v[w], v[h]); |
1543 | return 0; | 1543 | return 0; |
1544 | } | 1544 | } |
diff --git a/apps/screen_access.c b/apps/screen_access.c index 390fb2ad4e..a7b902918c 100644 --- a/apps/screen_access.c +++ b/apps/screen_access.c | |||
@@ -236,7 +236,7 @@ struct screen screens[NB_SCREENS] = | |||
236 | .backdrop_load=&backdrop_load, | 236 | .backdrop_load=&backdrop_load, |
237 | .backdrop_show=&backdrop_show, | 237 | .backdrop_show=&backdrop_show, |
238 | #endif | 238 | #endif |
239 | #if defined(HAVE_LCD_COLOR) | 239 | #if defined(HAVE_LCD_COLOR) |
240 | .gradient_fillrect = lcd_gradient_fillrect, | 240 | .gradient_fillrect = lcd_gradient_fillrect, |
241 | .gradient_fillrect_part = lcd_gradient_fillrect_part, | 241 | .gradient_fillrect_part = lcd_gradient_fillrect_part, |
242 | #endif | 242 | #endif |
diff --git a/apps/screen_access.h b/apps/screen_access.h index 81c7cb2a85..94c0a19670 100644 --- a/apps/screen_access.h +++ b/apps/screen_access.h | |||
@@ -130,7 +130,7 @@ struct screen | |||
130 | bool (*backdrop_load)(const char *filename, char* backdrop_buffer); | 130 | bool (*backdrop_load)(const char *filename, char* backdrop_buffer); |
131 | void (*backdrop_show)(char* backdrop_buffer); | 131 | void (*backdrop_show)(char* backdrop_buffer); |
132 | #endif | 132 | #endif |
133 | #if defined(HAVE_LCD_COLOR) | 133 | #if defined(HAVE_LCD_COLOR) |
134 | void (*gradient_fillrect)(int x, int y, int width, int height, | 134 | void (*gradient_fillrect)(int x, int y, int width, int height, |
135 | unsigned start, unsigned end); | 135 | unsigned start, unsigned end); |
136 | void (*gradient_fillrect_part)(int x, int y, int width, int height, | 136 | void (*gradient_fillrect_part)(int x, int y, int width, int height, |
diff --git a/apps/screens.c b/apps/screens.c index fde99912d5..fa2f9f9927 100644 --- a/apps/screens.c +++ b/apps/screens.c | |||
@@ -367,7 +367,7 @@ static const int id3_headers[]= | |||
367 | { | 367 | { |
368 | LANG_ID3_TITLE, | 368 | LANG_ID3_TITLE, |
369 | LANG_ID3_ARTIST, | 369 | LANG_ID3_ARTIST, |
370 | LANG_ID3_COMPOSER, | 370 | LANG_ID3_COMPOSER, |
371 | LANG_ID3_ALBUM, | 371 | LANG_ID3_ALBUM, |
372 | LANG_ID3_ALBUMARTIST, | 372 | LANG_ID3_ALBUMARTIST, |
373 | LANG_ID3_GROUPING, | 373 | LANG_ID3_GROUPING, |
@@ -766,7 +766,7 @@ int view_runtime(void) | |||
766 | while(1) | 766 | while(1) |
767 | { | 767 | { |
768 | global_status.runtime += ((current_tick - lasttime) / HZ); | 768 | global_status.runtime += ((current_tick - lasttime) / HZ); |
769 | 769 | ||
770 | lasttime = current_tick; | 770 | lasttime = current_tick; |
771 | if (say_runtime) | 771 | if (say_runtime) |
772 | { | 772 | { |
@@ -841,13 +841,13 @@ int calibrate(void) | |||
841 | enum touchscreen_mode old_mode = touchscreen_get_mode(); | 841 | enum touchscreen_mode old_mode = touchscreen_get_mode(); |
842 | struct touchscreen_calibration cal; | 842 | struct touchscreen_calibration cal; |
843 | int i, ret = 0; | 843 | int i, ret = 0; |
844 | 844 | ||
845 | /* hide the statusbar */ | 845 | /* hide the statusbar */ |
846 | viewportmanager_theme_enable(SCREEN_MAIN, false, NULL); | 846 | viewportmanager_theme_enable(SCREEN_MAIN, false, NULL); |
847 | 847 | ||
848 | touchscreen_disable_mapping(); /* set raw mode */ | 848 | touchscreen_disable_mapping(); /* set raw mode */ |
849 | touchscreen_set_mode(TOUCHSCREEN_POINT); | 849 | touchscreen_set_mode(TOUCHSCREEN_POINT); |
850 | 850 | ||
851 | for(i=0; i<3; i++) | 851 | for(i=0; i<3; i++) |
852 | { | 852 | { |
853 | screen->clear_display(); | 853 | screen->clear_display(); |
diff --git a/bootloader/common.c b/bootloader/common.c index 03c1bf9964..295ebdc51b 100644 --- a/bootloader/common.c +++ b/bootloader/common.c | |||
@@ -145,7 +145,7 @@ int load_raw_firmware(unsigned char* buf, char* firmware, int buffer_size) | |||
145 | } | 145 | } |
146 | 146 | ||
147 | len = filesize(fd); | 147 | len = filesize(fd); |
148 | 148 | ||
149 | if (len > buffer_size) | 149 | if (len > buffer_size) |
150 | return EFILE_TOO_BIG; | 150 | return EFILE_TOO_BIG; |
151 | 151 | ||
@@ -180,11 +180,11 @@ void display_logf(void) /* Doesn't return! */ | |||
180 | int touch, prev_y=0; | 180 | int touch, prev_y=0; |
181 | #endif | 181 | #endif |
182 | char buffer[COLUMNS+1]; | 182 | char buffer[COLUMNS+1]; |
183 | 183 | ||
184 | while(1) | 184 | while(1) |
185 | { | 185 | { |
186 | index = logfindex + user_index; | 186 | index = logfindex + user_index; |
187 | 187 | ||
188 | lcd_clear_display(); | 188 | lcd_clear_display(); |
189 | for(i = LINES-1; i>=0; i--) | 189 | for(i = LINES-1; i>=0; i--) |
190 | { | 190 | { |
@@ -195,19 +195,19 @@ void display_logf(void) /* Doesn't return! */ | |||
195 | else | 195 | else |
196 | break; /* done */ | 196 | break; /* done */ |
197 | } | 197 | } |
198 | 198 | ||
199 | memcpy(buffer, logfbuffer[index], COLUMNS); | 199 | memcpy(buffer, logfbuffer[index], COLUMNS); |
200 | 200 | ||
201 | if (logfbuffer[index][MAX_LOGF_ENTRY] == LOGF_TERMINATE_CONTINUE_LINE) | 201 | if (logfbuffer[index][MAX_LOGF_ENTRY] == LOGF_TERMINATE_CONTINUE_LINE) |
202 | buffer[MAX_LOGF_ENTRY-1] = '>'; | 202 | buffer[MAX_LOGF_ENTRY-1] = '>'; |
203 | else if (logfbuffer[index][MAX_LOGF_ENTRY] == LOGF_TERMINATE_MULTI_LINE) | 203 | else if (logfbuffer[index][MAX_LOGF_ENTRY] == LOGF_TERMINATE_MULTI_LINE) |
204 | buffer[MAX_LOGF_ENTRY-1] = '\0'; | 204 | buffer[MAX_LOGF_ENTRY-1] = '\0'; |
205 | 205 | ||
206 | buffer[COLUMNS] = '\0'; | 206 | buffer[COLUMNS] = '\0'; |
207 | 207 | ||
208 | lcd_puts(0, i, buffer); | 208 | lcd_puts(0, i, buffer); |
209 | } | 209 | } |
210 | 210 | ||
211 | button = button_get(false); | 211 | button = button_get(false); |
212 | if(button == SYS_USB_CONNECTED) | 212 | if(button == SYS_USB_CONNECTED) |
213 | usb_acknowledge(SYS_USB_CONNECTED_ACK); | 213 | usb_acknowledge(SYS_USB_CONNECTED_ACK); |
@@ -223,16 +223,16 @@ void display_logf(void) /* Doesn't return! */ | |||
223 | else if(button & BUTTON_TOUCHSCREEN) | 223 | else if(button & BUTTON_TOUCHSCREEN) |
224 | { | 224 | { |
225 | touch = button_get_data(); | 225 | touch = button_get_data(); |
226 | 226 | ||
227 | if(button & BUTTON_REL) | 227 | if(button & BUTTON_REL) |
228 | prev_y = 0; | 228 | prev_y = 0; |
229 | 229 | ||
230 | if(prev_y != 0) | 230 | if(prev_y != 0) |
231 | user_index += (prev_y - (touch & 0xFFFF)) / SYSFONT_HEIGHT; | 231 | user_index += (prev_y - (touch & 0xFFFF)) / SYSFONT_HEIGHT; |
232 | prev_y = touch & 0xFFFF; | 232 | prev_y = touch & 0xFFFF; |
233 | } | 233 | } |
234 | #endif | 234 | #endif |
235 | 235 | ||
236 | lcd_update(); | 236 | lcd_update(); |
237 | sleep(HZ/16); | 237 | sleep(HZ/16); |
238 | } | 238 | } |
diff --git a/firmware/drivers/lcd-16bit-vert.c b/firmware/drivers/lcd-16bit-vert.c index b336e78c78..8631271482 100644 --- a/firmware/drivers/lcd-16bit-vert.c +++ b/firmware/drivers/lcd-16bit-vert.c | |||
@@ -84,19 +84,19 @@ void lcd_hline(int x1, int x2, int y) | |||
84 | x1 = 0; | 84 | x1 = 0; |
85 | if (x2 >= lcd_current_viewport->width) | 85 | if (x2 >= lcd_current_viewport->width) |
86 | x2 = lcd_current_viewport->width-1; | 86 | x2 = lcd_current_viewport->width-1; |
87 | 87 | ||
88 | /* Adjust x1 and y to viewport */ | 88 | /* Adjust x1 and y to viewport */ |
89 | x1 += lcd_current_viewport->x; | 89 | x1 += lcd_current_viewport->x; |
90 | x2 += lcd_current_viewport->x; | 90 | x2 += lcd_current_viewport->x; |
91 | y += lcd_current_viewport->y; | 91 | y += lcd_current_viewport->y; |
92 | 92 | ||
93 | #if defined(HAVE_VIEWPORT_CLIP) | 93 | #if defined(HAVE_VIEWPORT_CLIP) |
94 | /********************* Viewport on screen clipping ********************/ | 94 | /********************* Viewport on screen clipping ********************/ |
95 | /* nothing to draw? */ | 95 | /* nothing to draw? */ |
96 | if (((unsigned)y >= (unsigned) LCD_HEIGHT) || (x1 >= LCD_WIDTH) | 96 | if (((unsigned)y >= (unsigned) LCD_HEIGHT) || (x1 >= LCD_WIDTH) |
97 | || (x2 < 0)) | 97 | || (x2 < 0)) |
98 | return; | 98 | return; |
99 | 99 | ||
100 | /* clipping */ | 100 | /* clipping */ |
101 | if (x1 < 0) | 101 | if (x1 < 0) |
102 | x1 = 0; | 102 | x1 = 0; |
@@ -143,19 +143,19 @@ void lcd_vline(int x, int y1, int y2) | |||
143 | y1 = 0; | 143 | y1 = 0; |
144 | if (y2 >= lcd_current_viewport->height) | 144 | if (y2 >= lcd_current_viewport->height) |
145 | y2 = lcd_current_viewport->height-1; | 145 | y2 = lcd_current_viewport->height-1; |
146 | 146 | ||
147 | /* adjust for viewport */ | 147 | /* adjust for viewport */ |
148 | x += lcd_current_viewport->x; | 148 | x += lcd_current_viewport->x; |
149 | y1 += lcd_current_viewport->y; | 149 | y1 += lcd_current_viewport->y; |
150 | y2 += lcd_current_viewport->y; | 150 | y2 += lcd_current_viewport->y; |
151 | 151 | ||
152 | #if defined(HAVE_VIEWPORT_CLIP) | 152 | #if defined(HAVE_VIEWPORT_CLIP) |
153 | /********************* Viewport on screen clipping ********************/ | 153 | /********************* Viewport on screen clipping ********************/ |
154 | /* nothing to draw? */ | 154 | /* nothing to draw? */ |
155 | if (( (unsigned) x >= (unsigned)LCD_WIDTH) || (y1 >= LCD_HEIGHT) | 155 | if (( (unsigned) x >= (unsigned)LCD_WIDTH) || (y1 >= LCD_HEIGHT) |
156 | || (y2 < 0)) | 156 | || (y2 < 0)) |
157 | return; | 157 | return; |
158 | 158 | ||
159 | /* clipping */ | 159 | /* clipping */ |
160 | if (y1 < 0) | 160 | if (y1 < 0) |
161 | y1 = 0; | 161 | y1 = 0; |
@@ -224,7 +224,7 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y, | |||
224 | if ((width <= 0) || (height <= 0) || (x >= lcd_current_viewport->width) || | 224 | if ((width <= 0) || (height <= 0) || (x >= lcd_current_viewport->width) || |
225 | (y >= lcd_current_viewport->height) || (x + width <= 0) || (y + height <= 0)) | 225 | (y >= lcd_current_viewport->height) || (x + width <= 0) || (y + height <= 0)) |
226 | return; | 226 | return; |
227 | 227 | ||
228 | if (x < 0) | 228 | if (x < 0) |
229 | { | 229 | { |
230 | width += x; | 230 | width += x; |
@@ -237,23 +237,23 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y, | |||
237 | src_y -= y; | 237 | src_y -= y; |
238 | y = 0; | 238 | y = 0; |
239 | } | 239 | } |
240 | 240 | ||
241 | if (x + width > lcd_current_viewport->width) | 241 | if (x + width > lcd_current_viewport->width) |
242 | width = lcd_current_viewport->width - x; | 242 | width = lcd_current_viewport->width - x; |
243 | if (y + height > lcd_current_viewport->height) | 243 | if (y + height > lcd_current_viewport->height) |
244 | height = lcd_current_viewport->height - y; | 244 | height = lcd_current_viewport->height - y; |
245 | 245 | ||
246 | /* adjust for viewport */ | 246 | /* adjust for viewport */ |
247 | x += lcd_current_viewport->x; | 247 | x += lcd_current_viewport->x; |
248 | y += lcd_current_viewport->y; | 248 | y += lcd_current_viewport->y; |
249 | 249 | ||
250 | #if defined(HAVE_VIEWPORT_CLIP) | 250 | #if defined(HAVE_VIEWPORT_CLIP) |
251 | /********************* Viewport on screen clipping ********************/ | 251 | /********************* Viewport on screen clipping ********************/ |
252 | /* nothing to draw? */ | 252 | /* nothing to draw? */ |
253 | if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT) | 253 | if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT) |
254 | || (x + width <= 0) || (y + height <= 0)) | 254 | || (x + width <= 0) || (y + height <= 0)) |
255 | return; | 255 | return; |
256 | 256 | ||
257 | /* clip image in viewport in screen */ | 257 | /* clip image in viewport in screen */ |
258 | if (x < 0) | 258 | if (x < 0) |
259 | { | 259 | { |
@@ -294,13 +294,13 @@ void ICODE_ATTR lcd_bitmap_transparent_part(const fb_data *src, int src_x, | |||
294 | { | 294 | { |
295 | fb_data *dst, *dst_end; | 295 | fb_data *dst, *dst_end; |
296 | int stride_dst; | 296 | int stride_dst; |
297 | 297 | ||
298 | /******************** Image in viewport clipping **********************/ | 298 | /******************** Image in viewport clipping **********************/ |
299 | /* nothing to draw? */ | 299 | /* nothing to draw? */ |
300 | if ((width <= 0) || (height <= 0) || (x >= lcd_current_viewport->width) || | 300 | if ((width <= 0) || (height <= 0) || (x >= lcd_current_viewport->width) || |
301 | (y >= lcd_current_viewport->height) || (x + width <= 0) || (y + height <= 0)) | 301 | (y >= lcd_current_viewport->height) || (x + width <= 0) || (y + height <= 0)) |
302 | return; | 302 | return; |
303 | 303 | ||
304 | if (x < 0) | 304 | if (x < 0) |
305 | { | 305 | { |
306 | width += x; | 306 | width += x; |
@@ -313,23 +313,23 @@ void ICODE_ATTR lcd_bitmap_transparent_part(const fb_data *src, int src_x, | |||
313 | src_y -= y; | 313 | src_y -= y; |
314 | y = 0; | 314 | y = 0; |
315 | } | 315 | } |
316 | 316 | ||
317 | if (x + width > lcd_current_viewport->width) | 317 | if (x + width > lcd_current_viewport->width) |
318 | width = lcd_current_viewport->width - x; | 318 | width = lcd_current_viewport->width - x; |
319 | if (y + height > lcd_current_viewport->height) | 319 | if (y + height > lcd_current_viewport->height) |
320 | height = lcd_current_viewport->height - y; | 320 | height = lcd_current_viewport->height - y; |
321 | 321 | ||
322 | /* adjust for viewport */ | 322 | /* adjust for viewport */ |
323 | x += lcd_current_viewport->x; | 323 | x += lcd_current_viewport->x; |
324 | y += lcd_current_viewport->y; | 324 | y += lcd_current_viewport->y; |
325 | 325 | ||
326 | #if defined(HAVE_VIEWPORT_CLIP) | 326 | #if defined(HAVE_VIEWPORT_CLIP) |
327 | /********************* Viewport on screen clipping ********************/ | 327 | /********************* Viewport on screen clipping ********************/ |
328 | /* nothing to draw? */ | 328 | /* nothing to draw? */ |
329 | if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT) | 329 | if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT) |
330 | || (x + width <= 0) || (y + height <= 0)) | 330 | || (x + width <= 0) || (y + height <= 0)) |
331 | return; | 331 | return; |
332 | 332 | ||
333 | /* clip image in viewport in screen */ | 333 | /* clip image in viewport in screen */ |
334 | if (x < 0) | 334 | if (x < 0) |
335 | { | 335 | { |
diff --git a/firmware/drivers/lcd-16bit.c b/firmware/drivers/lcd-16bit.c index 03c50f8ebf..6a76ba48ab 100644 --- a/firmware/drivers/lcd-16bit.c +++ b/firmware/drivers/lcd-16bit.c | |||
@@ -74,11 +74,11 @@ void lcd_hline(int x1, int x2, int y) | |||
74 | 74 | ||
75 | /******************** In viewport clipping **********************/ | 75 | /******************** In viewport clipping **********************/ |
76 | /* nothing to draw? */ | 76 | /* nothing to draw? */ |
77 | if (((unsigned)y >= (unsigned)lcd_current_viewport->height) || | 77 | if (((unsigned)y >= (unsigned)lcd_current_viewport->height) || |
78 | (x1 >= lcd_current_viewport->width) || | 78 | (x1 >= lcd_current_viewport->width) || |
79 | (x2 < 0)) | 79 | (x2 < 0)) |
80 | return; | 80 | return; |
81 | 81 | ||
82 | if (x1 < 0) | 82 | if (x1 < 0) |
83 | x1 = 0; | 83 | x1 = 0; |
84 | if (x2 >= lcd_current_viewport->width) | 84 | if (x2 >= lcd_current_viewport->width) |
@@ -88,14 +88,14 @@ void lcd_hline(int x1, int x2, int y) | |||
88 | x1 += lcd_current_viewport->x; | 88 | x1 += lcd_current_viewport->x; |
89 | x2 += lcd_current_viewport->x; | 89 | x2 += lcd_current_viewport->x; |
90 | y += lcd_current_viewport->y; | 90 | y += lcd_current_viewport->y; |
91 | 91 | ||
92 | #if defined(HAVE_VIEWPORT_CLIP) | 92 | #if defined(HAVE_VIEWPORT_CLIP) |
93 | /********************* Viewport on screen clipping ********************/ | 93 | /********************* Viewport on screen clipping ********************/ |
94 | /* nothing to draw? */ | 94 | /* nothing to draw? */ |
95 | if (((unsigned)y >= (unsigned) LCD_HEIGHT) || (x1 >= LCD_WIDTH) | 95 | if (((unsigned)y >= (unsigned) LCD_HEIGHT) || (x1 >= LCD_WIDTH) |
96 | || (x2 < 0)) | 96 | || (x2 < 0)) |
97 | return; | 97 | return; |
98 | 98 | ||
99 | /* clipping */ | 99 | /* clipping */ |
100 | if (x1 < 0) | 100 | if (x1 < 0) |
101 | x1 = 0; | 101 | x1 = 0; |
@@ -179,19 +179,19 @@ void lcd_vline(int x, int y1, int y2) | |||
179 | y1 = 0; | 179 | y1 = 0; |
180 | if (y2 >= lcd_current_viewport->height) | 180 | if (y2 >= lcd_current_viewport->height) |
181 | y2 = lcd_current_viewport->height-1; | 181 | y2 = lcd_current_viewport->height-1; |
182 | 182 | ||
183 | /* adjust for viewport */ | 183 | /* adjust for viewport */ |
184 | x += lcd_current_viewport->x; | 184 | x += lcd_current_viewport->x; |
185 | y1 += lcd_current_viewport->y; | 185 | y1 += lcd_current_viewport->y; |
186 | y2 += lcd_current_viewport->y; | 186 | y2 += lcd_current_viewport->y; |
187 | 187 | ||
188 | #if defined(HAVE_VIEWPORT_CLIP) | 188 | #if defined(HAVE_VIEWPORT_CLIP) |
189 | /********************* Viewport on screen clipping ********************/ | 189 | /********************* Viewport on screen clipping ********************/ |
190 | /* nothing to draw? */ | 190 | /* nothing to draw? */ |
191 | if (( (unsigned) x >= (unsigned)LCD_WIDTH) || (y1 >= LCD_HEIGHT) | 191 | if (( (unsigned) x >= (unsigned)LCD_WIDTH) || (y1 >= LCD_HEIGHT) |
192 | || (y2 < 0)) | 192 | || (y2 < 0)) |
193 | return; | 193 | return; |
194 | 194 | ||
195 | /* clipping */ | 195 | /* clipping */ |
196 | if (y1 < 0) | 196 | if (y1 < 0) |
197 | y1 = 0; | 197 | y1 = 0; |
@@ -224,7 +224,7 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y, | |||
224 | if ((width <= 0) || (height <= 0) || (x >= lcd_current_viewport->width) || | 224 | if ((width <= 0) || (height <= 0) || (x >= lcd_current_viewport->width) || |
225 | (y >= lcd_current_viewport->height) || (x + width <= 0) || (y + height <= 0)) | 225 | (y >= lcd_current_viewport->height) || (x + width <= 0) || (y + height <= 0)) |
226 | return; | 226 | return; |
227 | 227 | ||
228 | if (x < 0) | 228 | if (x < 0) |
229 | { | 229 | { |
230 | width += x; | 230 | width += x; |
@@ -237,23 +237,23 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y, | |||
237 | src_y -= y; | 237 | src_y -= y; |
238 | y = 0; | 238 | y = 0; |
239 | } | 239 | } |
240 | 240 | ||
241 | if (x + width > lcd_current_viewport->width) | 241 | if (x + width > lcd_current_viewport->width) |
242 | width = lcd_current_viewport->width - x; | 242 | width = lcd_current_viewport->width - x; |
243 | if (y + height > lcd_current_viewport->height) | 243 | if (y + height > lcd_current_viewport->height) |
244 | height = lcd_current_viewport->height - y; | 244 | height = lcd_current_viewport->height - y; |
245 | 245 | ||
246 | /* adjust for viewport */ | 246 | /* adjust for viewport */ |
247 | x += lcd_current_viewport->x; | 247 | x += lcd_current_viewport->x; |
248 | y += lcd_current_viewport->y; | 248 | y += lcd_current_viewport->y; |
249 | 249 | ||
250 | #if defined(HAVE_VIEWPORT_CLIP) | 250 | #if defined(HAVE_VIEWPORT_CLIP) |
251 | /********************* Viewport on screen clipping ********************/ | 251 | /********************* Viewport on screen clipping ********************/ |
252 | /* nothing to draw? */ | 252 | /* nothing to draw? */ |
253 | if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT) | 253 | if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT) |
254 | || (x + width <= 0) || (y + height <= 0)) | 254 | || (x + width <= 0) || (y + height <= 0)) |
255 | return; | 255 | return; |
256 | 256 | ||
257 | /* clip image in viewport in screen */ | 257 | /* clip image in viewport in screen */ |
258 | if (x < 0) | 258 | if (x < 0) |
259 | { | 259 | { |
@@ -272,7 +272,7 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y, | |||
272 | if (y + height > LCD_HEIGHT) | 272 | if (y + height > LCD_HEIGHT) |
273 | height = LCD_HEIGHT - y; | 273 | height = LCD_HEIGHT - y; |
274 | #endif | 274 | #endif |
275 | 275 | ||
276 | src += stride * src_y + src_x; /* move starting point */ | 276 | src += stride * src_y + src_x; /* move starting point */ |
277 | dst = FBADDR(x, y); | 277 | dst = FBADDR(x, y); |
278 | stride_dst = lcd_current_viewport->buffer->stride; | 278 | stride_dst = lcd_current_viewport->buffer->stride; |
@@ -300,7 +300,7 @@ void ICODE_ATTR lcd_bitmap_transparent_part(const fb_data *src, int src_x, | |||
300 | if ((width <= 0) || (height <= 0) || (x >= lcd_current_viewport->width) || | 300 | if ((width <= 0) || (height <= 0) || (x >= lcd_current_viewport->width) || |
301 | (y >= lcd_current_viewport->height) || (x + width <= 0) || (y + height <= 0)) | 301 | (y >= lcd_current_viewport->height) || (x + width <= 0) || (y + height <= 0)) |
302 | return; | 302 | return; |
303 | 303 | ||
304 | if (x < 0) | 304 | if (x < 0) |
305 | { | 305 | { |
306 | width += x; | 306 | width += x; |
@@ -313,23 +313,23 @@ void ICODE_ATTR lcd_bitmap_transparent_part(const fb_data *src, int src_x, | |||
313 | src_y -= y; | 313 | src_y -= y; |
314 | y = 0; | 314 | y = 0; |
315 | } | 315 | } |
316 | 316 | ||
317 | if (x + width > lcd_current_viewport->width) | 317 | if (x + width > lcd_current_viewport->width) |
318 | width = lcd_current_viewport->width - x; | 318 | width = lcd_current_viewport->width - x; |
319 | if (y + height > lcd_current_viewport->height) | 319 | if (y + height > lcd_current_viewport->height) |
320 | height = lcd_current_viewport->height - y; | 320 | height = lcd_current_viewport->height - y; |
321 | 321 | ||
322 | /* adjust for viewport */ | 322 | /* adjust for viewport */ |
323 | x += lcd_current_viewport->x; | 323 | x += lcd_current_viewport->x; |
324 | y += lcd_current_viewport->y; | 324 | y += lcd_current_viewport->y; |
325 | 325 | ||
326 | #if defined(HAVE_VIEWPORT_CLIP) | 326 | #if defined(HAVE_VIEWPORT_CLIP) |
327 | /********************* Viewport on screen clipping ********************/ | 327 | /********************* Viewport on screen clipping ********************/ |
328 | /* nothing to draw? */ | 328 | /* nothing to draw? */ |
329 | if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT) | 329 | if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT) |
330 | || (x + width <= 0) || (y + height <= 0)) | 330 | || (x + width <= 0) || (y + height <= 0)) |
331 | return; | 331 | return; |
332 | 332 | ||
333 | /* clip image in viewport in screen */ | 333 | /* clip image in viewport in screen */ |
334 | if (x < 0) | 334 | if (x < 0) |
335 | { | 335 | { |
diff --git a/firmware/drivers/lcd-1bit-vert.c b/firmware/drivers/lcd-1bit-vert.c index 57abdb91a6..c86ced9b6c 100644 --- a/firmware/drivers/lcd-1bit-vert.c +++ b/firmware/drivers/lcd-1bit-vert.c | |||
@@ -219,7 +219,7 @@ static void ICODE_ATTR solidinvblock(FBFN(data) *address, unsigned mask, | |||
219 | unsigned bits) | 219 | unsigned bits) |
220 | { | 220 | { |
221 | unsigned data = *(char *)address; | 221 | unsigned data = *(char *)address; |
222 | 222 | ||
223 | bits = ~bits ^ data; | 223 | bits = ~bits ^ data; |
224 | *address = data ^ (bits & mask); | 224 | *address = data ^ (bits & mask); |
225 | } | 225 | } |
@@ -255,7 +255,7 @@ void LCDFN(clear_viewport)(void) | |||
255 | oldmode = CURRENT_VP->drawmode; | 255 | oldmode = CURRENT_VP->drawmode; |
256 | 256 | ||
257 | /* Invert the INVERSEVID bit and set basic mode to SOLID */ | 257 | /* Invert the INVERSEVID bit and set basic mode to SOLID */ |
258 | CURRENT_VP->drawmode = (~CURRENT_VP->drawmode & DRMODE_INVERSEVID) | | 258 | CURRENT_VP->drawmode = (~CURRENT_VP->drawmode & DRMODE_INVERSEVID) | |
259 | DRMODE_SOLID; | 259 | DRMODE_SOLID; |
260 | 260 | ||
261 | LCDFN(fillrect)(0, 0, CURRENT_VP->width, CURRENT_VP->height); | 261 | LCDFN(fillrect)(0, 0, CURRENT_VP->width, CURRENT_VP->height); |
@@ -271,7 +271,7 @@ void LCDFN(clear_viewport)(void) | |||
271 | /* Set a single pixel */ | 271 | /* Set a single pixel */ |
272 | void LCDFN(drawpixel)(int x, int y) | 272 | void LCDFN(drawpixel)(int x, int y) |
273 | { | 273 | { |
274 | if ( ((unsigned)x < (unsigned)CURRENT_VP->width) | 274 | if ( ((unsigned)x < (unsigned)CURRENT_VP->width) |
275 | && ((unsigned)y < (unsigned)CURRENT_VP->height) | 275 | && ((unsigned)y < (unsigned)CURRENT_VP->height) |
276 | #if defined(HAVE_VIEWPORT_CLIP) | 276 | #if defined(HAVE_VIEWPORT_CLIP) |
277 | && ((unsigned)x < (unsigned)LCDM(WIDTH)) | 277 | && ((unsigned)x < (unsigned)LCDM(WIDTH)) |
@@ -385,30 +385,30 @@ void LCDFN(hline)(int x1, int x2, int y) | |||
385 | x1 = x2; | 385 | x1 = x2; |
386 | x2 = x; | 386 | x2 = x; |
387 | } | 387 | } |
388 | 388 | ||
389 | /******************** In viewport clipping **********************/ | 389 | /******************** In viewport clipping **********************/ |
390 | /* nothing to draw? */ | 390 | /* nothing to draw? */ |
391 | if (((unsigned)y >= (unsigned)CURRENT_VP->height) || (x1 >= CURRENT_VP->width) | 391 | if (((unsigned)y >= (unsigned)CURRENT_VP->height) || (x1 >= CURRENT_VP->width) |
392 | || (x2 < 0)) | 392 | || (x2 < 0)) |
393 | return; | 393 | return; |
394 | 394 | ||
395 | if (x1 < 0) | 395 | if (x1 < 0) |
396 | x1 = 0; | 396 | x1 = 0; |
397 | if (x2 >= CURRENT_VP->width) | 397 | if (x2 >= CURRENT_VP->width) |
398 | x2 = CURRENT_VP->width-1; | 398 | x2 = CURRENT_VP->width-1; |
399 | 399 | ||
400 | /* adjust to viewport */ | 400 | /* adjust to viewport */ |
401 | x1 += CURRENT_VP->x; | 401 | x1 += CURRENT_VP->x; |
402 | x2 += CURRENT_VP->x; | 402 | x2 += CURRENT_VP->x; |
403 | y += CURRENT_VP->y; | 403 | y += CURRENT_VP->y; |
404 | 404 | ||
405 | #if defined(HAVE_VIEWPORT_CLIP) | 405 | #if defined(HAVE_VIEWPORT_CLIP) |
406 | /********************* Viewport on screen clipping ********************/ | 406 | /********************* Viewport on screen clipping ********************/ |
407 | /* nothing to draw? */ | 407 | /* nothing to draw? */ |
408 | if (((unsigned)y >= (unsigned) LCDM(HEIGHT)) || (x1 >= LCDM(WIDTH)) | 408 | if (((unsigned)y >= (unsigned) LCDM(HEIGHT)) || (x1 >= LCDM(WIDTH)) |
409 | || (x2 < 0)) | 409 | || (x2 < 0)) |
410 | return; | 410 | return; |
411 | 411 | ||
412 | /* clipping */ | 412 | /* clipping */ |
413 | if (x1 < 0) | 413 | if (x1 < 0) |
414 | x1 = 0; | 414 | x1 = 0; |
@@ -449,25 +449,25 @@ void LCDFN(vline)(int x, int y1, int y2) | |||
449 | /* nothing to draw? */ | 449 | /* nothing to draw? */ |
450 | if (((unsigned)x >= (unsigned)CURRENT_VP->width) || (y1 >= CURRENT_VP->height) | 450 | if (((unsigned)x >= (unsigned)CURRENT_VP->width) || (y1 >= CURRENT_VP->height) |
451 | || (y2 < 0)) | 451 | || (y2 < 0)) |
452 | return; | 452 | return; |
453 | 453 | ||
454 | if (y1 < 0) | 454 | if (y1 < 0) |
455 | y1 = 0; | 455 | y1 = 0; |
456 | if (y2 >= CURRENT_VP->height) | 456 | if (y2 >= CURRENT_VP->height) |
457 | y2 = CURRENT_VP->height-1; | 457 | y2 = CURRENT_VP->height-1; |
458 | 458 | ||
459 | /* adjust for viewport */ | 459 | /* adjust for viewport */ |
460 | y1 += CURRENT_VP->y; | 460 | y1 += CURRENT_VP->y; |
461 | y2 += CURRENT_VP->y; | 461 | y2 += CURRENT_VP->y; |
462 | x += CURRENT_VP->x; | 462 | x += CURRENT_VP->x; |
463 | 463 | ||
464 | #if defined(HAVE_VIEWPORT_CLIP) | 464 | #if defined(HAVE_VIEWPORT_CLIP) |
465 | /********************* Viewport on screen clipping ********************/ | 465 | /********************* Viewport on screen clipping ********************/ |
466 | /* nothing to draw? */ | 466 | /* nothing to draw? */ |
467 | if (( (unsigned) x >= (unsigned)LCDM(WIDTH)) || (y1 >= LCDM(HEIGHT)) | 467 | if (( (unsigned) x >= (unsigned)LCDM(WIDTH)) || (y1 >= LCDM(HEIGHT)) |
468 | || (y2 < 0)) | 468 | || (y2 < 0)) |
469 | return; | 469 | return; |
470 | 470 | ||
471 | /* clipping */ | 471 | /* clipping */ |
472 | if (y1 < 0) | 472 | if (y1 < 0) |
473 | y1 = 0; | 473 | y1 = 0; |
@@ -538,18 +538,18 @@ void LCDFN(fillrect)(int x, int y, int width, int height) | |||
538 | width = CURRENT_VP->width - x; | 538 | width = CURRENT_VP->width - x; |
539 | if (y + height > CURRENT_VP->height) | 539 | if (y + height > CURRENT_VP->height) |
540 | height = CURRENT_VP->height - y; | 540 | height = CURRENT_VP->height - y; |
541 | 541 | ||
542 | /* adjust for viewport */ | 542 | /* adjust for viewport */ |
543 | x += CURRENT_VP->x; | 543 | x += CURRENT_VP->x; |
544 | y += CURRENT_VP->y; | 544 | y += CURRENT_VP->y; |
545 | 545 | ||
546 | #if defined(HAVE_VIEWPORT_CLIP) | 546 | #if defined(HAVE_VIEWPORT_CLIP) |
547 | /********************* Viewport on screen clipping ********************/ | 547 | /********************* Viewport on screen clipping ********************/ |
548 | /* nothing to draw? */ | 548 | /* nothing to draw? */ |
549 | if ((x >= LCDM(WIDTH)) || (y >= LCDM(HEIGHT)) | 549 | if ((x >= LCDM(WIDTH)) || (y >= LCDM(HEIGHT)) |
550 | || (x + width <= 0) || (y + height <= 0)) | 550 | || (x + width <= 0) || (y + height <= 0)) |
551 | return; | 551 | return; |
552 | 552 | ||
553 | /* clip image in viewport in screen */ | 553 | /* clip image in viewport in screen */ |
554 | if (x < 0) | 554 | if (x < 0) |
555 | { | 555 | { |
@@ -646,7 +646,7 @@ void ICODE_ATTR LCDFN(bitmap_part)(const unsigned char *src, int src_x, | |||
646 | if ((width <= 0) || (height <= 0) || (x >= CURRENT_VP->width) | 646 | if ((width <= 0) || (height <= 0) || (x >= CURRENT_VP->width) |
647 | || (y >= CURRENT_VP->height) || (x + width <= 0) || (y + height <= 0)) | 647 | || (y >= CURRENT_VP->height) || (x + width <= 0) || (y + height <= 0)) |
648 | return; | 648 | return; |
649 | 649 | ||
650 | /* clip image in viewport */ | 650 | /* clip image in viewport */ |
651 | if (x < 0) | 651 | if (x < 0) |
652 | { | 652 | { |
@@ -668,14 +668,14 @@ void ICODE_ATTR LCDFN(bitmap_part)(const unsigned char *src, int src_x, | |||
668 | /* adjust for viewport */ | 668 | /* adjust for viewport */ |
669 | x += CURRENT_VP->x; | 669 | x += CURRENT_VP->x; |
670 | y += CURRENT_VP->y; | 670 | y += CURRENT_VP->y; |
671 | 671 | ||
672 | #if defined(HAVE_VIEWPORT_CLIP) | 672 | #if defined(HAVE_VIEWPORT_CLIP) |
673 | /********************* Viewport on screen clipping ********************/ | 673 | /********************* Viewport on screen clipping ********************/ |
674 | /* nothing to draw? */ | 674 | /* nothing to draw? */ |
675 | if ((x >= LCDM(WIDTH)) || (y >= LCDM(HEIGHT)) | 675 | if ((x >= LCDM(WIDTH)) || (y >= LCDM(HEIGHT)) |
676 | || (x + width <= 0) || (y + height <= 0)) | 676 | || (x + width <= 0) || (y + height <= 0)) |
677 | return; | 677 | return; |
678 | 678 | ||
679 | /* clip image in viewport in screen */ | 679 | /* clip image in viewport in screen */ |
680 | if (x < 0) | 680 | if (x < 0) |
681 | { | 681 | { |
@@ -706,7 +706,7 @@ void ICODE_ATTR LCDFN(bitmap_part)(const unsigned char *src, int src_x, | |||
706 | bfunc = LCDFN(blockfuncs)[CURRENT_VP->drawmode]; | 706 | bfunc = LCDFN(blockfuncs)[CURRENT_VP->drawmode]; |
707 | mask = 0xFFu << (shift + src_y); | 707 | mask = 0xFFu << (shift + src_y); |
708 | mask_bottom = 0xFFu >> (~ny & 7); | 708 | mask_bottom = 0xFFu >> (~ny & 7); |
709 | 709 | ||
710 | if (shift == 0) | 710 | if (shift == 0) |
711 | { | 711 | { |
712 | bool copyopt = (CURRENT_VP->drawmode == DRMODE_SOLID); | 712 | bool copyopt = (CURRENT_VP->drawmode == DRMODE_SOLID); |
@@ -719,9 +719,9 @@ void ICODE_ATTR LCDFN(bitmap_part)(const unsigned char *src, int src_x, | |||
719 | { | 719 | { |
720 | const unsigned char *src_row = src; | 720 | const unsigned char *src_row = src; |
721 | FBFN(data) *dst_row = dst; | 721 | FBFN(data) *dst_row = dst; |
722 | 722 | ||
723 | dst_end = dst_row + width; | 723 | dst_end = dst_row + width; |
724 | do | 724 | do |
725 | bfunc(dst_row++, mask, *src_row++); | 725 | bfunc(dst_row++, mask, *src_row++); |
726 | while (dst_row < dst_end); | 726 | while (dst_row < dst_end); |
727 | } | 727 | } |
@@ -751,7 +751,7 @@ void ICODE_ATTR LCDFN(bitmap_part)(const unsigned char *src, int src_x, | |||
751 | FBFN(data) *dst_col = dst++; | 751 | FBFN(data) *dst_col = dst++; |
752 | unsigned mask_col = mask; | 752 | unsigned mask_col = mask; |
753 | unsigned data = 0; | 753 | unsigned data = 0; |
754 | 754 | ||
755 | for (y = ny; y >= 8; y -= 8) | 755 | for (y = ny; y >= 8; y -= 8) |
756 | { | 756 | { |
757 | data |= *src_col << shift; | 757 | data |= *src_col << shift; |
diff --git a/firmware/drivers/lcd-24bit.c b/firmware/drivers/lcd-24bit.c index 65fa01f37f..5ee290efe3 100644 --- a/firmware/drivers/lcd-24bit.c +++ b/firmware/drivers/lcd-24bit.c | |||
@@ -869,11 +869,11 @@ void lcd_hline(int x1, int x2, int y) | |||
869 | 869 | ||
870 | /******************** In viewport clipping **********************/ | 870 | /******************** In viewport clipping **********************/ |
871 | /* nothing to draw? */ | 871 | /* nothing to draw? */ |
872 | if (((unsigned)y >= (unsigned)lcd_current_viewport->height) || | 872 | if (((unsigned)y >= (unsigned)lcd_current_viewport->height) || |
873 | (x1 >= lcd_current_viewport->width) || | 873 | (x1 >= lcd_current_viewport->width) || |
874 | (x2 < 0)) | 874 | (x2 < 0)) |
875 | return; | 875 | return; |
876 | 876 | ||
877 | if (x1 < 0) | 877 | if (x1 < 0) |
878 | x1 = 0; | 878 | x1 = 0; |
879 | if (x2 >= lcd_current_viewport->width) | 879 | if (x2 >= lcd_current_viewport->width) |
@@ -883,14 +883,14 @@ void lcd_hline(int x1, int x2, int y) | |||
883 | x1 += lcd_current_viewport->x; | 883 | x1 += lcd_current_viewport->x; |
884 | x2 += lcd_current_viewport->x; | 884 | x2 += lcd_current_viewport->x; |
885 | y += lcd_current_viewport->y; | 885 | y += lcd_current_viewport->y; |
886 | 886 | ||
887 | #if defined(HAVE_VIEWPORT_CLIP) | 887 | #if defined(HAVE_VIEWPORT_CLIP) |
888 | /********************* Viewport on screen clipping ********************/ | 888 | /********************* Viewport on screen clipping ********************/ |
889 | /* nothing to draw? */ | 889 | /* nothing to draw? */ |
890 | if (((unsigned)y >= (unsigned) LCD_HEIGHT) || (x1 >= LCD_WIDTH) | 890 | if (((unsigned)y >= (unsigned) LCD_HEIGHT) || (x1 >= LCD_WIDTH) |
891 | || (x2 < 0)) | 891 | || (x2 < 0)) |
892 | return; | 892 | return; |
893 | 893 | ||
894 | /* clipping */ | 894 | /* clipping */ |
895 | if (x1 < 0) | 895 | if (x1 < 0) |
896 | x1 = 0; | 896 | x1 = 0; |
@@ -935,19 +935,19 @@ void lcd_vline(int x, int y1, int y2) | |||
935 | y1 = 0; | 935 | y1 = 0; |
936 | if (y2 >= lcd_current_viewport->height) | 936 | if (y2 >= lcd_current_viewport->height) |
937 | y2 = lcd_current_viewport->height-1; | 937 | y2 = lcd_current_viewport->height-1; |
938 | 938 | ||
939 | /* adjust for viewport */ | 939 | /* adjust for viewport */ |
940 | x += lcd_current_viewport->x; | 940 | x += lcd_current_viewport->x; |
941 | y1 += lcd_current_viewport->y; | 941 | y1 += lcd_current_viewport->y; |
942 | y2 += lcd_current_viewport->y; | 942 | y2 += lcd_current_viewport->y; |
943 | 943 | ||
944 | #if defined(HAVE_VIEWPORT_CLIP) | 944 | #if defined(HAVE_VIEWPORT_CLIP) |
945 | /********************* Viewport on screen clipping ********************/ | 945 | /********************* Viewport on screen clipping ********************/ |
946 | /* nothing to draw? */ | 946 | /* nothing to draw? */ |
947 | if (( (unsigned) x >= (unsigned)LCD_WIDTH) || (y1 >= LCD_HEIGHT) | 947 | if (( (unsigned) x >= (unsigned)LCD_WIDTH) || (y1 >= LCD_HEIGHT) |
948 | || (y2 < 0)) | 948 | || (y2 < 0)) |
949 | return; | 949 | return; |
950 | 950 | ||
951 | /* clipping */ | 951 | /* clipping */ |
952 | if (y1 < 0) | 952 | if (y1 < 0) |
953 | y1 = 0; | 953 | y1 = 0; |
@@ -978,7 +978,7 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y, | |||
978 | if ((width <= 0) || (height <= 0) || (x >= lcd_current_viewport->width) || | 978 | if ((width <= 0) || (height <= 0) || (x >= lcd_current_viewport->width) || |
979 | (y >= lcd_current_viewport->height) || (x + width <= 0) || (y + height <= 0)) | 979 | (y >= lcd_current_viewport->height) || (x + width <= 0) || (y + height <= 0)) |
980 | return; | 980 | return; |
981 | 981 | ||
982 | if (x < 0) | 982 | if (x < 0) |
983 | { | 983 | { |
984 | width += x; | 984 | width += x; |
@@ -991,23 +991,23 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y, | |||
991 | src_y -= y; | 991 | src_y -= y; |
992 | y = 0; | 992 | y = 0; |
993 | } | 993 | } |
994 | 994 | ||
995 | if (x + width > lcd_current_viewport->width) | 995 | if (x + width > lcd_current_viewport->width) |
996 | width = lcd_current_viewport->width - x; | 996 | width = lcd_current_viewport->width - x; |
997 | if (y + height > lcd_current_viewport->height) | 997 | if (y + height > lcd_current_viewport->height) |
998 | height = lcd_current_viewport->height - y; | 998 | height = lcd_current_viewport->height - y; |
999 | 999 | ||
1000 | /* adjust for viewport */ | 1000 | /* adjust for viewport */ |
1001 | x += lcd_current_viewport->x; | 1001 | x += lcd_current_viewport->x; |
1002 | y += lcd_current_viewport->y; | 1002 | y += lcd_current_viewport->y; |
1003 | 1003 | ||
1004 | #if defined(HAVE_VIEWPORT_CLIP) | 1004 | #if defined(HAVE_VIEWPORT_CLIP) |
1005 | /********************* Viewport on screen clipping ********************/ | 1005 | /********************* Viewport on screen clipping ********************/ |
1006 | /* nothing to draw? */ | 1006 | /* nothing to draw? */ |
1007 | if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT) | 1007 | if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT) |
1008 | || (x + width <= 0) || (y + height <= 0)) | 1008 | || (x + width <= 0) || (y + height <= 0)) |
1009 | return; | 1009 | return; |
1010 | 1010 | ||
1011 | /* clip image in viewport in screen */ | 1011 | /* clip image in viewport in screen */ |
1012 | if (x < 0) | 1012 | if (x < 0) |
1013 | { | 1013 | { |
@@ -1026,7 +1026,7 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y, | |||
1026 | if (y + height > LCD_HEIGHT) | 1026 | if (y + height > LCD_HEIGHT) |
1027 | height = LCD_HEIGHT - y; | 1027 | height = LCD_HEIGHT - y; |
1028 | #endif | 1028 | #endif |
1029 | 1029 | ||
1030 | src += stride * src_y + src_x; /* move starting point */ | 1030 | src += stride * src_y + src_x; /* move starting point */ |
1031 | dst = FBADDR(x, y); | 1031 | dst = FBADDR(x, y); |
1032 | 1032 | ||
@@ -1052,7 +1052,7 @@ void ICODE_ATTR lcd_bitmap_transparent_part(const fb_data *src, int src_x, | |||
1052 | if ((width <= 0) || (height <= 0) || (x >= lcd_current_viewport->width) || | 1052 | if ((width <= 0) || (height <= 0) || (x >= lcd_current_viewport->width) || |
1053 | (y >= lcd_current_viewport->height) || (x + width <= 0) || (y + height <= 0)) | 1053 | (y >= lcd_current_viewport->height) || (x + width <= 0) || (y + height <= 0)) |
1054 | return; | 1054 | return; |
1055 | 1055 | ||
1056 | if (x < 0) | 1056 | if (x < 0) |
1057 | { | 1057 | { |
1058 | width += x; | 1058 | width += x; |
@@ -1065,23 +1065,23 @@ void ICODE_ATTR lcd_bitmap_transparent_part(const fb_data *src, int src_x, | |||
1065 | src_y -= y; | 1065 | src_y -= y; |
1066 | y = 0; | 1066 | y = 0; |
1067 | } | 1067 | } |
1068 | 1068 | ||
1069 | if (x + width > lcd_current_viewport->width) | 1069 | if (x + width > lcd_current_viewport->width) |
1070 | width = lcd_current_viewport->width - x; | 1070 | width = lcd_current_viewport->width - x; |
1071 | if (y + height > lcd_current_viewport->height) | 1071 | if (y + height > lcd_current_viewport->height) |
1072 | height = lcd_current_viewport->height - y; | 1072 | height = lcd_current_viewport->height - y; |
1073 | 1073 | ||
1074 | /* adjust for viewport */ | 1074 | /* adjust for viewport */ |
1075 | x += lcd_current_viewport->x; | 1075 | x += lcd_current_viewport->x; |
1076 | y += lcd_current_viewport->y; | 1076 | y += lcd_current_viewport->y; |
1077 | 1077 | ||
1078 | #if defined(HAVE_VIEWPORT_CLIP) | 1078 | #if defined(HAVE_VIEWPORT_CLIP) |
1079 | /********************* Viewport on screen clipping ********************/ | 1079 | /********************* Viewport on screen clipping ********************/ |
1080 | /* nothing to draw? */ | 1080 | /* nothing to draw? */ |
1081 | if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT) | 1081 | if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT) |
1082 | || (x + width <= 0) || (y + height <= 0)) | 1082 | || (x + width <= 0) || (y + height <= 0)) |
1083 | return; | 1083 | return; |
1084 | 1084 | ||
1085 | /* clip image in viewport in screen */ | 1085 | /* clip image in viewport in screen */ |
1086 | if (x < 0) | 1086 | if (x < 0) |
1087 | { | 1087 | { |
diff --git a/firmware/drivers/lcd-2bit-horz.c b/firmware/drivers/lcd-2bit-horz.c index 35a2be5b2c..b2114ba830 100644 --- a/firmware/drivers/lcd-2bit-horz.c +++ b/firmware/drivers/lcd-2bit-horz.c | |||
@@ -8,7 +8,7 @@ | |||
8 | * $Id$ | 8 | * $Id$ |
9 | * | 9 | * |
10 | * LCD driver for horizontally-packed 2bpp greyscale display | 10 | * LCD driver for horizontally-packed 2bpp greyscale display |
11 | * | 11 | * |
12 | * Based on code from the rockbox lcd's driver | 12 | * Based on code from the rockbox lcd's driver |
13 | * | 13 | * |
14 | * Copyright (c) 2006 Seven Le Mesle (sevlm@free.fr) | 14 | * Copyright (c) 2006 Seven Le Mesle (sevlm@free.fr) |
@@ -199,7 +199,7 @@ static void flippixel(int x, int y) | |||
199 | { | 199 | { |
200 | unsigned mask = pixmask[x & 3]; | 200 | unsigned mask = pixmask[x & 3]; |
201 | fb_data *address = FBADDR(x>>2,y); | 201 | fb_data *address = FBADDR(x>>2,y); |
202 | 202 | ||
203 | *address ^= mask; | 203 | *address ^= mask; |
204 | } | 204 | } |
205 | 205 | ||
@@ -362,7 +362,7 @@ fb_data* lcd_get_backdrop(void) | |||
362 | static inline void setblock(fb_data *address, unsigned mask, unsigned bits) | 362 | static inline void setblock(fb_data *address, unsigned mask, unsigned bits) |
363 | { | 363 | { |
364 | unsigned data = *address; | 364 | unsigned data = *address; |
365 | 365 | ||
366 | bits ^= data; | 366 | bits ^= data; |
367 | *address = data ^ (bits & mask); | 367 | *address = data ^ (bits & mask); |
368 | } | 368 | } |
@@ -402,7 +402,7 @@ void lcd_clear_viewport(void) | |||
402 | lastmode = lcd_current_viewport->drawmode; | 402 | lastmode = lcd_current_viewport->drawmode; |
403 | 403 | ||
404 | /* Invert the INVERSEVID bit and set basic mode to SOLID */ | 404 | /* Invert the INVERSEVID bit and set basic mode to SOLID */ |
405 | lcd_current_viewport->drawmode = (~lastmode & DRMODE_INVERSEVID) | | 405 | lcd_current_viewport->drawmode = (~lastmode & DRMODE_INVERSEVID) | |
406 | DRMODE_SOLID; | 406 | DRMODE_SOLID; |
407 | 407 | ||
408 | lcd_fillrect(0, 0, lcd_current_viewport->width, lcd_current_viewport->height); | 408 | lcd_fillrect(0, 0, lcd_current_viewport->width, lcd_current_viewport->height); |
@@ -492,7 +492,7 @@ void lcd_drawline(int x1, int y1, int x2, int y2) | |||
492 | 492 | ||
493 | for (i = 0; i < numpixels; i++) | 493 | for (i = 0; i < numpixels; i++) |
494 | { | 494 | { |
495 | if ( ((unsigned)x < (unsigned)lcd_current_viewport->width) | 495 | if ( ((unsigned)x < (unsigned)lcd_current_viewport->width) |
496 | && ((unsigned)y < (unsigned)lcd_current_viewport->height) | 496 | && ((unsigned)y < (unsigned)lcd_current_viewport->height) |
497 | #if defined(HAVE_VIEWPORT_CLIP) | 497 | #if defined(HAVE_VIEWPORT_CLIP) |
498 | && ((unsigned)x < (unsigned)LCD_WIDTH) | 498 | && ((unsigned)x < (unsigned)LCD_WIDTH) |
@@ -531,13 +531,13 @@ void lcd_hline(int x1, int x2, int y) | |||
531 | x1 = x2; | 531 | x1 = x2; |
532 | x2 = nx; | 532 | x2 = nx; |
533 | } | 533 | } |
534 | 534 | ||
535 | /******************** In viewport clipping **********************/ | 535 | /******************** In viewport clipping **********************/ |
536 | /* nothing to draw? */ | 536 | /* nothing to draw? */ |
537 | if (((unsigned)y >= (unsigned)lcd_current_viewport->height) || (x1 >= lcd_current_viewport->width) | 537 | if (((unsigned)y >= (unsigned)lcd_current_viewport->height) || (x1 >= lcd_current_viewport->width) |
538 | || (x2 < 0)) | 538 | || (x2 < 0)) |
539 | return; | 539 | return; |
540 | 540 | ||
541 | if (x1 < 0) | 541 | if (x1 < 0) |
542 | x1 = 0; | 542 | x1 = 0; |
543 | if (x2 >= lcd_current_viewport->width) | 543 | if (x2 >= lcd_current_viewport->width) |
@@ -547,14 +547,14 @@ void lcd_hline(int x1, int x2, int y) | |||
547 | x1 += lcd_current_viewport->x; | 547 | x1 += lcd_current_viewport->x; |
548 | x2 += lcd_current_viewport->x; | 548 | x2 += lcd_current_viewport->x; |
549 | y += lcd_current_viewport->y; | 549 | y += lcd_current_viewport->y; |
550 | 550 | ||
551 | #if defined(HAVE_VIEWPORT_CLIP) | 551 | #if defined(HAVE_VIEWPORT_CLIP) |
552 | /********************* Viewport on screen clipping ********************/ | 552 | /********************* Viewport on screen clipping ********************/ |
553 | /* nothing to draw? */ | 553 | /* nothing to draw? */ |
554 | if (((unsigned)y >= (unsigned) LCD_HEIGHT) || (x1 >= LCD_WIDTH) | 554 | if (((unsigned)y >= (unsigned) LCD_HEIGHT) || (x1 >= LCD_WIDTH) |
555 | || (x2 < 0)) | 555 | || (x2 < 0)) |
556 | return; | 556 | return; |
557 | 557 | ||
558 | /* clipping */ | 558 | /* clipping */ |
559 | if (x1 < 0) | 559 | if (x1 < 0) |
560 | x1 = 0; | 560 | x1 = 0; |
@@ -567,7 +567,7 @@ void lcd_hline(int x1, int x2, int y) | |||
567 | nx = x2 - (x1 & ~3); | 567 | nx = x2 - (x1 & ~3); |
568 | mask = 0xFFu >> (2 * (x1 & 3)); | 568 | mask = 0xFFu >> (2 * (x1 & 3)); |
569 | mask_right = 0xFFu << (2 * (~nx & 3)); | 569 | mask_right = 0xFFu << (2 * (~nx & 3)); |
570 | 570 | ||
571 | for (; nx >= 4; nx -= 4) | 571 | for (; nx >= 4; nx -= 4) |
572 | { | 572 | { |
573 | bfunc(dst++, mask, 0xFFu); | 573 | bfunc(dst++, mask, 0xFFu); |
@@ -598,8 +598,8 @@ void lcd_vline(int x, int y1, int y2) | |||
598 | /* nothing to draw? */ | 598 | /* nothing to draw? */ |
599 | if (((unsigned)x >= (unsigned)lcd_current_viewport->width) || (y1 >= lcd_current_viewport->height) | 599 | if (((unsigned)x >= (unsigned)lcd_current_viewport->width) || (y1 >= lcd_current_viewport->height) |
600 | || (y2 < 0)) | 600 | || (y2 < 0)) |
601 | return; | 601 | return; |
602 | 602 | ||
603 | if (y1 < 0) | 603 | if (y1 < 0) |
604 | y1 = 0; | 604 | y1 = 0; |
605 | if (y2 >= lcd_current_viewport->height) | 605 | if (y2 >= lcd_current_viewport->height) |
@@ -609,26 +609,26 @@ void lcd_vline(int x, int y1, int y2) | |||
609 | y1 += lcd_current_viewport->y; | 609 | y1 += lcd_current_viewport->y; |
610 | y2 += lcd_current_viewport->y; | 610 | y2 += lcd_current_viewport->y; |
611 | x += lcd_current_viewport->x; | 611 | x += lcd_current_viewport->x; |
612 | 612 | ||
613 | #if defined(HAVE_VIEWPORT_CLIP) | 613 | #if defined(HAVE_VIEWPORT_CLIP) |
614 | /********************* Viewport on screen clipping ********************/ | 614 | /********************* Viewport on screen clipping ********************/ |
615 | /* nothing to draw? */ | 615 | /* nothing to draw? */ |
616 | if (( (unsigned) x >= (unsigned)LCD_WIDTH) || (y1 >= LCD_HEIGHT) | 616 | if (( (unsigned) x >= (unsigned)LCD_WIDTH) || (y1 >= LCD_HEIGHT) |
617 | || (y2 < 0)) | 617 | || (y2 < 0)) |
618 | return; | 618 | return; |
619 | 619 | ||
620 | /* clipping */ | 620 | /* clipping */ |
621 | if (y1 < 0) | 621 | if (y1 < 0) |
622 | y1 = 0; | 622 | y1 = 0; |
623 | if (y2 >= LCD_HEIGHT) | 623 | if (y2 >= LCD_HEIGHT) |
624 | y2 = LCD_HEIGHT-1; | 624 | y2 = LCD_HEIGHT-1; |
625 | #endif | 625 | #endif |
626 | 626 | ||
627 | bfunc = lcd_blockfuncs[lcd_current_viewport->drawmode]; | 627 | bfunc = lcd_blockfuncs[lcd_current_viewport->drawmode]; |
628 | dst = FBADDR(x>>2,y1); | 628 | dst = FBADDR(x>>2,y1); |
629 | stride_dst = LCD_FBSTRIDE(lcd_current_viewport->buffer->stride, 0); | 629 | stride_dst = LCD_FBSTRIDE(lcd_current_viewport->buffer->stride, 0); |
630 | mask = pixmask[x & 3]; | 630 | mask = pixmask[x & 3]; |
631 | 631 | ||
632 | dst_end = dst + (y2 - y1) * stride_dst; | 632 | dst_end = dst + (y2 - y1) * stride_dst; |
633 | do | 633 | do |
634 | { | 634 | { |
@@ -686,14 +686,14 @@ void lcd_fillrect(int x, int y, int width, int height) | |||
686 | /* adjust for viewport */ | 686 | /* adjust for viewport */ |
687 | x += lcd_current_viewport->x; | 687 | x += lcd_current_viewport->x; |
688 | y += lcd_current_viewport->y; | 688 | y += lcd_current_viewport->y; |
689 | 689 | ||
690 | #if defined(HAVE_VIEWPORT_CLIP) | 690 | #if defined(HAVE_VIEWPORT_CLIP) |
691 | /********************* Viewport on screen clipping ********************/ | 691 | /********************* Viewport on screen clipping ********************/ |
692 | /* nothing to draw? */ | 692 | /* nothing to draw? */ |
693 | if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT) | 693 | if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT) |
694 | || (x + width <= 0) || (y + height <= 0)) | 694 | || (x + width <= 0) || (y + height <= 0)) |
695 | return; | 695 | return; |
696 | 696 | ||
697 | /* clip image in viewport in screen */ | 697 | /* clip image in viewport in screen */ |
698 | if (x < 0) | 698 | if (x < 0) |
699 | { | 699 | { |
@@ -717,7 +717,7 @@ void lcd_fillrect(int x, int y, int width, int height) | |||
717 | nx = width - 1 + (x & 3); | 717 | nx = width - 1 + (x & 3); |
718 | mask = 0xFFu >> (2 * (x & 3)); | 718 | mask = 0xFFu >> (2 * (x & 3)); |
719 | mask_right = 0xFFu << (2 * (~nx & 3)); | 719 | mask_right = 0xFFu << (2 * (~nx & 3)); |
720 | 720 | ||
721 | for (; nx >= 4; nx -= 4) | 721 | for (; nx >= 4; nx -= 4) |
722 | { | 722 | { |
723 | unsigned char *dst_col = dst; | 723 | unsigned char *dst_col = dst; |
@@ -770,7 +770,7 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x, | |||
770 | if ((width <= 0) || (height <= 0) || (x >= lcd_current_viewport->width) || | 770 | if ((width <= 0) || (height <= 0) || (x >= lcd_current_viewport->width) || |
771 | (y >= lcd_current_viewport->height) || (x + width <= 0) || (y + height <= 0)) | 771 | (y >= lcd_current_viewport->height) || (x + width <= 0) || (y + height <= 0)) |
772 | return; | 772 | return; |
773 | 773 | ||
774 | if (x < 0) | 774 | if (x < 0) |
775 | { | 775 | { |
776 | width += x; | 776 | width += x; |
@@ -787,17 +787,17 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x, | |||
787 | width = lcd_current_viewport->width - x; | 787 | width = lcd_current_viewport->width - x; |
788 | if (y + height > lcd_current_viewport->height) | 788 | if (y + height > lcd_current_viewport->height) |
789 | height = lcd_current_viewport->height - y; | 789 | height = lcd_current_viewport->height - y; |
790 | 790 | ||
791 | x += lcd_current_viewport->x; /* adjust for viewport */ | 791 | x += lcd_current_viewport->x; /* adjust for viewport */ |
792 | y += lcd_current_viewport->y; /* adjust for viewport */ | 792 | y += lcd_current_viewport->y; /* adjust for viewport */ |
793 | 793 | ||
794 | #if defined(HAVE_VIEWPORT_CLIP) | 794 | #if defined(HAVE_VIEWPORT_CLIP) |
795 | /********************* Viewport on screen clipping ********************/ | 795 | /********************* Viewport on screen clipping ********************/ |
796 | /* nothing to draw? */ | 796 | /* nothing to draw? */ |
797 | if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT) | 797 | if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT) |
798 | || (x + width <= 0) || (y + height <= 0)) | 798 | || (x + width <= 0) || (y + height <= 0)) |
799 | return; | 799 | return; |
800 | 800 | ||
801 | /* clip image in viewport in screen */ | 801 | /* clip image in viewport in screen */ |
802 | if (x < 0) | 802 | if (x < 0) |
803 | { | 803 | { |
@@ -820,7 +820,7 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x, | |||
820 | src += stride * (src_y >> 3) + src_x; /* move starting point */ | 820 | src += stride * (src_y >> 3) + src_x; /* move starting point */ |
821 | src_y &= 7; | 821 | src_y &= 7; |
822 | src_end = src + width; | 822 | src_end = src + width; |
823 | 823 | ||
824 | dst = FBADDR(x >> 2,y); | 824 | dst = FBADDR(x >> 2,y); |
825 | stride_dst = LCD_FBSTRIDE(lcd_current_viewport->buffer->stride, 0); | 825 | stride_dst = LCD_FBSTRIDE(lcd_current_viewport->buffer->stride, 0); |
826 | dst_end = dst + height * stride_dst; | 826 | dst_end = dst + height * stride_dst; |
@@ -835,7 +835,7 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x, | |||
835 | do | 835 | do |
836 | { | 836 | { |
837 | const unsigned char *src_col = src++; | 837 | const unsigned char *src_col = src++; |
838 | unsigned data = (*src_col ^ dmask) >> src_y; | 838 | unsigned data = (*src_col ^ dmask) >> src_y; |
839 | fb_data *dst_col = dst; | 839 | fb_data *dst_col = dst; |
840 | int fg, bg; | 840 | int fg, bg; |
841 | long bo; | 841 | long bo; |
@@ -847,7 +847,7 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x, | |||
847 | data = *src_col ^ dmask; \ | 847 | data = *src_col ^ dmask; \ |
848 | } \ | 848 | } \ |
849 | } while (0) | 849 | } while (0) |
850 | 850 | ||
851 | switch (drmode) | 851 | switch (drmode) |
852 | { | 852 | { |
853 | case DRMODE_COMPLEMENT: | 853 | case DRMODE_COMPLEMENT: |
@@ -861,7 +861,7 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x, | |||
861 | } | 861 | } |
862 | while (dst_col < dst_end); | 862 | while (dst_col < dst_end); |
863 | break; | 863 | break; |
864 | 864 | ||
865 | case DRMODE_BG: | 865 | case DRMODE_BG: |
866 | if (lcd_backdrop) | 866 | if (lcd_backdrop) |
867 | { | 867 | { |
@@ -919,7 +919,7 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x, | |||
919 | do | 919 | do |
920 | { | 920 | { |
921 | unsigned block = *dst_col; | 921 | unsigned block = *dst_col; |
922 | *dst_col = block ^ ((block ^ ((data & 0x01) ? | 922 | *dst_col = block ^ ((block ^ ((data & 0x01) ? |
923 | fg : *(dst_col + bo))) & dst_mask); | 923 | fg : *(dst_col + bo))) & dst_mask); |
924 | 924 | ||
925 | dst_col += stride_dst; | 925 | dst_col += stride_dst; |
@@ -981,10 +981,10 @@ void ICODE_ATTR lcd_bitmap_part(const unsigned char *src, int src_x, | |||
981 | 981 | ||
982 | /******************** Image in viewport clipping **********************/ | 982 | /******************** Image in viewport clipping **********************/ |
983 | /* nothing to draw? */ | 983 | /* nothing to draw? */ |
984 | if ((width <= 0) || (height <= 0) || (x >= lcd_current_viewport->width) || | 984 | if ((width <= 0) || (height <= 0) || (x >= lcd_current_viewport->width) || |
985 | (y >= lcd_current_viewport->height) || (x + width <= 0) || (y + height <= 0)) | 985 | (y >= lcd_current_viewport->height) || (x + width <= 0) || (y + height <= 0)) |
986 | return; | 986 | return; |
987 | 987 | ||
988 | if (x < 0) | 988 | if (x < 0) |
989 | { | 989 | { |
990 | width += x; | 990 | width += x; |
@@ -1005,14 +1005,14 @@ void ICODE_ATTR lcd_bitmap_part(const unsigned char *src, int src_x, | |||
1005 | /* adjust for viewport */ | 1005 | /* adjust for viewport */ |
1006 | x += lcd_current_viewport->x; | 1006 | x += lcd_current_viewport->x; |
1007 | y += lcd_current_viewport->y; | 1007 | y += lcd_current_viewport->y; |
1008 | 1008 | ||
1009 | #if defined(HAVE_VIEWPORT_CLIP) | 1009 | #if defined(HAVE_VIEWPORT_CLIP) |
1010 | /********************* Viewport on screen clipping ********************/ | 1010 | /********************* Viewport on screen clipping ********************/ |
1011 | /* nothing to draw? */ | 1011 | /* nothing to draw? */ |
1012 | if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT) | 1012 | if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT) |
1013 | || (x + width <= 0) || (y + height <= 0)) | 1013 | || (x + width <= 0) || (y + height <= 0)) |
1014 | return; | 1014 | return; |
1015 | 1015 | ||
1016 | /* clip image in viewport in screen */ | 1016 | /* clip image in viewport in screen */ |
1017 | if (x < 0) | 1017 | if (x < 0) |
1018 | { | 1018 | { |
@@ -1044,7 +1044,7 @@ void ICODE_ATTR lcd_bitmap_part(const unsigned char *src, int src_x, | |||
1044 | 1044 | ||
1045 | mask = 0xFF00u >> (2 * (shift + src_x)); | 1045 | mask = 0xFF00u >> (2 * (shift + src_x)); |
1046 | mask_right = 0xFFu << (2 * (~nx & 3)); | 1046 | mask_right = 0xFFu << (2 * (~nx & 3)); |
1047 | 1047 | ||
1048 | shift *= 2; | 1048 | shift *= 2; |
1049 | dst_end = dst + height * stride_dst; | 1049 | dst_end = dst + height * stride_dst; |
1050 | do | 1050 | do |
@@ -1053,11 +1053,11 @@ void ICODE_ATTR lcd_bitmap_part(const unsigned char *src, int src_x, | |||
1053 | unsigned char *dst_row = dst; | 1053 | unsigned char *dst_row = dst; |
1054 | unsigned mask_row = mask >> 8; | 1054 | unsigned mask_row = mask >> 8; |
1055 | unsigned data = 0; | 1055 | unsigned data = 0; |
1056 | 1056 | ||
1057 | for (x = nx; x >= 4; x -= 4) | 1057 | for (x = nx; x >= 4; x -= 4) |
1058 | { | 1058 | { |
1059 | data = (data << 8) | *src_row++; | 1059 | data = (data << 8) | *src_row++; |
1060 | 1060 | ||
1061 | if (mask_row & 0xFF) | 1061 | if (mask_row & 0xFF) |
1062 | { | 1062 | { |
1063 | setblock(dst_row, mask_row, data >> shift); | 1063 | setblock(dst_row, mask_row, data >> shift); |
diff --git a/firmware/drivers/lcd-2bit-vert.c b/firmware/drivers/lcd-2bit-vert.c index a099c45e98..6a476495d0 100644 --- a/firmware/drivers/lcd-2bit-vert.c +++ b/firmware/drivers/lcd-2bit-vert.c | |||
@@ -260,7 +260,7 @@ static void ICODE_ATTR solidblock(fb_data *address, unsigned mask, | |||
260 | { | 260 | { |
261 | unsigned data = *address; | 261 | unsigned data = *address; |
262 | unsigned bgp = bg_pattern; | 262 | unsigned bgp = bg_pattern; |
263 | 263 | ||
264 | bits = bgp ^ ((bgp ^ fg_pattern) & bits); | 264 | bits = bgp ^ ((bgp ^ fg_pattern) & bits); |
265 | *address = data ^ ((data ^ bits) & mask); | 265 | *address = data ^ ((data ^ bits) & mask); |
266 | } | 266 | } |
@@ -270,7 +270,7 @@ static void ICODE_ATTR solidimgblock(fb_data *address, unsigned mask, | |||
270 | { | 270 | { |
271 | unsigned data = *address; | 271 | unsigned data = *address; |
272 | unsigned bgp = *(address + lcd_backdrop_offset); | 272 | unsigned bgp = *(address + lcd_backdrop_offset); |
273 | 273 | ||
274 | bits = bgp ^ ((bgp ^ fg_pattern) & bits); | 274 | bits = bgp ^ ((bgp ^ fg_pattern) & bits); |
275 | *address = data ^ ((data ^ bits) & mask); | 275 | *address = data ^ ((data ^ bits) & mask); |
276 | } | 276 | } |
@@ -310,7 +310,7 @@ static void ICODE_ATTR solidinvblock(fb_data *address, unsigned mask, | |||
310 | { | 310 | { |
311 | unsigned data = *address; | 311 | unsigned data = *address; |
312 | unsigned fgp = fg_pattern; | 312 | unsigned fgp = fg_pattern; |
313 | 313 | ||
314 | bits = fgp ^ ((fgp ^ bg_pattern) & bits); | 314 | bits = fgp ^ ((fgp ^ bg_pattern) & bits); |
315 | *address = data ^ ((data ^ bits) & mask); | 315 | *address = data ^ ((data ^ bits) & mask); |
316 | } | 316 | } |
@@ -320,7 +320,7 @@ static void ICODE_ATTR solidimginvblock(fb_data *address, unsigned mask, | |||
320 | { | 320 | { |
321 | unsigned data = *address; | 321 | unsigned data = *address; |
322 | unsigned fgp = fg_pattern; | 322 | unsigned fgp = fg_pattern; |
323 | 323 | ||
324 | bits = fgp ^ ((fgp ^ *(address + lcd_backdrop_offset)) & bits); | 324 | bits = fgp ^ ((fgp ^ *(address + lcd_backdrop_offset)) & bits); |
325 | *address = data ^ ((data ^ bits) & mask); | 325 | *address = data ^ ((data ^ bits) & mask); |
326 | } | 326 | } |
@@ -347,7 +347,7 @@ void lcd_set_backdrop(fb_data* backdrop) | |||
347 | lcd_pixelfuncs = lcd_pixelfuncs_backdrop; | 347 | lcd_pixelfuncs = lcd_pixelfuncs_backdrop; |
348 | lcd_blockfuncs = lcd_blockfuncs_backdrop; | 348 | lcd_blockfuncs = lcd_blockfuncs_backdrop; |
349 | } | 349 | } |
350 | else | 350 | else |
351 | { | 351 | { |
352 | lcd_backdrop_offset = 0; | 352 | lcd_backdrop_offset = 0; |
353 | lcd_pixelfuncs = lcd_pixelfuncs_bgcolor; | 353 | lcd_pixelfuncs = lcd_pixelfuncs_bgcolor; |
@@ -419,7 +419,7 @@ void lcd_clear_viewport(void) | |||
419 | /* Set a single pixel */ | 419 | /* Set a single pixel */ |
420 | void lcd_drawpixel(int x, int y) | 420 | void lcd_drawpixel(int x, int y) |
421 | { | 421 | { |
422 | if ( ((unsigned)x < (unsigned)lcd_current_viewport->width) | 422 | if ( ((unsigned)x < (unsigned)lcd_current_viewport->width) |
423 | && ((unsigned)y < (unsigned)lcd_current_viewport->height) | 423 | && ((unsigned)y < (unsigned)lcd_current_viewport->height) |
424 | #if defined(HAVE_VIEWPORT_CLIP) | 424 | #if defined(HAVE_VIEWPORT_CLIP) |
425 | && ((unsigned)x < (unsigned)LCD_WIDTH) | 425 | && ((unsigned)x < (unsigned)LCD_WIDTH) |
@@ -494,7 +494,7 @@ void lcd_drawline(int x1, int y1, int x2, int y2) | |||
494 | 494 | ||
495 | for (i = 0; i < numpixels; i++) | 495 | for (i = 0; i < numpixels; i++) |
496 | { | 496 | { |
497 | if ( ((unsigned)x < (unsigned)lcd_current_viewport->width) | 497 | if ( ((unsigned)x < (unsigned)lcd_current_viewport->width) |
498 | && ((unsigned)y < (unsigned)lcd_current_viewport->height) | 498 | && ((unsigned)y < (unsigned)lcd_current_viewport->height) |
499 | #if defined(HAVE_VIEWPORT_CLIP) | 499 | #if defined(HAVE_VIEWPORT_CLIP) |
500 | && ((unsigned)x < (unsigned)LCD_WIDTH) | 500 | && ((unsigned)x < (unsigned)LCD_WIDTH) |
@@ -534,12 +534,12 @@ void lcd_hline(int x1, int x2, int y) | |||
534 | x1 = x2; | 534 | x1 = x2; |
535 | x2 = x; | 535 | x2 = x; |
536 | } | 536 | } |
537 | 537 | ||
538 | /******************** In viewport clipping **********************/ | 538 | /******************** In viewport clipping **********************/ |
539 | /* nothing to draw? */ | 539 | /* nothing to draw? */ |
540 | if (((unsigned)y >= (unsigned)lcd_current_viewport->height) || (x1 >= lcd_current_viewport->width) | 540 | if (((unsigned)y >= (unsigned)lcd_current_viewport->height) || (x1 >= lcd_current_viewport->width) |
541 | || (x2 < 0)) | 541 | || (x2 < 0)) |
542 | return; | 542 | return; |
543 | 543 | ||
544 | if (x1 < 0) | 544 | if (x1 < 0) |
545 | x1 = 0; | 545 | x1 = 0; |
@@ -550,14 +550,14 @@ void lcd_hline(int x1, int x2, int y) | |||
550 | x1 += lcd_current_viewport->x; | 550 | x1 += lcd_current_viewport->x; |
551 | x2 += lcd_current_viewport->x; | 551 | x2 += lcd_current_viewport->x; |
552 | y += lcd_current_viewport->y; | 552 | y += lcd_current_viewport->y; |
553 | 553 | ||
554 | #if defined(HAVE_VIEWPORT_CLIP) | 554 | #if defined(HAVE_VIEWPORT_CLIP) |
555 | /********************* Viewport on screen clipping ********************/ | 555 | /********************* Viewport on screen clipping ********************/ |
556 | /* nothing to draw? */ | 556 | /* nothing to draw? */ |
557 | if (((unsigned)y >= (unsigned) LCD_HEIGHT) || (x1 >= LCD_WIDTH) | 557 | if (((unsigned)y >= (unsigned) LCD_HEIGHT) || (x1 >= LCD_WIDTH) |
558 | || (x2 < 0)) | 558 | || (x2 < 0)) |
559 | return; | 559 | return; |
560 | 560 | ||
561 | /* clipping */ | 561 | /* clipping */ |
562 | if (x1 < 0) | 562 | if (x1 < 0) |
563 | x1 = 0; | 563 | x1 = 0; |
@@ -598,25 +598,25 @@ void lcd_vline(int x, int y1, int y2) | |||
598 | /* nothing to draw? */ | 598 | /* nothing to draw? */ |
599 | if (((unsigned)x >= (unsigned)lcd_current_viewport->width) || (y1 >= lcd_current_viewport->height) | 599 | if (((unsigned)x >= (unsigned)lcd_current_viewport->width) || (y1 >= lcd_current_viewport->height) |
600 | || (y2 < 0)) | 600 | || (y2 < 0)) |
601 | return; | 601 | return; |
602 | 602 | ||
603 | if (y1 < 0) | 603 | if (y1 < 0) |
604 | y1 = 0; | 604 | y1 = 0; |
605 | if (y2 >= lcd_current_viewport->height) | 605 | if (y2 >= lcd_current_viewport->height) |
606 | y2 = lcd_current_viewport->height-1; | 606 | y2 = lcd_current_viewport->height-1; |
607 | 607 | ||
608 | /* adjust for viewport */ | 608 | /* adjust for viewport */ |
609 | y1 += lcd_current_viewport->y; | 609 | y1 += lcd_current_viewport->y; |
610 | y2 += lcd_current_viewport->y; | 610 | y2 += lcd_current_viewport->y; |
611 | x += lcd_current_viewport->x; | 611 | x += lcd_current_viewport->x; |
612 | 612 | ||
613 | #if defined(HAVE_VIEWPORT_CLIP) | 613 | #if defined(HAVE_VIEWPORT_CLIP) |
614 | /********************* Viewport on screen clipping ********************/ | 614 | /********************* Viewport on screen clipping ********************/ |
615 | /* nothing to draw? */ | 615 | /* nothing to draw? */ |
616 | if (( (unsigned) x >= (unsigned)LCD_WIDTH) || (y1 >= LCD_HEIGHT) | 616 | if (( (unsigned) x >= (unsigned)LCD_WIDTH) || (y1 >= LCD_HEIGHT) |
617 | || (y2 < 0)) | 617 | || (y2 < 0)) |
618 | return; | 618 | return; |
619 | 619 | ||
620 | /* clipping */ | 620 | /* clipping */ |
621 | if (y1 < 0) | 621 | if (y1 < 0) |
622 | y1 = 0; | 622 | y1 = 0; |
@@ -687,18 +687,18 @@ void lcd_fillrect(int x, int y, int width, int height) | |||
687 | width = lcd_current_viewport->width - x; | 687 | width = lcd_current_viewport->width - x; |
688 | if (y + height > lcd_current_viewport->height) | 688 | if (y + height > lcd_current_viewport->height) |
689 | height = lcd_current_viewport->height - y; | 689 | height = lcd_current_viewport->height - y; |
690 | 690 | ||
691 | /* adjust for viewport */ | 691 | /* adjust for viewport */ |
692 | x += lcd_current_viewport->x; | 692 | x += lcd_current_viewport->x; |
693 | y += lcd_current_viewport->y; | 693 | y += lcd_current_viewport->y; |
694 | 694 | ||
695 | #if defined(HAVE_VIEWPORT_CLIP) | 695 | #if defined(HAVE_VIEWPORT_CLIP) |
696 | /********************* Viewport on screen clipping ********************/ | 696 | /********************* Viewport on screen clipping ********************/ |
697 | /* nothing to draw? */ | 697 | /* nothing to draw? */ |
698 | if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT) | 698 | if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT) |
699 | || (x + width <= 0) || (y + height <= 0)) | 699 | || (x + width <= 0) || (y + height <= 0)) |
700 | return; | 700 | return; |
701 | 701 | ||
702 | /* clip image in viewport in screen */ | 702 | /* clip image in viewport in screen */ |
703 | if (x < 0) | 703 | if (x < 0) |
704 | { | 704 | { |
@@ -817,14 +817,14 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x, | |||
817 | /* adjust for viewport */ | 817 | /* adjust for viewport */ |
818 | x += lcd_current_viewport->x; | 818 | x += lcd_current_viewport->x; |
819 | y += lcd_current_viewport->y; | 819 | y += lcd_current_viewport->y; |
820 | 820 | ||
821 | #if defined(HAVE_VIEWPORT_CLIP) | 821 | #if defined(HAVE_VIEWPORT_CLIP) |
822 | /********************* Viewport on screen clipping ********************/ | 822 | /********************* Viewport on screen clipping ********************/ |
823 | /* nothing to draw? */ | 823 | /* nothing to draw? */ |
824 | if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT) | 824 | if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT) |
825 | || (x + width <= 0) || (y + height <= 0)) | 825 | || (x + width <= 0) || (y + height <= 0)) |
826 | return; | 826 | return; |
827 | 827 | ||
828 | /* clip image in viewport in screen */ | 828 | /* clip image in viewport in screen */ |
829 | if (x < 0) | 829 | if (x < 0) |
830 | { | 830 | { |
@@ -856,7 +856,7 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x, | |||
856 | mask_bottom = 0xFFFFu >> (2 * (~ny & 7)); | 856 | mask_bottom = 0xFFFFu >> (2 * (~ny & 7)); |
857 | 857 | ||
858 | bfunc = lcd_blockfuncs[lcd_current_viewport->drawmode]; | 858 | bfunc = lcd_blockfuncs[lcd_current_viewport->drawmode]; |
859 | 859 | ||
860 | if (shift == 0) | 860 | if (shift == 0) |
861 | { | 861 | { |
862 | unsigned dmask1, dmask2, data; | 862 | unsigned dmask1, dmask2, data; |
@@ -868,7 +868,7 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x, | |||
868 | { | 868 | { |
869 | const unsigned char *src_row = src; | 869 | const unsigned char *src_row = src; |
870 | fb_data *dst_row = dst + stride_dst; | 870 | fb_data *dst_row = dst + stride_dst; |
871 | 871 | ||
872 | dst_end = dst_row + width; | 872 | dst_end = dst_row + width; |
873 | 873 | ||
874 | if (dmask1 != 0) | 874 | if (dmask1 != 0) |
@@ -895,7 +895,7 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x, | |||
895 | /* & 0xFFu is unnecessary here - dmask1 can't exceed that*/ | 895 | /* & 0xFFu is unnecessary here - dmask1 can't exceed that*/ |
896 | dmask2 &= (mask_bottom >> 8); | 896 | dmask2 &= (mask_bottom >> 8); |
897 | dst_end = dst + width; | 897 | dst_end = dst + width; |
898 | 898 | ||
899 | if (dmask1 != 0) | 899 | if (dmask1 != 0) |
900 | { | 900 | { |
901 | if (dmask2 != 0) | 901 | if (dmask2 != 0) |
@@ -931,8 +931,8 @@ void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x, | |||
931 | fb_data *dst_col = dst++; | 931 | fb_data *dst_col = dst++; |
932 | unsigned mask_col = mask; | 932 | unsigned mask_col = mask; |
933 | unsigned data = 0; | 933 | unsigned data = 0; |
934 | 934 | ||
935 | for (y = ny; y >= 8; y -= 8) | 935 | for (y = ny; y >= 8; y -= 8) |
936 | { | 936 | { |
937 | data |= *src_col << shift; | 937 | data |= *src_col << shift; |
938 | 938 | ||
@@ -995,7 +995,7 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y, | |||
995 | if ((width <= 0) || (height <= 0) || (x >= lcd_current_viewport->width) | 995 | if ((width <= 0) || (height <= 0) || (x >= lcd_current_viewport->width) |
996 | || (y >= lcd_current_viewport->height) || (x + width <= 0) || (y + height <= 0)) | 996 | || (y >= lcd_current_viewport->height) || (x + width <= 0) || (y + height <= 0)) |
997 | return; | 997 | return; |
998 | 998 | ||
999 | if (x < 0) | 999 | if (x < 0) |
1000 | { | 1000 | { |
1001 | width += x; | 1001 | width += x; |
@@ -1016,14 +1016,14 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y, | |||
1016 | /* adjust for viewport */ | 1016 | /* adjust for viewport */ |
1017 | x += lcd_current_viewport->x; | 1017 | x += lcd_current_viewport->x; |
1018 | y += lcd_current_viewport->y; | 1018 | y += lcd_current_viewport->y; |
1019 | 1019 | ||
1020 | #if defined(HAVE_VIEWPORT_CLIP) | 1020 | #if defined(HAVE_VIEWPORT_CLIP) |
1021 | /********************* Viewport on screen clipping ********************/ | 1021 | /********************* Viewport on screen clipping ********************/ |
1022 | /* nothing to draw? */ | 1022 | /* nothing to draw? */ |
1023 | if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT) | 1023 | if ((x >= LCD_WIDTH) || (y >= LCD_HEIGHT) |
1024 | || (x + width <= 0) || (y + height <= 0)) | 1024 | || (x + width <= 0) || (y + height <= 0)) |
1025 | return; | 1025 | return; |
1026 | 1026 | ||
1027 | /* clip image in viewport in screen */ | 1027 | /* clip image in viewport in screen */ |
1028 | if (x < 0) | 1028 | if (x < 0) |
1029 | { | 1029 | { |
@@ -1052,7 +1052,7 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y, | |||
1052 | 1052 | ||
1053 | mask = 0xFFu << (2 * (shift + src_y)); | 1053 | mask = 0xFFu << (2 * (shift + src_y)); |
1054 | mask_bottom = 0xFFu >> (2 * (~ny & 3)); | 1054 | mask_bottom = 0xFFu >> (2 * (~ny & 3)); |
1055 | 1055 | ||
1056 | if (shift == 0) | 1056 | if (shift == 0) |
1057 | { | 1057 | { |
1058 | for (; ny >= 4; ny -= 4) | 1058 | for (; ny >= 4; ny -= 4) |
@@ -1063,9 +1063,9 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y, | |||
1063 | { | 1063 | { |
1064 | const fb_data *src_row = src; | 1064 | const fb_data *src_row = src; |
1065 | fb_data *dst_row = dst; | 1065 | fb_data *dst_row = dst; |
1066 | 1066 | ||
1067 | dst_end = dst_row + width; | 1067 | dst_end = dst_row + width; |
1068 | do | 1068 | do |
1069 | setblock(dst_row++, mask, *src_row++); | 1069 | setblock(dst_row++, mask, *src_row++); |
1070 | while (dst_row < dst_end); | 1070 | while (dst_row < dst_end); |
1071 | } | 1071 | } |
@@ -1095,7 +1095,7 @@ void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y, | |||
1095 | fb_data *dst_col = dst++; | 1095 | fb_data *dst_col = dst++; |
1096 | unsigned mask_col = mask; | 1096 | unsigned mask_col = mask; |
1097 | unsigned data = 0; | 1097 | unsigned data = 0; |
1098 | 1098 | ||
1099 | for (y = ny; y >= 4; y -= 4) | 1099 | for (y = ny; y >= 4; y -= 4) |
1100 | { | 1100 | { |
1101 | data |= *src_col << shift; | 1101 | data |= *src_col << shift; |
diff --git a/firmware/drivers/lcd-2bit-vi.c b/firmware/drivers/lcd-2bit-vi.c index 035e8b6d0d..c09bbce2e0 100644 --- a/firmware/drivers/lcd-2bit-vi.c +++ b/firmware/drivers/lcd-2bit-vi.c | |||
@@ -437,7 +437,7 @@ void LCDFN(clear_viewport)(void) | |||
437 | lastmode = CURRENT_VP->drawmode; | 437 | lastmode = CURRENT_VP->drawmode; |
438 | 438 | ||
439 | /* Invert the INVERSEVID bit and set basic mode to SOLID */ | 439 | /* Invert the INVERSEVID bit and set basic mode to SOLID */ |
440 | CURRENT_VP->drawmode = (~lastmode & DRMODE_INVERSEVID) | | 440 | CURRENT_VP->drawmode = (~lastmode & DRMODE_INVERSEVID) | |
441 | DRMODE_SOLID; | 441 | DRMODE_SOLID; |
442 | 442 | ||
443 | LCDFN(fillrect)(0, 0, CURRENT_VP->width, CURRENT_VP->height); | 443 | LCDFN(fillrect)(0, 0, CURRENT_VP->width, CURRENT_VP->height); |
@@ -452,7 +452,7 @@ void LCDFN(clear_viewport)(void) | |||
452 | /* Set a single pixel */ | 452 | /* Set a single pixel */ |
453 | void LCDFN(drawpixel)(int x, int y) | 453 | void LCDFN(drawpixel)(int x, int y) |
454 | { | 454 | { |
455 | if ( ((unsigned)x < (unsigned)CURRENT_VP->width) | 455 | if ( ((unsigned)x < (unsigned)CURRENT_VP->width) |
456 | && ((unsigned)y < (unsigned)CURRENT_VP->height) | 456 | && ((unsigned)y < (unsigned)CURRENT_VP->height) |
457 | #if defined(HAVE_VIEWPORT_CLIP) | 457 | #if defined(HAVE_VIEWPORT_CLIP) |
458 | && ((unsigned)x < (unsigned)LCDM(WIDTH)) | 458 | && ((unsigned)x < (unsigned)LCDM(WIDTH)) |
@@ -527,7 +527,7 @@ void LCDFN(drawline)(int x1, int y1, int x2, int y2) | |||
527 | 527 | ||
528 | for (i = 0; i < numpixels; i++) | 528 | for (i = 0; i < numpixels; i++) |
529 | { | 529 | { |
530 | if ( ((unsigned)x < (unsigned)CURRENT_VP->width) | 530 | if ( ((unsigned)x < (unsigned)CURRENT_VP->width) |
531 | && ((unsigned)y < (unsigned)CURRENT_VP->height) | 531 | && ((unsigned)y < (unsigned)CURRENT_VP->height) |
532 | #if defined(HAVE_VIEWPORT_CLIP) | 532 | #if defined(HAVE_VIEWPORT_CLIP) |
533 | && ((unsigned)x < (unsigned)LCDM(WIDTH)) | 533 | && ((unsigned)x < (unsigned)LCDM(WIDTH)) |
@@ -567,13 +567,13 @@ void LCDFN(hline)(int x1, int x2, int y) | |||
567 | x1 = x2; | 567 | x1 = x2; |
568 | x2 = x; | 568 | x2 = x; |
569 | } | 569 | } |
570 | 570 | ||
571 | /******************** In viewport clipping **********************/ | 571 | /******************** In viewport clipping **********************/ |
572 | /* nothing to draw? */ | 572 | /* nothing to draw? */ |
573 | if (((unsigned)y >= (unsigned)CURRENT_VP->height) || (x1 >= CURRENT_VP->width) | 573 | if (((unsigned)y >= (unsigned)CURRENT_VP->height) || (x1 >= CURRENT_VP->width) |
574 | || (x2 < 0)) | 574 | || (x2 < 0)) |
575 | return; | 575 | return; |
576 | 576 | ||
577 | if (x1 < 0) | 577 | if (x1 < 0) |
578 | x1 = 0; | 578 | x1 = 0; |
579 | if (x2 >= CURRENT_VP->width) | 579 | if (x2 >= CURRENT_VP->width) |
@@ -589,8 +589,8 @@ void LCDFN(hline)(int x1, int x2, int y) | |||
589 | /* nothing to draw? */ | 589 | /* nothing to draw? */ |
590 | if (((unsigned)y >= (unsigned) LCDM(HEIGHT)) || (x1 >= LCDM(WIDTH)) | 590 | if (((unsigned)y >= (unsigned) LCDM(HEIGHT)) || (x1 >= LCDM(WIDTH)) |
591 | || (x2 < 0)) | 591 | || (x2 < 0)) |
592 | return; | 592 | return; |
593 | 593 | ||
594 | /* clipping */ | 594 | /* clipping */ |
595 | if (x1 < 0) | 595 | if (x1 < 0) |
596 | x1 = 0; | 596 | x1 = 0; |
@@ -642,14 +642,14 @@ void LCDFN(vline)(int x, int y1, int y2) | |||
642 | y1 += CURRENT_VP->y; | 642 | y1 += CURRENT_VP->y; |
643 | y2 += CURRENT_VP->y; | 643 | y2 += CURRENT_VP->y; |
644 | x += CURRENT_VP->x; | 644 | x += CURRENT_VP->x; |
645 | 645 | ||
646 | #if defined(HAVE_VIEWPORT_CLIP) | 646 | #if defined(HAVE_VIEWPORT_CLIP) |
647 | /********************* Viewport on screen clipping ********************/ | 647 | /********************* Viewport on screen clipping ********************/ |
648 | /* nothing to draw? */ | 648 | /* nothing to draw? */ |
649 | if (( (unsigned) x >= (unsigned)LCDM(WIDTH)) || (y1 >= LCDM(HEIGHT)) | 649 | if (( (unsigned) x >= (unsigned)LCDM(WIDTH)) || (y1 >= LCDM(HEIGHT)) |
650 | || (y2 < 0)) | 650 | || (y2 < 0)) |
651 | return; | 651 | return; |
652 | 652 | ||
653 | /* clipping */ | 653 | /* clipping */ |
654 | if (y1 < 0) | 654 | if (y1 < 0) |
655 | y1 = 0; | 655 | y1 = 0; |
@@ -707,7 +707,7 @@ void LCDFN(fillrect)(int x, int y, int width, int height) | |||
707 | if ((width <= 0) || (height <= 0) || (x >= CURRENT_VP->width) | 707 | if ((width <= 0) || (height <= 0) || (x >= CURRENT_VP->width) |
708 | || (y >= CURRENT_VP->height) || (x + width <= 0) || (y + height <= 0)) | 708 | || (y >= CURRENT_VP->height) || (x + width <= 0) || (y + height <= 0)) |
709 | return; | 709 | return; |
710 | 710 | ||
711 | if (x < 0) | 711 | if (x < 0) |
712 | { | 712 | { |
713 | width += x; | 713 | width += x; |
@@ -726,14 +726,14 @@ void LCDFN(fillrect)(int x, int y, int width, int height) | |||
726 | /* adjust for viewport */ | 726 | /* adjust for viewport */ |
727 | x += CURRENT_VP->x; | 727 | x += CURRENT_VP->x; |
728 | y += CURRENT_VP->y; | 728 | y += CURRENT_VP->y; |
729 | 729 | ||
730 | #if defined(HAVE_VIEWPORT_CLIP) | 730 | #if defined(HAVE_VIEWPORT_CLIP) |
731 | /********************* Viewport on screen clipping ********************/ | 731 | /********************* Viewport on screen clipping ********************/ |
732 | /* nothing to draw? */ | 732 | /* nothing to draw? */ |
733 | if ((x >= LCDM(WIDTH)) || (y >= LCDM(HEIGHT)) | 733 | if ((x >= LCDM(WIDTH)) || (y >= LCDM(HEIGHT)) |
734 | || (x + width <= 0) || (y + height <= 0)) | 734 | || (x + width <= 0) || (y + height <= 0)) |
735 | return; | 735 | return; |
736 | 736 | ||
737 | /* clip image in viewport in screen */ | 737 | /* clip image in viewport in screen */ |
738 | if (x < 0) | 738 | if (x < 0) |
739 | { | 739 | { |
@@ -855,14 +855,14 @@ void ICODE_ATTR LCDFN(mono_bitmap_part)(const unsigned char *src, int src_x, | |||
855 | /* adjust for viewport */ | 855 | /* adjust for viewport */ |
856 | x += CURRENT_VP->x; | 856 | x += CURRENT_VP->x; |
857 | y += CURRENT_VP->y; | 857 | y += CURRENT_VP->y; |
858 | 858 | ||
859 | #if defined(HAVE_VIEWPORT_CLIP) | 859 | #if defined(HAVE_VIEWPORT_CLIP) |
860 | /********************* Viewport on screen clipping ********************/ | 860 | /********************* Viewport on screen clipping ********************/ |
861 | /* nothing to draw? */ | 861 | /* nothing to draw? */ |
862 | if ((x >= LCDM(WIDTH)) || (y >= LCDM(HEIGHT)) | 862 | if ((x >= LCDM(WIDTH)) || (y >= LCDM(HEIGHT)) |
863 | || (x + width <= 0) || (y + height <= 0)) | 863 | || (x + width <= 0) || (y + height <= 0)) |
864 | return; | 864 | return; |
865 | 865 | ||
866 | /* clip image in viewport in screen */ | 866 | /* clip image in viewport in screen */ |
867 | if (x < 0) | 867 | if (x < 0) |
868 | { | 868 | { |
@@ -1029,10 +1029,10 @@ void ICODE_ATTR LCDFN(bitmap_part)(const FBFN(data) *src, int src_x, | |||
1029 | #if defined(HAVE_VIEWPORT_CLIP) | 1029 | #if defined(HAVE_VIEWPORT_CLIP) |
1030 | /********************* Viewport on screen clipping ********************/ | 1030 | /********************* Viewport on screen clipping ********************/ |
1031 | /* nothing to draw? */ | 1031 | /* nothing to draw? */ |
1032 | if ((x >= LCDM(WIDTH)) || (y >= LCDM(HEIGHT)) | 1032 | if ((x >= LCDM(WIDTH)) || (y >= LCDM(HEIGHT)) |
1033 | || (x + width <= 0) || (y + height <= 0)) | 1033 | || (x + width <= 0) || (y + height <= 0)) |
1034 | return; | 1034 | return; |
1035 | 1035 | ||
1036 | /* clip image in viewport in screen */ | 1036 | /* clip image in viewport in screen */ |
1037 | if (x < 0) | 1037 | if (x < 0) |
1038 | { | 1038 | { |
diff --git a/firmware/drivers/lcd-bitmap-common.c b/firmware/drivers/lcd-bitmap-common.c index 94829b5d0c..9cd3ba3774 100644 --- a/firmware/drivers/lcd-bitmap-common.c +++ b/firmware/drivers/lcd-bitmap-common.c | |||
@@ -613,7 +613,7 @@ void LCDFN(nine_segment_bmp)(const struct bitmap* bm, int x, int y, | |||
613 | LCDFN(bmp_part)(bm, src_x, src_y_top, dst_x, dst_y_top, w, seg_h); | 613 | LCDFN(bmp_part)(bm, src_x, src_y_top, dst_x, dst_y_top, w, seg_h); |
614 | LCDFN(bmp_part)(bm, src_x, src_y_btm, dst_x, dst_y_btm, w, seg_h); | 614 | LCDFN(bmp_part)(bm, src_x, src_y_btm, dst_x, dst_y_btm, w, seg_h); |
615 | } | 615 | } |
616 | 616 | ||
617 | /* left & right in a single loop */ | 617 | /* left & right in a single loop */ |
618 | src_y = corner_h; | 618 | src_y = corner_h; |
619 | dst_y = corner_h; | 619 | dst_y = corner_h; |
diff --git a/firmware/drivers/lcd-color-common.c b/firmware/drivers/lcd-color-common.c index 60e95a25ca..3abc671770 100644 --- a/firmware/drivers/lcd-color-common.c +++ b/firmware/drivers/lcd-color-common.c | |||
@@ -586,7 +586,7 @@ void lcd_gradient_fillrect_part(int x, int y, int width, int height, | |||
586 | int x1, x2; | 586 | int x1, x2; |
587 | x1 = x; | 587 | x1 = x; |
588 | x2 = x + width; | 588 | x2 = x + width; |
589 | 589 | ||
590 | if (height == 0) return; | 590 | if (height == 0) return; |
591 | 591 | ||
592 | step_mul = (1 << 16) / src_height; | 592 | step_mul = (1 << 16) / src_height; |
diff --git a/firmware/export/config/mrobe500.h b/firmware/export/config/mrobe500.h index 57d13cf1ab..a7d72f76ac 100644 --- a/firmware/export/config/mrobe500.h +++ b/firmware/export/config/mrobe500.h | |||
@@ -81,7 +81,7 @@ | |||
81 | #define _RESOLUTION _LCD_RES_VGA | 81 | #define _RESOLUTION _LCD_RES_VGA |
82 | #define _ORIENTATION _LCD_LANDSCAPE | 82 | #define _ORIENTATION _LCD_LANDSCAPE |
83 | 83 | ||
84 | #if _RESOLUTION == _LCD_RES_VGA | 84 | #if _RESOLUTION == _LCD_RES_VGA |
85 | #define LCD_NATIVE_WIDTH 480 | 85 | #define LCD_NATIVE_WIDTH 480 |
86 | #define LCD_NATIVE_HEIGHT 640 | 86 | #define LCD_NATIVE_HEIGHT 640 |
87 | #define LCD_DPI 216 | 87 | #define LCD_DPI 216 |
diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h index af734da913..f5a3b3f1f4 100644 --- a/firmware/export/lcd.h +++ b/firmware/export/lcd.h | |||
@@ -34,7 +34,7 @@ | |||
34 | * Stride describes the amount that you need to increment to get to the next | 34 | * Stride describes the amount that you need to increment to get to the next |
35 | * line. For screens that have the pixels in contiguous horizontal strips | 35 | * line. For screens that have the pixels in contiguous horizontal strips |
36 | * stride should be equal to the image width. | 36 | * stride should be equal to the image width. |
37 | * | 37 | * |
38 | * For example, if the screen pixels are layed out as follows: | 38 | * For example, if the screen pixels are layed out as follows: |
39 | * | 39 | * |
40 | * width0 width1 width2 widthX-1 | 40 | * width0 width1 width2 widthX-1 |
@@ -57,9 +57,9 @@ | |||
57 | * height2 | pixel2 | 57 | * height2 | pixel2 |
58 | * | | | | 58 | * | | | |
59 | * \|/ | \|/ | 59 | * \|/ | \|/ |
60 | * heightY-1 | pixelY-1 | 60 | * heightY-1 | pixelY-1 |
61 | * | 61 | * |
62 | * then you would need to add Y pixels to get to the next line (the next | 62 | * then you would need to add Y pixels to get to the next line (the next |
63 | * line in this case is from width0 to width1). | 63 | * line in this case is from width0 to width1). |
64 | * | 64 | * |
65 | * The remote might have a different stride than the main screen so the screen | 65 | * The remote might have a different stride than the main screen so the screen |