aboutsummaryrefslogtreecommitdiffstats
path: root/src/gdisp
diff options
context:
space:
mode:
authorinmarket <andrewh@inmarket.com.au>2015-06-08 14:14:40 +1000
committerinmarket <andrewh@inmarket.com.au>2015-06-08 14:14:40 +1000
commitccde54722f2c284fb0e7fc273d65c57a3be71db1 (patch)
treefffa49870c73d7e9d5caaf5c6d1d47cf0e5c90d3 /src/gdisp
parente850c344b818f21a2ec286f9c4a149a9cd4ac34b (diff)
downloaduGFX-ccde54722f2c284fb0e7fc273d65c57a3be71db1.tar.gz
uGFX-ccde54722f2c284fb0e7fc273d65c57a3be71db1.tar.bz2
uGFX-ccde54722f2c284fb0e7fc273d65c57a3be71db1.zip
Added ability to compile ugfx as a single file (excluding driver and board files).
Simply compile src/gfx_mk.c
Diffstat (limited to 'src/gdisp')
-rw-r--r--src/gdisp/fonts/build_fonts.sh2
-rw-r--r--src/gdisp/fonts/fonts.h2
-rw-r--r--src/gdisp/fonts/mf_bwfont.h15
-rw-r--r--src/gdisp/fonts/mf_rlefont.h15
-rw-r--r--src/gdisp/fonts/mf_scaledfont.h15
-rw-r--r--src/gdisp/gdisp.c6
-rw-r--r--src/gdisp/gdisp.mk2
-rw-r--r--src/gdisp/gdisp_mk.c29
-rw-r--r--src/gdisp/mcufont/mf_bwfont.h4
-rw-r--r--src/gdisp/mcufont/mf_config.h2
-rw-r--r--src/gdisp/mcufont/mf_encoding.h6
-rw-r--r--src/gdisp/mcufont/mf_font.c12
-rw-r--r--src/gdisp/mcufont/mf_font.h6
-rw-r--r--src/gdisp/mcufont/mf_justify.c2
-rw-r--r--src/gdisp/mcufont/mf_rlefont.c2
-rw-r--r--src/gdisp/mcufont/mf_rlefont.h4
-rw-r--r--src/gdisp/mcufont/mf_scaledfont.c4
-rw-r--r--src/gdisp/mcufont/mf_scaledfont.h4
18 files changed, 108 insertions, 24 deletions
diff --git a/src/gdisp/fonts/build_fonts.sh b/src/gdisp/fonts/build_fonts.sh
index 22f95a91..8c10cfe6 100644
--- a/src/gdisp/fonts/build_fonts.sh
+++ b/src/gdisp/fonts/build_fonts.sh
@@ -65,7 +65,7 @@ build fixed_10x20.bdf fixed_10x20 bwfont
build fixed_7x14.bdf fixed_7x14 bwfont
build fixed_5x8.bdf fixed_5x8 bwfont
-echo '#include "gfx.h"' > fonts.h
+echo '// This file is generated by build_fonts.sh' > fonts.h
for file in *.c; do
echo >> fonts.h
noext="${file%.*}"
diff --git a/src/gdisp/fonts/fonts.h b/src/gdisp/fonts/fonts.h
index 13904267..25ecde33 100644
--- a/src/gdisp/fonts/fonts.h
+++ b/src/gdisp/fonts/fonts.h
@@ -1,4 +1,4 @@
-#include "gfx.h"
+// This file is generated by build_fonts.sh
#if defined(GDISP_INCLUDE_FONT_DEJAVUSANS10) && GDISP_INCLUDE_FONT_DEJAVUSANS10
#define GDISP_FONT_FOUND
diff --git a/src/gdisp/fonts/mf_bwfont.h b/src/gdisp/fonts/mf_bwfont.h
new file mode 100644
index 00000000..df0e071b
--- /dev/null
+++ b/src/gdisp/fonts/mf_bwfont.h
@@ -0,0 +1,15 @@
+/*
+ * This file is subject to the terms of the GFX License. If a copy of
+ * the license was not distributed with this file, you can obtain one at:
+ *
+ * http://ugfx.org/license.html
+ */
+
+/* This is a stub file to prevent having to include the mcufont
+ * directory in the include path for funny compilers such as arduino
+ * which don't support a user specified include path.
+ *
+ * It is not needed anyway as the files are already included.
+ *
+ * New versions of the font generator do not generate these include lines.
+ */
diff --git a/src/gdisp/fonts/mf_rlefont.h b/src/gdisp/fonts/mf_rlefont.h
new file mode 100644
index 00000000..df0e071b
--- /dev/null
+++ b/src/gdisp/fonts/mf_rlefont.h
@@ -0,0 +1,15 @@
+/*
+ * This file is subject to the terms of the GFX License. If a copy of
+ * the license was not distributed with this file, you can obtain one at:
+ *
+ * http://ugfx.org/license.html
+ */
+
+/* This is a stub file to prevent having to include the mcufont
+ * directory in the include path for funny compilers such as arduino
+ * which don't support a user specified include path.
+ *
+ * It is not needed anyway as the files are already included.
+ *
+ * New versions of the font generator do not generate these include lines.
+ */
diff --git a/src/gdisp/fonts/mf_scaledfont.h b/src/gdisp/fonts/mf_scaledfont.h
new file mode 100644
index 00000000..df0e071b
--- /dev/null
+++ b/src/gdisp/fonts/mf_scaledfont.h
@@ -0,0 +1,15 @@
+/*
+ * This file is subject to the terms of the GFX License. If a copy of
+ * the license was not distributed with this file, you can obtain one at:
+ *
+ * http://ugfx.org/license.html
+ */
+
+/* This is a stub file to prevent having to include the mcufont
+ * directory in the include path for funny compilers such as arduino
+ * which don't support a user specified include path.
+ *
+ * It is not needed anyway as the files are already included.
+ *
+ * New versions of the font generator do not generate these include lines.
+ */
diff --git a/src/gdisp/gdisp.c b/src/gdisp/gdisp.c
index 2491fd86..86931952 100644
--- a/src/gdisp/gdisp.c
+++ b/src/gdisp/gdisp.c
@@ -501,7 +501,7 @@ static void line_clip(GDisplay *g) {
}
#if GDISP_STARTUP_LOGO_TIMEOUT > 0
- static bool_t initDone;
+ static bool_t gdispInitDone;
static void StartupLogoDisplay(GDisplay *g) {
coord_t x, y, w;
const coord_t * p;
@@ -604,7 +604,7 @@ void _gdispInit(void)
#endif
}
- initDone = TRUE;
+ gdispInitDone = TRUE;
}
#endif
@@ -660,7 +660,7 @@ void _gdispPostInitDriver(GDriver *g) {
// Display the startup logo if this is a static initialised display
#if GDISP_STARTUP_LOGO_TIMEOUT > 0
- if (!initDone)
+ if (!gdispInitDone)
StartupLogoDisplay(gd);
#endif
diff --git a/src/gdisp/gdisp.mk b/src/gdisp/gdisp.mk
index c4def261..acab953e 100644
--- a/src/gdisp/gdisp.mk
+++ b/src/gdisp/gdisp.mk
@@ -15,5 +15,5 @@ GFXSRC += $(GFXLIB)/src/gdisp/gdisp.c \
MFDIR = $(GFXLIB)/src/gdisp/mcufont
include $(GFXLIB)/src/gdisp/mcufont/mcufont.mk
-GFXINC += $(MFDIR)
+#GFXINC += $(MFDIR)
GFXSRC += $(MFSRC)
diff --git a/src/gdisp/gdisp_mk.c b/src/gdisp/gdisp_mk.c
new file mode 100644
index 00000000..3209b3d0
--- /dev/null
+++ b/src/gdisp/gdisp_mk.c
@@ -0,0 +1,29 @@
+/*
+ * This file is subject to the terms of the GFX License. If a copy of
+ * the license was not distributed with this file, you can obtain one at:
+ *
+ * http://ugfx.org/license.html
+ */
+
+/* The very first thing that has to be compiled here is mf_font.c so that
+ * inclusion of the font header files does not stop the inclusion of the
+ * implementation specific parts of the font files.
+ */
+#include "mcufont/mf_font.c"
+#include "mcufont/mf_rlefont.c"
+#include "mcufont/mf_bwfont.c"
+#include "mcufont/mf_scaledfont.c"
+#include "mcufont/mf_encoding.c"
+#include "mcufont/mf_justify.c"
+#include "mcufont/mf_kerning.c"
+#include "mcufont/mf_wordwrap.c"
+
+#include "gdisp.c"
+#include "gdisp_fonts.c"
+#include "gdisp_pixmap.c"
+#include "gdisp_image.c"
+#include "gdisp_image_native.c"
+#include "gdisp_image_gif.c"
+#include "gdisp_image_bmp.c"
+#include "gdisp_image_jpg.c"
+#include "gdisp_image_png.c"
diff --git a/src/gdisp/mcufont/mf_bwfont.h b/src/gdisp/mcufont/mf_bwfont.h
index f0429073..761352df 100644
--- a/src/gdisp/mcufont/mf_bwfont.h
+++ b/src/gdisp/mcufont/mf_bwfont.h
@@ -73,12 +73,12 @@ struct mf_bwfont_s
/* Internal functions, don't use these directly. */
MF_EXTERN uint8_t mf_bwfont_render_character(const struct mf_font_s *font,
int16_t x0, int16_t y0,
- mf_char character,
+ uint16_t character,
mf_pixel_callback_t callback,
void *state);
MF_EXTERN uint8_t mf_bwfont_character_width(const struct mf_font_s *font,
- mf_char character);
+ uint16_t character);
#endif
#endif
diff --git a/src/gdisp/mcufont/mf_config.h b/src/gdisp/mcufont/mf_config.h
index 88838c1d..ac2262d4 100644
--- a/src/gdisp/mcufont/mf_config.h
+++ b/src/gdisp/mcufont/mf_config.h
@@ -159,7 +159,7 @@
#ifdef __cplusplus
#define MF_EXTERN extern "C"
#else
-#define MF_EXTERN extern
+#define MF_EXTERN
#endif
#endif
diff --git a/src/gdisp/mcufont/mf_encoding.h b/src/gdisp/mcufont/mf_encoding.h
index d8b7b70e..a8c44d9d 100644
--- a/src/gdisp/mcufont/mf_encoding.h
+++ b/src/gdisp/mcufont/mf_encoding.h
@@ -19,9 +19,11 @@
/* Type used to represent characters internally. */
#if MF_ENCODING == MF_ENCODING_ASCII
-typedef char mf_char;
+ typedef char mf_char;
+ #define MFCHAR2UINT16(c) ((uint16_t)(uint8_t)(c))
#else
-typedef uint16_t mf_char;
+ typedef uint16_t mf_char;
+ #define MFCHAR2UINT16(c) (c)
#endif
/* Type used to represent input strings. */
diff --git a/src/gdisp/mcufont/mf_font.c b/src/gdisp/mcufont/mf_font.c
index 7a4ebf95..ccf71bec 100644
--- a/src/gdisp/mcufont/mf_font.c
+++ b/src/gdisp/mcufont/mf_font.c
@@ -5,10 +5,18 @@
* http://ugfx.org/license.html
*/
-#include "mf_font.h"
+#include "mf_config.h"
#ifndef MF_NO_COMPILE
+#define MF_BWFONT_INTERNALS
+#define MF_RLEFONT_INTERNALS
+#define MF_SCALEDFONT_INTERNALS
+#include "mf_font.h"
+#include "mf_rlefont.h"
+#include "mf_bwfont.h"
+#include "mf_scaledfont.h"
+
#include <stdbool.h>
/* This will be made into a list of included fonts using macro magic. */
@@ -40,7 +48,7 @@ uint8_t mf_character_width(const struct mf_font_s *font,
mf_char character)
{
uint8_t width;
- width = font->character_width(font, character);
+ width = font->character_width(font, MFCHAR2UINT16(character));
if (!width)
{
diff --git a/src/gdisp/mcufont/mf_font.h b/src/gdisp/mcufont/mf_font.h
index 1166fa3b..ff8840c8 100644
--- a/src/gdisp/mcufont/mf_font.h
+++ b/src/gdisp/mcufont/mf_font.h
@@ -53,17 +53,17 @@ struct mf_font_s
uint8_t flags;
/* Fallback character to use for missing glyphs. */
- mf_char fallback_character;
+ uint16_t fallback_character;
/* Function to get character width. Should return 0 if character is
* not found. */
- uint8_t (*character_width)(const struct mf_font_s *font, mf_char character);
+ uint8_t (*character_width)(const struct mf_font_s *font, uint16_t character);
/* Function to render a character. Returns the character width or 0 if
* character is not found. */
uint8_t (*render_character)(const struct mf_font_s *font,
int16_t x0, int16_t y0,
- mf_char character,
+ uint16_t character,
mf_pixel_callback_t callback,
void *state);
};
diff --git a/src/gdisp/mcufont/mf_justify.c b/src/gdisp/mcufont/mf_justify.c
index 857777cd..204bb7f7 100644
--- a/src/gdisp/mcufont/mf_justify.c
+++ b/src/gdisp/mcufont/mf_justify.c
@@ -297,7 +297,7 @@ void mf_render_justified(const struct mf_font_s *font,
{
int16_t x, tmp;
- uint16_t c1 = 0, c2;
+ mf_char c1 = 0, c2;
x = x0 - font->baseline_x;
while (count--)
diff --git a/src/gdisp/mcufont/mf_rlefont.c b/src/gdisp/mcufont/mf_rlefont.c
index c4b344c6..2ef89fd1 100644
--- a/src/gdisp/mcufont/mf_rlefont.c
+++ b/src/gdisp/mcufont/mf_rlefont.c
@@ -267,7 +267,7 @@ uint8_t mf_rlefont_render_character(const struct mf_font_s *font,
rstate.callback = callback;
rstate.state = state;
- p = find_glyph((struct mf_rlefont_s*)font, character);
+ p = find_glyph((struct mf_rlefont_s*)font, character);
if (!p)
return 0;
diff --git a/src/gdisp/mcufont/mf_rlefont.h b/src/gdisp/mcufont/mf_rlefont.h
index d9cee8dc..7e717ccc 100644
--- a/src/gdisp/mcufont/mf_rlefont.h
+++ b/src/gdisp/mcufont/mf_rlefont.h
@@ -70,12 +70,12 @@ struct mf_rlefont_s
/* Internal functions, don't use these directly. */
MF_EXTERN uint8_t mf_rlefont_render_character(const struct mf_font_s *font,
int16_t x0, int16_t y0,
- mf_char character,
+ uint16_t character,
mf_pixel_callback_t callback,
void *state);
MF_EXTERN uint8_t mf_rlefont_character_width(const struct mf_font_s *font,
- mf_char character);
+ uint16_t character);
#endif
#endif
diff --git a/src/gdisp/mcufont/mf_scaledfont.c b/src/gdisp/mcufont/mf_scaledfont.c
index 4f9de208..570baef6 100644
--- a/src/gdisp/mcufont/mf_scaledfont.c
+++ b/src/gdisp/mcufont/mf_scaledfont.c
@@ -36,7 +36,7 @@ static void scaled_pixel_callback(int16_t x, int16_t y, uint8_t count,
}
uint8_t mf_scaled_character_width(const struct mf_font_s *font,
- mf_char character)
+ uint16_t character)
{
struct mf_scaledfont_s *sfont = (struct mf_scaledfont_s*)font;
uint8_t basewidth;
@@ -48,7 +48,7 @@ uint8_t mf_scaled_character_width(const struct mf_font_s *font,
uint8_t mf_scaled_render_character(const struct mf_font_s *font,
int16_t x0, int16_t y0,
- mf_char character,
+ uint16_t character,
mf_pixel_callback_t callback,
void *state)
{
diff --git a/src/gdisp/mcufont/mf_scaledfont.h b/src/gdisp/mcufont/mf_scaledfont.h
index 5fdc0980..c4e4406b 100644
--- a/src/gdisp/mcufont/mf_scaledfont.h
+++ b/src/gdisp/mcufont/mf_scaledfont.h
@@ -31,12 +31,12 @@ MF_EXTERN void mf_scale_font(struct mf_scaledfont_s *newfont,
/* Internal functions, don't use these directly. */
MF_EXTERN uint8_t mf_scaled_render_character(const struct mf_font_s *font,
int16_t x0, int16_t y0,
- mf_char character,
+ uint16_t character,
mf_pixel_callback_t callback,
void *state);
MF_EXTERN uint8_t mf_scaled_character_width(const struct mf_font_s *font,
- mf_char character);
+ uint16_t character);
#endif
#endif