diff options
-rw-r--r-- | firmware/drivers/lcd-16bit.c | 54 | ||||
-rw-r--r-- | firmware/drivers/lcd-1bit-vert.c | 13 | ||||
-rw-r--r-- | firmware/drivers/lcd-2bit-horz.c | 90 | ||||
-rw-r--r-- | firmware/drivers/lcd-2bit-vert.c | 88 | ||||
-rw-r--r-- | firmware/drivers/lcd-2bit-vi.c | 13 | ||||
-rw-r--r-- | firmware/drivers/lcd-remote-1bit-v.c | 1 | ||||
-rw-r--r-- | firmware/drivers/lcd-remote-2bit-vi.c | 1 |
7 files changed, 140 insertions, 120 deletions
diff --git a/firmware/drivers/lcd-16bit.c b/firmware/drivers/lcd-16bit.c index 20d30c572c..dab29efef7 100644 --- a/firmware/drivers/lcd-16bit.c +++ b/firmware/drivers/lcd-16bit.c | |||
@@ -204,32 +204,27 @@ int lcd_getstringsize(const unsigned char *str, int *w, int *h) | |||
204 | 204 | ||
205 | #define LCDADDR(x, y) (&lcd_framebuffer[(y)][(x)]) | 205 | #define LCDADDR(x, y) (&lcd_framebuffer[(y)][(x)]) |
206 | 206 | ||
207 | static void setpixel(fb_data *address) ICODE_ATTR; | 207 | static void ICODE_ATTR setpixel(fb_data *address) |
208 | static void setpixel(fb_data *address) | ||
209 | { | 208 | { |
210 | *address = current_vp->fg_pattern; | 209 | *address = current_vp->fg_pattern; |
211 | } | 210 | } |
212 | 211 | ||
213 | static void clearpixel(fb_data *address) ICODE_ATTR; | 212 | static void ICODE_ATTR clearpixel(fb_data *address) |
214 | static void clearpixel(fb_data *address) | ||
215 | { | 213 | { |
216 | *address = current_vp->bg_pattern; | 214 | *address = current_vp->bg_pattern; |
217 | } | 215 | } |
218 | 216 | ||
219 | static void clearimgpixel(fb_data *address) ICODE_ATTR; | 217 | static void ICODE_ATTR clearimgpixel(fb_data *address) |
220 | static void clearimgpixel(fb_data *address) | ||
221 | { | 218 | { |
222 | *address = *(fb_data *)((long)address + lcd_backdrop_offset); | 219 | *address = *(fb_data *)((long)address + lcd_backdrop_offset); |
223 | } | 220 | } |
224 | 221 | ||
225 | static void flippixel(fb_data *address) ICODE_ATTR; | 222 | static void ICODE_ATTR flippixel(fb_data *address) |
226 | static void flippixel(fb_data *address) | ||
227 | { | 223 | { |
228 | *address = ~(*address); | 224 | *address = ~(*address); |
229 | } | 225 | } |
230 | 226 | ||
231 | static void nopixel(fb_data *address) ICODE_ATTR; | 227 | static void ICODE_ATTR nopixel(fb_data *address) |
232 | static void nopixel(fb_data *address) | ||
233 | { | 228 | { |
234 | (void)address; | 229 | (void)address; |
235 | } | 230 | } |
@@ -349,8 +344,20 @@ void lcd_drawline(int x1, int y1, int x2, int y2) | |||
349 | int y, yinc1, yinc2; | 344 | int y, yinc1, yinc2; |
350 | lcd_fastpixelfunc_type *pfunc = lcd_fastpixelfuncs[current_vp->drawmode]; | 345 | lcd_fastpixelfunc_type *pfunc = lcd_fastpixelfuncs[current_vp->drawmode]; |
351 | 346 | ||
352 | deltax = abs(x2 - x1); | ||
353 | deltay = abs(y2 - y1); | 347 | deltay = abs(y2 - y1); |
348 | if (deltay == 0) | ||
349 | { | ||
350 | DEBUGF("lcd_drawline() called for horizontal line - optimisation.\n"); | ||
351 | lcd_hline(x1, x2, y1); | ||
352 | return; | ||
353 | } | ||
354 | deltax = abs(x2 - x1); | ||
355 | if (deltax == 0) | ||
356 | { | ||
357 | DEBUGF("lcd_drawline() called for vertical line - optimisation.\n"); | ||
358 | lcd_vline(x1, y1, y2); | ||
359 | return; | ||
360 | } | ||
354 | xinc2 = 1; | 361 | xinc2 = 1; |
355 | yinc2 = 1; | 362 | yinc2 = 1; |
356 | 363 | ||
@@ -699,11 +706,9 @@ static void lcd_gradient_rect_scroll(int x1, int x2, int y, int h, | |||
699 | 706 | ||
700 | /* Draw a partial monochrome bitmap */ | 707 | /* Draw a partial monochrome bitmap */ |
701 | 708 | ||
702 | void lcd_mono_bitmap_part(const unsigned char *src, int src_x, int src_y, | 709 | void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x, |
703 | int stride, int x, int y, int width, int height) | 710 | int src_y, int stride, int x, int y, |
704 | ICODE_ATTR; | 711 | int width, int height) |
705 | void lcd_mono_bitmap_part(const unsigned char *src, int src_x, int src_y, | ||
706 | int stride, int x, int y, int width, int height) | ||
707 | { | 712 | { |
708 | const unsigned char *src_end; | 713 | const unsigned char *src_end; |
709 | bool has_backdrop; | 714 | bool has_backdrop; |
@@ -798,11 +803,9 @@ void lcd_mono_bitmap(const unsigned char *src, int x, int y, int width, int heig | |||
798 | } | 803 | } |
799 | 804 | ||
800 | /* Draw a partial native bitmap */ | 805 | /* Draw a partial native bitmap */ |
801 | void lcd_bitmap_part(const fb_data *src, int src_x, int src_y, | 806 | void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y, |
802 | int stride, int x, int y, int width, int height) | 807 | int stride, int x, int y, int width, |
803 | ICODE_ATTR; | 808 | int height) |
804 | void lcd_bitmap_part(const fb_data *src, int src_x, int src_y, | ||
805 | int stride, int x, int y, int width, int height) | ||
806 | { | 809 | { |
807 | fb_data *dst, *dst_end; | 810 | fb_data *dst, *dst_end; |
808 | 811 | ||
@@ -851,12 +854,9 @@ void lcd_bitmap(const fb_data *src, int x, int y, int width, int height) | |||
851 | #if !defined(TOSHIBA_GIGABEAT_F) && !defined(TOSHIBA_GIGABEAT_S) \ | 854 | #if !defined(TOSHIBA_GIGABEAT_F) && !defined(TOSHIBA_GIGABEAT_S) \ |
852 | || defined(SIMULATOR) | 855 | || defined(SIMULATOR) |
853 | /* Draw a partial native bitmap */ | 856 | /* Draw a partial native bitmap */ |
854 | void lcd_bitmap_transparent_part(const fb_data *src, int src_x, int src_y, | 857 | void ICODE_ATTR lcd_bitmap_transparent_part(const fb_data *src, int src_x, |
855 | int stride, int x, int y, int width, | 858 | int src_y, int stride, int x, |
856 | int height) ICODE_ATTR; | 859 | int y, int width, int height) |
857 | void lcd_bitmap_transparent_part(const fb_data *src, int src_x, int src_y, | ||
858 | int stride, int x, int y, int width, | ||
859 | int height) | ||
860 | { | 860 | { |
861 | fb_data *dst, *dst_end; | 861 | fb_data *dst, *dst_end; |
862 | 862 | ||
diff --git a/firmware/drivers/lcd-1bit-vert.c b/firmware/drivers/lcd-1bit-vert.c index 3a6e59c461..c6fe40cdb7 100644 --- a/firmware/drivers/lcd-1bit-vert.c +++ b/firmware/drivers/lcd-1bit-vert.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #define LCDFN(fn) lcd_ ## fn | 36 | #define LCDFN(fn) lcd_ ## fn |
37 | #define FBFN(fn) fb_ ## fn | 37 | #define FBFN(fn) fb_ ## fn |
38 | #define LCDM(ma) LCD_ ## ma | 38 | #define LCDM(ma) LCD_ ## ma |
39 | #define LCDNAME "lcd_" | ||
39 | #define MAIN_LCD | 40 | #define MAIN_LCD |
40 | #endif | 41 | #endif |
41 | 42 | ||
@@ -290,7 +291,19 @@ void LCDFN(drawline)(int x1, int y1, int x2, int y2) | |||
290 | LCDFN(pixelfunc_type) *pfunc = LCDFN(pixelfuncs)[current_vp->drawmode]; | 291 | LCDFN(pixelfunc_type) *pfunc = LCDFN(pixelfuncs)[current_vp->drawmode]; |
291 | 292 | ||
292 | deltax = abs(x2 - x1); | 293 | deltax = abs(x2 - x1); |
294 | if (deltax == 0) | ||
295 | { | ||
296 | DEBUGF(LCDNAME "drawline() called for vertical line - optimisation.\n"); | ||
297 | LCDFN(vline)(x1, y1, y2); | ||
298 | return; | ||
299 | } | ||
293 | deltay = abs(y2 - y1); | 300 | deltay = abs(y2 - y1); |
301 | if (deltay == 0) | ||
302 | { | ||
303 | DEBUGF(LCDNAME "drawline() called for horizontal line - optimisation.\n"); | ||
304 | LCDFN(hline)(x1, x2, y1); | ||
305 | return; | ||
306 | } | ||
294 | xinc2 = 1; | 307 | xinc2 = 1; |
295 | yinc2 = 1; | 308 | yinc2 = 1; |
296 | 309 | ||
diff --git a/firmware/drivers/lcd-2bit-horz.c b/firmware/drivers/lcd-2bit-horz.c index 195885c072..30901efb98 100644 --- a/firmware/drivers/lcd-2bit-horz.c +++ b/firmware/drivers/lcd-2bit-horz.c | |||
@@ -239,43 +239,38 @@ lcd_pixelfunc_type* const * lcd_pixelfuncs = lcd_pixelfuncs_bgcolor; | |||
239 | 239 | ||
240 | 240 | ||
241 | /* 'mask' and 'bits' contain 2 bits per pixel */ | 241 | /* 'mask' and 'bits' contain 2 bits per pixel */ |
242 | static void flipblock(fb_data *address, unsigned mask, unsigned bits) | 242 | static void ICODE_ATTR flipblock(fb_data *address, unsigned mask, |
243 | ICODE_ATTR; | 243 | unsigned bits) |
244 | static void flipblock(fb_data *address, unsigned mask, unsigned bits) | ||
245 | { | 244 | { |
246 | *address ^= bits & mask; | 245 | *address ^= bits & mask; |
247 | } | 246 | } |
248 | 247 | ||
249 | static void bgblock(fb_data *address, unsigned mask, unsigned bits) | 248 | static void ICODE_ATTR bgblock(fb_data *address, unsigned mask, |
250 | ICODE_ATTR; | 249 | unsigned bits) |
251 | static void bgblock(fb_data *address, unsigned mask, unsigned bits) | ||
252 | { | 250 | { |
253 | unsigned data = *address; | 251 | unsigned data = *address; |
254 | 252 | ||
255 | *address = data ^ ((data ^ bg_pattern) & mask & ~bits); | 253 | *address = data ^ ((data ^ bg_pattern) & mask & ~bits); |
256 | } | 254 | } |
257 | 255 | ||
258 | static void bgimgblock(fb_data *address, unsigned mask, unsigned bits) | 256 | static void ICODE_ATTR bgimgblock(fb_data *address, unsigned mask, |
259 | ICODE_ATTR; | 257 | unsigned bits) |
260 | static void bgimgblock(fb_data *address, unsigned mask, unsigned bits) | ||
261 | { | 258 | { |
262 | unsigned data = *address; | 259 | unsigned data = *address; |
263 | 260 | ||
264 | *address = data ^ ((data ^ *(address + lcd_backdrop_offset)) & mask & ~bits); | 261 | *address = data ^ ((data ^ *(address + lcd_backdrop_offset)) & mask & ~bits); |
265 | } | 262 | } |
266 | 263 | ||
267 | static void fgblock(fb_data *address, unsigned mask, unsigned bits) | 264 | static void ICODE_ATTR fgblock(fb_data *address, unsigned mask, |
268 | ICODE_ATTR; | 265 | unsigned bits) |
269 | static void fgblock(fb_data *address, unsigned mask, unsigned bits) | ||
270 | { | 266 | { |
271 | unsigned data = *address; | 267 | unsigned data = *address; |
272 | 268 | ||
273 | *address = data ^ ((data ^ fg_pattern) & mask & bits); | 269 | *address = data ^ ((data ^ fg_pattern) & mask & bits); |
274 | } | 270 | } |
275 | 271 | ||
276 | static void solidblock(fb_data *address, unsigned mask, unsigned bits) | 272 | static void ICODE_ATTR solidblock(fb_data *address, unsigned mask, |
277 | ICODE_ATTR; | 273 | unsigned bits) |
278 | static void solidblock(fb_data *address, unsigned mask, unsigned bits) | ||
279 | { | 274 | { |
280 | unsigned data = *address; | 275 | unsigned data = *address; |
281 | unsigned bgp = bg_pattern; | 276 | unsigned bgp = bg_pattern; |
@@ -284,9 +279,8 @@ static void solidblock(fb_data *address, unsigned mask, unsigned bits) | |||
284 | *address = data ^ ((data ^ bits) & mask); | 279 | *address = data ^ ((data ^ bits) & mask); |
285 | } | 280 | } |
286 | 281 | ||
287 | static void solidimgblock(fb_data *address, unsigned mask, unsigned bits) | 282 | static void ICODE_ATTR solidimgblock(fb_data *address, unsigned mask, |
288 | ICODE_ATTR; | 283 | unsigned bits) |
289 | static void solidimgblock(fb_data *address, unsigned mask, unsigned bits) | ||
290 | { | 284 | { |
291 | unsigned data = *address; | 285 | unsigned data = *address; |
292 | unsigned bgp = *(address + lcd_backdrop_offset); | 286 | unsigned bgp = *(address + lcd_backdrop_offset); |
@@ -295,43 +289,38 @@ static void solidimgblock(fb_data *address, unsigned mask, unsigned bits) | |||
295 | *address = data ^ ((data ^ bits) & mask); | 289 | *address = data ^ ((data ^ bits) & mask); |
296 | } | 290 | } |
297 | 291 | ||
298 | static void flipinvblock(fb_data *address, unsigned mask, unsigned bits) | 292 | static void ICODE_ATTR flipinvblock(fb_data *address, unsigned mask, |
299 | ICODE_ATTR; | 293 | unsigned bits) |
300 | static void flipinvblock(fb_data *address, unsigned mask, unsigned bits) | ||
301 | { | 294 | { |
302 | *address ^= ~bits & mask; | 295 | *address ^= ~bits & mask; |
303 | } | 296 | } |
304 | 297 | ||
305 | static void bginvblock(fb_data *address, unsigned mask, unsigned bits) | 298 | static void ICODE_ATTR bginvblock(fb_data *address, unsigned mask, |
306 | ICODE_ATTR; | 299 | unsigned bits) |
307 | static void bginvblock(fb_data *address, unsigned mask, unsigned bits) | ||
308 | { | 300 | { |
309 | unsigned data = *address; | 301 | unsigned data = *address; |
310 | 302 | ||
311 | *address = data ^ ((data ^ bg_pattern) & mask & bits); | 303 | *address = data ^ ((data ^ bg_pattern) & mask & bits); |
312 | } | 304 | } |
313 | 305 | ||
314 | static void bgimginvblock(fb_data *address, unsigned mask, unsigned bits) | 306 | static void ICODE_ATTR bgimginvblock(fb_data *address, unsigned mask, |
315 | ICODE_ATTR; | 307 | unsigned bits) |
316 | static void bgimginvblock(fb_data *address, unsigned mask, unsigned bits) | ||
317 | { | 308 | { |
318 | unsigned data = *address; | 309 | unsigned data = *address; |
319 | 310 | ||
320 | *address = data ^ ((data ^ *(address + lcd_backdrop_offset)) & mask & bits); | 311 | *address = data ^ ((data ^ *(address + lcd_backdrop_offset)) & mask & bits); |
321 | } | 312 | } |
322 | 313 | ||
323 | static void fginvblock(fb_data *address, unsigned mask, unsigned bits) | 314 | static void ICODE_ATTR fginvblock(fb_data *address, unsigned mask, |
324 | ICODE_ATTR; | 315 | unsigned bits) |
325 | static void fginvblock(fb_data *address, unsigned mask, unsigned bits) | ||
326 | { | 316 | { |
327 | unsigned data = *address; | 317 | unsigned data = *address; |
328 | 318 | ||
329 | *address = data ^ ((data ^ fg_pattern) & mask & ~bits); | 319 | *address = data ^ ((data ^ fg_pattern) & mask & ~bits); |
330 | } | 320 | } |
331 | 321 | ||
332 | static void solidinvblock(fb_data *address, unsigned mask, unsigned bits) | 322 | static void ICODE_ATTR solidinvblock(fb_data *address, unsigned mask, |
333 | ICODE_ATTR; | 323 | unsigned bits) |
334 | static void solidinvblock(fb_data *address, unsigned mask, unsigned bits) | ||
335 | { | 324 | { |
336 | unsigned data = *address; | 325 | unsigned data = *address; |
337 | unsigned fgp = fg_pattern; | 326 | unsigned fgp = fg_pattern; |
@@ -340,9 +329,8 @@ static void solidinvblock(fb_data *address, unsigned mask, unsigned bits) | |||
340 | *address = data ^ ((data ^ bits) & mask); | 329 | *address = data ^ ((data ^ bits) & mask); |
341 | } | 330 | } |
342 | 331 | ||
343 | static void solidimginvblock(fb_data *address, unsigned mask, unsigned bits) | 332 | static void ICODE_ATTR solidimginvblock(fb_data *address, unsigned mask, |
344 | ICODE_ATTR; | 333 | unsigned bits) |
345 | static void solidimginvblock(fb_data *address, unsigned mask, unsigned bits) | ||
346 | { | 334 | { |
347 | unsigned data = *address; | 335 | unsigned data = *address; |
348 | unsigned fgp = fg_pattern; | 336 | unsigned fgp = fg_pattern; |
@@ -459,8 +447,20 @@ void lcd_drawline(int x1, int y1, int x2, int y2) | |||
459 | int y, yinc1, yinc2; | 447 | int y, yinc1, yinc2; |
460 | lcd_pixelfunc_type *pfunc = lcd_pixelfuncs[current_vp->drawmode]; | 448 | lcd_pixelfunc_type *pfunc = lcd_pixelfuncs[current_vp->drawmode]; |
461 | 449 | ||
462 | deltax = abs(x2 - x1); | ||
463 | deltay = abs(y2 - y1); | 450 | deltay = abs(y2 - y1); |
451 | if (deltay == 0) | ||
452 | { | ||
453 | DEBUGF("lcd_drawline() called for horizontal line - optimisation.\n"); | ||
454 | lcd_hline(x1, x2, y1); | ||
455 | return; | ||
456 | } | ||
457 | deltax = abs(x2 - x1); | ||
458 | if (deltax == 0) | ||
459 | { | ||
460 | DEBUGF("lcd_drawline() called for vertical line - optimisation.\n"); | ||
461 | lcd_vline(x1, y1, y2); | ||
462 | return; | ||
463 | } | ||
464 | xinc2 = 1; | 464 | xinc2 = 1; |
465 | yinc2 = 1; | 465 | yinc2 = 1; |
466 | 466 | ||
@@ -702,11 +702,9 @@ void lcd_fillrect(int x, int y, int width, int height) | |||
702 | * 0..7, the second row defines pixel row 8..15 etc. */ | 702 | * 0..7, the second row defines pixel row 8..15 etc. */ |
703 | 703 | ||
704 | /* Draw a partial monochrome bitmap */ | 704 | /* Draw a partial monochrome bitmap */ |
705 | void lcd_mono_bitmap_part(const unsigned char *src, int src_x, int src_y, | 705 | void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x, |
706 | int stride, int x, int y, int width, int height) | 706 | int src_y, int stride, int x, int y, |
707 | ICODE_ATTR; | 707 | int width, int height) |
708 | void lcd_mono_bitmap_part(const unsigned char *src, int src_x, int src_y, | ||
709 | int stride, int x, int y, int width, int height) | ||
710 | { | 708 | { |
711 | int ny, nx, ymax; | 709 | int ny, nx, ymax; |
712 | const unsigned char * src_end; | 710 | const unsigned char * src_end; |
@@ -795,11 +793,9 @@ void lcd_mono_bitmap(const unsigned char *src, int x, int y, int width, int heig | |||
795 | * This is the same as the internal lcd hw format. */ | 793 | * This is the same as the internal lcd hw format. */ |
796 | 794 | ||
797 | /* Draw a partial native bitmap */ | 795 | /* Draw a partial native bitmap */ |
798 | void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y, | 796 | void ICODE_ATTR lcd_bitmap_part(const unsigned char *src, int src_x, |
799 | int stride, int x, int y, int width, int height) | 797 | int src_y, int stride, int x, int y, |
800 | ICODE_ATTR; | 798 | int width, int height) |
801 | void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y, | ||
802 | int stride, int x, int y, int width, int height) | ||
803 | { | 799 | { |
804 | int shift, nx; | 800 | int shift, nx; |
805 | unsigned char *dst, *dst_end; | 801 | unsigned char *dst, *dst_end; |
diff --git a/firmware/drivers/lcd-2bit-vert.c b/firmware/drivers/lcd-2bit-vert.c index 5373bb9f0a..d43bf6cc81 100644 --- a/firmware/drivers/lcd-2bit-vert.c +++ b/firmware/drivers/lcd-2bit-vert.c | |||
@@ -242,43 +242,38 @@ lcd_pixelfunc_type* const lcd_pixelfuncs_backdrop[8] = { | |||
242 | lcd_pixelfunc_type* const * lcd_pixelfuncs = lcd_pixelfuncs_bgcolor; | 242 | lcd_pixelfunc_type* const * lcd_pixelfuncs = lcd_pixelfuncs_bgcolor; |
243 | 243 | ||
244 | /* 'mask' and 'bits' contain 2 bits per pixel */ | 244 | /* 'mask' and 'bits' contain 2 bits per pixel */ |
245 | static void flipblock(fb_data *address, unsigned mask, unsigned bits) | 245 | static void ICODE_ATTR flipblock(fb_data *address, unsigned mask, |
246 | ICODE_ATTR; | 246 | unsigned bits) |
247 | static void flipblock(fb_data *address, unsigned mask, unsigned bits) | ||
248 | { | 247 | { |
249 | *address ^= bits & mask; | 248 | *address ^= bits & mask; |
250 | } | 249 | } |
251 | 250 | ||
252 | static void bgblock(fb_data *address, unsigned mask, unsigned bits) | 251 | static void ICODE_ATTR bgblock(fb_data *address, unsigned mask, |
253 | ICODE_ATTR; | 252 | unsigned bits) |
254 | static void bgblock(fb_data *address, unsigned mask, unsigned bits) | ||
255 | { | 253 | { |
256 | unsigned data = *address; | 254 | unsigned data = *address; |
257 | 255 | ||
258 | *address = data ^ ((data ^ bg_pattern) & mask & ~bits); | 256 | *address = data ^ ((data ^ bg_pattern) & mask & ~bits); |
259 | } | 257 | } |
260 | 258 | ||
261 | static void bgimgblock(fb_data *address, unsigned mask, unsigned bits) | 259 | static void ICODE_ATTR bgimgblock(fb_data *address, unsigned mask, |
262 | ICODE_ATTR; | 260 | unsigned bits) |
263 | static void bgimgblock(fb_data *address, unsigned mask, unsigned bits) | ||
264 | { | 261 | { |
265 | unsigned data = *address; | 262 | unsigned data = *address; |
266 | 263 | ||
267 | *address = data ^ ((data ^ *(address + lcd_backdrop_offset)) & mask & ~bits); | 264 | *address = data ^ ((data ^ *(address + lcd_backdrop_offset)) & mask & ~bits); |
268 | } | 265 | } |
269 | 266 | ||
270 | static void fgblock(fb_data *address, unsigned mask, unsigned bits) | 267 | static void ICODE_ATTR fgblock(fb_data *address, unsigned mask, |
271 | ICODE_ATTR; | 268 | unsigned bits) |
272 | static void fgblock(fb_data *address, unsigned mask, unsigned bits) | ||
273 | { | 269 | { |
274 | unsigned data = *address; | 270 | unsigned data = *address; |
275 | 271 | ||
276 | *address = data ^ ((data ^ fg_pattern) & mask & bits); | 272 | *address = data ^ ((data ^ fg_pattern) & mask & bits); |
277 | } | 273 | } |
278 | 274 | ||
279 | static void solidblock(fb_data *address, unsigned mask, unsigned bits) | 275 | static void ICODE_ATTR solidblock(fb_data *address, unsigned mask, |
280 | ICODE_ATTR; | 276 | unsigned bits) |
281 | static void solidblock(fb_data *address, unsigned mask, unsigned bits) | ||
282 | { | 277 | { |
283 | unsigned data = *address; | 278 | unsigned data = *address; |
284 | unsigned bgp = bg_pattern; | 279 | unsigned bgp = bg_pattern; |
@@ -287,9 +282,8 @@ static void solidblock(fb_data *address, unsigned mask, unsigned bits) | |||
287 | *address = data ^ ((data ^ bits) & mask); | 282 | *address = data ^ ((data ^ bits) & mask); |
288 | } | 283 | } |
289 | 284 | ||
290 | static void solidimgblock(fb_data *address, unsigned mask, unsigned bits) | 285 | static void ICODE_ATTR solidimgblock(fb_data *address, unsigned mask, |
291 | ICODE_ATTR; | 286 | unsigned bits) |
292 | static void solidimgblock(fb_data *address, unsigned mask, unsigned bits) | ||
293 | { | 287 | { |
294 | unsigned data = *address; | 288 | unsigned data = *address; |
295 | unsigned bgp = *(address + lcd_backdrop_offset); | 289 | unsigned bgp = *(address + lcd_backdrop_offset); |
@@ -298,43 +292,38 @@ static void solidimgblock(fb_data *address, unsigned mask, unsigned bits) | |||
298 | *address = data ^ ((data ^ bits) & mask); | 292 | *address = data ^ ((data ^ bits) & mask); |
299 | } | 293 | } |
300 | 294 | ||
301 | static void flipinvblock(fb_data *address, unsigned mask, unsigned bits) | 295 | static void ICODE_ATTR flipinvblock(fb_data *address, unsigned mask, |
302 | ICODE_ATTR; | 296 | unsigned bits) |
303 | static void flipinvblock(fb_data *address, unsigned mask, unsigned bits) | ||
304 | { | 297 | { |
305 | *address ^= ~bits & mask; | 298 | *address ^= ~bits & mask; |
306 | } | 299 | } |
307 | 300 | ||
308 | static void bginvblock(fb_data *address, unsigned mask, unsigned bits) | 301 | static void ICODE_ATTR bginvblock(fb_data *address, unsigned mask, |
309 | ICODE_ATTR; | 302 | unsigned bits) |
310 | static void bginvblock(fb_data *address, unsigned mask, unsigned bits) | ||
311 | { | 303 | { |
312 | unsigned data = *address; | 304 | unsigned data = *address; |
313 | 305 | ||
314 | *address = data ^ ((data ^ bg_pattern) & mask & bits); | 306 | *address = data ^ ((data ^ bg_pattern) & mask & bits); |
315 | } | 307 | } |
316 | 308 | ||
317 | static void bgimginvblock(fb_data *address, unsigned mask, unsigned bits) | 309 | static void ICODE_ATTR bgimginvblock(fb_data *address, unsigned mask, |
318 | ICODE_ATTR; | 310 | unsigned bits) |
319 | static void bgimginvblock(fb_data *address, unsigned mask, unsigned bits) | ||
320 | { | 311 | { |
321 | unsigned data = *address; | 312 | unsigned data = *address; |
322 | 313 | ||
323 | *address = data ^ ((data ^ *(address + lcd_backdrop_offset)) & mask & bits); | 314 | *address = data ^ ((data ^ *(address + lcd_backdrop_offset)) & mask & bits); |
324 | } | 315 | } |
325 | 316 | ||
326 | static void fginvblock(fb_data *address, unsigned mask, unsigned bits) | 317 | static void ICODE_ATTR fginvblock(fb_data *address, unsigned mask, |
327 | ICODE_ATTR; | 318 | unsigned bits) |
328 | static void fginvblock(fb_data *address, unsigned mask, unsigned bits) | ||
329 | { | 319 | { |
330 | unsigned data = *address; | 320 | unsigned data = *address; |
331 | 321 | ||
332 | *address = data ^ ((data ^ fg_pattern) & mask & ~bits); | 322 | *address = data ^ ((data ^ fg_pattern) & mask & ~bits); |
333 | } | 323 | } |
334 | 324 | ||
335 | static void solidinvblock(fb_data *address, unsigned mask, unsigned bits) | 325 | static void ICODE_ATTR solidinvblock(fb_data *address, unsigned mask, |
336 | ICODE_ATTR; | 326 | unsigned bits) |
337 | static void solidinvblock(fb_data *address, unsigned mask, unsigned bits) | ||
338 | { | 327 | { |
339 | unsigned data = *address; | 328 | unsigned data = *address; |
340 | unsigned fgp = fg_pattern; | 329 | unsigned fgp = fg_pattern; |
@@ -343,9 +332,8 @@ static void solidinvblock(fb_data *address, unsigned mask, unsigned bits) | |||
343 | *address = data ^ ((data ^ bits) & mask); | 332 | *address = data ^ ((data ^ bits) & mask); |
344 | } | 333 | } |
345 | 334 | ||
346 | static void solidimginvblock(fb_data *address, unsigned mask, unsigned bits) | 335 | static void ICODE_ATTR solidimginvblock(fb_data *address, unsigned mask, |
347 | ICODE_ATTR; | 336 | unsigned bits) |
348 | static void solidimginvblock(fb_data *address, unsigned mask, unsigned bits) | ||
349 | { | 337 | { |
350 | unsigned data = *address; | 338 | unsigned data = *address; |
351 | unsigned fgp = fg_pattern; | 339 | unsigned fgp = fg_pattern; |
@@ -463,7 +451,19 @@ void lcd_drawline(int x1, int y1, int x2, int y2) | |||
463 | lcd_pixelfunc_type *pfunc = lcd_pixelfuncs[current_vp->drawmode]; | 451 | lcd_pixelfunc_type *pfunc = lcd_pixelfuncs[current_vp->drawmode]; |
464 | 452 | ||
465 | deltax = abs(x2 - x1); | 453 | deltax = abs(x2 - x1); |
454 | if (deltax == 0) | ||
455 | { | ||
456 | DEBUGF("lcd_drawline() called for vertical line - optimisation.\n"); | ||
457 | lcd_vline(x1, y1, y2); | ||
458 | return; | ||
459 | } | ||
466 | deltay = abs(y2 - y1); | 460 | deltay = abs(y2 - y1); |
461 | if (deltay == 0) | ||
462 | { | ||
463 | DEBUGF("lcd_drawline() called for horizontal line - optimisation.\n"); | ||
464 | lcd_hline(x1, x2, y1); | ||
465 | return; | ||
466 | } | ||
467 | xinc2 = 1; | 467 | xinc2 = 1; |
468 | yinc2 = 1; | 468 | yinc2 = 1; |
469 | 469 | ||
@@ -729,11 +729,9 @@ void lcd_fillrect(int x, int y, int width, int height) | |||
729 | * This is similar to the internal lcd hw format. */ | 729 | * This is similar to the internal lcd hw format. */ |
730 | 730 | ||
731 | /* Draw a partial monochrome bitmap */ | 731 | /* Draw a partial monochrome bitmap */ |
732 | void lcd_mono_bitmap_part(const unsigned char *src, int src_x, int src_y, | 732 | void ICODE_ATTR lcd_mono_bitmap_part(const unsigned char *src, int src_x, |
733 | int stride, int x, int y, int width, int height) | 733 | int src_y, int stride, int x, int y, |
734 | ICODE_ATTR; | 734 | int width, int height) |
735 | void lcd_mono_bitmap_part(const unsigned char *src, int src_x, int src_y, | ||
736 | int stride, int x, int y, int width, int height) | ||
737 | { | 735 | { |
738 | int shift, ny; | 736 | int shift, ny; |
739 | fb_data *dst, *dst_end; | 737 | fb_data *dst, *dst_end; |
@@ -901,11 +899,9 @@ void lcd_mono_bitmap(const unsigned char *src, int x, int y, int width, int heig | |||
901 | * This is the same as the internal lcd hw format. */ | 899 | * This is the same as the internal lcd hw format. */ |
902 | 900 | ||
903 | /* Draw a partial native bitmap */ | 901 | /* Draw a partial native bitmap */ |
904 | void lcd_bitmap_part(const fb_data *src, int src_x, int src_y, | 902 | void ICODE_ATTR lcd_bitmap_part(const fb_data *src, int src_x, int src_y, |
905 | int stride, int x, int y, int width, int height) | 903 | int stride, int x, int y, int width, |
906 | ICODE_ATTR; | 904 | int height) |
907 | void lcd_bitmap_part(const fb_data *src, int src_x, int src_y, | ||
908 | int stride, int x, int y, int width, int height) | ||
909 | { | 905 | { |
910 | int shift, ny; | 906 | int shift, ny; |
911 | fb_data *dst, *dst_end; | 907 | fb_data *dst, *dst_end; |
diff --git a/firmware/drivers/lcd-2bit-vi.c b/firmware/drivers/lcd-2bit-vi.c index 0878258e84..7d97f19174 100644 --- a/firmware/drivers/lcd-2bit-vi.c +++ b/firmware/drivers/lcd-2bit-vi.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #define LCDFN(fn) lcd_ ## fn | 39 | #define LCDFN(fn) lcd_ ## fn |
40 | #define FBFN(fn) fb_ ## fn | 40 | #define FBFN(fn) fb_ ## fn |
41 | #define LCDM(ma) LCD_ ## ma | 41 | #define LCDM(ma) LCD_ ## ma |
42 | #define LCDNAME "lcd_" | ||
42 | #define MAIN_LCD | 43 | #define MAIN_LCD |
43 | #endif | 44 | #endif |
44 | 45 | ||
@@ -476,7 +477,19 @@ void LCDFN(drawline)(int x1, int y1, int x2, int y2) | |||
476 | LCDFN(pixelfunc_type) *pfunc = LCDFN(pixelfuncs)[current_vp->drawmode]; | 477 | LCDFN(pixelfunc_type) *pfunc = LCDFN(pixelfuncs)[current_vp->drawmode]; |
477 | 478 | ||
478 | deltax = abs(x2 - x1); | 479 | deltax = abs(x2 - x1); |
480 | if (deltax == 0) | ||
481 | { | ||
482 | DEBUGF(LCDNAME "drawline() called for vertical line - optimisation.\n"); | ||
483 | LCDFN(vline)(x1, y1, y2); | ||
484 | return; | ||
485 | } | ||
479 | deltay = abs(y2 - y1); | 486 | deltay = abs(y2 - y1); |
487 | if (deltay == 0) | ||
488 | { | ||
489 | DEBUGF(LCDNAME "drawline() called for horizontal line - optimisation.\n"); | ||
490 | LCDFN(hline)(x1, x2, y1); | ||
491 | return; | ||
492 | } | ||
480 | xinc2 = 1; | 493 | xinc2 = 1; |
481 | yinc2 = 1; | 494 | yinc2 = 1; |
482 | 495 | ||
diff --git a/firmware/drivers/lcd-remote-1bit-v.c b/firmware/drivers/lcd-remote-1bit-v.c index bed7cc6671..8e6898a8a2 100644 --- a/firmware/drivers/lcd-remote-1bit-v.c +++ b/firmware/drivers/lcd-remote-1bit-v.c | |||
@@ -23,5 +23,6 @@ | |||
23 | #define LCDFN(fn) lcd_remote_ ## fn | 23 | #define LCDFN(fn) lcd_remote_ ## fn |
24 | #define FBFN(fn) fb_remote_ ## fn | 24 | #define FBFN(fn) fb_remote_ ## fn |
25 | #define LCDM(ma) LCD_REMOTE_ ## ma | 25 | #define LCDM(ma) LCD_REMOTE_ ## ma |
26 | #define LCDNAME "lcd_remote_" | ||
26 | 27 | ||
27 | #include "lcd-1bit-vert.c" | 28 | #include "lcd-1bit-vert.c" |
diff --git a/firmware/drivers/lcd-remote-2bit-vi.c b/firmware/drivers/lcd-remote-2bit-vi.c index d2440a6296..d050143468 100644 --- a/firmware/drivers/lcd-remote-2bit-vi.c +++ b/firmware/drivers/lcd-remote-2bit-vi.c | |||
@@ -25,5 +25,6 @@ | |||
25 | #define LCDFN(fn) lcd_remote_ ## fn | 25 | #define LCDFN(fn) lcd_remote_ ## fn |
26 | #define FBFN(fn) fb_remote_ ## fn | 26 | #define FBFN(fn) fb_remote_ ## fn |
27 | #define LCDM(ma) LCD_REMOTE_ ## ma | 27 | #define LCDM(ma) LCD_REMOTE_ ## ma |
28 | #define LCDNAME "lcd_remote_" | ||
28 | 29 | ||
29 | #include "lcd-2bit-vi.c" | 30 | #include "lcd-2bit-vi.c" |