summaryrefslogtreecommitdiff
path: root/apps/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins')
-rw-r--r--apps/plugins/credits.c68
-rw-r--r--apps/plugins/cube.c10
-rw-r--r--apps/plugins/flipit.c75
-rw-r--r--apps/plugins/invadrox.c4
-rw-r--r--apps/plugins/jackpot.c70
-rw-r--r--apps/plugins/lib/SOURCES4
-rw-r--r--apps/plugins/lib/display_text.c4
-rw-r--r--apps/plugins/lib/mylcd.h9
-rw-r--r--apps/plugins/lib/osd.h4
-rw-r--r--apps/plugins/lib/playergfx.c526
-rw-r--r--apps/plugins/lib/playergfx.h55
-rw-r--r--apps/plugins/lib/simple_viewer.c5
-rw-r--r--apps/plugins/logo.c17
-rw-r--r--apps/plugins/lrcplayer.c53
-rw-r--r--apps/plugins/metronome.c5
-rw-r--r--apps/plugins/mosaique.c15
-rw-r--r--apps/plugins/random_folder_advance_config.c2
-rw-r--r--apps/plugins/rockblox.c38
-rw-r--r--apps/plugins/snow.c19
-rw-r--r--apps/plugins/text_viewer/tv_display.c5
20 files changed, 6 insertions, 982 deletions
diff --git a/apps/plugins/credits.c b/apps/plugins/credits.c
index 6e993b5468..593b54277e 100644
--- a/apps/plugins/credits.c
+++ b/apps/plugins/credits.c
@@ -27,69 +27,6 @@ static const char* const credits[] = {
27#include "credits.raw" /* generated list of names from docs/CREDITS */ 27#include "credits.raw" /* generated list of names from docs/CREDITS */
28}; 28};
29 29
30#ifdef HAVE_LCD_CHARCELLS
31
32static void roll_credits(void)
33{
34 int numnames = sizeof(credits)/sizeof(char*);
35 int curr_name = 0;
36 int curr_len = rb->utf8length(credits[0]);
37 int curr_index = 0;
38 int curr_line = 0;
39 int name, len, new_len, line, x;
40
41 while (1)
42 {
43 rb->lcd_clear_display();
44
45 name = curr_name;
46 x = -curr_index;
47 len = curr_len;
48 line = curr_line;
49
50 while (x < 11)
51 {
52 int x2;
53
54 if (x < 0)
55 rb->lcd_puts(0, line,
56 credits[name] + rb->utf8seek(credits[name], -x));
57 else
58 rb->lcd_puts(x, line, credits[name]);
59
60 if (++name >= numnames)
61 break;
62
63 line ^= 1;
64
65 x2 = x + len/2;
66 if ((unsigned)x2 < 11)
67 rb->lcd_putc(x2, line, '*');
68
69 new_len = rb->utf8length(credits[name]);
70 x += MAX(len/2 + 2, len - new_len/2 + 1);
71 len = new_len;
72 }
73 rb->lcd_update();
74
75 /* abort on keypress */
76 if(rb->action_userabort(HZ/8))
77 return;
78
79 if (++curr_index >= curr_len)
80 {
81 if (++curr_name >= numnames)
82 break;
83 new_len = rb->utf8length(credits[curr_name]);
84 curr_index -= MAX(curr_len/2 + 2, curr_len - new_len/2 + 1);
85 curr_len = new_len;
86 curr_line ^= 1;
87 }
88 }
89}
90
91#else
92
93static bool stop_autoscroll(int action) 30static bool stop_autoscroll(int action)
94{ 31{
95 switch (action) 32 switch (action)
@@ -362,8 +299,6 @@ static void roll_credits(void)
362 } 299 }
363} 300}
364 301
365#endif
366
367enum plugin_status plugin_start(const void* parameter) 302enum plugin_status plugin_start(const void* parameter)
368{ 303{
369 (void)parameter; 304 (void)parameter;
@@ -372,9 +307,6 @@ enum plugin_status plugin_start(const void* parameter)
372 backlight_ignore_timeout(); 307 backlight_ignore_timeout();
373 308
374 rb->show_logo(); 309 rb->show_logo();
375#ifdef HAVE_LCD_CHARCELLS
376 rb->lcd_double_height(false);
377#endif
378 310
379 /* Show the logo for about 3 secs allowing the user to stop */ 311 /* Show the logo for about 3 secs allowing the user to stop */
380 if(!rb->action_userabort(3*HZ)) 312 if(!rb->action_userabort(3*HZ))
diff --git a/apps/plugins/cube.c b/apps/plugins/cube.c
index 4cd314a035..29d2ba2fc1 100644
--- a/apps/plugins/cube.c
+++ b/apps/plugins/cube.c
@@ -22,7 +22,6 @@
22***************************************************************************/ 22***************************************************************************/
23#include "plugin.h" 23#include "plugin.h"
24#include "fixedpoint.h" 24#include "fixedpoint.h"
25#include "lib/playergfx.h"
26#include "lib/pluginlib_exit.h" 25#include "lib/pluginlib_exit.h"
27#if LCD_DEPTH > 1 26#if LCD_DEPTH > 1
28#include "lib/mylcd.h" /* MYLCD_CFG_RB_XLCD or MYLCD_CFG_PGFX */ 27#include "lib/mylcd.h" /* MYLCD_CFG_RB_XLCD or MYLCD_CFG_PGFX */
@@ -746,8 +745,6 @@ static void cleanup(void)
746{ 745{
747#ifdef USEGSLIB 746#ifdef USEGSLIB
748 grey_release(); 747 grey_release();
749#elif defined HAVE_LCD_CHARCELLS
750 pgfx_release();
751#endif 748#endif
752} 749}
753 750
@@ -797,13 +794,6 @@ enum plugin_status plugin_start(const void* parameter)
797 grey_setfont(FONT_SYSFIXED); 794 grey_setfont(FONT_SYSFIXED);
798#endif 795#endif
799 rb->lcd_setfont(FONT_SYSFIXED); 796 rb->lcd_setfont(FONT_SYSFIXED);
800#else /* LCD_CHARCELLS */
801 if (!pgfx_init(4, 2))
802 {
803 rb->splash(HZ*2, "Old LCD :(");
804 return PLUGIN_OK;
805 }
806 pgfx_display(0, 0);
807#endif 797#endif
808 798
809 atexit(cleanup); 799 atexit(cleanup);
diff --git a/apps/plugins/flipit.c b/apps/plugins/flipit.c
index fab409cc14..294bee8f5b 100644
--- a/apps/plugins/flipit.c
+++ b/apps/plugins/flipit.c
@@ -595,75 +595,6 @@ static void draw_info_panel(void)
595 GRID_TOP + 4*(TK_HEIGHT+TK_SPACE) + 2, s ); 595 GRID_TOP + 4*(TK_HEIGHT+TK_SPACE) + 2, s );
596} 596}
597 597
598#else /* HAVE_LCD_CHARCELLS */
599
600static const unsigned char tk_pat[4][7] = {
601 { 0x0e, 0x11, 0x0e, 0x00, 0x0e, 0x11, 0x0e }, /* white - white */
602 { 0x0e, 0x11, 0x0e, 0x00, 0x0e, 0x1f, 0x0e }, /* white - black */
603 { 0x0e, 0x1f, 0x0e, 0x00, 0x0e, 0x11, 0x0e }, /* black - white */
604 { 0x0e, 0x1f, 0x0e, 0x00, 0x0e, 0x1f, 0x0e } /* black - black */
605};
606
607static unsigned char cur_pat[7];
608static unsigned long gfx_chars[5];
609
610static void release_gfx(void)
611{
612 int i;
613
614 for (i = 0; i < 5; i++)
615 if (gfx_chars[i])
616 rb->lcd_unlock_pattern(gfx_chars[i]);
617}
618
619static bool init_gfx(void)
620{
621 int i;
622
623 for (i = 0; i < 5; i++) {
624 if ((gfx_chars[i] = rb->lcd_get_locked_pattern()) == 0) {
625 release_gfx();
626 return false;
627 }
628 }
629 for (i = 0; i < 4; i++)
630 rb->lcd_define_pattern(gfx_chars[i], tk_pat[i]);
631 return true;
632}
633
634/* draw a spot at the coordinates (x,y), range of p is 0-19 */
635static void draw_spot(int p)
636{
637 if ((p/5) & 1)
638 p -= 5;
639
640 rb->lcd_putc (p%5, p/10, gfx_chars[2*spots[p]+spots[p+5]]);
641}
642
643/* draw the cursor at the current cursor position */
644static void draw_cursor(void)
645{
646 if ((cursor_pos/5) & 1) {
647 rb->memcpy( cur_pat, tk_pat[2*spots[cursor_pos-5]+spots[cursor_pos]], 7 );
648 cur_pat[4] ^= 0x15;
649 cur_pat[6] ^= 0x11;
650 }
651 else {
652 rb->memcpy( cur_pat, tk_pat[2*spots[cursor_pos]+spots[cursor_pos+5]], 7 );
653 cur_pat[0] ^= 0x15;
654 cur_pat[2] ^= 0x11;
655 }
656 rb->lcd_define_pattern(gfx_chars[4], cur_pat);
657 rb->lcd_putc( cursor_pos%5, cursor_pos/10, gfx_chars[4] );
658}
659
660/* draw the info panel ... duh */
661static void draw_info_panel(void)
662{
663 rb->lcd_puts( 6, 0, "Flips" );
664 rb->lcd_putsf( 6, 1, "%d", moves );
665}
666
667#endif /* LCD */ 598#endif /* LCD */
668 599
669/* clear the cursor where it is */ 600/* clear the cursor where it is */
@@ -978,9 +909,6 @@ enum plugin_status plugin_start(const void* parameter)
978#endif 909#endif
979 910
980 rb->lcd_update(); 911 rb->lcd_update();
981#else /* HAVE_LCD_CHARCELLS */
982 if (!init_gfx())
983 return PLUGIN_ERROR;
984#endif 912#endif
985 rb->button_get_w_tmo(HZ*3); 913 rb->button_get_w_tmo(HZ*3);
986 914
@@ -995,8 +923,5 @@ enum plugin_status plugin_start(const void* parameter)
995 rb->srand(*rb->current_tick); 923 rb->srand(*rb->current_tick);
996 924
997 rc = flipit_loop(); 925 rc = flipit_loop();
998#ifdef HAVE_LCD_CHARCELLS
999 release_gfx();
1000#endif
1001 return rc; 926 return rc;
1002} 927}
diff --git a/apps/plugins/invadrox.c b/apps/plugins/invadrox.c
index 8cf4d67f3e..e7529895ac 100644
--- a/apps/plugins/invadrox.c
+++ b/apps/plugins/invadrox.c
@@ -66,10 +66,6 @@
66/* Original graphics is only 1bpp so it should be portable 66/* Original graphics is only 1bpp so it should be portable
67 * to most targets. But for now, only support the simple ones. 67 * to most targets. But for now, only support the simple ones.
68 */ 68 */
69#ifndef HAVE_LCD_BITMAP
70 #error INVADROX: Unsupported LCD
71#endif
72
73#if (LCD_DEPTH < 2) 69#if (LCD_DEPTH < 2)
74 #error INVADROX: Unsupported LCD 70 #error INVADROX: Unsupported LCD
75#endif 71#endif
diff --git a/apps/plugins/jackpot.c b/apps/plugins/jackpot.c
index b380e85180..26f8f47e8f 100644
--- a/apps/plugins/jackpot.c
+++ b/apps/plugins/jackpot.c
@@ -30,24 +30,7 @@ const struct button_mapping* plugin_contexts[]={pla_main_ctx};
30#define NB_PICTURES 9 30#define NB_PICTURES 9
31#define NB_SLOTS 3 31#define NB_SLOTS 3
32 32
33#ifdef HAVE_LCD_CHARCELLS 33#ifdef HAVE_LCD_BITMAP
34#define PICTURE_ROTATION_STEPS 7
35static unsigned char jackpot_slots_patterns[]={
36 0x00, 0x0A, 0x1F, 0x1F, 0x1F, 0x0e, 0x04, /* (+00)Heart */
37 0x00, 0x04, 0x0E, 0x1F, 0x1F, 0x04, 0x0E, /* (+07)Spade */
38 0x00, 0x04, 0x0E, 0x1F, 0x0E, 0x04, 0x00, /* (+14)Diamond */
39 0x00, 0x15, 0x0E, 0x1F, 0x0E, 0x15, 0x00, /* (+21)Club */
40 0x03, 0x04, 0x0e, 0x1F, 0x1F, 0x1F, 0x0e, /* (+28)Cherry */
41 0x00, 0x04, 0x04, 0x1F, 0x04, 0x0E, 0x1F, /* (+35)Cross */
42 0x04, 0x0E, 0x15, 0x04, 0x0A, 0x0A, 0x11, /* (+42)Man */
43 0x00, 0x1F, 0x1F, 0x1F, 0x1F, 0x1F, 0x00, /* (+49)Square */
44 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* (+56)Empty */
45 0x00, 0x0A, 0x1F, 0x1F, 0x1F, 0x0e, 0x04 /* (+63)Heart */
46};
47static unsigned long char_patterns[NB_SLOTS];
48#define SLEEP_TIME (HZ/24)
49#else /* bitmaps LCDs */
50
51#define PICTURE_HEIGHT (BMPHEIGHT_jackpot_slots/(NB_PICTURES+1)) 34#define PICTURE_HEIGHT (BMPHEIGHT_jackpot_slots/(NB_PICTURES+1))
52#if NB_SCREENS==1 35#if NB_SCREENS==1
53#define PICTURE_ROTATION_STEPS PICTURE_HEIGHT 36#define PICTURE_ROTATION_STEPS PICTURE_HEIGHT
@@ -72,7 +55,7 @@ const struct picture jackpot_pictures[]={
72}; 55};
73 56
74#define SLEEP_TIME (HZ/200) 57#define SLEEP_TIME (HZ/200)
75#endif /* HAVE_LCD_CHARCELLS */ 58#endif /* HAVE_LCD_BITMAP */
76 59
77struct jackpot 60struct jackpot
78{ 61{
@@ -92,29 +75,9 @@ struct jackpot
92 int money; 75 int money;
93}; 76};
94 77
95#ifdef HAVE_LCD_CHARCELLS
96static void patterns_init(struct screen* display)
97{
98 int i;
99 for(i=0;i<NB_SLOTS;i++)
100 char_patterns[i]=display->get_locked_pattern();
101}
102
103static void patterns_deinit(struct screen* display)
104{
105 /* Restore the old pattern */
106 int i;
107 for(i=0;i<NB_SLOTS;i++)
108 display->unlock_pattern(char_patterns[i]);
109}
110#endif /* HAVE_LCD_CHARCELLS */
111
112/*Call when the program exit*/ 78/*Call when the program exit*/
113static void jackpot_exit(void) 79static void jackpot_exit(void)
114{ 80{
115#ifdef HAVE_LCD_CHARCELLS
116 patterns_deinit(rb->screens[SCREEN_MAIN]);
117#endif /* HAVE_LCD_CHARCELLS */
118} 81}
119 82
120static void jackpot_init(struct jackpot* game) 83static void jackpot_init(struct jackpot* game)
@@ -168,47 +131,25 @@ static void jackpot_display_slot_machine(struct jackpot* game, struct screen* di
168 char str[20]; 131 char str[20];
169 int i; 132 int i;
170 bool changes=false; 133 bool changes=false;
171#ifdef HAVE_LCD_CHARCELLS
172 display->putchar(0, 0, '[');
173#else
174 const struct picture* picture= &(jackpot_pictures[display->screen_type]); 134 const struct picture* picture= &(jackpot_pictures[display->screen_type]);
175 int pos_x=(display->getwidth()-NB_SLOTS*(picture->width+1))/2; 135 int pos_x=(display->getwidth()-NB_SLOTS*(picture->width+1))/2;
176 int pos_y=(display->getheight()-(picture->slide_height))/2; 136 int pos_y=(display->getheight()-(picture->slide_height))/2;
177#endif /* HAVE_LCD_CHARCELLS */
178 for(i=0;i<NB_SLOTS;i++) 137 for(i=0;i<NB_SLOTS;i++)
179 { 138 {
180#ifdef HAVE_LCD_CHARCELLS
181 /* the only charcell lcd is 7 pixel high */
182 int state_y=(game->slot_state[i]*7)/PICTURE_ROTATION_STEPS;
183#else
184 int state_y= 139 int state_y=
185 (picture->slide_height*game->slot_state[i])/PICTURE_ROTATION_STEPS; 140 (picture->slide_height*game->slot_state[i])/PICTURE_ROTATION_STEPS;
186#endif /* HAVE_LCD_CHARCELLS */
187 int previous_state_y=game->state_y[display->screen_type][i]; 141 int previous_state_y=game->state_y[display->screen_type][i];
188 if(state_y==previous_state_y) 142 if(state_y==previous_state_y)
189 continue;/*no need to update the picture 143 continue;/*no need to update the picture
190 as it's the same as previous displayed one*/ 144 as it's the same as previous displayed one*/
191 changes=true; 145 changes=true;
192 game->state_y[display->screen_type][i]=state_y; 146 game->state_y[display->screen_type][i]=state_y;
193#ifdef HAVE_LCD_CHARCELLS
194 char* current_pattern=&(jackpot_slots_patterns[state_y]);
195 display->define_pattern(char_patterns[i],
196 current_pattern);
197 display->putchar(i+1, 0, char_patterns[i]);
198#else
199 vertical_picture_draw_part(display, picture, state_y, pos_x, pos_y); 147 vertical_picture_draw_part(display, picture, state_y, pos_x, pos_y);
200 pos_x+=(picture->width+1); 148 pos_x+=(picture->width+1);
201#endif
202 } 149 }
203 if(changes){ 150 if(changes){
204#ifdef HAVE_LCD_CHARCELLS
205 rb->snprintf(str,sizeof(str),"$%d", game->money);
206 display->putchar(++i, 0, ']');
207 display->puts(++i, 0, str);
208#else
209 rb->snprintf(str,sizeof(str),"money : $%d", game->money); 151 rb->snprintf(str,sizeof(str),"money : $%d", game->money);
210 display->puts(0, 0, str); 152 display->puts(0, 0, str);
211#endif
212 display->update(); 153 display->update();
213 } 154 }
214} 155}
@@ -216,9 +157,6 @@ static void jackpot_display_slot_machine(struct jackpot* game, struct screen* di
216 157
217static void jackpot_info_message(struct screen* display, char* message) 158static void jackpot_info_message(struct screen* display, char* message)
218{ 159{
219#ifdef HAVE_LCD_CHARCELLS
220 display->puts_scroll(0,1,message);
221#else
222 int xpos, ypos; 160 int xpos, ypos;
223 int message_height, message_width; 161 int message_height, message_width;
224 display->getstringsize(message, &message_width, &message_height); 162 display->getstringsize(message, &message_width, &message_height);
@@ -228,7 +166,6 @@ static void jackpot_info_message(struct screen* display, char* message)
228 message_height); 166 message_height);
229 display->putsxy(xpos,ypos,message); 167 display->putsxy(xpos,ypos,message);
230 display->update(); 168 display->update();
231#endif /* HAVE_LCD_CHARCELLS */
232} 169}
233 170
234static void jackpot_print_turn_result(struct jackpot* game, 171static void jackpot_print_turn_result(struct jackpot* game,
@@ -299,9 +236,6 @@ enum plugin_status plugin_start(const void* parameter)
299 (void)parameter; 236 (void)parameter;
300 atexit(jackpot_exit); 237 atexit(jackpot_exit);
301 rb->srand(*rb->current_tick); 238 rb->srand(*rb->current_tick);
302#ifdef HAVE_LCD_CHARCELLS
303 patterns_init(rb->screens[SCREEN_MAIN]);
304#endif /* HAVE_LCD_CHARCELLS */
305 jackpot_init(&game); 239 jackpot_init(&game);
306 240
307 FOR_NB_SCREENS(i){ 241 FOR_NB_SCREENS(i){
diff --git a/apps/plugins/lib/SOURCES b/apps/plugins/lib/SOURCES
index 82b9fba4a5..effc076eb7 100644
--- a/apps/plugins/lib/SOURCES
+++ b/apps/plugins/lib/SOURCES
@@ -33,10 +33,6 @@ overlay.c
33profile_plugin.c 33profile_plugin.c
34#endif 34#endif
35 35
36#ifdef HAVE_LCD_CHARCELLS
37playergfx.c
38#endif
39
40#ifdef HAVE_LCD_BITMAP 36#ifdef HAVE_LCD_BITMAP
41 37
42#ifdef CPU_ARM 38#ifdef CPU_ARM
diff --git a/apps/plugins/lib/display_text.c b/apps/plugins/lib/display_text.c
index 5d13fc678d..90712a649f 100644
--- a/apps/plugins/lib/display_text.c
+++ b/apps/plugins/lib/display_text.c
@@ -22,11 +22,7 @@
22#include "plugin.h" 22#include "plugin.h"
23#include "display_text.h" 23#include "display_text.h"
24 24
25#ifdef HAVE_LCD_CHARCELLS
26#define MARGIN 0
27#else
28#define MARGIN 5 25#define MARGIN 5
29#endif
30 26
31static bool wait_key_press(void) 27static bool wait_key_press(void)
32{ 28{
diff --git a/apps/plugins/lib/mylcd.h b/apps/plugins/lib/mylcd.h
index e363111c71..a543d60890 100644
--- a/apps/plugins/lib/mylcd.h
+++ b/apps/plugins/lib/mylcd.h
@@ -32,15 +32,10 @@
32 * targets. On color, mylcd_ub_update_XXXX refer to the proper update 32 * targets. On color, mylcd_ub_update_XXXX refer to the proper update
33 * functions, otherwise they are no-ops. 33 * functions, otherwise they are no-ops.
34 * 34 *
35 * lib/playergfx.h or lib/grey.h should be included before including this 35 * lib/grey.h should be included before including this
36 * header. For bitmap LCD's, defaults to rb->lcd_XXXX otherwise. 36 * header. For bitmap LCD's, defaults to rb->lcd_XXXX otherwise.
37 */ 37 */
38#if defined (HAVE_LCD_CHARCELLS) && defined(__PGFX_H__) 38#if defined (HAVE_LCD_BITMAP) && (LCD_DEPTH < 4) && defined(__GREY_H__)
39#define MYLCD_CFG_PGFX /* using PGFX */
40#define mylcd_(fn) pgfx_##fn
41#define mylcd_ub_(fn) pgfx_##fn
42
43#elif defined (HAVE_LCD_BITMAP) && (LCD_DEPTH < 4) && defined(__GREY_H__)
44#define MYLCD_CFG_GREYLIB /* using greylib */ 39#define MYLCD_CFG_GREYLIB /* using greylib */
45#define mylcd_(fn) grey_##fn 40#define mylcd_(fn) grey_##fn
46#define myxlcd_(fn) grey_##fn 41#define myxlcd_(fn) grey_##fn
diff --git a/apps/plugins/lib/osd.h b/apps/plugins/lib/osd.h
index b5bf63d9fe..1c2752139a 100644
--- a/apps/plugins/lib/osd.h
+++ b/apps/plugins/lib/osd.h
@@ -23,10 +23,6 @@
23#ifndef OSD_H 23#ifndef OSD_H
24#define OSD_H 24#define OSD_H
25 25
26#ifndef HAVE_LCD_BITMAP
27#error OSD requires bitmapped LCD
28#endif
29
30/* At this time: assumes use of the default viewport for normal drawing */ 26/* At this time: assumes use of the default viewport for normal drawing */
31 27
32/* Callback implemented by user. Paramters are OSD vp-relative coordinates */ 28/* Callback implemented by user. Paramters are OSD vp-relative coordinates */
diff --git a/apps/plugins/lib/playergfx.c b/apps/plugins/lib/playergfx.c
deleted file mode 100644
index b2ba71351f..0000000000
--- a/apps/plugins/lib/playergfx.c
+++ /dev/null
@@ -1,526 +0,0 @@
1/***************************************************************************
2* __________ __ ___.
3* Open \______ \ ____ ____ | | _\_ |__ _______ ___
4* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7* \/ \/ \/ \/ \/
8* $Id$
9*
10* Bitmap graphics on player LCD!
11*
12* Copyright (C) 2005 Jens Arnold
13*
14* This program is free software; you can redistribute it and/or
15* modify it under the terms of the GNU General Public License
16* as published by the Free Software Foundation; either version 2
17* of the License, or (at your option) any later version.
18*
19* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20* KIND, either express or implied.
21*
22****************************************************************************/
23
24#include "plugin.h"
25
26#include "playergfx.h"
27
28/*** globals ***/
29
30static int char_width;
31static int char_height;
32static int pixel_height;
33static int pixel_width;
34static unsigned long gfx_chars[8];
35static unsigned char gfx_buffer[56];
36static int drawmode = DRMODE_SOLID;
37
38/*** Special functions ***/
39
40/* library init */
41bool pgfx_init(int cwidth, int cheight)
42{
43 int i;
44
45 if (((unsigned) cwidth * (unsigned) cheight) > 8 || (unsigned) cheight > 2)
46 return false;
47
48 char_width = cwidth;
49 char_height = cheight;
50 pixel_height = 7 * char_height;
51 pixel_width = 5 * char_width;
52
53 for (i = 0; i < cwidth * cheight; i++)
54 {
55 if ((gfx_chars[i] = rb->lcd_get_locked_pattern()) == 0)
56 {
57 pgfx_release();
58 return false;
59 }
60 }
61
62 return true;
63}
64
65/* library deinit */
66void pgfx_release(void)
67{
68 int i;
69
70 for (i = 0; i < 8; i++)
71 if (gfx_chars[i])
72 rb->lcd_unlock_pattern(gfx_chars[i]);
73}
74
75/* place the display */
76void pgfx_display(int cx, int cy)
77{
78 int i, j;
79 int width = MIN(char_width, 11 - cx);
80 int height = MIN(char_height, 2 - cy);
81
82 for (i = 0; i < width; i++)
83 for (j = 0; j < height; j++)
84 rb->lcd_putc(cx + i, cy + j, gfx_chars[char_height * i + j]);
85}
86
87void pgfx_display_block(int cx, int cy, int x, int y)
88{
89 rb->lcd_putc(cx, cy, gfx_chars[char_height * x + y]);
90}
91
92
93/*** Update functions ***/
94
95void pgfx_update(void)
96{
97 int i;
98
99 for (i = 0; i < char_width * char_height; i++)
100 rb->lcd_define_pattern(gfx_chars[i], gfx_buffer + 7 * i);
101
102 rb->lcd_update();
103}
104
105/*** Parameter handling ***/
106
107void pgfx_set_drawmode(int mode)
108{
109 drawmode = mode & (DRMODE_SOLID|DRMODE_INVERSEVID);
110}
111
112int pgfx_get_drawmode(void)
113{
114 return drawmode;
115}
116
117/*** Low-level drawing functions ***/
118
119static void setpixel(int x, int y)
120{
121 gfx_buffer[pixel_height * (x/5) + y] |= 0x10 >> (x%5);
122}
123
124static void clearpixel(int x, int y)
125{
126 gfx_buffer[pixel_height * (x/5) + y] &= ~(0x10 >> (x%5));
127}
128
129static void flippixel(int x, int y)
130{
131 gfx_buffer[pixel_height * (x/5) + y] ^= 0x10 >> (x%5);
132}
133
134static void nopixel(int x, int y)
135{
136 (void)x;
137 (void)y;
138}
139
140lcd_pixelfunc_type* pgfx_pixelfuncs[8] = {
141 flippixel, nopixel, setpixel, setpixel,
142 nopixel, clearpixel, nopixel, clearpixel
143};
144
145static void flipblock(unsigned char *address, unsigned mask, unsigned bits)
146{
147 *address ^= (bits & mask);
148}
149
150static void bgblock(unsigned char *address, unsigned mask, unsigned bits)
151{
152 *address &= (bits | ~mask);
153}
154
155static void fgblock(unsigned char *address, unsigned mask, unsigned bits)
156{
157 *address |= (bits & mask);
158}
159
160static void solidblock(unsigned char *address, unsigned mask, unsigned bits)
161{
162 unsigned data = *(char *)address;
163
164 bits ^= data;
165 *address = data ^ (bits & mask);
166}
167
168static void flipinvblock(unsigned char *address, unsigned mask, unsigned bits)
169{
170 *address ^= (~bits & mask);
171}
172
173static void bginvblock(unsigned char *address, unsigned mask, unsigned bits)
174{
175 *address &= ~(bits & mask);
176}
177
178static void fginvblock(unsigned char *address, unsigned mask, unsigned bits)
179{
180 *address |= (~bits & mask);
181}
182
183static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits)
184{
185 unsigned data = *(char *)address;
186
187 bits = ~bits ^ data;
188 *address = data ^ (bits & mask);
189}
190
191lcd_blockfunc_type* pgfx_blockfuncs[8] = {
192 flipblock, bgblock, fgblock, solidblock,
193 flipinvblock, bginvblock, fginvblock, solidinvblock
194};
195
196/*** Drawing functions ***/
197
198/* Clear the whole display */
199void pgfx_clear_display(void)
200{
201 unsigned bits = (drawmode & DRMODE_INVERSEVID) ? 0x1F : 0;
202
203 rb->memset(gfx_buffer, bits, char_width * pixel_height);
204}
205
206/* Set a single pixel */
207void pgfx_drawpixel(int x, int y)
208{
209 if (((unsigned)x < (unsigned)pixel_width)
210 && ((unsigned)y < (unsigned)pixel_height))
211 pgfx_pixelfuncs[drawmode](x, y);
212}
213
214/* Draw a line */
215void pgfx_drawline(int x1, int y1, int x2, int y2)
216{
217 int numpixels;
218 int i;
219 int deltax, deltay;
220 int d, dinc1, dinc2;
221 int x, xinc1, xinc2;
222 int y, yinc1, yinc2;
223 lcd_pixelfunc_type *pfunc = pgfx_pixelfuncs[drawmode];
224
225 deltax = abs(x2 - x1);
226 deltay = abs(y2 - y1);
227 xinc2 = 1;
228 yinc2 = 1;
229
230 if (deltax >= deltay)
231 {
232 numpixels = deltax;
233 d = 2 * deltay - deltax;
234 dinc1 = deltay * 2;
235 dinc2 = (deltay - deltax) * 2;
236 xinc1 = 1;
237 yinc1 = 0;
238 }
239 else
240 {
241 numpixels = deltay;
242 d = 2 * deltax - deltay;
243 dinc1 = deltax * 2;
244 dinc2 = (deltax - deltay) * 2;
245 xinc1 = 0;
246 yinc1 = 1;
247 }
248 numpixels++; /* include endpoints */
249
250 if (x1 > x2)
251 {
252 xinc1 = -xinc1;
253 xinc2 = -xinc2;
254 }
255
256 if (y1 > y2)
257 {
258 yinc1 = -yinc1;
259 yinc2 = -yinc2;
260 }
261
262 x = x1;
263 y = y1;
264
265 for (i = 0; i < numpixels; i++)
266 {
267 if (((unsigned)x < (unsigned)pixel_width)
268 && ((unsigned)y < (unsigned)pixel_height))
269 pfunc(x, y);
270
271 if (d < 0)
272 {
273 d += dinc1;
274 x += xinc1;
275 y += yinc1;
276 }
277 else
278 {
279 d += dinc2;
280 x += xinc2;
281 y += yinc2;
282 }
283 }
284}
285
286/* Draw a horizontal line (optimised) */
287void pgfx_hline(int x1, int x2, int y)
288{
289 int nx;
290 unsigned char *dst;
291 unsigned mask, mask_right;
292 lcd_blockfunc_type *bfunc;
293
294 /* direction flip */
295 if (x2 < x1)
296 {
297 nx = x1;
298 x1 = x2;
299 x2 = nx;
300 }
301
302 /* nothing to draw? */
303 if (((unsigned)y >= (unsigned)pixel_height) || (x1 >= pixel_width)
304 || (x2 < 0))
305 return;
306
307 /* clipping */
308 if (x1 < 0)
309 x1 = 0;
310 if (x2 >= pixel_width)
311 x2 = pixel_width - 1;
312
313 bfunc = pgfx_blockfuncs[drawmode];
314 dst = &gfx_buffer[pixel_height * (x1/5) + y];
315 nx = x2 - (x1 - (x1 % 5));
316 mask = 0x1F >> (x1 % 5);
317 mask_right = 0x1F0 >> (nx % 5);
318
319 for (; nx >= 5; nx -= 5)
320 {
321 bfunc(dst, mask, 0xFFu);
322 dst += pixel_height;
323 mask = 0x1F;
324 }
325 mask &= mask_right;
326 bfunc(dst, mask, 0x1F);
327}
328
329/* Draw a vertical line (optimised) */
330void pgfx_vline(int x, int y1, int y2)
331{
332 int y;
333 unsigned char *dst, *dst_end;
334 unsigned mask;
335 lcd_blockfunc_type *bfunc;
336
337 /* direction flip */
338 if (y2 < y1)
339 {
340 y = y1;
341 y1 = y2;
342 y2 = y;
343 }
344
345 /* nothing to draw? */
346 if (((unsigned)x >= (unsigned)pixel_width) || (y1 >= pixel_height)
347 || (y2 < 0))
348 return;
349
350 /* clipping */
351 if (y1 < 0)
352 y1 = 0;
353 if (y2 >= pixel_height)
354 y2 = pixel_height - 1;
355
356 bfunc = pgfx_blockfuncs[drawmode];
357 dst = &gfx_buffer[pixel_height * (x/5) + y1];
358 mask = 0x10 >> (x % 5);
359
360 dst_end = dst + y2 - y1;
361 do
362 bfunc(dst++, mask, 0x1F);
363 while (dst <= dst_end);
364}
365
366/* Draw a rectangular box */
367void pgfx_drawrect(int x, int y, int width, int height)
368{
369 if ((width <= 0) || (height <= 0))
370 return;
371
372 int x2 = x + width - 1;
373 int y2 = y + height - 1;
374
375 pgfx_vline(x, y, y2);
376 pgfx_vline(x2, y, y2);
377 pgfx_hline(x, x2, y);
378 pgfx_hline(x, x2, y2);
379}
380
381/* Fill a rectangular area */
382void pgfx_fillrect(int x, int y, int width, int height)
383{
384 int nx;
385 unsigned char *dst, *dst_end;
386 unsigned mask, mask_right;
387 lcd_blockfunc_type *bfunc;
388
389 /* nothing to draw? */
390 if ((width <= 0) || (height <= 0) || (x >= pixel_width)
391 || (y >= pixel_height) || (x + width <= 0) || (y + height <= 0))
392 return;
393
394 /* clipping */
395 if (x < 0)
396 {
397 width += x;
398 x = 0;
399 }
400 if (y < 0)
401 {
402 height += y;
403 y = 0;
404 }
405 if (x + width > pixel_width)
406 width = pixel_width - x;
407 if (y + height > pixel_height)
408 height = pixel_height - y;
409
410 bfunc = pgfx_blockfuncs[drawmode];
411 dst = &gfx_buffer[pixel_height * (x/5) + y];
412 nx = width - 1 + (x % 5);
413 mask = 0x1F >> (x % 5);
414 mask_right = 0x1F0 >> (nx % 5);
415
416 for (; nx >= 5; nx -= 5)
417 {
418 unsigned char *dst_col = dst;
419
420 dst_end = dst_col + height;
421 do
422 bfunc(dst_col++, mask, 0x1F);
423 while (dst_col < dst_end);
424
425 dst += pixel_height;
426 mask = 0x1F;
427 }
428 mask &= mask_right;
429
430 dst_end = dst + height;
431 do
432 bfunc(dst++, mask, 0x1F);
433 while (dst < dst_end);
434}
435
436/* About PlayerGFX internal bitmap format:
437 *
438 * A bitmap contains one bit for every pixel that defines if that pixel is
439 * black (1) or white (0). Bits within a byte are arranged horizontally,
440 * MSB at the left.
441 * The bytes are stored in row-major order, with byte 0 being top left,
442 * byte 1 2nd from left etc. Each row of bytes defines one pixel row.
443 *
444 * This approximates the (even more strange) internal hardware format. */
445
446/* Draw a partial bitmap. stride is given in pixels */
447void pgfx_bitmap_part(const unsigned char *src, int src_x, int src_y,
448 int stride, int x, int y, int width, int height)
449{
450 int nx, shift;
451 unsigned char *dst, *dst_end;
452 unsigned mask, mask_right;
453 lcd_blockfunc_type *bfunc;
454
455 /* nothing to draw? */
456 if ((width <= 0) || (height <= 0) || (x >= pixel_width)
457 || (y >= pixel_height) || (x + width <= 0) || (y + height <= 0))
458 return;
459
460 /* clipping */
461 if (x < 0)
462 {
463 width += x;
464 src_x -= x;
465 x = 0;
466 }
467 if (y < 0)
468 {
469 height += y;
470 src_y -= y;
471 y = 0;
472 }
473 if (x + width > pixel_width)
474 width = pixel_width - x;
475 if (y + height > pixel_height)
476 height = pixel_height - y;
477
478 stride = (stride + 7) >> 3; /* convert to no. of bytes */
479
480 src += stride * src_y + (src_x >> 3); /* move starting point */
481 dst = &gfx_buffer[pixel_height * (x/5) + y];
482 shift = 3 + (x % 5) - (src_x & 7);
483 nx = width - 1 + (x % 5);
484
485 bfunc = pgfx_blockfuncs[drawmode];
486 mask = 0x1F >> (x % 5);
487 mask_right = 0x1F0 >> (nx % 5);
488
489 dst_end = dst + height;
490 do
491 {
492 const unsigned char *src_row = src;
493 unsigned char *dst_row = dst++;
494 unsigned mask_row = mask;
495 unsigned data = *src_row++;
496 int extrabits = shift;
497
498 for (x = nx; x >= 5; x -= 5)
499 {
500 if (extrabits < 0)
501 {
502 data = (data << 8) | *src_row++;
503 extrabits += 8;
504 }
505 bfunc(dst_row, mask_row, data >> extrabits);
506 extrabits -= 5;
507 dst_row += pixel_height;
508 mask_row = 0x1F;
509 }
510 if (extrabits < 0)
511 {
512 data = (data << 8) | *src_row;
513 extrabits += 8;
514 }
515 bfunc(dst_row, mask_row & mask_right, data >> extrabits);
516
517 src += stride;
518 }
519 while (dst < dst_end);
520}
521
522/* Draw a full bitmap */
523void pgfx_bitmap(const unsigned char *src, int x, int y, int width, int height)
524{
525 pgfx_bitmap_part(src, 0, 0, width, x, y, width, height);
526}
diff --git a/apps/plugins/lib/playergfx.h b/apps/plugins/lib/playergfx.h
deleted file mode 100644
index 9f1305af12..0000000000
--- a/apps/plugins/lib/playergfx.h
+++ /dev/null
@@ -1,55 +0,0 @@
1/***************************************************************************
2* __________ __ ___.
3* Open \______ \ ____ ____ | | _\_ |__ _______ ___
4* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7* \/ \/ \/ \/ \/
8* $Id$
9*
10* Bitmap graphics on player LCD!
11*
12* Copyright (C) 2005 Jens Arnold
13*
14* This program is free software; you can redistribute it and/or
15* modify it under the terms of the GNU General Public License
16* as published by the Free Software Foundation; either version 2
17* of the License, or (at your option) any later version.
18*
19* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
20* KIND, either express or implied.
21*
22****************************************************************************/
23
24#ifndef __PGFX_H__
25#define __PGFX_H__
26
27#include "plugin.h"
28
29#ifdef HAVE_LCD_CHARCELLS /* Player only :) */
30
31bool pgfx_init(int cwidth, int cheight);
32void pgfx_release(void);
33void pgfx_display(int cx, int cy);
34void pgfx_display_block(int cx, int cy, int x, int y);
35void pgfx_update(void);
36
37void pgfx_set_drawmode(int mode);
38int pgfx_get_drawmode(void);
39
40void pgfx_clear_display(void);
41void pgfx_drawpixel(int x, int y);
42void pgfx_drawline(int x1, int y1, int x2, int y2);
43void pgfx_hline(int x1, int x2, int y);
44void pgfx_vline(int x, int y1, int y2);
45void pgfx_drawrect(int x, int y, int width, int height);
46void pgfx_fillrect(int x, int y, int width, int height);
47void pgfx_bitmap_part(const unsigned char *src, int src_x, int src_y,
48 int stride, int x, int y, int width, int height);
49void pgfx_bitmap(const unsigned char *src, int x, int y, int width, int height);
50
51#define pgfx_mono_bitmap_part pgfx_bitmap_part
52#define pgfx_mono_bitmap pgfx_bitmap
53
54#endif /* HAVE_LCD_CHARCELLS */
55#endif /* __PGFX_H__ */
diff --git a/apps/plugins/lib/simple_viewer.c b/apps/plugins/lib/simple_viewer.c
index 6927d84a96..4c05ee68c5 100644
--- a/apps/plugins/lib/simple_viewer.c
+++ b/apps/plugins/lib/simple_viewer.c
@@ -64,17 +64,12 @@ static const char* get_next_line(const char *text, struct view_info *info)
64 total = 0; 64 total = 0;
65 while(*ptr) 65 while(*ptr)
66 { 66 {
67#ifdef HAVE_LCD_CHARCELLS
68 n = rb->utf8seek(ptr, 1);
69 w = 1;
70#else
71 unsigned short ch; 67 unsigned short ch;
72 n = ((intptr_t)rb->utf8decode(ptr, &ch) - (intptr_t)ptr); 68 n = ((intptr_t)rb->utf8decode(ptr, &ch) - (intptr_t)ptr);
73 if (rb->is_diacritic(ch, NULL)) 69 if (rb->is_diacritic(ch, NULL))
74 w = 0; 70 w = 0;
75 else 71 else
76 w = rb->font_get_width(info->pf, ch); 72 w = rb->font_get_width(info->pf, ch);
77#endif
78 if (isbrchr(ptr, n)) 73 if (isbrchr(ptr, n))
79 space = ptr+(isspace(*ptr) || total + w <= info->vp.width? n: 0); 74 space = ptr+(isspace(*ptr) || total + w <= info->vp.width? n: 0);
80 if (*ptr == '\n') 75 if (*ptr == '\n')
diff --git a/apps/plugins/logo.c b/apps/plugins/logo.c
index e1c570b6a5..60bed3b826 100644
--- a/apps/plugins/logo.c
+++ b/apps/plugins/logo.c
@@ -19,7 +19,6 @@
19 * 19 *
20 **************************************************************************/ 20 **************************************************************************/
21#include "plugin.h" 21#include "plugin.h"
22#include "lib/playergfx.h"
23#include "lib/pluginlib_actions.h" 22#include "lib/pluginlib_actions.h"
24 23
25/* this set the context to use with PLA */ 24/* this set the context to use with PLA */
@@ -81,19 +80,9 @@ enum plugin_status plugin_start(const void* parameter) {
81 int y = (DISPLAY_HEIGHT / 2) - (LOGO_HEIGHT / 2); 80 int y = (DISPLAY_HEIGHT / 2) - (LOGO_HEIGHT / 2);
82 int dx; 81 int dx;
83 int dy; 82 int dy;
84#ifdef HAVE_LCD_CHARCELLS
85 int cpos = -1;
86 int old_cpos = -1;
87#endif
88 83
89 (void)parameter; 84 (void)parameter;
90 85
91#ifdef HAVE_LCD_CHARCELLS
92 if (!pgfx_init(4, 2)) {
93 rb->splash(HZ*2, "Old LCD :(");
94 return PLUGIN_OK;
95 }
96#endif
97 rb->srand(*rb->current_tick); 86 rb->srand(*rb->current_tick);
98 dx = rb->rand()%(2*RAND_SCALE+1) - RAND_SCALE; 87 dx = rb->rand()%(2*RAND_SCALE+1) - RAND_SCALE;
99 dy = rb->rand()%(2*RAND_SCALE+1) - RAND_SCALE; 88 dy = rb->rand()%(2*RAND_SCALE+1) - RAND_SCALE;
@@ -159,9 +148,6 @@ enum plugin_status plugin_start(const void* parameter) {
159 switch (button) { 148 switch (button) {
160 case LP_QUIT: 149 case LP_QUIT:
161 case LP_QUIT2: 150 case LP_QUIT2:
162#ifdef HAVE_LCD_CHARCELLS
163 pgfx_release();
164#endif
165 return PLUGIN_OK; 151 return PLUGIN_OK;
166 case LP_DEC_X: 152 case LP_DEC_X:
167 case LP_DEC_X_REPEAT: 153 case LP_DEC_X_REPEAT:
@@ -184,9 +170,6 @@ enum plugin_status plugin_start(const void* parameter) {
184 170
185 default: 171 default:
186 if (rb->default_event_handler(button) == SYS_USB_CONNECTED) { 172 if (rb->default_event_handler(button) == SYS_USB_CONNECTED) {
187#ifdef HAVE_LCD_CHARCELLS
188 pgfx_release();
189#endif
190 return PLUGIN_USB_CONNECTED; 173 return PLUGIN_USB_CONNECTED;
191 } 174 }
192 break; 175 break;
diff --git a/apps/plugins/lrcplayer.c b/apps/plugins/lrcplayer.c
index eb441eab8d..1b017942a9 100644
--- a/apps/plugins/lrcplayer.c
+++ b/apps/plugins/lrcplayer.c
@@ -144,11 +144,7 @@ static struct viewport vp_lyrics[NB_SCREENS];
144 144
145#include "lib/pluginlib_actions.h" 145#include "lib/pluginlib_actions.h"
146#define LST_SET_TIME (LST_SET_MSEC|LST_SET_SEC|LST_SET_MIN|LST_SET_HOUR) 146#define LST_SET_TIME (LST_SET_MSEC|LST_SET_SEC|LST_SET_MIN|LST_SET_HOUR)
147#ifdef HAVE_LCD_CHARCELLS
148#define LST_OFF_Y 0
149#else /* HAVE_LCD_BITMAP */
150#define LST_OFF_Y 1 147#define LST_OFF_Y 1
151#endif
152static int lrc_set_time(const char *title, const char *unit, long *pval, 148static int lrc_set_time(const char *title, const char *unit, long *pval,
153 int step, int min, int max, int flags) 149 int step, int min, int max, int flags)
154{ 150{
@@ -229,17 +225,11 @@ static int lrc_set_time(const char *title, const char *unit, long *pval,
229 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); 225 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
230 rb->lcd_putsxy(x, y*(1+LST_OFF_Y), &buffer[p_start]); 226 rb->lcd_putsxy(x, y*(1+LST_OFF_Y), &buffer[p_start]);
231 rb->lcd_set_drawmode(DRMODE_SOLID); 227 rb->lcd_set_drawmode(DRMODE_SOLID);
232#else
233 rb->lcd_put_cursor(x+rb->utf8length(&buffer[p_start])-1, y, 0x7F);
234#endif 228#endif
235 } 229 }
236 rb->lcd_update(); 230 rb->lcd_update();
237 int button = pluginlib_getaction(TIMEOUT_BLOCK, lst_contexts, ARRAYLEN(lst_contexts)); 231 int button = pluginlib_getaction(TIMEOUT_BLOCK, lst_contexts, ARRAYLEN(lst_contexts));
238 int mult = 1; 232 int mult = 1;
239#ifdef HAVE_LCD_CHARCELLS
240 if (pos_min != pos_max)
241 rb->lcd_remove_cursor();
242#endif
243 switch (button) 233 switch (button)
244 { 234 {
245 case PLA_UP_REPEAT: 235 case PLA_UP_REPEAT:
@@ -452,9 +442,7 @@ static struct lrc_brpos *calc_brpos(struct lrc_line *lrc_line, int i)
452 int word_count, word_width; 442 int word_count, word_width;
453 const unsigned char *str; 443 const unsigned char *str;
454 } 444 }
455#ifndef HAVE_LCD_CHARCELLS
456 sp, 445 sp,
457#endif
458 cr; 446 cr;
459 447
460 lrc_buffer_used = (lrc_buffer_used+3)&~3; /* 4 bytes aligned */ 448 lrc_buffer_used = (lrc_buffer_used+3)&~3; /* 4 bytes aligned */
@@ -514,19 +502,15 @@ static struct lrc_brpos *calc_brpos(struct lrc_line *lrc_line, int i)
514 cr.nword = lrc_line->nword; 502 cr.nword = lrc_line->nword;
515 lrc_word = lrc_line->words+cr.nword; 503 lrc_word = lrc_line->words+cr.nword;
516 cr.str = (lrc_word-1)->word; 504 cr.str = (lrc_word-1)->word;
517#ifndef HAVE_LCD_CHARCELLS
518 sp.word_count = 0; 505 sp.word_count = 0;
519 sp.word_width = 0; 506 sp.word_width = 0;
520 sp.nword = 0; 507 sp.nword = 0;
521 sp.count = 0; 508 sp.count = 0;
522 sp.width = 0; 509 sp.width = 0;
523#endif
524 do { 510 do {
525 cr.count = 0; 511 cr.count = 0;
526 cr.width = 0; 512 cr.width = 0;
527#ifndef HAVE_LCD_CHARCELLS
528 sp.str = NULL; 513 sp.str = NULL;
529#endif
530 514
531 while (1) 515 while (1)
532 { 516 {
@@ -541,10 +525,6 @@ static struct lrc_brpos *calc_brpos(struct lrc_line *lrc_line, int i)
541 break; 525 break;
542 526
543 int c, w; 527 int c, w;
544#ifdef HAVE_LCD_CHARCELLS
545 c = rb->utf8seek(cr.str, 1);
546 w = 1;
547#else
548 c = ((intptr_t)rb->utf8decode(cr.str, &ch) - (intptr_t)cr.str); 528 c = ((intptr_t)rb->utf8decode(cr.str, &ch) - (intptr_t)cr.str);
549 if (rb->is_diacritic(ch, NULL)) 529 if (rb->is_diacritic(ch, NULL))
550 w = 0; 530 w = 0;
@@ -576,7 +556,6 @@ static struct lrc_brpos *calc_brpos(struct lrc_line *lrc_line, int i)
576 } 556 }
577 break; 557 break;
578 } 558 }
579#endif
580 cr.count += c; 559 cr.count += c;
581 cr.width += w; 560 cr.width += w;
582 lrc_word->count += c; 561 lrc_word->count += c;
@@ -1916,38 +1895,6 @@ static void display_lrcs(void)
1916 } 1895 }
1917 if (!lrc_line && ypos < vp_lyrics[i].height) 1896 if (!lrc_line && ypos < vp_lyrics[i].height)
1918 display->putsxy(0, ypos, "[end]"); 1897 display->putsxy(0, ypos, "[end]");
1919#else /* HAVE_LCD_CHARCELLS */
1920 struct lrc_line *lrc_line = lrc_center;
1921 struct lrc_brpos *lrc_brpos = calc_brpos(lrc_line, i);
1922 long elapsed = 0;
1923 const char *str = get_lrc_str(lrc_line);
1924 int x = vp_lyrics[i].width/2, y = 0;
1925
1926 if (rin >= 0 && len > 0)
1927 {
1928 elapsed = rin * lrc_center->width / len;
1929 while (elapsed > lrc_brpos->width)
1930 {
1931 elapsed -= lrc_brpos->width;
1932 str = lrc_skip_space(str+lrc_brpos->count);
1933 lrc_brpos++;
1934 }
1935 }
1936 rb->strlcpy(temp_buf, str, lrc_brpos->count+1);
1937
1938 x -= elapsed;
1939 if (x < 0)
1940 display->puts(0, y, temp_buf + rb->utf8seek(temp_buf, -x));
1941 else
1942 display->puts(x, y, temp_buf);
1943 x += rb->utf8length(temp_buf)+1;
1944 lrc_line = lrc_line->next;
1945 if (!lrc_line && x < vp_lyrics[i].width)
1946 {
1947 if (x < vp_lyrics[i].width/2)
1948 x = vp_lyrics[i].width/2;
1949 display->puts(x, y, "[end]");
1950 }
1951#endif /* HAVE_LCD_BITMAP */ 1898#endif /* HAVE_LCD_BITMAP */
1952 display->update_viewport(); 1899 display->update_viewport();
1953 display->set_viewport(NULL); 1900 display->set_viewport(NULL);
diff --git a/apps/plugins/metronome.c b/apps/plugins/metronome.c
index 02217390cd..75947df618 100644
--- a/apps/plugins/metronome.c
+++ b/apps/plugins/metronome.c
@@ -1022,12 +1022,7 @@ static void play_tock(void)
1022static void metronome_draw(struct screen* display, int state) 1022static void metronome_draw(struct screen* display, int state)
1023{ 1023{
1024 struct part *ps; 1024 struct part *ps;
1025#ifndef HAVE_LCD_BITMAP
1026 char beat1 = ' ';
1027 char beat2 = ' ';
1028#else
1029 int textlen = display->lcdwidth / display->getcharwidth(); 1025 int textlen = display->lcdwidth / display->getcharwidth();
1030#endif
1031 ps = part; 1026 ps = part;
1032 display->clear_display(); 1027 display->clear_display();
1033#ifdef HAVE_LCD_BITMAP 1028#ifdef HAVE_LCD_BITMAP
diff --git a/apps/plugins/mosaique.c b/apps/plugins/mosaique.c
index 68938a1f13..28ea9efd93 100644
--- a/apps/plugins/mosaique.c
+++ b/apps/plugins/mosaique.c
@@ -19,7 +19,6 @@
19 * 19 *
20 **************************************************************************/ 20 **************************************************************************/
21#include "plugin.h" 21#include "plugin.h"
22#include "lib/playergfx.h"
23#include "lib/mylcd.h" 22#include "lib/mylcd.h"
24#include "lib/pluginlib_actions.h" 23#include "lib/pluginlib_actions.h"
25 24
@@ -59,14 +58,6 @@ enum plugin_status plugin_start(const void* parameter)
59 int sy = 3; 58 int sy = 3;
60 (void)parameter; 59 (void)parameter;
61 60
62#ifdef HAVE_LCD_CHARCELLS
63 if (!pgfx_init(4, 2))
64 {
65 rb->splash(HZ*2, "Old LCD :(");
66 return PLUGIN_OK;
67 }
68 pgfx_display(3, 0);
69#endif
70 mylcd_clear_display(); 61 mylcd_clear_display();
71 mylcd_set_drawmode(DRMODE_COMPLEMENT); 62 mylcd_set_drawmode(DRMODE_COMPLEMENT);
72 while (1) { 63 while (1) {
@@ -117,9 +108,6 @@ enum plugin_status plugin_start(const void* parameter)
117 case MOSAIQUE_QUIT: 108 case MOSAIQUE_QUIT:
118 case MOSAIQUE_QUIT2: 109 case MOSAIQUE_QUIT2:
119 mylcd_set_drawmode(DRMODE_SOLID); 110 mylcd_set_drawmode(DRMODE_SOLID);
120#ifdef HAVE_LCD_CHARCELLS
121 pgfx_release();
122#endif
123 return PLUGIN_OK; 111 return PLUGIN_OK;
124 112
125 case MOSAIQUE_SPEED: 113 case MOSAIQUE_SPEED:
@@ -142,9 +130,6 @@ enum plugin_status plugin_start(const void* parameter)
142 if (rb->default_event_handler(button) == SYS_USB_CONNECTED) 130 if (rb->default_event_handler(button) == SYS_USB_CONNECTED)
143 { 131 {
144 mylcd_set_drawmode(DRMODE_SOLID); 132 mylcd_set_drawmode(DRMODE_SOLID);
145#ifdef HAVE_LCD_CHARCELLS
146 pgfx_release();
147#endif
148 return PLUGIN_USB_CONNECTED; 133 return PLUGIN_USB_CONNECTED;
149 } 134 }
150 break; 135 break;
diff --git a/apps/plugins/random_folder_advance_config.c b/apps/plugins/random_folder_advance_config.c
index add1fc5724..68440e4602 100644
--- a/apps/plugins/random_folder_advance_config.c
+++ b/apps/plugins/random_folder_advance_config.c
@@ -229,9 +229,7 @@ static void generate(void)
229 rb->splashf(HZ, "Couldnt open %s", RFA_FILE); 229 rb->splashf(HZ, "Couldnt open %s", RFA_FILE);
230 return; 230 return;
231 } 231 }
232#ifndef HAVE_LCD_CHARCELLS
233 update_screen(true); 232 update_screen(true);
234#endif
235 lasttick = *rb->current_tick; 233 lasttick = *rb->current_tick;
236 234
237 if(!custom_dir()) 235 if(!custom_dir())
diff --git a/apps/plugins/rockblox.c b/apps/plugins/rockblox.c
index 1732d61277..c7968c3e20 100644
--- a/apps/plugins/rockblox.c
+++ b/apps/plugins/rockblox.c
@@ -25,7 +25,6 @@
25#include "lib/helper.h" 25#include "lib/helper.h"
26#include "lib/highscore.h" 26#include "lib/highscore.h"
27#include "lib/playback_control.h" 27#include "lib/playback_control.h"
28#include "lib/playergfx.h"
29#include "lib/mylcd.h" 28#include "lib/mylcd.h"
30 29
31 30
@@ -770,17 +769,8 @@
770 769
771extern const fb_data rockblox_background[]; 770extern const fb_data rockblox_background[];
772 771
773#else /* HAVE_LCD_CHARCELLS */ 772#else
774 773#error "lcd screen size not defined!"
775#define BOARD_HEIGHT 14
776
777#define BLOCK_WIDTH 1
778#define BLOCK_HEIGHT 1
779#define BOARD_X 5
780#define BOARD_Y 0
781#define PREVIEW_X 15
782#define PREVIEW_Y 1
783
784#endif 774#endif
785 775
786#ifndef HIGHSCORE_SPACE 776#ifndef HIGHSCORE_SPACE
@@ -992,10 +982,6 @@ static void show_details (void)
992 rb->lcd_putsxyf (LABEL_X, SCORE_Y, "%d", rockblox_status.score); 982 rb->lcd_putsxyf (LABEL_X, SCORE_Y, "%d", rockblox_status.score);
993 rb->lcd_putsxyf (LEVEL_X, LEVEL_Y, "%d", rockblox_status.level); 983 rb->lcd_putsxyf (LEVEL_X, LEVEL_Y, "%d", rockblox_status.level);
994 rb->lcd_putsxyf (LINES_X, LINES_Y, "%d", rockblox_status.lines); 984 rb->lcd_putsxyf (LINES_X, LINES_Y, "%d", rockblox_status.lines);
995#else /* HAVE_LCD_CHARCELLS */
996 rb->lcd_putsf (5, 0, "L%d/%d", rockblox_status.level,
997 rockblox_status.lines);
998 rb->lcd_putsf (5, 1, "S%d", rockblox_status.score);
999#endif 985#endif
1000} 986}
1001 987
@@ -1066,15 +1052,6 @@ static void init_rockblox (bool resume)
1066 1052
1067#ifdef HAVE_LCD_BITMAP 1053#ifdef HAVE_LCD_BITMAP
1068 rb->lcd_bitmap (rockblox_background, 0, 0, LCD_WIDTH, LCD_HEIGHT); 1054 rb->lcd_bitmap (rockblox_background, 0, 0, LCD_WIDTH, LCD_HEIGHT);
1069#else /* HAVE_LCD_CHARCELLS */
1070 pgfx_display (0, 0);
1071 pgfx_display_block (3, 0, 3, 1);
1072 pgfx_display_block (4, 0, 3, 0);
1073 rb->lcd_puts(4, 1, " ");
1074 pgfx_clear_display();
1075 pgfx_fillrect (3, 0, 2, 14);
1076 pgfx_fillrect (15, 7, 2, 7);
1077 pgfx_update();
1078#endif 1055#endif
1079 if (!resume) 1056 if (!resume)
1080 { 1057 {
@@ -1200,8 +1177,6 @@ static void refresh_board (void)
1200 rb->lcd_hline (BOARD_X + i * BLOCK_WIDTH + 1, 1177 rb->lcd_hline (BOARD_X + i * BLOCK_WIDTH + 1,
1201 BOARD_X + (i + 1) * BLOCK_WIDTH - 1, 1178 BOARD_X + (i + 1) * BLOCK_WIDTH - 1,
1202 BOARD_Y + (j + 1) * BLOCK_HEIGHT - 1); 1179 BOARD_Y + (j + 1) * BLOCK_HEIGHT - 1);
1203#else /* HAVE_LCD_CHARCELLS */
1204 pgfx_drawpixel (BOARD_X + i, BOARD_Y + j);
1205#endif 1180#endif
1206 } 1181 }
1207 } 1182 }
@@ -1246,8 +1221,6 @@ static void refresh_board (void)
1246 rb->lcd_hline (BOARD_X + x * BLOCK_WIDTH + 1, 1221 rb->lcd_hline (BOARD_X + x * BLOCK_WIDTH + 1,
1247 BOARD_X + (x + 1) * BLOCK_WIDTH - 1, 1222 BOARD_X + (x + 1) * BLOCK_WIDTH - 1,
1248 BOARD_Y + (y + 1) * BLOCK_HEIGHT - 1); 1223 BOARD_Y + (y + 1) * BLOCK_HEIGHT - 1);
1249#else /* HAVE_LCD_CHARCELLS */
1250 pgfx_drawpixel (BOARD_X + x, BOARD_Y + y);
1251#endif 1224#endif
1252 } 1225 }
1253 1226
@@ -1285,8 +1258,6 @@ static void refresh_board (void)
1285 rb->lcd_hline (BOARD_X + x * BLOCK_WIDTH + 1, 1258 rb->lcd_hline (BOARD_X + x * BLOCK_WIDTH + 1,
1286 BOARD_X + (x + 1) * BLOCK_WIDTH - 1, 1259 BOARD_X + (x + 1) * BLOCK_WIDTH - 1,
1287 BOARD_Y + (y + 1) * BLOCK_HEIGHT - 1); 1260 BOARD_Y + (y + 1) * BLOCK_HEIGHT - 1);
1288#else /* HAVE_LCD_CHARCELLS */
1289 pgfx_drawpixel (BOARD_X + x, BOARD_Y + y);
1290#endif 1261#endif
1291 } 1262 }
1292 1263
@@ -1355,8 +1326,6 @@ static void draw_next_block (void)
1355 rb->lcd_hline (PREVIEW_X + rx * BLOCK_WIDTH + 1, 1326 rb->lcd_hline (PREVIEW_X + rx * BLOCK_WIDTH + 1,
1356 PREVIEW_X + (rx + 1) * BLOCK_WIDTH - 1, 1327 PREVIEW_X + (rx + 1) * BLOCK_WIDTH - 1,
1357 PREVIEW_Y + (ry + 1) * BLOCK_HEIGHT - 1); 1328 PREVIEW_Y + (ry + 1) * BLOCK_HEIGHT - 1);
1358#else /* HAVE_LCD_CHARCELLS */
1359 pgfx_drawpixel (PREVIEW_X + rx, PREVIEW_Y + ry);
1360#endif 1329#endif
1361 } 1330 }
1362 1331
@@ -1787,9 +1756,6 @@ enum plugin_status plugin_start (const void *parameter)
1787 } 1756 }
1788 } 1757 }
1789 1758
1790#ifndef HAVE_LCD_BITMAP
1791 pgfx_release();
1792#endif
1793 /* Save user's HighScore */ 1759 /* Save user's HighScore */
1794 highscore_save(SCORE_FILE, highscores, NUM_SCORES); 1760 highscore_save(SCORE_FILE, highscores, NUM_SCORES);
1795 backlight_use_settings(); 1761 backlight_use_settings();
diff --git a/apps/plugins/snow.c b/apps/plugins/snow.c
index 74efb8ea00..f05d3c2a44 100644
--- a/apps/plugins/snow.c
+++ b/apps/plugins/snow.c
@@ -19,7 +19,6 @@
19 * 19 *
20 **************************************************************************/ 20 **************************************************************************/
21#include "plugin.h" 21#include "plugin.h"
22#include "lib/playergfx.h"
23#include "lib/mylcd.h" 22#include "lib/mylcd.h"
24#include "lib/pluginlib_actions.h" 23#include "lib/pluginlib_actions.h"
25 24
@@ -143,11 +142,6 @@ static void snow_init(void)
143 particles[i][0]=-1; 142 particles[i][0]=-1;
144 particles[i][1]=-1; 143 particles[i][1]=-1;
145 } 144 }
146#ifdef HAVE_LCD_CHARCELLS
147 pgfx_display(0, 0); /* display three times */
148 pgfx_display(4, 0);
149 pgfx_display(8, 0);
150#endif
151 mylcd_clear_display(); 145 mylcd_clear_display();
152#ifdef HAVE_REMOTE_LCD 146#ifdef HAVE_REMOTE_LCD
153 rb->lcd_remote_clear_display(); 147 rb->lcd_remote_clear_display();
@@ -159,13 +153,6 @@ enum plugin_status plugin_start(const void* parameter)
159 int button; 153 int button;
160 (void)(parameter); 154 (void)(parameter);
161 155
162#ifdef HAVE_LCD_CHARCELLS
163 if (!pgfx_init(4, 2))
164 {
165 rb->splash(HZ*2, "Old LCD :(");
166 return PLUGIN_OK;
167 }
168#endif
169#ifdef HAVE_LCD_COLOR 156#ifdef HAVE_LCD_COLOR
170 rb->lcd_clear_display(); 157 rb->lcd_clear_display();
171 rb->lcd_set_foreground(LCD_WHITE); 158 rb->lcd_set_foreground(LCD_WHITE);
@@ -186,17 +173,11 @@ enum plugin_status plugin_start(const void* parameter)
186 173
187 if ((button == SNOW_QUIT) || (button == SNOW_QUIT2)) 174 if ((button == SNOW_QUIT) || (button == SNOW_QUIT2))
188 { 175 {
189#ifdef HAVE_LCD_CHARCELLS
190 pgfx_release();
191#endif
192 return PLUGIN_OK; 176 return PLUGIN_OK;
193 } 177 }
194 else 178 else
195 if (rb->default_event_handler(button) == SYS_USB_CONNECTED) 179 if (rb->default_event_handler(button) == SYS_USB_CONNECTED)
196 { 180 {
197#ifdef HAVE_LCD_CHARCELLS
198 pgfx_release();
199#endif
200 return PLUGIN_USB_CONNECTED; 181 return PLUGIN_USB_CONNECTED;
201 } 182 }
202 } 183 }
diff --git a/apps/plugins/text_viewer/tv_display.c b/apps/plugins/text_viewer/tv_display.c
index 1f8499bed2..d6175b79cf 100644
--- a/apps/plugins/text_viewer/tv_display.c
+++ b/apps/plugins/text_viewer/tv_display.c
@@ -69,11 +69,6 @@
69#define TV_SCROLLBAR_WIDTH rb->global_settings->scrollbar_width 69#define TV_SCROLLBAR_WIDTH rb->global_settings->scrollbar_width
70#define TV_SCROLLBAR_HEIGHT 4 70#define TV_SCROLLBAR_HEIGHT 4
71 71
72
73#ifndef HAVE_LCD_BITMAP
74#define TV_BOOKMARK_ICON 0xe101
75#endif
76
77struct tv_rect { 72struct tv_rect {
78 int x; 73 int x;
79 int y; 74 int y;