summaryrefslogtreecommitdiff
path: root/firmware/drivers/lcd-2bit-vi.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers/lcd-2bit-vi.c')
-rw-r--r--firmware/drivers/lcd-2bit-vi.c111
1 files changed, 0 insertions, 111 deletions
diff --git a/firmware/drivers/lcd-2bit-vi.c b/firmware/drivers/lcd-2bit-vi.c
index b19fdba266..976af8f62d 100644
--- a/firmware/drivers/lcd-2bit-vi.c
+++ b/firmware/drivers/lcd-2bit-vi.c
@@ -452,102 +452,6 @@ void LCDFN(clear_viewport)(void)
452 CURRENT_VP->flags &= ~(VP_FLAG_VP_SET_CLEAN); 452 CURRENT_VP->flags &= ~(VP_FLAG_VP_SET_CLEAN);
453} 453}
454 454
455/* Set a single pixel */
456void LCDFN(drawpixel)(int x, int y)
457{
458 if (LCDFN(clip_viewport_pixel)(&x, &y))
459 LCDFN(pixelfuncs)[CURRENT_VP->drawmode](x, y);
460}
461
462/* Draw a line */
463void LCDFN(drawline)(int x1, int y1, int x2, int y2)
464{
465 int numpixels;
466 int i;
467 int deltax, deltay;
468 int d, dinc1, dinc2;
469 int x, xinc1, xinc2;
470 int y, yinc1, yinc2;
471 int x_vp, y_vp, w_vp, h_vp;
472 LCDFN(pixelfunc_type) *pfunc = LCDFN(pixelfuncs)[CURRENT_VP->drawmode];
473
474 deltax = abs(x2 - x1);
475 if (deltax == 0)
476 {
477 /* DEBUGF(LCDNAME "drawline() called for vertical line - optimisation.\n"); */
478 LCDFN(vline)(x1, y1, y2);
479 return;
480 }
481 deltay = abs(y2 - y1);
482 if (deltay == 0)
483 {
484 /* DEBUGF(LCDNAME "drawline() called for horizontal line - optimisation.\n"); */
485 LCDFN(hline)(x1, x2, y1);
486 return;
487 }
488 xinc2 = 1;
489 yinc2 = 1;
490
491 if (deltax >= deltay)
492 {
493 numpixels = deltax;
494 d = 2 * deltay - deltax;
495 dinc1 = deltay * 2;
496 dinc2 = (deltay - deltax) * 2;
497 xinc1 = 1;
498 yinc1 = 0;
499 }
500 else
501 {
502 numpixels = deltay;
503 d = 2 * deltax - deltay;
504 dinc1 = deltax * 2;
505 dinc2 = (deltax - deltay) * 2;
506 xinc1 = 0;
507 yinc1 = 1;
508 }
509 numpixels++; /* include endpoints */
510
511 if (x1 > x2)
512 {
513 xinc1 = -xinc1;
514 xinc2 = -xinc2;
515 }
516
517 if (y1 > y2)
518 {
519 yinc1 = -yinc1;
520 yinc2 = -yinc2;
521 }
522
523 x = x1;
524 y = y1;
525
526 x_vp = CURRENT_VP->x;
527 y_vp = CURRENT_VP->y;
528 w_vp = CURRENT_VP->width;
529 h_vp = CURRENT_VP->height;
530
531 for (i = 0; i < numpixels; i++)
532 {
533 if (x >= 0 && y >= 0 && x < w_vp && y < h_vp)
534 pfunc(x + x_vp, y + y_vp);
535
536 if (d < 0)
537 {
538 d += dinc1;
539 x += xinc1;
540 y += yinc1;
541 }
542 else
543 {
544 d += dinc2;
545 x += xinc2;
546 y += yinc2;
547 }
548 }
549}
550
551/* Draw a horizontal line (optimised) */ 455/* Draw a horizontal line (optimised) */
552void LCDFN(hline)(int x1, int x2, int y) 456void LCDFN(hline)(int x1, int x2, int y)
553{ 457{
@@ -602,21 +506,6 @@ void LCDFN(vline)(int x, int y1, int y2)
602 bfunc(dst, mask, 0xFFFFu); 506 bfunc(dst, mask, 0xFFFFu);
603} 507}
604 508
605/* Draw a rectangular box */
606void LCDFN(drawrect)(int x, int y, int width, int height)
607{
608 if ((width <= 0) || (height <= 0))
609 return;
610
611 int x2 = x + width - 1;
612 int y2 = y + height - 1;
613
614 LCDFN(vline)(x, y, y2);
615 LCDFN(vline)(x2, y, y2);
616 LCDFN(hline)(x, x2, y);
617 LCDFN(hline)(x, x2, y2);
618}
619
620/* Fill a rectangular area */ 509/* Fill a rectangular area */
621void LCDFN(fillrect)(int x, int y, int width, int height) 510void LCDFN(fillrect)(int x, int y, int width, int height)
622{ 511{