OSDN Git Service

Bug fixed.
[bluetank/bluetank.git] / soft / utils / lcdtool / lcdimg.c
index 6d64552..e920b9b 100644 (file)
@@ -213,7 +213,7 @@ int lcdimg_text(LCDIMG *p, const int x, const int y, const char c)
     return 0;
 }
 
-static void draw_char(LCDIMG *p, LCDIMG_DRAWER drawer, const int px, const int py, const char c)
+static void draw_char(LCDIMG *p, LCDIMG_DRAWER drawer, void *extobj, const int px, const int py, const char c)
 {
     int x, y;
     int nx, ny;
@@ -221,17 +221,19 @@ static void draw_char(LCDIMG *p, LCDIMG_DRAWER drawer, const int px, const int p
         for (x = 0; x < FONT_X; x++) {
             for (ny = 0; ny < p->pixsiz_y; ny++) {
                 for (nx = 0; nx < p->pixsiz_x; nx++) {
+                    uint8_t pat = font5x8_master[(c * FONT_X) + x];
                     drawer(
-                            px + (p->pixsiz_x * x) + (p->pixsiz_x * (x - 1)) + nx,
-                            py + (p->pixsiz_y * y) + (p->pixsiz_y * (y - 1)) + ny,
-                            true);
+                            px + (p->pixsiz_x * x) + (p->pixgap_x * (x - 1)) + nx,
+                            py + (p->pixsiz_y * y) + (p->pixgap_y * (y - 1)) + ny,
+                            (pat & (1 << y)),
+                            extobj);
                 }
             }
         }
     }
 }
 
-int lcdimg_draw(LCDIMG *p, LCDIMG_DRAWER drawer)
+int lcdimg_draw(LCDIMG *p, LCDIMG_DRAWER drawer, void *extobj)
 {
     int x, y;
     for (y = 0; y < p->chcnt_y; y++) {
@@ -239,8 +241,9 @@ int lcdimg_draw(LCDIMG *p, LCDIMG_DRAWER drawer)
             draw_char(
                     p,
                     drawer,
-                    p->ofs_x + (p->pixsiz_x * FONT_X) + (p->pixgap_x * (FONT_X - 1)) + (p->chgap_x * x),
-                    p->ofs_y + (p->pixsiz_y * FONT_X) + (p->pixgap_y * (FONT_Y - 1)) + (p->chgap_y * y),
+                    extobj,
+                    p->ofs_x + ((p->pixsiz_x * FONT_X) * x) + ((p->pixgap_x * (FONT_X - 1)) * x) + (p->chgap_x * x),
+                    p->ofs_y + ((p->pixsiz_y * FONT_Y) * y) + ((p->pixgap_y * (FONT_Y - 1)) * y) + (p->chgap_y * y),
                     p->txtbuf[(y * p->chcnt_x) + x]);
         }
     }