diff options
author | Thomas Martitz <kugel@rockbox.org> | 2013-12-13 10:24:15 +0100 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2014-03-10 22:55:26 +0100 |
commit | 50f0dd80d660b332a1739e07a630c2cef1b678c6 (patch) | |
tree | d06ff8c644092167028e0582911ab3550b29ca66 /apps/gui/skin_engine | |
parent | 4262e648eb3adbd502ea57319d3fd27103a4f267 (diff) | |
download | rockbox-50f0dd80d660b332a1739e07a630c2cef1b678c6.tar.gz rockbox-50f0dd80d660b332a1739e07a630c2cef1b678c6.zip |
ab_repeat: Move GUI bits to the skin engine. This allows ab_repeat to be compiled headless.
Change-Id: I4fa3b8ef7139313891ca70df11f7f17c5df38cb7
Diffstat (limited to 'apps/gui/skin_engine')
-rwxr-xr-x | apps/gui/skin_engine/skin_display.c | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/apps/gui/skin_engine/skin_display.c b/apps/gui/skin_engine/skin_display.c index 137bced19b..60557bba0d 100755 --- a/apps/gui/skin_engine/skin_display.c +++ b/apps/gui/skin_engine/skin_display.c | |||
@@ -97,6 +97,73 @@ void skin_update(enum skinnable_screens skin, enum screen_type screen, | |||
97 | 97 | ||
98 | #ifdef HAVE_LCD_BITMAP | 98 | #ifdef HAVE_LCD_BITMAP |
99 | 99 | ||
100 | |||
101 | #ifdef AB_REPEAT_ENABLE | ||
102 | |||
103 | #define DIRECTION_RIGHT 1 | ||
104 | #define DIRECTION_LEFT -1 | ||
105 | |||
106 | static int ab_calc_mark_x_pos(int mark, int capacity, | ||
107 | int offset, int size) | ||
108 | { | ||
109 | return offset + ( (size * mark) / capacity ); | ||
110 | } | ||
111 | |||
112 | static void ab_draw_vertical_line_mark(struct screen * screen, | ||
113 | int x, int y, int h) | ||
114 | { | ||
115 | screen->set_drawmode(DRMODE_COMPLEMENT); | ||
116 | screen->vline(x, y, y+h-1); | ||
117 | } | ||
118 | |||
119 | static void ab_draw_arrow_mark(struct screen * screen, | ||
120 | int x, int y, int h, int direction) | ||
121 | { | ||
122 | /* draw lines in decreasing size until a height of zero is reached */ | ||
123 | screen->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | ||
124 | while( h > 0 ) | ||
125 | { | ||
126 | screen->vline(x, y, y+h-1); | ||
127 | h -= 2; | ||
128 | y++; | ||
129 | x += direction; | ||
130 | screen->set_drawmode(DRMODE_COMPLEMENT); | ||
131 | } | ||
132 | } | ||
133 | |||
134 | void ab_draw_markers(struct screen * screen, int capacity, | ||
135 | int x, int y, int w, int h) | ||
136 | { | ||
137 | bool a_set, b_set; | ||
138 | unsigned int a, b; | ||
139 | int xa, xb; | ||
140 | |||
141 | a_set = ab_get_A_marker(&a); | ||
142 | b_set = ab_get_B_marker(&b); | ||
143 | xa = ab_calc_mark_x_pos(a, capacity, x, w); | ||
144 | xb = ab_calc_mark_x_pos(b, capacity, x, w); | ||
145 | /* if both markers are set, determine if they're far enough apart | ||
146 | to draw arrows */ | ||
147 | if ( a_set && b_set ) | ||
148 | { | ||
149 | int arrow_width = (h+1) / 2; | ||
150 | if ( (xb-xa) < (arrow_width*2) ) | ||
151 | { | ||
152 | ab_draw_vertical_line_mark(screen, xa, y, h); | ||
153 | ab_draw_vertical_line_mark(screen, xb, y, h); | ||
154 | return; | ||
155 | } | ||
156 | } | ||
157 | |||
158 | if (a_set) | ||
159 | ab_draw_arrow_mark(screen, xa, y, h, DIRECTION_RIGHT); | ||
160 | |||
161 | if (b_set) | ||
162 | ab_draw_arrow_mark(screen, xb, y, h, DIRECTION_LEFT); | ||
163 | } | ||
164 | |||
165 | #endif | ||
166 | |||
100 | void draw_progressbar(struct gui_wps *gwps, int line, struct progressbar *pb) | 167 | void draw_progressbar(struct gui_wps *gwps, int line, struct progressbar *pb) |
101 | { | 168 | { |
102 | struct screen *display = gwps->display; | 169 | struct screen *display = gwps->display; |