summaryrefslogtreecommitdiff
path: root/firmware/drivers/lcd-2bit-horz.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers/lcd-2bit-horz.c')
-rw-r--r--firmware/drivers/lcd-2bit-horz.c90
1 files changed, 43 insertions, 47 deletions
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 */
242static void flipblock(fb_data *address, unsigned mask, unsigned bits) 242static void ICODE_ATTR flipblock(fb_data *address, unsigned mask,
243 ICODE_ATTR; 243 unsigned bits)
244static void flipblock(fb_data *address, unsigned mask, unsigned bits)
245{ 244{
246 *address ^= bits & mask; 245 *address ^= bits & mask;
247} 246}
248 247
249static void bgblock(fb_data *address, unsigned mask, unsigned bits) 248static void ICODE_ATTR bgblock(fb_data *address, unsigned mask,
250 ICODE_ATTR; 249 unsigned bits)
251static 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
258static void bgimgblock(fb_data *address, unsigned mask, unsigned bits) 256static void ICODE_ATTR bgimgblock(fb_data *address, unsigned mask,
259 ICODE_ATTR; 257 unsigned bits)
260static 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
267static void fgblock(fb_data *address, unsigned mask, unsigned bits) 264static void ICODE_ATTR fgblock(fb_data *address, unsigned mask,
268 ICODE_ATTR; 265 unsigned bits)
269static 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
276static void solidblock(fb_data *address, unsigned mask, unsigned bits) 272static void ICODE_ATTR solidblock(fb_data *address, unsigned mask,
277 ICODE_ATTR; 273 unsigned bits)
278static 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
287static void solidimgblock(fb_data *address, unsigned mask, unsigned bits) 282static void ICODE_ATTR solidimgblock(fb_data *address, unsigned mask,
288 ICODE_ATTR; 283 unsigned bits)
289static 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
298static void flipinvblock(fb_data *address, unsigned mask, unsigned bits) 292static void ICODE_ATTR flipinvblock(fb_data *address, unsigned mask,
299 ICODE_ATTR; 293 unsigned bits)
300static void flipinvblock(fb_data *address, unsigned mask, unsigned bits)
301{ 294{
302 *address ^= ~bits & mask; 295 *address ^= ~bits & mask;
303} 296}
304 297
305static void bginvblock(fb_data *address, unsigned mask, unsigned bits) 298static void ICODE_ATTR bginvblock(fb_data *address, unsigned mask,
306 ICODE_ATTR; 299 unsigned bits)
307static 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
314static void bgimginvblock(fb_data *address, unsigned mask, unsigned bits) 306static void ICODE_ATTR bgimginvblock(fb_data *address, unsigned mask,
315 ICODE_ATTR; 307 unsigned bits)
316static 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
323static void fginvblock(fb_data *address, unsigned mask, unsigned bits) 314static void ICODE_ATTR fginvblock(fb_data *address, unsigned mask,
324 ICODE_ATTR; 315 unsigned bits)
325static 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
332static void solidinvblock(fb_data *address, unsigned mask, unsigned bits) 322static void ICODE_ATTR solidinvblock(fb_data *address, unsigned mask,
333 ICODE_ATTR; 323 unsigned bits)
334static 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
343static void solidimginvblock(fb_data *address, unsigned mask, unsigned bits) 332static void ICODE_ATTR solidimginvblock(fb_data *address, unsigned mask,
344 ICODE_ATTR; 333 unsigned bits)
345static 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 */
705void lcd_mono_bitmap_part(const unsigned char *src, int src_x, int src_y, 705void 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)
708void 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 */
798void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y, 796void 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)
801void 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;