aboutsummaryrefslogtreecommitdiffstats
path: root/src/gdisp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gdisp')
-rw-r--r--src/gdisp/fonts/DejaVuSans10.c6
-rw-r--r--src/gdisp/fonts/DejaVuSans12.c6
-rw-r--r--src/gdisp/fonts/DejaVuSans12_aa.c8
-rw-r--r--src/gdisp/fonts/DejaVuSans16.c8
-rw-r--r--src/gdisp/fonts/DejaVuSans16_aa.c8
-rw-r--r--src/gdisp/fonts/DejaVuSans20.c8
-rw-r--r--src/gdisp/fonts/DejaVuSans20_aa.c8
-rw-r--r--src/gdisp/fonts/DejaVuSans24.c8
-rw-r--r--src/gdisp/fonts/DejaVuSans24_aa.c8
-rw-r--r--src/gdisp/fonts/DejaVuSans32.c8
-rw-r--r--src/gdisp/fonts/DejaVuSans32_aa.c8
-rw-r--r--src/gdisp/fonts/DejaVuSansBold12.c6
-rw-r--r--src/gdisp/fonts/DejaVuSansBold12_aa.c8
-rw-r--r--src/gdisp/fonts/LargeNumbers.c8
-rw-r--r--src/gdisp/fonts/UI1.c16
-rw-r--r--src/gdisp/fonts/UI2.c8
-rw-r--r--src/gdisp/fonts/fixed_10x20.c6
-rw-r--r--src/gdisp/fonts/fixed_5x8.c2
-rw-r--r--src/gdisp/fonts/fixed_7x14.c2
-rw-r--r--src/gdisp/gdisp.c80
-rw-r--r--src/gdisp/gdisp.h20
-rw-r--r--src/gdisp/gdisp_colors.h30
-rw-r--r--src/gdisp/gdisp_driver.h32
-rw-r--r--src/gdisp/gdisp_fonts.c2
-rw-r--r--src/gdisp/gdisp_image.c58
-rw-r--r--src/gdisp/gdisp_image.h16
-rw-r--r--src/gdisp/gdisp_image_bmp.c80
-rw-r--r--src/gdisp/gdisp_image_gif.c144
-rw-r--r--src/gdisp/gdisp_image_jpg.c150
-rw-r--r--src/gdisp/gdisp_image_native.c15
-rw-r--r--src/gdisp/gdisp_image_png.c160
-rw-r--r--src/gdisp/gdisp_image_support.h62
-rw-r--r--src/gdisp/gdisp_pixmap.c14
-rw-r--r--src/gdisp/mcufont/mf_bwfont.c30
-rw-r--r--src/gdisp/mcufont/mf_bwfont.h34
-rw-r--r--src/gdisp/mcufont/mf_encoding.c6
-rw-r--r--src/gdisp/mcufont/mf_encoding.h6
-rw-r--r--src/gdisp/mcufont/mf_font.c10
-rw-r--r--src/gdisp/mcufont/mf_font.h36
-rw-r--r--src/gdisp/mcufont/mf_justify.c70
-rw-r--r--src/gdisp/mcufont/mf_justify.h14
-rw-r--r--src/gdisp/mcufont/mf_kerning.c26
-rw-r--r--src/gdisp/mcufont/mf_kerning.h2
-rw-r--r--src/gdisp/mcufont/mf_rlefont.c74
-rw-r--r--src/gdisp/mcufont/mf_rlefont.h30
-rw-r--r--src/gdisp/mcufont/mf_scaledfont.c30
-rw-r--r--src/gdisp/mcufont/mf_scaledfont.h16
-rw-r--r--src/gdisp/mcufont/mf_wordwrap.c42
-rw-r--r--src/gdisp/mcufont/mf_wordwrap.h4
49 files changed, 717 insertions, 716 deletions
diff --git a/src/gdisp/fonts/DejaVuSans10.c b/src/gdisp/fonts/DejaVuSans10.c
index 604fcd02..f3abbae4 100644
--- a/src/gdisp/fonts/DejaVuSans10.c
+++ b/src/gdisp/fonts/DejaVuSans10.c
@@ -11,7 +11,7 @@
#error The font file is not compatible with this version of mcufont.
#endif
-static const uint8_t mf_bwfont_DejaVuSans10_glyph_data_0[1222] = {
+static const gU8 mf_bwfont_DejaVuSans10_glyph_data_0[1222] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00,
0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0xe8, 0x00, 0x3e, 0x00, 0x28, 0x00, 0xf8, 0x00,
0x2e, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x98, 0x00, 0x94, 0x00, 0xfe, 0x01, 0xa4, 0x00,
@@ -91,7 +91,7 @@ static const uint8_t mf_bwfont_DejaVuSans10_glyph_data_0[1222] = {
0x20, 0x00, 0x20, 0x00, 0x10, 0x00,
};
-static const uint16_t mf_bwfont_DejaVuSans10_glyph_offsets_0[96] = {
+static const gU16 mf_bwfont_DejaVuSans10_glyph_offsets_0[96] = {
0x0000, 0x0000, 0x0004, 0x0009, 0x0012, 0x0019, 0x0023, 0x002c,
0x002f, 0x0033, 0x0037, 0x003d, 0x0046, 0x0049, 0x004e, 0x0051,
0x0055, 0x005c, 0x0063, 0x006a, 0x0071, 0x0078, 0x007f, 0x0086,
@@ -106,7 +106,7 @@ static const uint16_t mf_bwfont_DejaVuSans10_glyph_offsets_0[96] = {
0x0238, 0x023f, 0x0246, 0x024c, 0x0252, 0x0255, 0x025b, 0x0263,
};
-static const uint8_t mf_bwfont_DejaVuSans10_glyph_widths_0[95] = {
+static const gU8 mf_bwfont_DejaVuSans10_glyph_widths_0[95] = {
0x03, 0x04, 0x05, 0x08, 0x06, 0x0a, 0x09, 0x03, 0x04, 0x04, 0x05, 0x08, 0x03, 0x04, 0x03, 0x03,
0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x03, 0x03, 0x08, 0x08, 0x08, 0x05,
0x0b, 0x07, 0x07, 0x08, 0x08, 0x07, 0x06, 0x08, 0x08, 0x03, 0x03, 0x07, 0x06, 0x09, 0x08, 0x08,
diff --git a/src/gdisp/fonts/DejaVuSans12.c b/src/gdisp/fonts/DejaVuSans12.c
index e9e16118..e7e39ac3 100644
--- a/src/gdisp/fonts/DejaVuSans12.c
+++ b/src/gdisp/fonts/DejaVuSans12.c
@@ -11,7 +11,7 @@
#error The font file is not compatible with this version of mcufont.
#endif
-static const uint8_t mf_bwfont_DejaVuSans12_glyph_data_0[1372] = {
+static const gU8 mf_bwfont_DejaVuSans12_glyph_data_0[1372] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x03, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00,
0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x90, 0x02, 0xf0, 0x01, 0x9c, 0x00, 0x90, 0x03,
0xf8, 0x00, 0x94, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x01, 0x24, 0x02,
@@ -100,7 +100,7 @@ static const uint8_t mf_bwfont_DejaVuSans12_glyph_data_0[1372] = {
0x20, 0x00, 0x20, 0x00, 0x40, 0x00, 0x40, 0x00, 0x40, 0x00, 0x20, 0x00,
};
-static const uint16_t mf_bwfont_DejaVuSans12_glyph_offsets_0[96] = {
+static const gU16 mf_bwfont_DejaVuSans12_glyph_offsets_0[96] = {
0x0000, 0x0000, 0x0004, 0x0009, 0x0013, 0x001b, 0x0026, 0x0030,
0x0033, 0x0038, 0x003d, 0x0044, 0x004d, 0x0050, 0x0055, 0x0058,
0x005d, 0x0065, 0x006c, 0x0074, 0x007c, 0x0084, 0x008c, 0x0094,
@@ -115,7 +115,7 @@ static const uint16_t mf_bwfont_DejaVuSans12_glyph_offsets_0[96] = {
0x027d, 0x0284, 0x028b, 0x0291, 0x0299, 0x029d, 0x02a4, 0x02ae,
};
-static const uint8_t mf_bwfont_DejaVuSans12_glyph_widths_0[95] = {
+static const gU8 mf_bwfont_DejaVuSans12_glyph_widths_0[95] = {
0x04, 0x05, 0x05, 0x0a, 0x08, 0x0b, 0x0a, 0x03, 0x05, 0x05, 0x06, 0x0a, 0x04, 0x04, 0x04, 0x04,
0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x04, 0x04, 0x0a, 0x0a, 0x0a, 0x06,
0x0d, 0x08, 0x08, 0x08, 0x09, 0x08, 0x07, 0x09, 0x09, 0x03, 0x03, 0x07, 0x06, 0x0a, 0x09, 0x09,
diff --git a/src/gdisp/fonts/DejaVuSans12_aa.c b/src/gdisp/fonts/DejaVuSans12_aa.c
index 3384b4e3..9f5021ea 100644
--- a/src/gdisp/fonts/DejaVuSans12_aa.c
+++ b/src/gdisp/fonts/DejaVuSans12_aa.c
@@ -11,7 +11,7 @@
#error The font file is not compatible with this version of mcufont.
#endif
-static const uint8_t mf_rlefont_DejaVuSans12_aa_dictionary_data[329] = {
+static const gU8 mf_rlefont_DejaVuSans12_aa_dictionary_data[329] = {
0x27, 0x02, 0x0b, 0x80, 0x01, 0x80, 0x07, 0x80, 0x04, 0x80, 0x02, 0x80, 0x06, 0x04, 0x80, 0x02,
0x0e, 0xc9, 0xde, 0xc7, 0x0a, 0x06, 0x2a, 0x10, 0x84, 0x07, 0x80, 0x02, 0x80, 0x0c, 0x80, 0x0c,
0x0f, 0x80, 0x08, 0xcd, 0xc3, 0x86, 0x0d, 0x0c, 0xc2, 0xca, 0x29, 0xc8, 0xcb, 0xc4, 0xcc, 0xce,
@@ -35,7 +35,7 @@ static const uint8_t mf_rlefont_DejaVuSans12_aa_dictionary_data[329] = {
0x45, 0x0f, 0x45, 0x0c, 0x08, 0x48, 0x08, 0x0c, 0x3f,
};
-static const uint16_t mf_rlefont_DejaVuSans12_aa_dictionary_offsets[122] = {
+static const gU16 mf_rlefont_DejaVuSans12_aa_dictionary_offsets[122] = {
0x0000, 0x0001, 0x0002, 0x0003, 0x0005, 0x000b, 0x000d, 0x000e,
0x0010, 0x0011, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019,
0x001c, 0x0020, 0x0021, 0x0023, 0x0025, 0x0026, 0x0027, 0x0028,
@@ -54,7 +54,7 @@ static const uint16_t mf_rlefont_DejaVuSans12_aa_dictionary_offsets[122] = {
0x0143, 0x0149,
};
-static const uint8_t mf_rlefont_DejaVuSans12_aa_glyph_data_0[2069] = {
+static const gU8 mf_rlefont_DejaVuSans12_aa_glyph_data_0[2069] = {
0x04, 0x00, 0x10, 0x05, 0x25, 0x8b, 0x0e, 0x2e, 0x0d, 0x20, 0x83, 0x0f, 0x10, 0x05, 0x1a, 0x94,
0x1d, 0x94, 0x6b, 0xac, 0x10, 0x0a, 0x29, 0x25, 0x0d, 0x01, 0x5d, 0x3f, 0x55, 0x0c, 0x00, 0x08,
0x06, 0x23, 0x05, 0xc3, 0x6b, 0x0a, 0x05, 0x49, 0x45, 0x0d, 0x01, 0x5d, 0x3f, 0x2c, 0x05, 0x23,
@@ -187,7 +187,7 @@ static const uint8_t mf_rlefont_DejaVuSans12_aa_glyph_data_0[2069] = {
0x05, 0x70, 0x0c, 0x05, 0x10,
};
-static const uint16_t mf_rlefont_DejaVuSans12_aa_glyph_offsets_0[95] = {
+static const gU16 mf_rlefont_DejaVuSans12_aa_glyph_offsets_0[95] = {
0x0000, 0x0003, 0x000d, 0x0015, 0x0039, 0x005e, 0x008a, 0x00b7,
0x00bb, 0x00d2, 0x00ec, 0x0104, 0x010d, 0x0112, 0x0117, 0x011c,
0x0133, 0x0152, 0x015a, 0x0175, 0x0196, 0x01ad, 0x01c7, 0x01f1,
diff --git a/src/gdisp/fonts/DejaVuSans16.c b/src/gdisp/fonts/DejaVuSans16.c
index 375ec048..bfe62297 100644
--- a/src/gdisp/fonts/DejaVuSans16.c
+++ b/src/gdisp/fonts/DejaVuSans16.c
@@ -11,7 +11,7 @@
#error The font file is not compatible with this version of mcufont.
#endif
-static const uint8_t mf_rlefont_DejaVuSans16_dictionary_data[247] = {
+static const gU8 mf_rlefont_DejaVuSans16_dictionary_data[247] = {
0x0f, 0x15, 0x83, 0x0a, 0x41, 0x2f, 0x06, 0x0a, 0x80, 0x01, 0x0b, 0x83, 0x01, 0x3d, 0x05, 0x80,
0x09, 0x80, 0x06, 0x80, 0x09, 0x80, 0x06, 0x80, 0x09, 0x80, 0x01, 0x05, 0x80, 0x03, 0x0a, 0x81,
0x0e, 0x80, 0x0d, 0x03, 0x80, 0x01, 0x0f, 0x80, 0x10, 0x80, 0x10, 0x80, 0x01, 0x09, 0x80, 0x01,
@@ -30,7 +30,7 @@ static const uint8_t mf_rlefont_DejaVuSans16_dictionary_data[247] = {
0xc0, 0xc4, 0x2d, 0x2d, 0x23, 0xfc, 0x36,
};
-static const uint16_t mf_rlefont_DejaVuSans16_dictionary_offsets[88] = {
+static const gU16 mf_rlefont_DejaVuSans16_dictionary_offsets[88] = {
0x0000, 0x0001, 0x0002, 0x0004, 0x0006, 0x0007, 0x000a, 0x000d,
0x000e, 0x001b, 0x001e, 0x0020, 0x0023, 0x0026, 0x002d, 0x0030,
0x0031, 0x0037, 0x0038, 0x003b, 0x0040, 0x0042, 0x0046, 0x0049,
@@ -44,7 +44,7 @@ static const uint16_t mf_rlefont_DejaVuSans16_dictionary_offsets[88] = {
0x00e6, 0x00e8, 0x00ea, 0x00ed, 0x00f0, 0x00f1, 0x00f4, 0x00f7,
};
-static const uint8_t mf_rlefont_DejaVuSans16_glyph_data_0[1166] = {
+static const gU8 mf_rlefont_DejaVuSans16_glyph_data_0[1166] = {
0x05, 0x00, 0x10, 0x06, 0x27, 0x43, 0x49, 0x18, 0x2f, 0x2b, 0x10, 0x06, 0x58, 0x55, 0x3d, 0x55,
0x10, 0x0d, 0xf4, 0x19, 0x41, 0x8d, 0x42, 0xfa, 0x5e, 0x29, 0xdd, 0x5e, 0x29, 0xdd, 0x10, 0x0a,
0x2f, 0x65, 0x2c, 0x1a, 0xfe, 0xa9, 0x1d, 0x55, 0xe0, 0x38, 0x8b, 0x4a, 0x36, 0xd6, 0x1d, 0xde,
@@ -120,7 +120,7 @@ static const uint8_t mf_rlefont_DejaVuSans16_glyph_data_0[1166] = {
0x18, 0x8a, 0x4a, 0x49, 0x4c, 0x10, 0x0d, 0x00, 0x1f, 0x1f, 0x93, 0x68, 0x7c, 0x10,
};
-static const uint16_t mf_rlefont_DejaVuSans16_glyph_offsets_0[95] = {
+static const gU16 mf_rlefont_DejaVuSans16_glyph_offsets_0[95] = {
0x0000, 0x0003, 0x000b, 0x0011, 0x001f, 0x0034, 0x004f, 0x0064,
0x0068, 0x0074, 0x007f, 0x008d, 0x0097, 0x009c, 0x00a2, 0x00a6,
0x00b2, 0x00c0, 0x00ca, 0x00d9, 0x00e7, 0x00f8, 0x0106, 0x0116,
diff --git a/src/gdisp/fonts/DejaVuSans16_aa.c b/src/gdisp/fonts/DejaVuSans16_aa.c
index adcf9a37..63de43dc 100644
--- a/src/gdisp/fonts/DejaVuSans16_aa.c
+++ b/src/gdisp/fonts/DejaVuSans16_aa.c
@@ -11,7 +11,7 @@
#error The font file is not compatible with this version of mcufont.
#endif
-static const uint8_t mf_rlefont_DejaVuSans16_aa_dictionary_data[425] = {
+static const gU8 mf_rlefont_DejaVuSans16_aa_dictionary_data[425] = {
0x02, 0x07, 0x05, 0x16, 0x0a, 0x80, 0x02, 0x09, 0x04, 0x11, 0x10, 0x0a, 0x08, 0x01, 0x80, 0x04,
0x80, 0x08, 0x80, 0x40, 0x08, 0x86, 0x14, 0x80, 0x01, 0x80, 0x11, 0x80, 0x11, 0x80, 0xc1, 0x80,
0xc3, 0xcb, 0xde, 0x88, 0x85, 0x80, 0x0e, 0x01, 0xc1, 0x07, 0xc7, 0xc9, 0x07, 0x80, 0x03, 0xca,
@@ -41,7 +41,7 @@ static const uint8_t mf_rlefont_DejaVuSans16_aa_dictionary_data[425] = {
0x30, 0x47, 0x05, 0x66, 0x02, 0x65, 0x06, 0x02, 0x00,
};
-static const uint16_t mf_rlefont_DejaVuSans16_aa_dictionary_offsets[140] = {
+static const gU16 mf_rlefont_DejaVuSans16_aa_dictionary_offsets[140] = {
0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0007, 0x0008, 0x0009,
0x000a, 0x000b, 0x000c, 0x000d, 0x000f, 0x0011, 0x0013, 0x0015,
0x0016, 0x0017, 0x0019, 0x001e, 0x0020, 0x0023, 0x0024, 0x0025,
@@ -62,7 +62,7 @@ static const uint16_t mf_rlefont_DejaVuSans16_aa_dictionary_offsets[140] = {
0x019a, 0x01a2, 0x01a7, 0x01a9,
};
-static const uint8_t mf_rlefont_DejaVuSans16_aa_glyph_data_0[2853] = {
+static const gU8 mf_rlefont_DejaVuSans16_aa_glyph_data_0[2853] = {
0x05, 0x00, 0x10, 0x06, 0x6a, 0x89, 0x1f, 0x0e, 0x1f, 0x0d, 0x82, 0x69, 0x61, 0x10, 0x06, 0x28,
0xed, 0x48, 0xa8, 0x48, 0xa8, 0x48, 0xa8, 0x10, 0x0d, 0x18, 0x69, 0x70, 0x00, 0x2b, 0x03, 0x48,
0x0d, 0x06, 0x00, 0x05, 0x0e, 0x48, 0x4a, 0xa2, 0x70, 0x22, 0x65, 0x2d, 0x88, 0x0a, 0x09, 0x65,
@@ -244,7 +244,7 @@ static const uint8_t mf_rlefont_DejaVuSans16_aa_glyph_data_0[2853] = {
0x7c, 0x36, 0x19, 0x30, 0x10,
};
-static const uint16_t mf_rlefont_DejaVuSans16_aa_glyph_offsets_0[95] = {
+static const gU16 mf_rlefont_DejaVuSans16_aa_glyph_offsets_0[95] = {
0x0000, 0x0003, 0x000e, 0x0018, 0x004e, 0x007e, 0x00d1, 0x010e,
0x0111, 0x0136, 0x0158, 0x016f, 0x0179, 0x0183, 0x0188, 0x018e,
0x01ab, 0x01db, 0x01e8, 0x0210, 0x023c, 0x025c, 0x027b, 0x02b1,
diff --git a/src/gdisp/fonts/DejaVuSans20.c b/src/gdisp/fonts/DejaVuSans20.c
index cf9bd271..ccc36cb3 100644
--- a/src/gdisp/fonts/DejaVuSans20.c
+++ b/src/gdisp/fonts/DejaVuSans20.c
@@ -11,7 +11,7 @@
#error The font file is not compatible with this version of mcufont.
#endif
-static const uint8_t mf_rlefont_DejaVuSans20_dictionary_data[320] = {
+static const gU8 mf_rlefont_DejaVuSans20_dictionary_data[320] = {
0x05, 0x0a, 0x81, 0x03, 0x17, 0x05, 0x81, 0x0b, 0x81, 0x84, 0x0b, 0x04, 0x83, 0x03, 0x82, 0x0b,
0x81, 0x02, 0x81, 0x02, 0x85, 0x12, 0x81, 0x0a, 0x80, 0x01, 0x80, 0x40, 0x18, 0x01, 0x87, 0x0b,
0x12, 0x81, 0x12, 0x81, 0x12, 0x81, 0x12, 0x81, 0x10, 0x04, 0x81, 0x1e, 0x11, 0x06, 0x81, 0x83,
@@ -34,7 +34,7 @@ static const uint8_t mf_rlefont_DejaVuSans20_dictionary_data[320] = {
0xaa, 0x34, 0x1c, 0x34, 0x9c, 0x38, 0x20, 0x37, 0xba, 0x34, 0x28, 0x34, 0x3b, 0x34, 0x39, 0x40,
};
-static const uint16_t mf_rlefont_DejaVuSans20_dictionary_offsets[110] = {
+static const gU16 mf_rlefont_DejaVuSans20_dictionary_offsets[110] = {
0x0000, 0x0001, 0x0004, 0x0005, 0x0009, 0x000b, 0x000d, 0x000f,
0x0011, 0x0014, 0x0015, 0x0018, 0x001b, 0x001d, 0x0020, 0x0028,
0x0029, 0x002b, 0x002c, 0x002d, 0x002f, 0x0031, 0x0033, 0x0036,
@@ -51,7 +51,7 @@ static const uint16_t mf_rlefont_DejaVuSans20_dictionary_offsets[110] = {
0x0135, 0x0137, 0x0139, 0x013b, 0x013e, 0x0140,
};
-static const uint8_t mf_rlefont_DejaVuSans20_glyph_data_0[1558] = {
+static const gU8 mf_rlefont_DejaVuSans20_glyph_data_0[1558] = {
0x06, 0x00, 0x10, 0x08, 0x1a, 0x83, 0x65, 0x22, 0x29, 0x70, 0x10, 0x0a, 0x3e, 0x80, 0x7b, 0xd0,
0x80, 0x7b, 0x5f, 0xfc, 0xb7, 0x10, 0x11, 0x1a, 0x5e, 0x5f, 0xea, 0x20, 0x1f, 0x8c, 0x38, 0xa6,
0x3d, 0x33, 0x6e, 0x33, 0x3e, 0xa7, 0x38, 0x5b, 0x38, 0xa6, 0x3d, 0x33, 0x6e, 0x33, 0x19, 0x3d,
@@ -152,7 +152,7 @@ static const uint8_t mf_rlefont_DejaVuSans20_glyph_data_0[1558] = {
0x3f, 0x42, 0x93, 0x43, 0xc2, 0x10,
};
-static const uint16_t mf_rlefont_DejaVuSans20_glyph_offsets_0[95] = {
+static const gU16 mf_rlefont_DejaVuSans20_glyph_offsets_0[95] = {
0x0000, 0x0003, 0x000b, 0x0016, 0x0037, 0x0058, 0x0084, 0x00a7,
0x00aa, 0x00b7, 0x00c5, 0x00d9, 0x00e5, 0x00ed, 0x00f4, 0x00fa,
0x0104, 0x0114, 0x011f, 0x012f, 0x013d, 0x0155, 0x0165, 0x017d,
diff --git a/src/gdisp/fonts/DejaVuSans20_aa.c b/src/gdisp/fonts/DejaVuSans20_aa.c
index d05ab3b0..5297d319 100644
--- a/src/gdisp/fonts/DejaVuSans20_aa.c
+++ b/src/gdisp/fonts/DejaVuSans20_aa.c
@@ -10,7 +10,7 @@
#error The font file is not compatible with this version of mcufont.
#endif
-static const uint8_t mf_rlefont_DejaVuSans20_aa_dictionary_data[486] = {
+static const gU8 mf_rlefont_DejaVuSans20_aa_dictionary_data[486] = {
0x05, 0x0b, 0x09, 0x81, 0x12, 0x81, 0x81, 0x05, 0x81, 0x0b, 0x0d, 0x17, 0x10, 0x28, 0x0b, 0x86,
0x12, 0x81, 0x12, 0x81, 0x08, 0x0e, 0x06, 0x84, 0x40, 0x1d, 0x80, 0xce, 0x8b, 0x08, 0x8b, 0x15,
0x80, 0xc3, 0x80, 0xcb, 0xca, 0x81, 0x12, 0x0a, 0x02, 0x81, 0xc7, 0x41, 0x3e, 0x01, 0xc9, 0x80,
@@ -44,7 +44,7 @@ static const uint8_t mf_rlefont_DejaVuSans20_aa_dictionary_data[486] = {
0x0f, 0x60, 0x08, 0x4e, 0x0d, 0x28,
};
-static const uint16_t mf_rlefont_DejaVuSans20_aa_dictionary_offsets[156] = {
+static const gU16 mf_rlefont_DejaVuSans20_aa_dictionary_offsets[156] = {
0x0000, 0x0001, 0x0002, 0x0003, 0x0006, 0x000a, 0x000b, 0x000c,
0x000d, 0x000e, 0x0010, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018,
0x001a, 0x001c, 0x001f, 0x0020, 0x0022, 0x0024, 0x0026, 0x0027,
@@ -67,7 +67,7 @@ static const uint16_t mf_rlefont_DejaVuSans20_aa_dictionary_offsets[156] = {
0x01e0, 0x01e2, 0x01e4, 0x01e6,
};
-static const uint8_t mf_rlefont_DejaVuSans20_aa_glyph_data_0[3979] = {
+static const gU8 mf_rlefont_DejaVuSans20_aa_glyph_data_0[3979] = {
0x06, 0x00, 0x10, 0x08, 0x25, 0x22, 0x8a, 0x2e, 0x3d, 0x2e, 0x0d, 0x0d, 0x2e, 0x48, 0x20, 0x22,
0x10, 0x0a, 0x1e, 0xb7, 0x96, 0x96, 0x10, 0x11, 0x58, 0x50, 0x05, 0x6d, 0x30, 0x48, 0x1d, 0x09,
0xf5, 0x01, 0x6f, 0x1d, 0x0d, 0x0b, 0x30, 0x05, 0x6d, 0x37, 0x02, 0x0f, 0x07, 0x00, 0x33, 0x2f,
@@ -319,7 +319,7 @@ static const uint8_t mf_rlefont_DejaVuSans20_aa_glyph_data_0[3979] = {
0x00, 0x01, 0x04, 0x08, 0x0c, 0x47, 0x55, 0x01, 0x25, 0x56, 0x10,
};
-static const uint16_t mf_rlefont_DejaVuSans20_aa_glyph_offsets_0[95] = {
+static const gU16 mf_rlefont_DejaVuSans20_aa_glyph_offsets_0[95] = {
0x0000, 0x0003, 0x0011, 0x0017, 0x0066, 0x00ad, 0x0120, 0x017c,
0x017f, 0x01ac, 0x01db, 0x0207, 0x0210, 0x0219, 0x0222, 0x0227,
0x024f, 0x029c, 0x02af, 0x02e3, 0x031d, 0x034d, 0x0378, 0x03bb,
diff --git a/src/gdisp/fonts/DejaVuSans24.c b/src/gdisp/fonts/DejaVuSans24.c
index caabb080..224b6cfe 100644
--- a/src/gdisp/fonts/DejaVuSans24.c
+++ b/src/gdisp/fonts/DejaVuSans24.c
@@ -11,7 +11,7 @@
#error The font file is not compatible with this version of mcufont.
#endif
-static const uint8_t mf_rlefont_DejaVuSans24_dictionary_data[395] = {
+static const gU8 mf_rlefont_DejaVuSans24_dictionary_data[395] = {
0x80, 0x0a, 0x80, 0x3d, 0x81, 0x02, 0x81, 0x81, 0x09, 0x81, 0x0c, 0x81, 0x09, 0x81, 0x0c, 0x81,
0x09, 0x81, 0x08, 0x16, 0x81, 0x01, 0x82, 0x0e, 0x84, 0x01, 0x07, 0x87, 0x01, 0x86, 0x0d, 0x85,
0x80, 0x0c, 0x83, 0x0f, 0x89, 0x0f, 0x82, 0x07, 0x0b, 0x81, 0x09, 0x81, 0x0c, 0x13, 0x81, 0x16,
@@ -39,7 +39,7 @@ static const uint8_t mf_rlefont_DejaVuSans24_dictionary_data[395] = {
0xc2, 0x90, 0x3b, 0x3a, 0x2a, 0xf0, 0x2d, 0x34, 0x3d, 0xf0, 0x54,
};
-static const uint16_t mf_rlefont_DejaVuSans24_dictionary_offsets[119] = {
+static const gU16 mf_rlefont_DejaVuSans24_dictionary_offsets[119] = {
0x0000, 0x0003, 0x0004, 0x0007, 0x0013, 0x0016, 0x0018, 0x001a,
0x001b, 0x001d, 0x001f, 0x0020, 0x0022, 0x0026, 0x0028, 0x002d,
0x002f, 0x0031, 0x0032, 0x0035, 0x0037, 0x003a, 0x003d, 0x0043,
@@ -57,7 +57,7 @@ static const uint16_t mf_rlefont_DejaVuSans24_dictionary_offsets[119] = {
0x0172, 0x0173, 0x0178, 0x017e, 0x0184, 0x0189, 0x018b,
};
-static const uint8_t mf_rlefont_DejaVuSans24_glyph_data_0[1873] = {
+static const gU8 mf_rlefont_DejaVuSans24_glyph_data_0[1873] = {
0x08, 0x00, 0x10, 0x0a, 0x00, 0x4a, 0x47, 0x5d, 0x56, 0x19, 0x74, 0x10, 0x0b, 0x4c, 0x1a, 0x64,
0xfc, 0x1a, 0x64, 0xfc, 0x1a, 0x10, 0x14, 0xc4, 0x4e, 0xc7, 0xc6, 0x82, 0x8d, 0xc7, 0xc7, 0x82,
0x8d, 0xc5, 0xc7, 0x2b, 0x4b, 0x2c, 0x4b, 0xe7, 0x4a, 0x77, 0x8d, 0x4f, 0x3c, 0x2b, 0xa5, 0x4a,
@@ -178,7 +178,7 @@ static const uint8_t mf_rlefont_DejaVuSans24_glyph_data_0[1873] = {
0x10,
};
-static const uint16_t mf_rlefont_DejaVuSans24_glyph_offsets_0[95] = {
+static const gU16 mf_rlefont_DejaVuSans24_glyph_offsets_0[95] = {
0x0000, 0x0003, 0x000c, 0x0016, 0x0043, 0x006c, 0x00a8, 0x00cf,
0x00d3, 0x00e0, 0x00ec, 0x0101, 0x010f, 0x0114, 0x011d, 0x0121,
0x0130, 0x014a, 0x0157, 0x016d, 0x0186, 0x01a5, 0x01bb, 0x01dd,
diff --git a/src/gdisp/fonts/DejaVuSans24_aa.c b/src/gdisp/fonts/DejaVuSans24_aa.c
index 9afd72c9..8a3d235b 100644
--- a/src/gdisp/fonts/DejaVuSans24_aa.c
+++ b/src/gdisp/fonts/DejaVuSans24_aa.c
@@ -11,7 +11,7 @@
#error The font file is not compatible with this version of mcufont.
#endif
-static const uint8_t mf_rlefont_DejaVuSans24_aa_dictionary_data[596] = {
+static const gU8 mf_rlefont_DejaVuSans24_aa_dictionary_data[596] = {
0x20, 0x0f, 0x04, 0x81, 0x05, 0x1e, 0x11, 0x0c, 0x81, 0x01, 0x81, 0x0e, 0x81, 0x07, 0x81, 0x0e,
0x10, 0xc8, 0x80, 0xce, 0xc5, 0xd1, 0x04, 0x0b, 0x84, 0x09, 0x17, 0x81, 0x17, 0x81, 0x06, 0x88,
0x0e, 0x15, 0x12, 0x0a, 0x17, 0x81, 0x02, 0x09, 0x81, 0xce, 0x85, 0x0c, 0x83, 0x85, 0x06, 0xc2,
@@ -52,7 +52,7 @@ static const uint8_t mf_rlefont_DejaVuSans24_aa_dictionary_data[596] = {
0x38, 0x30, 0x0d, 0x65,
};
-static const uint16_t mf_rlefont_DejaVuSans24_aa_dictionary_offsets[170] = {
+static const gU16 mf_rlefont_DejaVuSans24_aa_dictionary_offsets[170] = {
0x0000, 0x0001, 0x0002, 0x0004, 0x0005, 0x0006, 0x0007, 0x0009,
0x0010, 0x0011, 0x0016, 0x0017, 0x0018, 0x0019, 0x001a, 0x001e,
0x001f, 0x0021, 0x0022, 0x0023, 0x0024, 0x0026, 0x0027, 0x0029,
@@ -77,7 +77,7 @@ static const uint16_t mf_rlefont_DejaVuSans24_aa_dictionary_offsets[170] = {
0x0252, 0x0254,
};
-static const uint8_t mf_rlefont_DejaVuSans24_aa_glyph_data_0[4800] = {
+static const gU8 mf_rlefont_DejaVuSans24_aa_glyph_data_0[4800] = {
0x08, 0x00, 0x10, 0x0a, 0x2d, 0x4c, 0xae, 0x7e, 0x5c, 0x7e, 0x8a, 0x7e, 0x0d, 0x0d, 0x7e, 0x0c,
0x0c, 0x7f, 0x81, 0x98, 0x10, 0x0b, 0x4c, 0x50, 0x7f, 0x93, 0x93, 0x93, 0x10, 0x14, 0x3a, 0x18,
0x52, 0x54, 0x53, 0x1d, 0x36, 0x01, 0x2d, 0x09, 0x55, 0x1d, 0x4a, 0x3a, 0x6c, 0x44, 0xb3, 0x85,
@@ -380,7 +380,7 @@ static const uint8_t mf_rlefont_DejaVuSans24_aa_glyph_data_0[4800] = {
0x58, 0x2b, 0x39, 0x05, 0x01, 0x60, 0x0a, 0xc3, 0x46, 0x2b, 0x07, 0x27, 0x8e, 0x4a, 0x8d, 0x10,
};
-static const uint16_t mf_rlefont_DejaVuSans24_aa_glyph_offsets_0[95] = {
+static const gU16 mf_rlefont_DejaVuSans24_aa_glyph_offsets_0[95] = {
0x0000, 0x0003, 0x0015, 0x001d, 0x0077, 0x00d4, 0x0174, 0x01dd,
0x01e1, 0x021d, 0x0251, 0x0282, 0x028f, 0x0299, 0x02a2, 0x02a7,
0x02de, 0x0337, 0x034b, 0x0389, 0x03d2, 0x040b, 0x0440, 0x049d,
diff --git a/src/gdisp/fonts/DejaVuSans32.c b/src/gdisp/fonts/DejaVuSans32.c
index ca669582..b63d201f 100644
--- a/src/gdisp/fonts/DejaVuSans32.c
+++ b/src/gdisp/fonts/DejaVuSans32.c
@@ -11,7 +11,7 @@
#error The font file is not compatible with this version of mcufont.
#endif
-static const uint8_t mf_rlefont_DejaVuSans32_dictionary_data[578] = {
+static const gU8 mf_rlefont_DejaVuSans32_dictionary_data[578] = {
0x06, 0x83, 0x1e, 0x82, 0x03, 0x0c, 0x80, 0x09, 0x8b, 0x84, 0x0e, 0x80, 0x82, 0x0c, 0x80, 0x05,
0x83, 0x16, 0x83, 0x93, 0x0d, 0x87, 0x83, 0x11, 0x81, 0x1c, 0x87, 0x17, 0x80, 0x01, 0x1e, 0x82,
0x1e, 0x82, 0x1b, 0x81, 0x07, 0x82, 0x06, 0x06, 0x82, 0x03, 0x0b, 0x82, 0x08, 0x03, 0x82, 0x85,
@@ -51,7 +51,7 @@ static const uint8_t mf_rlefont_DejaVuSans32_dictionary_data[578] = {
0xd2, 0x5e,
};
-static const uint16_t mf_rlefont_DejaVuSans32_dictionary_offsets[141] = {
+static const gU16 mf_rlefont_DejaVuSans32_dictionary_offsets[141] = {
0x0000, 0x0002, 0x0005, 0x0007, 0x0008, 0x0009, 0x000a, 0x000c,
0x000f, 0x0011, 0x0013, 0x0016, 0x0017, 0x0019, 0x001a, 0x001e,
0x0022, 0x0024, 0x0027, 0x002a, 0x002d, 0x002f, 0x0031, 0x0034,
@@ -72,7 +72,7 @@ static const uint16_t mf_rlefont_DejaVuSans32_dictionary_offsets[141] = {
0x0233, 0x0239, 0x023b, 0x023f, 0x0242,
};
-static const uint8_t mf_rlefont_DejaVuSans32_glyph_data_0[2504] = {
+static const gU8 mf_rlefont_DejaVuSans32_glyph_data_0[2504] = {
0x0a, 0x00, 0x10, 0x0d, 0x6e, 0x6c, 0x80, 0x6f, 0x25, 0x6e, 0x8b, 0x10, 0x0f, 0x6e, 0x68, 0x2c,
0x7e, 0x7e, 0x7e, 0x7e, 0x10, 0x1b, 0x67, 0x6e, 0x52, 0x58, 0x5e, 0x74, 0xc7, 0x4f, 0x9d, 0x2c,
0x8c, 0x5a, 0x24, 0x9d, 0x2c, 0x9d, 0x2c, 0x8c, 0x5a, 0x24, 0x9d, 0xb4, 0x9d, 0xdc, 0xa5, 0xc7,
@@ -232,7 +232,7 @@ static const uint8_t mf_rlefont_DejaVuSans32_glyph_data_0[2504] = {
0x36, 0x3d, 0xf0, 0x4b, 0x1e, 0x3b, 0xff, 0x10,
};
-static const uint16_t mf_rlefont_DejaVuSans32_glyph_offsets_0[95] = {
+static const gU16 mf_rlefont_DejaVuSans32_glyph_offsets_0[95] = {
0x0000, 0x0003, 0x000c, 0x0015, 0x0038, 0x0077, 0x00c9, 0x0105,
0x0109, 0x011f, 0x0135, 0x0156, 0x0165, 0x016f, 0x0179, 0x017f,
0x0196, 0x01b7, 0x01c8, 0x01dc, 0x01f8, 0x0225, 0x023e, 0x026b,
diff --git a/src/gdisp/fonts/DejaVuSans32_aa.c b/src/gdisp/fonts/DejaVuSans32_aa.c
index 8b8f6e8d..78f56141 100644
--- a/src/gdisp/fonts/DejaVuSans32_aa.c
+++ b/src/gdisp/fonts/DejaVuSans32_aa.c
@@ -11,7 +11,7 @@
#error The font file is not compatible with this version of mcufont.
#endif
-static const uint8_t mf_rlefont_DejaVuSans32_aa_dictionary_data[740] = {
+static const gU8 mf_rlefont_DejaVuSans32_aa_dictionary_data[740] = {
0x86, 0x1a, 0x86, 0x1a, 0x85, 0x1e, 0x82, 0x1e, 0x81, 0x12, 0x82, 0x08, 0x1a, 0x1d, 0x05, 0x85,
0x13, 0x1c, 0x88, 0x0f, 0x81, 0xcb, 0x0a, 0x82, 0x0f, 0x80, 0x1e, 0x82, 0x1e, 0x82, 0x83, 0x08,
0x0c, 0xce, 0x1d, 0x0d, 0x40, 0x07, 0x8d, 0x13, 0xc9, 0x85, 0x1e, 0x82, 0x15, 0x17, 0x8c, 0x01,
@@ -61,7 +61,7 @@ static const uint8_t mf_rlefont_DejaVuSans32_aa_dictionary_data[740] = {
0x3b, 0x2a, 0x0c, 0x1c,
};
-static const uint16_t mf_rlefont_DejaVuSans32_aa_dictionary_offsets[188] = {
+static const gU16 mf_rlefont_DejaVuSans32_aa_dictionary_offsets[188] = {
0x0000, 0x0005, 0x0009, 0x000c, 0x000d, 0x000e, 0x000f, 0x0010,
0x0011, 0x0012, 0x0014, 0x0016, 0x0019, 0x001e, 0x001f, 0x0020,
0x0021, 0x0023, 0x0024, 0x0026, 0x0028, 0x002a, 0x002c, 0x002d,
@@ -88,7 +88,7 @@ static const uint16_t mf_rlefont_DejaVuSans32_aa_dictionary_offsets[188] = {
0x02de, 0x02e0, 0x02e2, 0x02e4,
};
-static const uint8_t mf_rlefont_DejaVuSans32_aa_glyph_data_0[6702] = {
+static const gU8 mf_rlefont_DejaVuSans32_aa_glyph_data_0[6702] = {
0x0a, 0x00, 0x10, 0x0d, 0x82, 0xe0, 0x3b, 0xac, 0x3b, 0x53, 0x28, 0x78, 0x0f, 0x28, 0x78, 0x52,
0x3b, 0x0c, 0x38, 0x3b, 0x0b, 0x88, 0x20, 0x82, 0xc1, 0x10, 0x0f, 0x82, 0xa4, 0xa4, 0xa4, 0xa4,
0xa4, 0xa4, 0xa4, 0xa4, 0xa4, 0x10, 0x1b, 0x76, 0x82, 0x81, 0x4f, 0x3d, 0x0e, 0x93, 0x9f, 0xc6,
@@ -510,7 +510,7 @@ static const uint8_t mf_rlefont_DejaVuSans32_aa_glyph_data_0[6702] = {
0x01, 0x29, 0x0e, 0x06, 0x26, 0x04, 0x09, 0x0c, 0x90, 0x45, 0x03, 0x6b, 0x8f, 0x10,
};
-static const uint16_t mf_rlefont_DejaVuSans32_aa_glyph_offsets_0[95] = {
+static const gU16 mf_rlefont_DejaVuSans32_aa_glyph_offsets_0[95] = {
0x0000, 0x0003, 0x001a, 0x0026, 0x00a6, 0x0132, 0x020e, 0x02a9,
0x02ad, 0x0301, 0x0353, 0x039e, 0x03ad, 0x03b9, 0x03c3, 0x03cb,
0x0416, 0x0497, 0x04b2, 0x0511, 0x0571, 0x05c3, 0x060c, 0x0698,
diff --git a/src/gdisp/fonts/DejaVuSansBold12.c b/src/gdisp/fonts/DejaVuSansBold12.c
index b2581760..f3fe8701 100644
--- a/src/gdisp/fonts/DejaVuSansBold12.c
+++ b/src/gdisp/fonts/DejaVuSansBold12.c
@@ -11,7 +11,7 @@
#error The font file is not compatible with this version of mcufont.
#endif
-static const uint8_t mf_bwfont_DejaVuSansBold12_glyph_data_0[1540] = {
+static const gU8 mf_bwfont_DejaVuSansBold12_glyph_data_0[1540] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x03, 0x7e, 0x03, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00,
0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0xc8, 0x03, 0xf8, 0x01, 0x4e, 0x00,
0xc8, 0x03, 0x7c, 0x00, 0x4e, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x02, 0x7c, 0x02,
@@ -111,7 +111,7 @@ static const uint8_t mf_bwfont_DejaVuSansBold12_glyph_data_0[1540] = {
0x40, 0x00, 0x20, 0x00,
};
-static const uint16_t mf_bwfont_DejaVuSansBold12_glyph_offsets_0[96] = {
+static const gU16 mf_bwfont_DejaVuSansBold12_glyph_offsets_0[96] = {
0x0000, 0x0000, 0x0005, 0x000a, 0x0014, 0x001d, 0x002a, 0x0035,
0x0038, 0x003e, 0x0043, 0x004a, 0x0053, 0x0057, 0x005d, 0x0061,
0x0066, 0x006f, 0x0077, 0x0080, 0x0089, 0x0092, 0x009b, 0x00a4,
@@ -126,7 +126,7 @@ static const uint16_t mf_bwfont_DejaVuSansBold12_glyph_offsets_0[96] = {
0x02cc, 0x02d4, 0x02dc, 0x02e4, 0x02ec, 0x02f0, 0x02f8, 0x0302,
};
-static const uint8_t mf_bwfont_DejaVuSansBold12_glyph_widths_0[95] = {
+static const gU8 mf_bwfont_DejaVuSansBold12_glyph_widths_0[95] = {
0x04, 0x05, 0x06, 0x0a, 0x08, 0x0c, 0x0a, 0x04, 0x05, 0x05, 0x06, 0x0a, 0x05, 0x05, 0x05, 0x04,
0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x05, 0x05, 0x0a, 0x0a, 0x0a, 0x07,
0x0c, 0x09, 0x09, 0x09, 0x0a, 0x08, 0x08, 0x0a, 0x0a, 0x04, 0x04, 0x09, 0x08, 0x0c, 0x0a, 0x0b,
diff --git a/src/gdisp/fonts/DejaVuSansBold12_aa.c b/src/gdisp/fonts/DejaVuSansBold12_aa.c
index bab54f58..798444a0 100644
--- a/src/gdisp/fonts/DejaVuSansBold12_aa.c
+++ b/src/gdisp/fonts/DejaVuSansBold12_aa.c
@@ -11,7 +11,7 @@
#error The font file is not compatible with this version of mcufont.
#endif
-static const uint8_t mf_rlefont_DejaVuSansBold12_aa_dictionary_data[295] = {
+static const gU8 mf_rlefont_DejaVuSansBold12_aa_dictionary_data[295] = {
0x09, 0x06, 0xce, 0x80, 0xc2, 0x02, 0x11, 0x80, 0xc5, 0x07, 0x0a, 0x03, 0x0b, 0x02, 0x01, 0xc2,
0x06, 0x81, 0x81, 0x0c, 0x81, 0x86, 0x04, 0x81, 0x2c, 0x83, 0x05, 0x2b, 0x80, 0xc3, 0x80, 0xcb,
0x0f, 0x40, 0x07, 0xce, 0xcb, 0x80, 0xc6, 0x0c, 0xd9, 0x0c, 0x01, 0xca, 0x84, 0x1a, 0xc5, 0xc1,
@@ -33,7 +33,7 @@ static const uint8_t mf_rlefont_DejaVuSansBold12_aa_dictionary_data[295] = {
0x36, 0x0b, 0x1c, 0x0d, 0x63, 0x0a, 0x49,
};
-static const uint16_t mf_rlefont_DejaVuSansBold12_aa_dictionary_offsets[115] = {
+static const gU16 mf_rlefont_DejaVuSansBold12_aa_dictionary_offsets[115] = {
0x0000, 0x0001, 0x0002, 0x0006, 0x0007, 0x0009, 0x000a, 0x000b,
0x000c, 0x000d, 0x000e, 0x0010, 0x0012, 0x0015, 0x0016, 0x0018,
0x0019, 0x001a, 0x001b, 0x001c, 0x001e, 0x0020, 0x0021, 0x0023,
@@ -51,7 +51,7 @@ static const uint16_t mf_rlefont_DejaVuSansBold12_aa_dictionary_offsets[115] = {
0x0123, 0x0125, 0x0127,
};
-static const uint8_t mf_rlefont_DejaVuSansBold12_aa_glyph_data_0[2289] = {
+static const gU8 mf_rlefont_DejaVuSansBold12_aa_glyph_data_0[2289] = {
0x04, 0x00, 0x10, 0x05, 0x1b, 0x6d, 0x50, 0x0d, 0x0d, 0x50, 0x0c, 0x0c, 0x34, 0x24, 0x10, 0x06,
0x2d, 0xee, 0x52, 0xac, 0x52, 0xac, 0x10, 0x0a, 0x52, 0x82, 0x4a, 0x06, 0x0d, 0x18, 0x46, 0x32,
0x09, 0x19, 0x51, 0x56, 0x69, 0x3f, 0x01, 0x1d, 0x74, 0x4a, 0x06, 0x0d, 0x52, 0xc3, 0x1c, 0x1d,
@@ -198,7 +198,7 @@ static const uint8_t mf_rlefont_DejaVuSansBold12_aa_glyph_data_0[2289] = {
0x10,
};
-static const uint16_t mf_rlefont_DejaVuSansBold12_aa_glyph_offsets_0[95] = {
+static const gU16 mf_rlefont_DejaVuSansBold12_aa_glyph_offsets_0[95] = {
0x0000, 0x0003, 0x000f, 0x0017, 0x003e, 0x0064, 0x00a2, 0x00d5,
0x00d9, 0x00f5, 0x0113, 0x0129, 0x0132, 0x0136, 0x013d, 0x0142,
0x0158, 0x017b, 0x0184, 0x01a5, 0x01cd, 0x01eb, 0x0201, 0x0227,
diff --git a/src/gdisp/fonts/LargeNumbers.c b/src/gdisp/fonts/LargeNumbers.c
index 08517248..d2251524 100644
--- a/src/gdisp/fonts/LargeNumbers.c
+++ b/src/gdisp/fonts/LargeNumbers.c
@@ -11,7 +11,7 @@
#error The font file is not compatible with this version of mcufont.
#endif
-static const uint8_t mf_rlefont_LargeNumbers_dictionary_data[141] = {
+static const gU8 mf_rlefont_LargeNumbers_dictionary_data[141] = {
0x82, 0x11, 0x85, 0x11, 0x82, 0x0f, 0x10, 0x82, 0x02, 0x82, 0x10, 0x82, 0x02, 0x82, 0x16, 0x0d,
0x04, 0x15, 0x81, 0x8c, 0x0b, 0x8c, 0x03, 0x86, 0x11, 0x86, 0x80, 0x14, 0x82, 0x84, 0x0a, 0x1a,
0x82, 0x08, 0x03, 0x81, 0x89, 0x80, 0x0c, 0x44, 0x10, 0x09, 0x82, 0x81, 0x13, 0x83, 0x13, 0x84,
@@ -23,7 +23,7 @@ static const uint8_t mf_rlefont_LargeNumbers_dictionary_data[141] = {
0x3c, 0x65, 0x39, 0x23, 0x23, 0x00, 0x2e, 0x25, 0x2c, 0x3d, 0x2a, 0x23, 0x0f,
};
-static const uint16_t mf_rlefont_LargeNumbers_dictionary_offsets[55] = {
+static const gU16 mf_rlefont_LargeNumbers_dictionary_offsets[55] = {
0x0000, 0x0005, 0x0006, 0x000c, 0x000e, 0x000f, 0x0010, 0x0011,
0x0013, 0x0016, 0x0018, 0x001a, 0x001d, 0x001e, 0x001f, 0x0021,
0x0022, 0x0024, 0x0025, 0x0027, 0x0029, 0x002b, 0x003a, 0x003c,
@@ -33,7 +33,7 @@ static const uint16_t mf_rlefont_LargeNumbers_dictionary_offsets[55] = {
0x0080, 0x0082, 0x0085, 0x0087, 0x0089, 0x008b, 0x008d,
};
-static const uint8_t mf_rlefont_LargeNumbers_glyph_data_0[630] = {
+static const gU8 mf_rlefont_LargeNumbers_glyph_data_0[630] = {
0x08, 0x00, 0x10, 0x0b, 0x00, 0x26, 0x45, 0x49, 0x45, 0x3b, 0x7c, 0x49, 0x0f, 0x10, 0x0d, 0x26,
0x1b, 0x1a, 0x1b, 0x1a, 0x1b, 0x1a, 0x1b, 0x10, 0x14, 0x37, 0x1f, 0x75, 0x19, 0x40, 0x42, 0x37,
0x34, 0x29, 0x27, 0xd4, 0x75, 0x19, 0x40, 0xec, 0x2a, 0x34, 0x29, 0x37, 0x40, 0x42, 0x10, 0x11,
@@ -76,7 +76,7 @@ static const uint8_t mf_rlefont_LargeNumbers_glyph_data_0[630] = {
0x37, 0x47, 0x3f, 0x3e, 0x21, 0x10,
};
-static const uint16_t mf_rlefont_LargeNumbers_glyph_offsets_0[26] = {
+static const gU16 mf_rlefont_LargeNumbers_glyph_offsets_0[26] = {
0x0000, 0x0003, 0x000e, 0x0018, 0x002f, 0x0065, 0x00a5, 0x00d5,
0x00db, 0x00eb, 0x00fb, 0x0114, 0x0125, 0x012d, 0x0136, 0x013b,
0x014c, 0x016a, 0x0180, 0x0199, 0x01b7, 0x01dc, 0x01f5, 0x021b,
diff --git a/src/gdisp/fonts/UI1.c b/src/gdisp/fonts/UI1.c
index c61c0f4f..05af02d8 100644
--- a/src/gdisp/fonts/UI1.c
+++ b/src/gdisp/fonts/UI1.c
@@ -26,7 +26,7 @@
#error The font file is not compatible with this version of mcufont.
#endif
-static const uint8_t mf_rlefont_UI1_dictionary_data[283] = {
+static const gU8 mf_rlefont_UI1_dictionary_data[283] = {
0x03, 0x80, 0x05, 0x84, 0x04, 0x03, 0x82, 0x08, 0x07, 0x81, 0x24, 0x0b, 0x05, 0x80, 0x02, 0x02,
0x81, 0x80, 0x0f, 0x83, 0x06, 0x01, 0x80, 0x05, 0x80, 0x03, 0x37, 0x22, 0x03, 0x83, 0x20, 0x06,
0x80, 0x01, 0x80, 0x85, 0x04, 0x80, 0x01, 0x80, 0x06, 0x12, 0x05, 0x82, 0x07, 0x80, 0x07, 0x15,
@@ -47,7 +47,7 @@ static const uint8_t mf_rlefont_UI1_dictionary_data[283] = {
0x26, 0x37, 0x2f, 0x3e, 0xec, 0x86, 0x00, 0x85, 0x88, 0x27, 0x86,
};
-static const uint16_t mf_rlefont_UI1_dictionary_offsets[108] = {
+static const gU16 mf_rlefont_UI1_dictionary_offsets[108] = {
0x0000, 0x0003, 0x0005, 0x0008, 0x000a, 0x000b, 0x000c, 0x000f,
0x0011, 0x0013, 0x0015, 0x001a, 0x001b, 0x001c, 0x001e, 0x001f,
0x0020, 0x0023, 0x0024, 0x0029, 0x002a, 0x002c, 0x002f, 0x0030,
@@ -64,15 +64,15 @@ static const uint16_t mf_rlefont_UI1_dictionary_offsets[108] = {
0x0114, 0x0116, 0x0118, 0x011b,
};
-static const uint8_t mf_rlefont_UI1_glyph_data_0[3] = {
+static const gU8 mf_rlefont_UI1_glyph_data_0[3] = {
0x03, 0x00, 0x10,
};
-static const uint16_t mf_rlefont_UI1_glyph_offsets_0[1] = {
+static const gU16 mf_rlefont_UI1_glyph_offsets_0[1] = {
0x0000,
};
-static const uint8_t mf_rlefont_UI1_glyph_data_1[786] = {
+static const gU8 mf_rlefont_UI1_glyph_data_1[786] = {
0x03, 0x00, 0x10, 0x03, 0x56, 0x50, 0x34, 0x32, 0x10, 0x05, 0xfd, 0x5e, 0xee, 0x10, 0x08, 0xc4,
0x44, 0x5e, 0x19, 0x80, 0xac, 0x1b, 0x8b, 0x2a, 0xd8, 0x10, 0x07, 0x35, 0x66, 0x64, 0x35, 0x57,
0x8a, 0x48, 0x88, 0x76, 0x0f, 0x10, 0x0b, 0x2f, 0xd4, 0x8c, 0x8d, 0xa8, 0x81, 0x9a, 0x32, 0x8a,
@@ -125,7 +125,7 @@ static const uint8_t mf_rlefont_UI1_glyph_data_1[786] = {
0x1b, 0x10,
};
-static const uint16_t mf_rlefont_UI1_glyph_offsets_1[100] = {
+static const gU16 mf_rlefont_UI1_glyph_offsets_1[100] = {
0x0000, 0x0003, 0x0009, 0x000e, 0x001a, 0x0026, 0x0036, 0x0045,
0x0048, 0x004f, 0x0056, 0x005e, 0x0066, 0x006c, 0x0070, 0x0075,
0x007c, 0x0088, 0x0090, 0x0098, 0x00a1, 0x00ac, 0x00b5, 0x00bc,
@@ -141,7 +141,7 @@ static const uint16_t mf_rlefont_UI1_glyph_offsets_1[100] = {
0x02ff, 0x02fe, 0x02fe, 0x030a,
};
-static const uint8_t mf_rlefont_UI1_glyph_data_2[786] = {
+static const gU8 mf_rlefont_UI1_glyph_data_2[786] = {
0x06, 0x26, 0xf8, 0x66, 0x21, 0xa2, 0x1b, 0x10, 0x08, 0x23, 0x29, 0x10, 0x0c, 0x23, 0x43, 0x83,
0x10, 0x00, 0x0b, 0x7d, 0x37, 0xdd, 0x8a, 0xad, 0x7a, 0xae, 0x10, 0x03, 0x1d, 0x47, 0x5f, 0x10,
0x06, 0x34, 0x8c, 0x1b, 0x6e, 0xfd, 0x78, 0x70, 0xd0, 0x32, 0x10, 0x07, 0x00, 0x2f, 0x6e, 0x3e,
@@ -194,7 +194,7 @@ static const uint8_t mf_rlefont_UI1_glyph_data_2[786] = {
0x82, 0x10,
};
-static const uint16_t mf_rlefont_UI1_glyph_offsets_2[107] = {
+static const gU16 mf_rlefont_UI1_glyph_offsets_2[107] = {
0x0000, 0x0008, 0x000c, 0x0011, 0x0012, 0x0011, 0x0011, 0x0011,
0x0011, 0x0011, 0x0011, 0x0011, 0x001b, 0x0020, 0x002b, 0x0035,
0x0041, 0x004c, 0x0053, 0x0060, 0x0064, 0x0073, 0x007d, 0x0086,
diff --git a/src/gdisp/fonts/UI2.c b/src/gdisp/fonts/UI2.c
index b1f368c2..6bee68ec 100644
--- a/src/gdisp/fonts/UI2.c
+++ b/src/gdisp/fonts/UI2.c
@@ -26,7 +26,7 @@
#error The font file is not compatible with this version of mcufont.
#endif
-static const uint8_t mf_rlefont_UI2_dictionary_data[159] = {
+static const gU8 mf_rlefont_UI2_dictionary_data[159] = {
0x2c, 0x80, 0x06, 0x80, 0x03, 0x80, 0x06, 0x80, 0x03, 0x80, 0x01, 0x01, 0x80, 0x06, 0x80, 0x80,
0x0a, 0x80, 0x06, 0x21, 0x82, 0x01, 0x80, 0x07, 0x03, 0x80, 0x01, 0x80, 0x05, 0x02, 0x80, 0x07,
0x80, 0x0a, 0x80, 0x0a, 0x0b, 0x80, 0x01, 0x80, 0x05, 0x80, 0x02, 0x04, 0x80, 0x02, 0x09, 0x01,
@@ -39,7 +39,7 @@ static const uint8_t mf_rlefont_UI2_dictionary_data[159] = {
0xc6, 0xa9, 0x25, 0x2e, 0x1e, 0xd6, 0x29, 0x1e, 0x25, 0x28, 0x1b, 0x1f, 0x22, 0x1b, 0x74,
};
-static const uint16_t mf_rlefont_UI2_dictionary_offsets[62] = {
+static const gU16 mf_rlefont_UI2_dictionary_offsets[62] = {
0x0000, 0x0001, 0x000b, 0x000f, 0x0013, 0x0014, 0x0015, 0x0018,
0x001c, 0x001d, 0x001f, 0x0021, 0x0024, 0x0025, 0x0028, 0x002b,
0x002e, 0x002f, 0x0031, 0x0032, 0x0034, 0x0035, 0x0038, 0x003a,
@@ -50,7 +50,7 @@ static const uint16_t mf_rlefont_UI2_dictionary_offsets[62] = {
0x0092, 0x0095, 0x0096, 0x0098, 0x009d, 0x009f,
};
-static const uint8_t mf_rlefont_UI2_glyph_data_0[822] = {
+static const gU8 mf_rlefont_UI2_glyph_data_0[822] = {
0x03, 0x00, 0x10, 0x03, 0x46, 0x39, 0x4e, 0x10, 0x05, 0x50, 0xee, 0x10, 0x08, 0xfc, 0x24, 0x50,
0xe3, 0x22, 0x86, 0x1f, 0x22, 0x38, 0x50, 0x10, 0x07, 0xfc, 0x1e, 0x92, 0x48, 0x28, 0xd0, 0x23,
0x86, 0x88, 0x41, 0x2e, 0x10, 0x0b, 0x28, 0xdc, 0x94, 0xa8, 0x88, 0x96, 0x85, 0x9a, 0x28, 0x91,
@@ -105,7 +105,7 @@ static const uint8_t mf_rlefont_UI2_glyph_data_0[822] = {
0x07, 0x2c, 0x2e, 0x89, 0x6c, 0x10,
};
-static const uint16_t mf_rlefont_UI2_glyph_offsets_0[95] = {
+static const gU16 mf_rlefont_UI2_glyph_offsets_0[95] = {
0x0000, 0x0003, 0x0008, 0x000c, 0x0018, 0x0025, 0x0036, 0x0045,
0x0048, 0x004e, 0x0054, 0x005e, 0x0067, 0x006c, 0x0070, 0x0075,
0x007e, 0x008c, 0x0095, 0x009e, 0x00a8, 0x00b4, 0x00be, 0x00c5,
diff --git a/src/gdisp/fonts/fixed_10x20.c b/src/gdisp/fonts/fixed_10x20.c
index 6c6fc416..daff69ff 100644
--- a/src/gdisp/fonts/fixed_10x20.c
+++ b/src/gdisp/fonts/fixed_10x20.c
@@ -11,7 +11,7 @@
#error The font file is not compatible with this version of mcufont.
#endif
-static const uint8_t mf_bwfont_fixed_10x20_glyph_data_0[2193] = {
+static const gU8 mf_bwfont_fixed_10x20_glyph_data_0[2193] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x1b, 0x00, 0xff, 0x1b, 0x00, 0x00,
0x00, 0x00, 0x07, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00,
0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x10, 0x0f, 0x00, 0xf0, 0x0f, 0x00, 0xfe, 0x01, 0x00,
@@ -152,7 +152,7 @@ static const uint8_t mf_bwfont_fixed_10x20_glyph_data_0[2193] = {
0x00,
};
-static const uint16_t mf_bwfont_fixed_10x20_glyph_offsets_0[96] = {
+static const gU16 mf_bwfont_fixed_10x20_glyph_offsets_0[96] = {
0x0000, 0x0000, 0x0005, 0x000c, 0x0015, 0x001d, 0x0026, 0x002f,
0x0034, 0x003b, 0x0041, 0x0049, 0x0051, 0x0057, 0x005f, 0x0065,
0x006d, 0x0075, 0x007d, 0x0085, 0x008d, 0x0095, 0x009d, 0x00a5,
@@ -167,7 +167,7 @@ static const uint16_t mf_bwfont_fixed_10x20_glyph_offsets_0[96] = {
0x02a6, 0x02ae, 0x02b6, 0x02be, 0x02c6, 0x02cb, 0x02d3, 0x02db,
};
-static const uint8_t mf_bwfont_fixed_10x20_glyph_widths_0[95] = {
+static const gU8 mf_bwfont_fixed_10x20_glyph_widths_0[95] = {
0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a,
0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a,
0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a,
diff --git a/src/gdisp/fonts/fixed_5x8.c b/src/gdisp/fonts/fixed_5x8.c
index d65d58bf..367971f5 100644
--- a/src/gdisp/fonts/fixed_5x8.c
+++ b/src/gdisp/fonts/fixed_5x8.c
@@ -11,7 +11,7 @@
#error The font file is not compatible with this version of mcufont.
#endif
-static const uint8_t mf_bwfont_fixed_5x8_glyph_data_0[475] = {
+static const gU8 mf_bwfont_fixed_5x8_glyph_data_0[475] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5e, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x0e, 0x00, 0x14,
0x7f, 0x14, 0x7f, 0x14, 0x04, 0x2a, 0x7f, 0x2a, 0x10, 0x00, 0x16, 0x08, 0x34, 0x00, 0x36, 0x49,
0x36, 0x40, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x00, 0x00, 0x00, 0x42, 0x3c,
diff --git a/src/gdisp/fonts/fixed_7x14.c b/src/gdisp/fonts/fixed_7x14.c
index 28b05608..bff0ef77 100644
--- a/src/gdisp/fonts/fixed_7x14.c
+++ b/src/gdisp/fonts/fixed_7x14.c
@@ -11,7 +11,7 @@
#error The font file is not compatible with this version of mcufont.
#endif
-static const uint8_t mf_bwfont_fixed_7x14_glyph_data_0[1330] = {
+static const gU8 mf_bwfont_fixed_7x14_glyph_data_0[1330] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xfe, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0f, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x00, 0xfe, 0x07,
diff --git a/src/gdisp/gdisp.c b/src/gdisp/gdisp.c
index 8f8dbd7c..7b5438d7 100644
--- a/src/gdisp/gdisp.c
+++ b/src/gdisp/gdisp.c
@@ -196,7 +196,7 @@ static GFXINLINE void fillarea(GDisplay *g) {
if (gvmt(g)->writestart)
#endif
{
- uint32_t area;
+ gU32 area;
#if GDISP_HARDWARE_STREAM_POS
if ((g->flags & GDISP_FLG_SCRSTREAM)) {
@@ -205,7 +205,7 @@ static GFXINLINE void fillarea(GDisplay *g) {
}
#endif
- area = (uint32_t)g->p.cx * g->p.cy;
+ area = (gU32)g->p.cx * g->p.cy;
gdisp_lld_write_start(g);
#if GDISP_HARDWARE_STREAM_POS
#if GDISP_HARDWARE_STREAM_POS == HARDWARE_AUTODETECT
@@ -426,9 +426,9 @@ static void vline_clip(GDisplay *g) {
// Parameters: x,y and x1,y1
// Alters: x,y x1,y1 cx,cy
static void line_clip(GDisplay *g) {
- int16_t dy, dx;
- int16_t addx, addy;
- int16_t P, diff, i;
+ gI16 dy, dx;
+ gI16 addx, addy;
+ gI16 P, diff, i;
// Is this a horizontal line (or a point)
if (g->p.y == g->p.y1) {
@@ -713,8 +713,8 @@ gCoord gdispGGetWidth(GDisplay *g) { return g->g.Width; }
gCoord gdispGGetHeight(GDisplay *g) { return g->g.Height; }
gPowermode gdispGGetPowerMode(GDisplay *g) { return g->g.Powermode; }
gOrientation gdispGGetOrientation(GDisplay *g) { return g->g.Orientation; }
-uint8_t gdispGGetBacklight(GDisplay *g) { return g->g.Backlight; }
-uint8_t gdispGGetContrast(GDisplay *g) { return g->g.Contrast; }
+gU8 gdispGGetBacklight(GDisplay *g) { return g->g.Backlight; }
+gU8 gdispGGetContrast(GDisplay *g) { return g->g.Contrast; }
void gdispGFlush(GDisplay *g) {
#if GDISP_HARDWARE_FLUSH
@@ -1041,13 +1041,13 @@ void gdispGClear(GDisplay *g, gColor color) {
if (gvmt(g)->writestart)
#endif
{
- uint32_t area;
+ gU32 area;
g->p.x = g->p.y = 0;
g->p.cx = g->g.Width;
g->p.cy = g->g.Height;
g->p.color = color;
- area = (uint32_t)g->p.cx * g->p.cy;
+ area = (gU32)g->p.cx * g->p.cy;
gdisp_lld_write_start(g);
#if GDISP_HARDWARE_STREAM_POS
@@ -1428,8 +1428,8 @@ void gdispGBlitArea(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoor
#if GDISP_NEED_ELLIPSE
void gdispGDrawEllipse(GDisplay *g, gCoord x, gCoord y, gCoord a, gCoord b, gColor color) {
gCoord dx, dy;
- int32_t a2, b2;
- int32_t err, e2;
+ gI32 a2, b2;
+ gI32 err, e2;
MUTEX_ENTER(g);
@@ -1467,8 +1467,8 @@ void gdispGBlitArea(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoor
#if GDISP_NEED_ELLIPSE
void gdispGFillEllipse(GDisplay *g, gCoord x, gCoord y, gCoord a, gCoord b, gColor color) {
gCoord dx, dy;
- int32_t a2, b2;
- int32_t err, e2;
+ gI32 a2, b2;
+ gI32 err, e2;
MUTEX_ENTER(g);
@@ -1502,7 +1502,7 @@ void gdispGBlitArea(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoor
#endif
#if GDISP_NEED_ARCSECTORS
- void gdispGDrawArcSectors(GDisplay *g, gCoord x, gCoord y, gCoord radius, uint8_t sectors, gColor color) {
+ void gdispGDrawArcSectors(GDisplay *g, gCoord x, gCoord y, gCoord radius, gU8 sectors, gColor color) {
gCoord a, b, P;
MUTEX_ENTER(g);
@@ -1546,7 +1546,7 @@ void gdispGBlitArea(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoor
#endif
#if GDISP_NEED_ARCSECTORS
- void gdispGFillArcSectors(GDisplay *g, gCoord x, gCoord y, gCoord radius, uint8_t sectors, gColor color) {
+ void gdispGFillArcSectors(GDisplay *g, gCoord x, gCoord y, gCoord radius, gU8 sectors, gColor color) {
gCoord a, b, P;
MUTEX_ENTER(g);
@@ -1733,7 +1733,7 @@ void gdispGBlitArea(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoor
void gdispGDrawArc(GDisplay *g, gCoord x, gCoord y, gCoord radius, gCoord start, gCoord end, gColor color) {
gCoord a, b, P, sedge, eedge;
- uint8_t full, sbit, ebit, tbit;
+ gU8 full, sbit, ebit, tbit;
// Normalize the angles
if (start < 0)
@@ -2036,7 +2036,7 @@ void gdispGBlitArea(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoor
gCoord a, b, P;
gCoord sy, ey;
fixed sxa, sxb, sxd, exa, exb, exd;
- uint8_t qtr;
+ gU8 qtr;
MUTEX_ENTER(g);
@@ -3099,7 +3099,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
}
}
- static int32_t rounding_div(const int32_t n, const int32_t d)
+ static gI32 rounding_div(const gI32 n, const gI32 d)
{
if ((n < 0) != (d < 0))
return (n - d/2) / d;
@@ -3112,7 +3112,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
static void get_normal_vector(gCoord dx, gCoord dy, gCoord norm, gCoord *nx, gCoord *ny)
{
gCoord absDx, absDy;
- int32_t len_n, len, len2;
+ gI32 len_n, len, len2;
char maxSteps;
/* Take the absolute value of dx and dy, multiplied by 2 for precision */
@@ -3259,7 +3259,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
#include "mcufont/mcufont.h"
#if GDISP_NEED_ANTIALIAS && GDISP_HARDWARE_PIXELREAD
- static void drawcharline(int16_t x, int16_t y, uint8_t count, uint8_t alpha, void *state) {
+ static void drawcharline(gI16 x, gI16 y, gU8 count, gU8 alpha, void *state) {
#define GD ((GDisplay *)state)
if (y < GD->t.clipy0 || y >= GD->t.clipy1 || x+count <= GD->t.clipx0 || x >= GD->t.clipx1)
return;
@@ -3282,7 +3282,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
#undef GD
}
#else
- static void drawcharline(int16_t x, int16_t y, uint8_t count, uint8_t alpha, void *state) {
+ static void drawcharline(gI16 x, gI16 y, gU8 count, gU8 alpha, void *state) {
#define GD ((GDisplay *)state)
if (y < GD->t.clipy0 || y >= GD->t.clipy1 || x+count <= GD->t.clipx0 || x >= GD->t.clipx1)
return;
@@ -3301,7 +3301,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
#endif
#if GDISP_NEED_ANTIALIAS
- static void fillcharline(int16_t x, int16_t y, uint8_t count, uint8_t alpha, void *state) {
+ static void fillcharline(gI16 x, gI16 y, gU8 count, gU8 alpha, void *state) {
#define GD ((GDisplay *)state)
if (y < GD->t.clipy0 || y >= GD->t.clipy1 || x+count <= GD->t.clipx0 || x >= GD->t.clipx1)
return;
@@ -3325,14 +3325,14 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
#endif
/* Callback to render characters. */
- static uint8_t drawcharglyph(int16_t x, int16_t y, mf_char ch, void *state) {
+ static gU8 drawcharglyph(gI16 x, gI16 y, mf_char ch, void *state) {
#define GD ((GDisplay *)state)
return mf_render_character(GD->t.font, x, y, ch, drawcharline, state);
#undef GD
}
/* Callback to render characters. */
- static uint8_t fillcharglyph(int16_t x, int16_t y, mf_char ch, void *state) {
+ static gU8 fillcharglyph(gI16 x, gI16 y, mf_char ch, void *state) {
#define GD ((GDisplay *)state)
return mf_render_character(GD->t.font, x, y, ch, fillcharline, state);
#undef GD
@@ -3340,21 +3340,21 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
/* Callback to render string boxes with word wrap. */
#if GDISP_NEED_TEXT_WORDWRAP
- static gBool mf_countline_callback(mf_str line, uint16_t count, void *state) {
+ static gBool mf_countline_callback(mf_str line, gU16 count, void *state) {
(void) line;
(void) count;
((gCoord*)state)[0]++;
return gTrue;
}
- static gBool mf_drawline_callback(mf_str line, uint16_t count, void *state) {
+ static gBool mf_drawline_callback(mf_str line, gU16 count, void *state) {
#define GD ((GDisplay *)state)
mf_render_aligned(GD->t.font, GD->t.wrapx, GD->t.wrapy, GD->t.lrj, line, count, drawcharglyph, state);
GD->t.wrapy += GD->t.font->line_height;
#undef GD
return gTrue;
}
- static gBool mf_fillline_callback(mf_str line, uint16_t count, void *state) {
+ static gBool mf_fillline_callback(mf_str line, gU16 count, void *state) {
#define GD ((GDisplay *)state)
mf_render_aligned(GD->t.font, GD->t.wrapx, GD->t.wrapy, GD->t.lrj, line, count, fillcharglyph, state);
GD->t.wrapy += GD->t.font->line_height;
@@ -3363,7 +3363,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
}
#endif
- void gdispGDrawChar(GDisplay *g, gCoord x, gCoord y, uint16_t c, gFont font, gColor color) {
+ void gdispGDrawChar(GDisplay *g, gCoord x, gCoord y, gU16 c, gFont font, gColor color) {
if (!font)
return;
MUTEX_ENTER(g);
@@ -3378,7 +3378,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
MUTEX_EXIT(g);
}
- void gdispGFillChar(GDisplay *g, gCoord x, gCoord y, uint16_t c, gFont font, gColor color, gColor bgcolor) {
+ void gdispGFillChar(GDisplay *g, gCoord x, gCoord y, gU16 c, gFont font, gColor color, gColor bgcolor) {
if (!font)
return;
MUTEX_ENTER(g);
@@ -3632,7 +3632,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
return mf_character_width(font, c);
}
- gCoord gdispGetStringWidthCount(const char* str, gFont font, uint16_t count) {
+ gCoord gdispGetStringWidthCount(const char* str, gFont font, gU16 count) {
if (!str || !font)
return 0;
@@ -3652,14 +3652,14 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
#if GDISP_PIXELFORMAT == GDISP_PIXELFORMAT_RGB888
// Special alpha hacked version.
// Note: this will still work with real RGB888
- gColor gdispBlendColor(gColor fg, gColor bg, uint8_t alpha)
+ gColor gdispBlendColor(gColor fg, gColor bg, gU8 alpha)
{
- uint32_t ratio;
- uint32_t a1, r1, g1, b1;
- uint32_t a2, r2, g2, b2;
+ gU32 ratio;
+ gU32 a1, r1, g1, b1;
+ gU32 a2, r2, g2, b2;
// Ratio - add one to get 1 to 256
- ratio = (uint32_t)alpha + 1; // 0 to 1 in 0.8 fixed point
+ ratio = (gU32)alpha + 1; // 0 to 1 in 0.8 fixed point
// Calculate the pre-multiplied values of r, g, b for the fg color
a1 = ALPHA_OF(fg); // 0 to 1 in 0.8 fixed point
@@ -3699,11 +3699,11 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
return ARGB2COLOR(a1, r1, g1, b1);
}
#else
- gColor gdispBlendColor(gColor fg, gColor bg, uint8_t alpha)
+ gColor gdispBlendColor(gColor fg, gColor bg, gU8 alpha)
{
- uint16_t fg_ratio = alpha + 1;
- uint16_t bg_ratio = 256 - alpha;
- uint16_t r, g, b;
+ gU16 fg_ratio = alpha + 1;
+ gU16 bg_ratio = 256 - alpha;
+ gU16 r, g, b;
r = RED_OF(fg) * fg_ratio;
g = GREEN_OF(fg) * fg_ratio;
@@ -3722,7 +3722,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
#endif
gColor gdispContrastColor(gColor color) {
- uint16_t r, g, b;
+ gU16 r, g, b;
r = RED_OF(color) > 128 ? 0 : 255;
g = GREEN_OF(color) > 128 ? 0 : 255;
diff --git a/src/gdisp/gdisp.h b/src/gdisp/gdisp.h
index a7d4ea4c..dffde4aa 100644
--- a/src/gdisp/gdisp.h
+++ b/src/gdisp/gdisp.h
@@ -36,7 +36,7 @@
/**
* @brief The type for a coordinate or length on the screen.
*/
-typedef int16_t gCoord;
+typedef gI16 gCoord;
#if GFX_USE_GDISP || defined(__DOXYGEN__)
@@ -237,7 +237,7 @@ typedef gColor gPixel;
*
* @api
*/
-gColor gdispBlendColor(gColor fg, gColor bg, uint8_t alpha);
+gColor gdispBlendColor(gColor fg, gColor bg, gU8 alpha);
/**
* @brief Find a contrasting color
@@ -346,7 +346,7 @@ gOrientation gdispGGetOrientation(GDisplay *g);
*
* @api
*/
-uint8_t gdispGGetBacklight(GDisplay *g);
+gU8 gdispGGetBacklight(GDisplay *g);
#define gdispGetBacklight() gdispGGetBacklight(GDISP)
/**
@@ -358,7 +358,7 @@ uint8_t gdispGGetBacklight(GDisplay *g);
*
* @api
*/
-uint8_t gdispGGetContrast(GDisplay *g);
+gU8 gdispGGetContrast(GDisplay *g);
#define gdispGetContrast() gdispGGetContrast(GDISP)
/* Drawing Functions */
@@ -657,7 +657,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
*
* @api
*/
- void gdispGDrawArcSectors(GDisplay *g, gCoord x, gCoord y, gCoord radius, uint8_t sectors, gColor color);
+ void gdispGDrawArcSectors(GDisplay *g, gCoord x, gCoord y, gCoord radius, gU8 sectors, gColor color);
#define gdispDrawArcSectors(x,y,r,s,c) gdispGDrawArcSectors(GDISP,x,y,r,s,c)
/**
@@ -686,7 +686,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
*
* @api
*/
- void gdispGFillArcSectors(GDisplay *g, gCoord x, gCoord y, gCoord radius, uint8_t sectors, gColor color);
+ void gdispGFillArcSectors(GDisplay *g, gCoord x, gCoord y, gCoord radius, gU8 sectors, gColor color);
#define gdispFillArcSectors(x,y,r,s,c) gdispGFillArcSectors(GDISP,x,y,r,s,c)
#endif
@@ -917,7 +917,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
*
* @api
*/
- void gdispGDrawChar(GDisplay *g, gCoord x, gCoord y, uint16_t c, gFont font, gColor color);
+ void gdispGDrawChar(GDisplay *g, gCoord x, gCoord y, gU16 c, gFont font, gColor color);
#define gdispDrawChar(x,y,s,f,c) gdispGDrawChar(GDISP,x,y,s,f,c)
/**
@@ -933,7 +933,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
*
* @api
*/
- void gdispGFillChar(GDisplay *g, gCoord x, gCoord y, uint16_t c, gFont font, gColor color, gColor bgcolor);
+ void gdispGFillChar(GDisplay *g, gCoord x, gCoord y, gU16 c, gFont font, gColor color, gColor bgcolor);
#define gdispFillChar(x,y,s,f,c,b) gdispGFillChar(GDISP,x,y,s,f,c,b)
/**
@@ -1040,7 +1040,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
*
* @api
*/
- gCoord gdispGetStringWidthCount(const char* str, gFont font, uint16_t count);
+ gCoord gdispGetStringWidthCount(const char* str, gFont font, gU16 count);
/**
* @brief Get the pixel width of an entire string.
@@ -1090,7 +1090,7 @@ void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor
* @param[in] scale_x The scale factor in horizontal direction.
* @param[in] scale_y The scale factor in vertical direction.
*/
- gFont gdispScaleFont(gFont font, uint8_t scale_x, uint8_t scale_y);
+ gFont gdispScaleFont(gFont font, gU8 scale_x, gU8 scale_y);
/**
* @brief Get the name of the specified font.
diff --git a/src/gdisp/gdisp_colors.h b/src/gdisp/gdisp_colors.h
index 4f4521a8..37484165 100644
--- a/src/gdisp/gdisp_colors.h
+++ b/src/gdisp/gdisp_colors.h
@@ -23,7 +23,7 @@
#if GFX_USE_GDISP || defined(__DOXYGEN__)
-typedef uint16_t gColorformat;
+typedef gU16 gColorformat;
/**
* @name Color system masks
@@ -173,7 +173,7 @@ typedef uint16_t gColorformat;
/**
* @brief The color type
*/
- #define COLOR_TYPE uint16_t
+ #define COLOR_TYPE gU16
/**
* @brief The number of bits in the color type (not necessarily the same as COLOR_BITS).
@@ -214,7 +214,7 @@ typedef uint16_t gColorformat;
* @note A 5 bit color component maximum value (0x1F) converts to 0xF8 (slightly off-color)
* @{
*/
- #define LUMA_OF(c) ((RED_OF(c)+((uint16_t)GREEN_OF(c)<<1)+BLUE_OF(c))>>2)
+ #define LUMA_OF(c) ((RED_OF(c)+((gU16)GREEN_OF(c)<<1)+BLUE_OF(c))>>2)
#define RED_OF(c) (((c) & 0xF800)>>8)
#define GREEN_OF(c) (((c)&0x007E)>>3)
#define BLUE_OF(c) (((c)&0x001F)<<3)
@@ -234,7 +234,7 @@ typedef uint16_t gColorformat;
* @note A 5 bit color component maximum value (0x1F) converts to 0xFF (the true equivalent color)
* @{
*/
- #define EXACT_LUMA_OF(c) ((EXACT_RED_OF(c)+((uint16_t)EXACT_GREEN_OF(c)<<1)+EXACT_BLUE_OF(c))>>2)
+ #define EXACT_LUMA_OF(c) ((EXACT_RED_OF(c)+((gU16)EXACT_GREEN_OF(c)<<1)+EXACT_BLUE_OF(c))>>2)
#define EXACT_RED_OF(c) (((((c)>>11)&0x1F)*255)/31)
#define EXACT_GREEN_OF(c) (((((c)>>5)&0x3F)*255)/63)
#define EXACT_BLUE_OF(c) (((((c)>>0)&0x1F)*255)/31)
@@ -261,13 +261,13 @@ typedef uint16_t gColorformat;
// From the number of bits determine COLOR_TYPE, COLOR_TYPE_BITS and masking
#if COLOR_BITS <= 8
- #define COLOR_TYPE uint8_t
+ #define COLOR_TYPE gU8
#define COLOR_TYPE_BITS 8
#elif COLOR_BITS <= 16
- #define COLOR_TYPE uint16_t
+ #define COLOR_TYPE gU16
#define COLOR_TYPE_BITS 16
#elif COLOR_BITS <= 32
- #define COLOR_TYPE uint32_t
+ #define COLOR_TYPE gU32
#define COLOR_TYPE_BITS 32
#else
#error "GDISP: Cannot define color types with more than 32 bits"
@@ -321,11 +321,11 @@ typedef uint16_t gColorformat;
#define BLUE_OF(c) (((c) & (((1<<COLOR_BITS_B)-1) << COLOR_SHIFT_B)) << (8-(COLOR_BITS_B+COLOR_SHIFT_B)))
#define RGB2COLOR_B(b) (((COLOR_TYPE)((b) & (0xFF & ~((1<<(8-COLOR_BITS_B))-1)))) >> (8-(COLOR_BITS_B+COLOR_SHIFT_B)))
#endif
- #define LUMA_OF(c) ((RED_OF(c)+((uint16_t)GREEN_OF(c)<<1)+BLUE_OF(c))>>2)
- #define EXACT_RED_OF(c) (((uint16_t)(((c)>>COLOR_SHIFT_R)&((1<<COLOR_BITS_R)-1))*255)/((1<<COLOR_BITS_R)-1))
- #define EXACT_GREEN_OF(c) (((uint16_t)(((c)>>COLOR_SHIFT_G)&((1<<COLOR_BITS_G)-1))*255)/((1<<COLOR_BITS_G)-1))
- #define EXACT_BLUE_OF(c) (((uint16_t)(((c)>>COLOR_SHIFT_B)&((1<<COLOR_BITS_B)-1))*255)/((1<<COLOR_BITS_B)-1))
- #define EXACT_LUMA_OF(c) ((EXACT_RED_OF(c)+((uint16_t)EXACT_GREEN_OF(c)<<1)+EXACT_BLUE_OF(c))>>2)
+ #define LUMA_OF(c) ((RED_OF(c)+((gU16)GREEN_OF(c)<<1)+BLUE_OF(c))>>2)
+ #define EXACT_RED_OF(c) (((gU16)(((c)>>COLOR_SHIFT_R)&((1<<COLOR_BITS_R)-1))*255)/((1<<COLOR_BITS_R)-1))
+ #define EXACT_GREEN_OF(c) (((gU16)(((c)>>COLOR_SHIFT_G)&((1<<COLOR_BITS_G)-1))*255)/((1<<COLOR_BITS_G)-1))
+ #define EXACT_BLUE_OF(c) (((gU16)(((c)>>COLOR_SHIFT_B)&((1<<COLOR_BITS_B)-1))*255)/((1<<COLOR_BITS_B)-1))
+ #define EXACT_LUMA_OF(c) ((EXACT_RED_OF(c)+((gU16)EXACT_GREEN_OF(c)<<1)+EXACT_BLUE_OF(c))>>2)
#define LUMA2COLOR(l) (RGB2COLOR_R(l) | RGB2COLOR_G(l) | RGB2COLOR_B(l))
#define RGB2COLOR(r,g,b) (RGB2COLOR_R(r) | RGB2COLOR_G(g) | RGB2COLOR_B(b))
@@ -382,7 +382,7 @@ typedef uint16_t gColorformat;
// From the number of bits determine COLOR_TYPE, COLOR_TYPE_BITS and masking
#if COLOR_BITS <= 8
- #define COLOR_TYPE uint8_t
+ #define COLOR_TYPE gU8
#define COLOR_TYPE_BITS 8
#else
#error "GDISP: Cannot define gray-scale color types with more than 8 bits"
@@ -402,11 +402,11 @@ typedef uint16_t gColorformat;
#define EXACT_LUMA_OF(c) LUMA_OF(c)
#else
// They eye is more sensitive to green
- #define RGB2COLOR(r,g,b) ((COLOR_TYPE)(((uint16_t)(r)+(g)+(g)+(b)) >> (10-COLOR_BITS)))
+ #define RGB2COLOR(r,g,b) ((COLOR_TYPE)(((gU16)(r)+(g)+(g)+(b)) >> (10-COLOR_BITS)))
#define LUMA2COLOR(l) ((COLOR_TYPE)((l)>>(8-COLOR_BITS)))
#define HTML2COLOR(h) ((COLOR_TYPE)(((((h)&0xFF0000)>>16)+(((h)&0x00FF00)>>7)+((h)&0x0000FF)) >> (10-COLOR_BITS)))
#define LUMA_OF(c) (((c) & ((1<<COLOR_BITS)-1)) << (8-COLOR_BITS))
- #define EXACT_LUMA_OF(c) ((((uint16_t)(c) & ((1<<COLOR_BITS)-1))*255)/((1<<COLOR_BITS)-1))
+ #define EXACT_LUMA_OF(c) ((((gU16)(c) & ((1<<COLOR_BITS)-1))*255)/((1<<COLOR_BITS)-1))
#endif
#define RED_OF(c) LUMA_OF(c)
diff --git a/src/gdisp/gdisp_driver.h b/src/gdisp/gdisp_driver.h
index 4570a160..dc77699a 100644
--- a/src/gdisp/gdisp_driver.h
+++ b/src/gdisp/gdisp_driver.h
@@ -322,16 +322,16 @@ struct GDisplay {
gCoord Height;
gOrientation Orientation;
gPowermode Powermode;
- uint8_t Backlight;
- uint8_t Contrast;
+ gU8 Backlight;
+ gU8 Contrast;
} g;
void * priv; // A private area just for the drivers use.
void * board; // A private area just for the board interfaces use.
- uint8_t systemdisplay;
- uint8_t controllerdisplay;
- uint16_t flags;
+ gU8 systemdisplay;
+ gU8 controllerdisplay;
+ gU16 flags;
#define GDISP_FLG_INSTREAM 0x0001 // We are in a user based stream operation
#define GDISP_FLG_SCRSTREAM 0x0002 // The stream area currently covers the whole screen
#define GDISP_FLG_DRIVER 0x0004 // This flags and above are for use by the driver
@@ -828,13 +828,13 @@ typedef struct GDISPVMT {
// From the number of bits determine COLOR_TYPE, COLOR_TYPE_BITS and masking
#if LLDCOLOR_BITS <= 8
- #define LLDCOLOR_TYPE uint8_t
+ #define LLDCOLOR_TYPE gU8
#define LLDCOLOR_TYPE_BITS 8
#elif LLDCOLOR_BITS <= 16
- #define LLDCOLOR_TYPE uint16_t
+ #define LLDCOLOR_TYPE gU16
#define LLDCOLOR_TYPE_BITS 16
#elif LLDCOLOR_BITS <= 32
- #define LLDCOLOR_TYPE uint32_t
+ #define LLDCOLOR_TYPE gU32
#define LLDCOLOR_TYPE_BITS 32
#else
#error "GDISP: Cannot define low level driver color types with more than 32 bits"
@@ -888,11 +888,11 @@ typedef struct GDISPVMT {
#define LLDBLUE_OF(c) (((c) & (((1<<LLDCOLOR_BITS_B)-1) << LLDCOLOR_SHIFT_B)) << (8-(LLDCOLOR_BITS_B+LLDCOLOR_SHIFT_B)))
#define LLDRGB2COLOR_B(b) (((LLDCOLOR_TYPE)((b) & (0xFF & ~((1<<(8-LLDCOLOR_BITS_B))-1)))) >> (8-(LLDCOLOR_BITS_B+LLDCOLOR_SHIFT_B)))
#endif
- #define LLDLUMA_OF(c) ((LLDRED_OF(c)+((uint16_t)LLDGREEN_OF(c)<<1)+LLDBLUE_OF(c))>>2)
- #define LLDEXACT_RED_OF(c) (((uint16_t)(((c)>>LLDCOLOR_SHIFT_R)&((1<<LLDCOLOR_BITS_R)-1))*255)/((1<<LLDCOLOR_BITS_R)-1))
- #define LLDEXACT_GREEN_OF(c) (((uint16_t)(((c)>>LLDCOLOR_SHIFT_G)&((1<<LLDCOLOR_BITS_G)-1))*255)/((1<<LLDCOLOR_BITS_G)-1))
- #define LLDEXACT_BLUE_OF(c) (((uint16_t)(((c)>>LLDCOLOR_SHIFT_B)&((1<<LLDCOLOR_BITS_B)-1))*255)/((1<<LLDCOLOR_BITS_B)-1))
- #define LLDEXACT_LUMA_OF(c) ((LLDEXACT_RED_OF(c)+((uint16_t)LLDEXACT_GREEN_OF(c)<<1)+LLDEXACT_BLUE_OF(c))>>2)
+ #define LLDLUMA_OF(c) ((LLDRED_OF(c)+((gU16)LLDGREEN_OF(c)<<1)+LLDBLUE_OF(c))>>2)
+ #define LLDEXACT_RED_OF(c) (((gU16)(((c)>>LLDCOLOR_SHIFT_R)&((1<<LLDCOLOR_BITS_R)-1))*255)/((1<<LLDCOLOR_BITS_R)-1))
+ #define LLDEXACT_GREEN_OF(c) (((gU16)(((c)>>LLDCOLOR_SHIFT_G)&((1<<LLDCOLOR_BITS_G)-1))*255)/((1<<LLDCOLOR_BITS_G)-1))
+ #define LLDEXACT_BLUE_OF(c) (((gU16)(((c)>>LLDCOLOR_SHIFT_B)&((1<<LLDCOLOR_BITS_B)-1))*255)/((1<<LLDCOLOR_BITS_B)-1))
+ #define LLDEXACT_LUMA_OF(c) ((LLDEXACT_RED_OF(c)+((gU16)LLDEXACT_GREEN_OF(c)<<1)+LLDEXACT_BLUE_OF(c))>>2)
#define LLDLUMA2COLOR(l) (LLDRGB2COLOR_R(l) | LLDRGB2COLOR_G(l) | LLDRGB2COLOR_B(l))
#define LLDRGB2COLOR(r,g,b) (LLDRGB2COLOR_R(r) | LLDRGB2COLOR_G(g) | LLDRGB2COLOR_B(b))
@@ -937,7 +937,7 @@ typedef struct GDISPVMT {
// From the number of bits determine COLOR_TYPE, COLOR_TYPE_BITS and masking
#if LLDCOLOR_BITS <= 8
- #define LLDCOLOR_TYPE uint8_t
+ #define LLDCOLOR_TYPE gU8
#define LLDCOLOR_TYPE_BITS 8
#else
#error "GDISP: Cannot define gray-scale low level driver color types with more than 8 bits"
@@ -957,11 +957,11 @@ typedef struct GDISPVMT {
#define LLDEXACT_LUMA_OF(c) LLDLUMA_OF(c)
#else
// They eye is more sensitive to green
- #define LLDRGB2COLOR(r,g,b) ((LLDCOLOR_TYPE)(((uint16_t)(r)+(g)+(g)+(b)) >> (10-LLDCOLOR_BITS)))
+ #define LLDRGB2COLOR(r,g,b) ((LLDCOLOR_TYPE)(((gU16)(r)+(g)+(g)+(b)) >> (10-LLDCOLOR_BITS)))
#define LLDLUMA2COLOR(l) ((LLDCOLOR_TYPE)((l)>>(8-LLDCOLOR_BITS)))
#define LLDHTML2COLOR(h) ((LLDCOLOR_TYPE)(((((h)&0xFF0000)>>16)+(((h)&0x00FF00)>>7)+((h)&0x0000FF)) >> (10-LLDCOLOR_BITS)))
#define LLDLUMA_OF(c) (((c) & ((1<<LLDCOLOR_BITS)-1)) << (8-LLDCOLOR_BITS))
- #define LLDEXACT_LUMA_OF(c) ((((uint16_t)(c) & ((1<<LLDCOLOR_BITS)-1))*255)/((1<<LLDCOLOR_BITS)-1))
+ #define LLDEXACT_LUMA_OF(c) ((((gU16)(c) & ((1<<LLDCOLOR_BITS)-1))*255)/((1<<LLDCOLOR_BITS)-1))
#endif
#define LLDRED_OF(c) LLDLUMA_OF(c)
diff --git a/src/gdisp/gdisp_fonts.c b/src/gdisp/gdisp_fonts.c
index 57b948b6..f2225522 100644
--- a/src/gdisp/gdisp_fonts.c
+++ b/src/gdisp/gdisp_fonts.c
@@ -74,7 +74,7 @@ void gdispCloseFont(gFont font) {
}
}
-gFont gdispScaleFont(gFont font, uint8_t scale_x, uint8_t scale_y)
+gFont gdispScaleFont(gFont font, gU8 scale_x, gU8 scale_y)
{
struct mf_scaledfont_s *newfont;
diff --git a/src/gdisp/gdisp_image.c b/src/gdisp/gdisp_image.c
index 03955643..64024d6a 100644
--- a/src/gdisp/gdisp_image.c
+++ b/src/gdisp/gdisp_image.c
@@ -33,9 +33,9 @@
extern gdispImageError gdispImageCache_BMP(gdispImage *img);
extern gdispImageError gdispGImageDraw_BMP(GDisplay *g, gdispImage *img, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord sx, gCoord sy);
extern gDelay gdispImageNext_BMP(gdispImage *img);
- extern uint16_t gdispImageGetPaletteSize_BMP(gdispImage *img);
- extern gColor gdispImageGetPalette_BMP(gdispImage *img, uint16_t index);
- extern gBool gdispImageAdjustPalette_BMP(gdispImage *img, uint16_t index, gColor newColor);
+ extern gU16 gdispImageGetPaletteSize_BMP(gdispImage *img);
+ extern gColor gdispImageGetPalette_BMP(gdispImage *img, gU16 index);
+ extern gBool gdispImageAdjustPalette_BMP(gdispImage *img, gU16 index, gColor newColor);
#endif
#if GDISP_NEED_IMAGE_JPG
@@ -65,9 +65,9 @@ typedef struct gdispImageHandlers {
gCoord cx, gCoord cy,
gCoord sx, gCoord sy); /* The draw function */
gDelay (*next)(gdispImage *img); /* The next frame function */
- uint16_t (*getPaletteSize)(gdispImage *img); /* Retrieve the size of the palette (number of entries) */
- gColor (*getPalette)(gdispImage *img, uint16_t index); /* Retrieve a specific color value of the palette */
- gBool (*adjustPalette)(gdispImage *img, uint16_t index, gColor newColor); /* Replace a color value in the palette */
+ gU16 (*getPaletteSize)(gdispImage *img); /* Retrieve the size of the palette (number of entries) */
+ gColor (*getPalette)(gdispImage *img, gU16 index); /* Retrieve a specific color value of the palette */
+ gBool (*adjustPalette)(gdispImage *img, gU16 index, gColor newColor); /* Replace a color value in the palette */
} gdispImageHandlers;
static gdispImageHandlers ImageHandlers[] = {
@@ -192,19 +192,19 @@ gDelay gdispImageNext(gdispImage *img) {
return img->fns->next(img);
}
-uint16_t gdispImageGetPaletteSize(gdispImage *img) {
+gU16 gdispImageGetPaletteSize(gdispImage *img) {
if (!img || !img->fns) return 0;
if (!img->fns->getPaletteSize) return 0;
return img->fns->getPaletteSize(img);
}
-gColor gdispImageGetPalette(gdispImage *img, uint16_t index) {
+gColor gdispImageGetPalette(gdispImage *img, gU16 index) {
if (!img || !img->fns) return 0;
if (!img->fns->getPalette) return 0;
return img->fns->getPalette(img, index);
}
-gBool gdispImageAdjustPalette(gdispImage *img, uint16_t index, gColor newColor) {
+gBool gdispImageAdjustPalette(gdispImage *img, gU16 index, gColor newColor) {
if (!img || !img->fns) return gFalse;
if (!img->fns->adjustPalette) return gFalse;
return img->fns->adjustPalette(img, index, newColor);
@@ -212,7 +212,7 @@ gBool gdispImageAdjustPalette(gdispImage *img, uint16_t index, gColor newColor)
// Helper Routines
-void *gdispImageAlloc(gdispImage *img, size_t sz) {
+void *gdispImageAlloc(gdispImage *img, gMemSize sz) {
#if GDISP_NEED_IMAGE_ACCOUNTING
void *ptr;
@@ -229,7 +229,7 @@ void *gdispImageAlloc(gdispImage *img, size_t sz) {
#endif
}
-void gdispImageFree(gdispImage *img, void *ptr, size_t sz) {
+void gdispImageFree(gdispImage *img, void *ptr, gMemSize sz) {
#if GDISP_NEED_IMAGE_ACCOUNTING
gfxFree(ptr);
img->memused -= sz;
@@ -244,44 +244,44 @@ void gdispImageFree(gdispImage *img, void *ptr, size_t sz) {
&& GFX_CPU_ENDIAN != GFX_CPU_ENDIAN_WBDWL && GFX_CPU_ENDIAN != GFX_CPU_ENDIAN_WLDWB
union wbyteorder_u {
- uint8_t b[2];
- uint32_t w;
+ gU8 b[2];
+ gU32 w;
};
union dwbyteorder_u {
- uint8_t b[4];
- uint32_t l;
+ gU8 b[4];
+ gU32 l;
};
- uint16_t gdispImageH16toLE16(uint16_t w) {
+ gU16 gdispImageH16toLE16(gU16 w) {
union wbyteorder_u we;
we.w = w;
- return (((uint16_t)we.b[0]))|(((uint16_t)we.b[1]) << 8);
+ return (((gU16)we.b[0]))|(((gU16)we.b[1]) << 8);
}
- uint16_t gdispImageH16toBE16(uint16_t w) {
+ gU16 gdispImageH16toBE16(gU16 w) {
union wbyteorder_u we;
we.w = w;
- return (((uint16_t)we.b[0]) << 8)|(((uint16_t)we.b[1]));
+ return (((gU16)we.b[0]) << 8)|(((gU16)we.b[1]));
}
- uint32_t gdispImageH32toLE32(uint32_t dw) {
+ gU32 gdispImageH32toLE32(gU32 dw) {
union dwbyteorder_u we;
we.l = dw;
- return (((uint32_t)we.b[0]))
- |(((uint32_t)we.b[1]) << 8)
- |(((uint32_t)we.b[2]) << 16)
- |(((uint32_t)we.b[3]) << 24);
+ return (((gU32)we.b[0]))
+ |(((gU32)we.b[1]) << 8)
+ |(((gU32)we.b[2]) << 16)
+ |(((gU32)we.b[3]) << 24);
}
- uint32_t gdispImageH32toBE32(uint32_t dw) {
+ gU32 gdispImageH32toBE32(gU32 dw) {
union dwbyteorder_u we;
we.l = dw;
- return (((uint32_t)we.b[0]) << 24)
- |(((uint32_t)we.b[1]) << 16)
- |(((uint32_t)we.b[2]) << 8)
- |(((uint32_t)we.b[3]));
+ return (((gU32)we.b[0]) << 24)
+ |(((gU32)we.b[1]) << 16)
+ |(((gU32)we.b[2]) << 8)
+ |(((gU32)we.b[3]));
}
#endif
diff --git a/src/gdisp/gdisp_image.h b/src/gdisp/gdisp_image.h
index eeb45475..a590774c 100644
--- a/src/gdisp/gdisp_image.h
+++ b/src/gdisp/gdisp_image.h
@@ -23,7 +23,7 @@
/**
* @brief The type of image
*/
-typedef uint16_t gdispImageType;
+typedef gU16 gdispImageType;
#define GDISP_IMAGE_TYPE_UNKNOWN 0
#define GDISP_IMAGE_TYPE_NATIVE 1
#define GDISP_IMAGE_TYPE_GIF 2
@@ -34,7 +34,7 @@ typedef uint16_t gdispImageType;
/**
* @brief An image error code
*/
-typedef uint16_t gdispImageError;
+typedef gU16 gdispImageError;
#define GDISP_IMAGE_ERR_OK 0
#define GDISP_IMAGE_ERR_UNRECOVERABLE 0x8000
#define GDISP_IMAGE_ERR_BADFORMAT (GDISP_IMAGE_ERR_UNRECOVERABLE+1)
@@ -48,7 +48,7 @@ typedef uint16_t gdispImageError;
/**
* @brief Image flags
*/
-typedef uint16_t gdispImageFlags;
+typedef gU16 gdispImageFlags;
#define GDISP_IMAGE_FLG_TRANSPARENT 0x0001 /* The image has transparency */
#define GDISP_IMAGE_FLG_ANIMATED 0x0002 /* The image has animation */
#define GDISP_IMAGE_FLG_MULTIPAGE 0x0004 /* The image has multiple pages */
@@ -63,8 +63,8 @@ typedef struct gdispImage {
gCoord width, height; /* @< The image dimensions */
GFILE * f; /* @< The underlying GFILE */
#if GDISP_NEED_IMAGE_ACCOUNTING
- uint32_t memused; /* @< How much RAM is currently allocated */
- uint32_t maxmemused; /* @< How much RAM has been allocated (maximum) */
+ gU32 memused; /* @< How much RAM is currently allocated */
+ gU32 maxmemused; /* @< How much RAM has been allocated (maximum) */
#endif
const struct gdispImageHandlers * fns; /* @< Don't mess with this! */
void * priv; /* @< Don't mess with this! */
@@ -253,7 +253,7 @@ gDelay gdispImageNext(gdispImage *img);
*
* @pre gdispImageOpen() must have returned successfully.
*/
-uint16_t gdispImageGetPaletteSize(gdispImage *img);
+gU16 gdispImageGetPaletteSize(gdispImage *img);
/**
* @brief Get an entry in the color palette.
@@ -266,7 +266,7 @@ uint16_t gdispImageGetPaletteSize(gdispImage *img);
*
* @note This function will return 0 if the index is out of bounds or if the image doesn't use a color palette.
*/
-gColor gdispImageGetPalette(gdispImage *img, uint16_t index);
+gColor gdispImageGetPalette(gdispImage *img, gU16 index);
/**
* @brief Modify an entry in the color palette.
@@ -279,7 +279,7 @@ gColor gdispImageGetPalette(gdispImage *img, uint16_t index);
* @pre gdispImageOpen() must have returned successfully.
* @note This function will return @p gFalse if the index is out of bounds or if the image doesn't use a color palette.
*/
-gBool gdispImageAdjustPalette(gdispImage *img, uint16_t index, gColor newColor);
+gBool gdispImageAdjustPalette(gdispImage *img, gU16 index, gColor newColor);
#endif /* GFX_USE_GDISP && GDISP_NEED_IMAGE */
#endif /* _GDISP_IMAGE_H */
diff --git a/src/gdisp/gdisp_image_bmp.c b/src/gdisp/gdisp_image_bmp.c
index 98c8b3c9..c358a565 100644
--- a/src/gdisp/gdisp_image_bmp.c
+++ b/src/gdisp/gdisp_image_bmp.c
@@ -12,7 +12,7 @@
#include "gdisp_image_support.h"
typedef struct gdispImagePrivate_BMP {
- uint8_t bmpflags;
+ gU8 bmpflags;
#define BMP_V2 0x01 // Version 2 (old) header format
#define BMP_V4 0x02 // Version 4 (alpha support) header format
#define BMP_PALETTE 0x04 // Uses a palette
@@ -21,26 +21,26 @@ typedef struct gdispImagePrivate_BMP {
#define BMP_RLE_ENC 0x20 // Currently in RLE encoded run
#define BMP_RLE_ABS 0x40 // Currently in RLE absolute run
#define BMP_TOP_TO_BOTTOM 0x80 // Decodes bottom to top line
- uint8_t bitsperpixel;
+ gU8 bitsperpixel;
#if GDISP_NEED_IMAGE_BMP_1 || GDISP_NEED_IMAGE_BMP_4 || GDISP_NEED_IMAGE_BMP_4_RLE || GDISP_NEED_IMAGE_BMP_8 || GDISP_NEED_IMAGE_BMP_8_RLE
- uint16_t palsize;
+ gU16 palsize;
gPixel *palette;
#endif
#if GDISP_NEED_IMAGE_BMP_4_RLE || GDISP_NEED_IMAGE_BMP_8_RLE
- uint16_t rlerun;
- uint8_t rlecode;
+ gU16 rlerun;
+ gU8 rlecode;
#endif
#if GDISP_NEED_IMAGE_BMP_16 || GDISP_NEED_IMAGE_BMP_32
- int8_t shiftred;
- int8_t shiftgreen;
- int8_t shiftblue;
- int8_t shiftalpha;
- uint32_t maskred;
- uint32_t maskgreen;
- uint32_t maskblue;
- uint32_t maskalpha;
-#endif
- size_t frame0pos;
+ gI8 shiftred;
+ gI8 shiftgreen;
+ gI8 shiftblue;
+ gI8 shiftalpha;
+ gU32 maskred;
+ gU32 maskgreen;
+ gU32 maskblue;
+ gU32 maskalpha;
+#endif
+ gFileSize frame0pos;
gPixel *frame0cache;
gPixel buf[GDISP_IMAGE_BMP_BLIT_BUFFER_SIZE];
} gdispImagePrivate_BMP;
@@ -63,10 +63,10 @@ void gdispImageClose_BMP(gdispImage *img) {
gdispImageError gdispImageOpen_BMP(gdispImage *img) {
gdispImagePrivate_BMP *priv;
- uint8_t hdr[2];
- uint16_t aword;
- uint32_t adword;
- uint32_t offsetColorTable;
+ gU8 hdr[2];
+ gU16 aword;
+ gU32 adword;
+ gU32 offsetColorTable;
/* Read the file identifier */
if (gfileRead(img->f, hdr, 2) != 2)
@@ -172,7 +172,7 @@ gdispImageError gdispImageOpen_BMP(gdispImage *img) {
img->width = adword;
// Get the height
adword = gdispImageGetAlignedLE32(priv->buf, 4);
- if ((int32_t)adword < 0) { // Negative test
+ if ((gI32)adword < 0) { // Negative test
priv->bmpflags |= BMP_TOP_TO_BOTTOM;
adword = -adword;
}
@@ -267,12 +267,12 @@ gdispImageError gdispImageOpen_BMP(gdispImage *img) {
if (priv->bmpflags & BMP_V2) {
for(aword = 0; aword < priv->palsize; aword++) {
if (gfileRead(img->f, &priv->buf, 3) != 3) goto baddatacleanup;
- priv->palette[aword] = RGB2COLOR(((uint8_t *)priv->buf)[2], ((uint8_t *)priv->buf)[1], ((uint8_t *)priv->buf)[0]);
+ priv->palette[aword] = RGB2COLOR(((gU8 *)priv->buf)[2], ((gU8 *)priv->buf)[1], ((gU8 *)priv->buf)[0]);
}
} else {
for(aword = 0; aword < priv->palsize; aword++) {
if (gfileRead(img->f, &priv->buf, 4) != 4) goto baddatacleanup;
- priv->palette[aword] = RGB2COLOR(((uint8_t *)priv->buf)[2], ((uint8_t *)priv->buf)[1], ((uint8_t *)priv->buf)[0]);
+ priv->palette[aword] = RGB2COLOR(((gU8 *)priv->buf)[2], ((gU8 *)priv->buf)[1], ((gU8 *)priv->buf)[0]);
}
}
@@ -365,8 +365,8 @@ static gCoord getPixels(gdispImage *img, gCoord x) {
#if GDISP_NEED_IMAGE_BMP_1
case 1:
{
- uint8_t b[4];
- uint8_t m;
+ gU8 b[4];
+ gU8 m;
priv = (gdispImagePrivate_BMP *)img->priv;
pc = priv->buf;
@@ -398,7 +398,7 @@ static gCoord getPixels(gdispImage *img, gCoord x) {
if (priv->bmpflags & BMP_COMP_RLE)
#endif
{
- uint8_t b[4];
+ gU8 b[4];
while(x < img->width) {
if (priv->bmpflags & BMP_RLE_ENC) {
@@ -462,7 +462,7 @@ static gCoord getPixels(gdispImage *img, gCoord x) {
// There are always at least 2 bytes in an RLE code
if (gfileRead(img->f, &b, 2) != 2)
return 0;
- priv->rlerun = b[0] + (uint16_t)b[1] * img->width;
+ priv->rlerun = b[0] + (gU16)b[1] * img->width;
priv->rlecode = 0; // Who knows what color this should really be
priv->bmpflags |= BMP_RLE_ENC;
} else { // Absolute mode
@@ -475,7 +475,7 @@ static gCoord getPixels(gdispImage *img, gCoord x) {
#endif
#if GDISP_NEED_IMAGE_BMP_4
{
- uint8_t b[4];
+ gU8 b[4];
while(x < img->width && len <= GDISP_IMAGE_BMP_BLIT_BUFFER_SIZE-8) {
if (gfileRead(img->f, &b, 4) != 4)
@@ -504,7 +504,7 @@ static gCoord getPixels(gdispImage *img, gCoord x) {
if (priv->bmpflags & BMP_COMP_RLE)
#endif
{
- uint8_t b[4];
+ gU8 b[4];
while(x < img->width) {
if (priv->bmpflags & BMP_RLE_ENC) {
@@ -556,7 +556,7 @@ static gCoord getPixels(gdispImage *img, gCoord x) {
// There are always at least 2 bytes in an RLE code
if (gfileRead(img->f, &b, 2) != 2)
return GDISP_IMAGE_ERR_BADDATA;
- priv->rlerun = b[0] + (uint16_t)b[1] * img->width;
+ priv->rlerun = b[0] + (gU16)b[1] * img->width;
priv->rlecode = 0; // Who knows what color this should really be
priv->bmpflags |= BMP_RLE_ENC;
} else { // Absolute mode
@@ -569,7 +569,7 @@ static gCoord getPixels(gdispImage *img, gCoord x) {
#endif
#if GDISP_NEED_IMAGE_BMP_8
{
- uint8_t b[4];
+ gU8 b[4];
while(x < img->width && len <= GDISP_IMAGE_BMP_BLIT_BUFFER_SIZE-4) {
if (gfileRead(img->f, &b, 4) != 4)
@@ -590,7 +590,7 @@ static gCoord getPixels(gdispImage *img, gCoord x) {
#if GDISP_NEED_IMAGE_BMP_16
case 16:
{
- uint16_t w[2];
+ gU16 w[2];
gColor r, g, b;
while(x < img->width && len <= GDISP_IMAGE_BMP_BLIT_BUFFER_SIZE-2) {
@@ -623,7 +623,7 @@ static gCoord getPixels(gdispImage *img, gCoord x) {
if (priv->shiftblue < 0)
b = (gColor)((w[1] & priv->maskblue) << -priv->shiftblue);
else
- b = (uint8_t)((w[1] & priv->maskblue) >> priv->shiftblue);
+ b = (gU8)((w[1] & priv->maskblue) >> priv->shiftblue);
/* We don't support alpha yet */
*pc++ = RGB2COLOR(r, g, b);
x += 2;
@@ -636,7 +636,7 @@ static gCoord getPixels(gdispImage *img, gCoord x) {
#if GDISP_NEED_IMAGE_BMP_24
case 24:
{
- uint8_t b[3];
+ gU8 b[3];
while(x < img->width && len < GDISP_IMAGE_BMP_BLIT_BUFFER_SIZE) {
if (gfileRead(img->f, &b, 3) != 3)
@@ -658,7 +658,7 @@ static gCoord getPixels(gdispImage *img, gCoord x) {
#if GDISP_NEED_IMAGE_BMP_32
case 32:
{
- uint32_t dw;
+ gU32 dw;
gColor r, g, b;
while(x < img->width && len < GDISP_IMAGE_BMP_BLIT_BUFFER_SIZE) {
@@ -696,7 +696,7 @@ gdispImageError gdispImageCache_BMP(gdispImage *img) {
gColor * pcs;
gColor * pcd;
gCoord pos, x, y;
- size_t len;
+ gMemSize len;
/* If we are already cached - just return OK */
priv = (gdispImagePrivate_BMP *)img->priv;
@@ -822,7 +822,7 @@ gDelay gdispImageNext_BMP(gdispImage *img) {
return gDelayForever;
}
-uint16_t gdispImageGetPaletteSize_BMP(gdispImage *img) {
+gU16 gdispImageGetPaletteSize_BMP(gdispImage *img) {
#if GDISP_NEED_IMAGE_BMP_1 || GDISP_NEED_IMAGE_BMP_4 || GDISP_NEED_IMAGE_BMP_8
gdispImagePrivate_BMP *priv;
@@ -839,7 +839,7 @@ uint16_t gdispImageGetPaletteSize_BMP(gdispImage *img) {
#endif
}
-gColor gdispImageGetPalette_BMP(gdispImage *img, uint16_t index) {
+gColor gdispImageGetPalette_BMP(gdispImage *img, gU16 index) {
#if GDISP_NEED_IMAGE_BMP_1 || GDISP_NEED_IMAGE_BMP_4 || GDISP_NEED_IMAGE_BMP_8
gdispImagePrivate_BMP *priv;
@@ -853,14 +853,14 @@ gColor gdispImageGetPalette_BMP(gdispImage *img, uint16_t index) {
if (index >= priv->palsize)
return 0;
- return priv->palette[(uint8_t)index];
+ return priv->palette[(gU8)index];
#else
return 0;
#endif
}
-gBool gdispImageAdjustPalette_BMP(gdispImage *img, uint16_t index, gColor newColor) {
+gBool gdispImageAdjustPalette_BMP(gdispImage *img, gU16 index, gColor newColor) {
#if GDISP_NEED_IMAGE_BMP_1 || GDISP_NEED_IMAGE_BMP_4 || GDISP_NEED_IMAGE_BMP_8
gdispImagePrivate_BMP *priv;
@@ -874,7 +874,7 @@ gBool gdispImageAdjustPalette_BMP(gdispImage *img, uint16_t index, gColor newCol
if (index >= priv->palsize)
return gFalse;
- priv->palette[(uint8_t)index] = newColor;
+ priv->palette[(gU8)index] = newColor;
return gTrue;
diff --git a/src/gdisp/gdisp_image_gif.c b/src/gdisp/gdisp_image_gif.c
index 632d168e..804dce52 100644
--- a/src/gdisp/gdisp_image_gif.c
+++ b/src/gdisp/gdisp_image_gif.c
@@ -22,7 +22,7 @@
#define GIF_CODE_NONE (GIF_CODE_MAX+3) // Illegal code to signal empty
// Convert bits to masks for that number of bits
-static const uint16_t GifBitMask[] = {
+static const gU16 GifBitMask[] = {
0x0000, 0x0001, 0x0003, 0x0007,
0x000f, 0x001f, 0x003f, 0x007f,
0x00ff, 0x01ff, 0x03ff, 0x07ff,
@@ -31,68 +31,68 @@ static const uint16_t GifBitMask[] = {
// Structure for decoding a single frame
typedef struct gifimgdecode {
- uint8_t blocksz; // The size of the block currently being processed
- uint8_t maxpixel; // The maximum allowed pixel value
- uint8_t bitsperpixel;
- uint8_t bitspercode;
- uint8_t shiftbits;
- uint16_t maxcodesz;
- uint16_t stackcnt; // The number of items on the stack
- uint16_t code_clear;
- uint16_t code_eof;
- uint16_t code_max;
- uint16_t code_last;
- uint32_t shiftdata;
+ gU8 blocksz; // The size of the block currently being processed
+ gU8 maxpixel; // The maximum allowed pixel value
+ gU8 bitsperpixel;
+ gU8 bitspercode;
+ gU8 shiftbits;
+ gU16 maxcodesz;
+ gU16 stackcnt; // The number of items on the stack
+ gU16 code_clear;
+ gU16 code_eof;
+ gU16 code_max;
+ gU16 code_last;
+ gU32 shiftdata;
gColor * palette;
- uint8_t buf[GDISP_IMAGE_GIF_BLIT_BUFFER_SIZE]; // Buffer for decoded pixels
- uint16_t prefix[1<<GIF_MAX_CODE_BITS]; // The LZW table
- uint8_t suffix[1<<GIF_MAX_CODE_BITS]; // So we can trace the codes
- uint8_t stack[1<<GIF_MAX_CODE_BITS]; // Decoded pixels might be stacked here
+ gU8 buf[GDISP_IMAGE_GIF_BLIT_BUFFER_SIZE]; // Buffer for decoded pixels
+ gU16 prefix[1<<GIF_MAX_CODE_BITS]; // The LZW table
+ gU8 suffix[1<<GIF_MAX_CODE_BITS]; // So we can trace the codes
+ gU8 stack[1<<GIF_MAX_CODE_BITS]; // Decoded pixels might be stacked here
} gifimgdecode;
// The data on a single frame
typedef struct gifimgframe {
gCoord x, y; // position relative to full image
gCoord width, height; // size of frame
- uint16_t delay; // delay after processing
- uint8_t flags; // Local flags
+ gU16 delay; // delay after processing
+ gU8 flags; // Local flags
#define GIFL_TRANSPARENT 0x01 // There exists a transparent color
#define GIFL_DISPOSECLEAR 0x02 // Dispose this frame by clearing
#define GIFL_DISPOSEREST 0x04 // Dispose this frame by restoring
#define GIFL_INTERLACE 0x08 // Current frame is interlaced
- uint8_t paltrans; // Transparency
- uint16_t palsize; // Local palette size
- size_t posstart; // The file position of the start of the image
- size_t pospal; // The file position of the palette
- size_t posimg; // The file position of the image bits
- size_t posend; // The file position of the end of the frame
+ gU8 paltrans; // Transparency
+ gU16 palsize; // Local palette size
+ gFileSize posstart; // The file position of the start of the image
+ gFileSize pospal; // The file position of the palette
+ gFileSize posimg; // The file position of the image bits
+ gFileSize posend; // The file position of the end of the frame
} gifimgframe;
// The data for a cache
typedef struct gifimgcache {
gifimgframe frame;
gColor * palette; // Local palette
- uint8_t * imagebits; // Image bits - only saved when caching
+ gU8 * imagebits; // Image bits - only saved when caching
struct gifimgcache *next; // Next cached frame
} gifimgcache;
// The data for a dispose area
typedef struct gifimgdispose {
- uint8_t flags; // Frame flags
- uint8_t paltrans; // Transparency
+ gU8 flags; // Frame flags
+ gU8 paltrans; // Transparency
gCoord x, y; // position relative to full image
gCoord width, height; // size of dispose area
} gifimgdispose;
typedef struct gdispImagePrivate_GIF {
- uint8_t flags; // Flags (global)
+ gU8 flags; // Flags (global)
#define GIF_LOOP 0x01 // Loop back to first frame
#define GIF_LOOPFOREVER 0x02 // Looping is forever
- uint8_t bgcolor; // Background Color (global)
- uint16_t loops; // Remaining frame loops (if animated)
- uint16_t palsize; // Global palette size (global)
+ gU8 bgcolor; // Background Color (global)
+ gU16 loops; // Remaining frame loops (if animated)
+ gU16 palsize; // Global palette size (global)
gPixel *palette; // Global palette (global)
- size_t frame0pos; // The position of the first frame
+ gFileSize frame0pos; // The position of the first frame
gifimgcache * cache; // The list of cached frames
gifimgcache * curcache; // The cache of the current frame (if created)
gifimgdecode * decode; // The decode data for the decode in progress
@@ -109,7 +109,7 @@ typedef struct gdispImagePrivate_GIF {
static gdispImageError startDecodeGif(gdispImage *img) {
gdispImagePrivate_GIF * priv;
gifimgdecode * decode;
- uint16_t cnt;
+ gU16 cnt;
priv = (gdispImagePrivate_GIF *)img->priv;
@@ -182,8 +182,8 @@ static void stopDecodeGif(gdispImage *img) {
}
}
-static uint16_t getPrefixGif(gifimgdecode *decode, uint16_t code) {
- uint16_t i;
+static gU16 getPrefixGif(gifimgdecode *decode, gU16 code) {
+ gU16 i;
for(i=0; code > decode->code_clear && i <= GIF_CODE_MAX; i++, code = decode->prefix[code]) {
if (code > GIF_CODE_MAX)
@@ -201,12 +201,12 @@ static uint16_t getPrefixGif(gifimgdecode *decode, uint16_t code) {
*
* Note: The resulting pixels are stored in decode->buf
*/
-static uint16_t getBytesGif(gdispImage *img) {
+static gU16 getBytesGif(gdispImage *img) {
gdispImagePrivate_GIF * priv;
gifimgdecode * decode;
- uint16_t cnt;
- uint16_t code, prefix;
- uint8_t bdata;
+ gU16 cnt;
+ gU16 code, prefix;
+ gU8 bdata;
priv = (gdispImagePrivate_GIF *)img->priv;
decode = priv->decode;
@@ -337,8 +337,8 @@ static uint16_t getBytesGif(gdispImage *img) {
static gdispImageError initFrameGif(gdispImage *img) {
gdispImagePrivate_GIF * priv;
gifimgcache * cache;
- uint8_t blocktype;
- uint8_t blocksz;
+ gU8 blocktype;
+ gU8 blocksz;
priv = (gdispImagePrivate_GIF *)img->priv;
@@ -351,8 +351,8 @@ static gdispImageError initFrameGif(gdispImage *img) {
priv->dispose.height = priv->frame.height;
// Check for a cached version of this image
- for(cache=priv->cache; cache && cache->frame.posstart <= (size_t)gfileGetPos(img->f); cache=cache->next) {
- if (cache->frame.posstart == (size_t)gfileGetPos(img->f)) {
+ for(cache=priv->cache; cache && cache->frame.posstart <= gfileGetPos(img->f); cache=cache->next) {
+ if (cache->frame.posstart == gfileGetPos(img->f)) {
priv->frame = cache->frame;
priv->curcache = cache;
return GDISP_IMAGE_ERR_OK;
@@ -380,9 +380,9 @@ static gdispImageError initFrameGif(gdispImage *img) {
priv->frame.y = gdispImageGetAlignedLE16(priv->buf, 2);
priv->frame.width = gdispImageGetAlignedLE16(priv->buf, 4);
priv->frame.height = gdispImageGetAlignedLE16(priv->buf, 6);
- if (((uint8_t *)priv->buf)[8] & 0x80) // Local color table?
- priv->frame.palsize = 2 << (((uint8_t *)priv->buf)[8] & 0x07);
- if (((uint8_t *)priv->buf)[8] & 0x40) // Interlaced?
+ if (((gU8 *)priv->buf)[8] & 0x80) // Local color table?
+ priv->frame.palsize = 2 << (((gU8 *)priv->buf)[8] & 0x07);
+ if (((gU8 *)priv->buf)[8] & 0x40) // Interlaced?
priv->frame.flags |= GIFL_INTERLACE;
// We are ready to go for the actual palette read and image decode
@@ -406,26 +406,26 @@ static gdispImageError initFrameGif(gdispImage *img) {
if (gfileRead(img->f, priv->buf, 6) != 6)
return GDISP_IMAGE_ERR_BADDATA;
// Check we have read a 4 byte data block and a data block terminator (0)
- if (((uint8_t *)priv->buf)[0] != 4 || ((uint8_t *)priv->buf)[5] != 0)
+ if (((gU8 *)priv->buf)[0] != 4 || ((gU8 *)priv->buf)[5] != 0)
return GDISP_IMAGE_ERR_BADDATA;
// Process the flags
- switch(((uint8_t *)priv->buf)[1] & 0x1C) {
+ switch(((gU8 *)priv->buf)[1] & 0x1C) {
case 0x00: case 0x04: break; // Dispose = do nothing
case 0x08: priv->frame.flags |= GIFL_DISPOSECLEAR; break; // Dispose = clear
case 0x0C: case 0x10: priv->frame.flags |= GIFL_DISPOSEREST; break; // Dispose = restore. Value 0x10 is a hack for bad encoders
default: return GDISP_IMAGE_ERR_UNSUPPORTED;
}
- if (((uint8_t *)priv->buf)[1] & 0x01) {
+ if (((gU8 *)priv->buf)[1] & 0x01) {
priv->frame.flags |= GIFL_TRANSPARENT;
img->flags |= GDISP_IMAGE_FLG_TRANSPARENT; // We set this but never clear it
}
- if (((uint8_t *)priv->buf)[1] & 0x02) // Wait for user input?
+ if (((gU8 *)priv->buf)[1] & 0x02) // Wait for user input?
img->flags |= GDISP_IMAGE_FLG_MULTIPAGE;
else
img->flags &= ~GDISP_IMAGE_FLG_MULTIPAGE;
// Process frame delay and the transparent color (if any)
priv->frame.delay = gdispImageGetAlignedLE16(priv->buf, 2);
- priv->frame.paltrans = ((uint8_t *)priv->buf)[4];
+ priv->frame.paltrans = ((gU8 *)priv->buf)[4];
break;
case 0xFF: // EXTENSION - Application
@@ -436,14 +436,14 @@ static gdispImageError initFrameGif(gdispImage *img) {
if (gfileRead(img->f, priv->buf, 16) != 16)
return GDISP_IMAGE_ERR_BADDATA;
// Check we have read a 11 byte data block
- if (((uint8_t *)priv->buf)[0] != 11 && ((uint8_t *)priv->buf)[12] != 3)
+ if (((gU8 *)priv->buf)[0] != 11 && ((gU8 *)priv->buf)[12] != 3)
return GDISP_IMAGE_ERR_BADDATA;
// Check the vendor
- if (((uint8_t *)priv->buf)[1] == 'N' && ((uint8_t *)priv->buf)[2] == 'E' && ((uint8_t *)priv->buf)[3] == 'T'
- && ((uint8_t *)priv->buf)[4] == 'S' && ((uint8_t *)priv->buf)[5] == 'C' && ((uint8_t *)priv->buf)[6] == 'A'
- && ((uint8_t *)priv->buf)[7] == 'P' && ((uint8_t *)priv->buf)[8] == 'E' && ((uint8_t *)priv->buf)[9] == '2'
- && ((uint8_t *)priv->buf)[10] == '.' && ((uint8_t *)priv->buf)[11] == '0') {
- if (((uint8_t *)priv->buf)[13] == 1) {
+ if (((gU8 *)priv->buf)[1] == 'N' && ((gU8 *)priv->buf)[2] == 'E' && ((gU8 *)priv->buf)[3] == 'T'
+ && ((gU8 *)priv->buf)[4] == 'S' && ((gU8 *)priv->buf)[5] == 'C' && ((gU8 *)priv->buf)[6] == 'A'
+ && ((gU8 *)priv->buf)[7] == 'P' && ((gU8 *)priv->buf)[8] == 'E' && ((gU8 *)priv->buf)[9] == '2'
+ && ((gU8 *)priv->buf)[10] == '.' && ((gU8 *)priv->buf)[11] == '0') {
+ if (((gU8 *)priv->buf)[13] == 1) {
priv->loops = gdispImageGetAlignedLE16(priv->buf, 14);
priv->flags |= GIF_LOOP;
if (!priv->loops)
@@ -516,8 +516,8 @@ void gdispImageClose_GIF(gdispImage *img) {
gdispImageError gdispImageOpen_GIF(gdispImage *img) {
gdispImagePrivate_GIF *priv;
- uint8_t hdr[6];
- uint16_t aword;
+ gU8 hdr[6];
+ gU16 aword;
/* Read the file identifier */
if (gfileRead(img->f, hdr, 6) != 6)
@@ -555,9 +555,9 @@ gdispImageError gdispImageOpen_GIF(gdispImage *img) {
img->width = gdispImageGetAlignedLE16(priv->buf, 0);
// Get the height
img->height = gdispImageGetAlignedLE16(priv->buf, 2);
- if (((uint8_t *)priv->buf)[4] & 0x80) {
+ if (((gU8 *)priv->buf)[4] & 0x80) {
// Global color table
- priv->palsize = 2 << (((uint8_t *)priv->buf)[4] & 0x07);
+ priv->palsize = 2 << (((gU8 *)priv->buf)[4] & 0x07);
// Allocate the global palette
if (!(priv->palette = (gColor *)gdispImageAlloc(img, priv->palsize*sizeof(gColor))))
goto nomemcleanup;
@@ -565,10 +565,10 @@ gdispImageError gdispImageOpen_GIF(gdispImage *img) {
for(aword = 0; aword < priv->palsize; aword++) {
if (gfileRead(img->f, &priv->buf, 3) != 3)
goto baddatacleanup;
- priv->palette[aword] = RGB2COLOR(((uint8_t *)priv->buf)[0], ((uint8_t *)priv->buf)[1], ((uint8_t *)priv->buf)[2]);
+ priv->palette[aword] = RGB2COLOR(((gU8 *)priv->buf)[0], ((gU8 *)priv->buf)[1], ((gU8 *)priv->buf)[2]);
}
}
- priv->bgcolor = ((uint8_t *)priv->buf)[5];
+ priv->bgcolor = ((gU8 *)priv->buf)[5];
// Save the fram0pos
priv->frame0pos = gfileGetPos(img->f);
@@ -599,10 +599,10 @@ gdispImageError gdispImageCache_GIF(gdispImage *img) {
gdispImagePrivate_GIF * priv;
gifimgcache * cache;
gifimgdecode * decode;
- uint8_t * p;
- uint8_t * q;
+ gU8 * p;
+ gU8 * q;
gCoord mx, my;
- uint16_t cnt;
+ gU16 cnt;
/* If we are already cached - just return OK */
priv = (gdispImagePrivate_GIF *)img->priv;
@@ -616,7 +616,7 @@ gdispImageError gdispImageCache_GIF(gdispImage *img) {
/* Initialise the cache */
decode = 0;
cache->frame = priv->frame;
- cache->imagebits = (uint8_t *)(cache+1) + cache->frame.palsize*sizeof(gColor);
+ cache->imagebits = (gU8 *)(cache+1) + cache->frame.palsize*sizeof(gColor);
cache->next = 0;
/* Start the decode */
@@ -769,10 +769,10 @@ baddatacleanup:
gdispImageError gdispGImageDraw_GIF(GDisplay *g, gdispImage *img, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord sx, gCoord sy) {
gdispImagePrivate_GIF * priv;
gifimgdecode * decode;
- uint8_t * q = 0;
+ gU8 * q = 0;
gCoord mx, my, fx, fy;
- uint16_t cnt, gcnt;
- uint8_t col;
+ gU16 cnt, gcnt;
+ gU8 col;
priv = (gdispImagePrivate_GIF *)img->priv;
@@ -1109,7 +1109,7 @@ baddatacleanup:
gDelay gdispImageNext_GIF(gdispImage *img) {
gdispImagePrivate_GIF * priv;
gDelay delay;
- uint8_t blocksz;
+ gU8 blocksz;
priv = (gdispImagePrivate_GIF *)img->priv;
diff --git a/src/gdisp/gdisp_image_jpg.c b/src/gdisp/gdisp_image_jpg.c
index 3191d51a..716020fa 100644
--- a/src/gdisp/gdisp_image_jpg.c
+++ b/src/gdisp/gdisp_image_jpg.c
@@ -33,21 +33,21 @@ typedef struct {
/* Decompressor object structure */
typedef struct JDEC {
unsigned dctr; /* Number of bytes available in the input buffer */
- uint8_t* dptr; /* Current data read ptr */
- uint8_t* inbuf; /* Bit stream input buffer */
- uint8_t dmsk; /* Current bit in the current read byte */
- uint8_t scale; /* Output scaling ratio */
- uint8_t msx, msy; /* MCU size in unit of block (width, height) */
- uint8_t qtid[3]; /* Quantization table ID of each component */
- int16_t dcv[3]; /* Previous DC element of each component */
- uint16_t nrst; /* Restart inverval */
+ gU8* dptr; /* Current data read ptr */
+ gU8* inbuf; /* Bit stream input buffer */
+ gU8 dmsk; /* Current bit in the current read byte */
+ gU8 scale; /* Output scaling ratio */
+ gU8 msx, msy; /* MCU size in unit of block (width, height) */
+ gU8 qtid[3]; /* Quantization table ID of each component */
+ gI16 dcv[3]; /* Previous DC element of each component */
+ gU16 nrst; /* Restart inverval */
unsigned width, height; /* Size of the input image (pixel) */
- uint8_t* huffbits[2][2]; /* Huffman bit distribution tables [id][dcac] */
- uint16_t* huffcode[2][2]; /* Huffman code word tables [id][dcac] */
- uint8_t* huffdata[2][2]; /* Huffman decoded data tables [id][dcac] */
- int32_t* qttbl[4]; /* Dequaitizer tables [id] */
+ gU8* huffbits[2][2]; /* Huffman bit distribution tables [id][dcac] */
+ gU16* huffcode[2][2]; /* Huffman code word tables [id][dcac] */
+ gU8* huffdata[2][2]; /* Huffman decoded data tables [id][dcac] */
+ gI32* qttbl[4]; /* Dequaitizer tables [id] */
void* workbuf; /* Working buffer for IDCT and RGB output */
- uint8_t* mcubuf; /* Working buffer for the MCU */
+ gU8* mcubuf; /* Working buffer for the MCU */
void* pool; /* Pointer to available memory pool */
unsigned sz_pool; /* Size of momory pool (bytes available) */
gdispImage* img; /* Pointer to I/O device identifiler for the session */
@@ -55,7 +55,7 @@ typedef struct JDEC {
/* TJpgDec API functions */
gdispImageError jd_prepare(JDEC*, void*, gdispImage*);
-gdispImageError jd_decomp(JDEC*, unsigned(*)(gdispImage*,void*,JRECT*), uint8_t);
+gdispImageError jd_decomp(JDEC*, unsigned(*)(gdispImage*,void*,JRECT*), gU8);
/*---------------------------------------------------------------------------*/
typedef struct gdispImagePrivate_JPG {
@@ -64,7 +64,7 @@ typedef struct gdispImagePrivate_JPG {
gdispImageError gdispImageOpen_JPG(gdispImage *img){
gdispImagePrivate_JPG *priv;
- uint8_t hdr[4];
+ gU8 hdr[4];
unsigned len;
/* Read the file identifier */
@@ -132,7 +132,7 @@ void gdispImageClose_JPG(gdispImage *img){
static unsigned gdispImage_JPG_WriteToCache(gdispImage *img, void *bitmap, JRECT *rect)
{
gdispImagePrivate_JPG *priv;
- uint8_t *in;
+ gU8 *in;
gPixel *out;
gCoord x, y;
@@ -233,7 +233,7 @@ gDelay gdispImageNext_JPG(gdispImage *img) {
#define ZIG(n) Zig[n]
static
-const uint8_t Zig[64] = { /* Zigzag-order to raster-order conversion table */
+const gU8 Zig[64] = { /* Zigzag-order to raster-order conversion table */
0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5,
12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28,
35, 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51,
@@ -250,15 +250,15 @@ const uint8_t Zig[64] = { /* Zigzag-order to raster-order conversion table */
#define IPSF(n) Ipsf[n]
static
-const uint16_t Ipsf[64] = { /* See also aa_idct.png */
- (uint16_t)(1.00000*8192), (uint16_t)(1.38704*8192), (uint16_t)(1.30656*8192), (uint16_t)(1.17588*8192), (uint16_t)(1.00000*8192), (uint16_t)(0.78570*8192), (uint16_t)(0.54120*8192), (uint16_t)(0.27590*8192),
- (uint16_t)(1.38704*8192), (uint16_t)(1.92388*8192), (uint16_t)(1.81226*8192), (uint16_t)(1.63099*8192), (uint16_t)(1.38704*8192), (uint16_t)(1.08979*8192), (uint16_t)(0.75066*8192), (uint16_t)(0.38268*8192),
- (uint16_t)(1.30656*8192), (uint16_t)(1.81226*8192), (uint16_t)(1.70711*8192), (uint16_t)(1.53636*8192), (uint16_t)(1.30656*8192), (uint16_t)(1.02656*8192), (uint16_t)(0.70711*8192), (uint16_t)(0.36048*8192),
- (uint16_t)(1.17588*8192), (uint16_t)(1.63099*8192), (uint16_t)(1.53636*8192), (uint16_t)(1.38268*8192), (uint16_t)(1.17588*8192), (uint16_t)(0.92388*8192), (uint16_t)(0.63638*8192), (uint16_t)(0.32442*8192),
- (uint16_t)(1.00000*8192), (uint16_t)(1.38704*8192), (uint16_t)(1.30656*8192), (uint16_t)(1.17588*8192), (uint16_t)(1.00000*8192), (uint16_t)(0.78570*8192), (uint16_t)(0.54120*8192), (uint16_t)(0.27590*8192),
- (uint16_t)(0.78570*8192), (uint16_t)(1.08979*8192), (uint16_t)(1.02656*8192), (uint16_t)(0.92388*8192), (uint16_t)(0.78570*8192), (uint16_t)(0.61732*8192), (uint16_t)(0.42522*8192), (uint16_t)(0.21677*8192),
- (uint16_t)(0.54120*8192), (uint16_t)(0.75066*8192), (uint16_t)(0.70711*8192), (uint16_t)(0.63638*8192), (uint16_t)(0.54120*8192), (uint16_t)(0.42522*8192), (uint16_t)(0.29290*8192), (uint16_t)(0.14932*8192),
- (uint16_t)(0.27590*8192), (uint16_t)(0.38268*8192), (uint16_t)(0.36048*8192), (uint16_t)(0.32442*8192), (uint16_t)(0.27590*8192), (uint16_t)(0.21678*8192), (uint16_t)(0.14932*8192), (uint16_t)(0.07612*8192)
+const gU16 Ipsf[64] = { /* See also aa_idct.png */
+ (gU16)(1.00000*8192), (gU16)(1.38704*8192), (gU16)(1.30656*8192), (gU16)(1.17588*8192), (gU16)(1.00000*8192), (gU16)(0.78570*8192), (gU16)(0.54120*8192), (gU16)(0.27590*8192),
+ (gU16)(1.38704*8192), (gU16)(1.92388*8192), (gU16)(1.81226*8192), (gU16)(1.63099*8192), (gU16)(1.38704*8192), (gU16)(1.08979*8192), (gU16)(0.75066*8192), (gU16)(0.38268*8192),
+ (gU16)(1.30656*8192), (gU16)(1.81226*8192), (gU16)(1.70711*8192), (gU16)(1.53636*8192), (gU16)(1.30656*8192), (gU16)(1.02656*8192), (gU16)(0.70711*8192), (gU16)(0.36048*8192),
+ (gU16)(1.17588*8192), (gU16)(1.63099*8192), (gU16)(1.53636*8192), (gU16)(1.38268*8192), (gU16)(1.17588*8192), (gU16)(0.92388*8192), (gU16)(0.63638*8192), (gU16)(0.32442*8192),
+ (gU16)(1.00000*8192), (gU16)(1.38704*8192), (gU16)(1.30656*8192), (gU16)(1.17588*8192), (gU16)(1.00000*8192), (gU16)(0.78570*8192), (gU16)(0.54120*8192), (gU16)(0.27590*8192),
+ (gU16)(0.78570*8192), (gU16)(1.08979*8192), (gU16)(1.02656*8192), (gU16)(0.92388*8192), (gU16)(0.78570*8192), (gU16)(0.61732*8192), (gU16)(0.42522*8192), (gU16)(0.21677*8192),
+ (gU16)(0.54120*8192), (gU16)(0.75066*8192), (gU16)(0.70711*8192), (gU16)(0.63638*8192), (gU16)(0.54120*8192), (gU16)(0.42522*8192), (gU16)(0.29290*8192), (gU16)(0.14932*8192),
+ (gU16)(0.27590*8192), (gU16)(0.38268*8192), (gU16)(0.36048*8192), (gU16)(0.32442*8192), (gU16)(0.27590*8192), (gU16)(0.21678*8192), (gU16)(0.14932*8192), (gU16)(0.07612*8192)
};
@@ -272,7 +272,7 @@ const uint16_t Ipsf[64] = { /* See also aa_idct.png */
#define BYTECLIP(v) Clip8[(unsigned)(v) & 0x3FF]
static
-const uint8_t Clip8[1024] = {
+const gU8 Clip8[1024] = {
/* 0..255 */
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
@@ -314,14 +314,14 @@ const uint8_t Clip8[1024] = {
#else /* JD_TBLCLIP */
inline
-uint8_t BYTECLIP (
+gU8 BYTECLIP (
int val
)
{
if (val < 0) val = 0;
if (val > 255) val = 255;
- return (uint8_t)val;
+ return (gU8)val;
}
#endif
@@ -362,13 +362,13 @@ void* alloc_pool ( /* Pointer to allocated memory block (NULL:no memory availabl
static
unsigned create_qt_tbl ( /* 0:OK, !0:Failed */
JDEC* jd, /* Pointer to the decompressor object */
- const uint8_t* data, /* Pointer to the quantizer tables */
+ const gU8* data, /* Pointer to the quantizer tables */
unsigned ndata /* Size of input data */
)
{
unsigned i;
- uint8_t d, z;
- int32_t *pb;
+ gU8 d, z;
+ gI32 *pb;
while (ndata) { /* Process all tables in the segment */
@@ -377,12 +377,12 @@ unsigned create_qt_tbl ( /* 0:OK, !0:Failed */
d = *data++; /* Get table property */
if (d & 0xF0) return GDISP_IMAGE_ERR_BADDATA; /* Err: not 8-bit resolution */
i = d & 3; /* Get table ID */
- pb = alloc_pool(jd, 64 * sizeof (int32_t));/* Allocate a memory block for the table */
+ pb = alloc_pool(jd, 64 * sizeof (gI32));/* Allocate a memory block for the table */
if (!pb) return GDISP_IMAGE_ERR_NOMEMORY; /* Err: not enough memory */
jd->qttbl[i] = pb; /* Register the table */
for (i = 0; i < 64; i++) { /* Load the table */
z = ZIG(i); /* Zigzag-order to raster-order conversion */
- pb[z] = (int32_t)((uint32_t)*data++ * IPSF(z)); /* Apply scale factor of Arai algorithm to the de-quantizers */
+ pb[z] = (gI32)((gU32)*data++ * IPSF(z)); /* Apply scale factor of Arai algorithm to the de-quantizers */
}
}
@@ -399,13 +399,13 @@ unsigned create_qt_tbl ( /* 0:OK, !0:Failed */
static
unsigned create_huffman_tbl ( /* 0:OK, !0:Failed */
JDEC* jd, /* Pointer to the decompressor object */
- const uint8_t* data, /* Pointer to the packed huffman tables */
+ const gU8* data, /* Pointer to the packed huffman tables */
unsigned ndata /* Size of input data */
)
{
unsigned i, j, b, np, cls, num;
- uint8_t d, *pb, *pd;
- uint16_t hc, *ph;
+ gU8 d, *pb, *pd;
+ gU16 hc, *ph;
while (ndata) { /* Process all tables in the segment */
@@ -422,7 +422,7 @@ unsigned create_huffman_tbl ( /* 0:OK, !0:Failed */
np += b; /* Get sum of code words for each code */
}
- ph = alloc_pool(jd, np * sizeof (uint16_t));/* Allocate a memory block for the code word table */
+ ph = alloc_pool(jd, np * sizeof (gU16));/* Allocate a memory block for the code word table */
if (!ph) return GDISP_IMAGE_ERR_NOMEMORY; /* Err: not enough memory */
jd->huffcode[num][cls] = ph;
hc = 0;
@@ -460,7 +460,7 @@ int bitext ( /* >=0: extracted data, <0: error code */
unsigned nbit /* Number of bits to extract (1 to 11) */
)
{
- uint8_t msk, s, *dp;
+ gU8 msk, s, *dp;
unsigned dc, v, f;
@@ -508,12 +508,12 @@ int bitext ( /* >=0: extracted data, <0: error code */
static
int huffext ( /* >=0: decoded data, <0: error code */
JDEC* jd, /* Pointer to the decompressor object */
- const uint8_t* hbits, /* Pointer to the bit distribution table */
- const uint16_t* hcode, /* Pointer to the code word table */
- const uint8_t* hdata /* Pointer to the data table */
+ const gU8* hbits, /* Pointer to the bit distribution table */
+ const gU16* hcode, /* Pointer to the code word table */
+ const gU8* hdata /* Pointer to the data table */
)
{
- uint8_t msk, s, *dp;
+ gU8 msk, s, *dp;
unsigned dc, v, f, bl, nd;
@@ -569,13 +569,13 @@ int huffext ( /* >=0: decoded data, <0: error code */
static
void block_idct (
- int32_t* src, /* Input block data (de-quantized and pre-scaled for Arai Algorithm) */
- uint8_t* dst /* Pointer to the destination to store the block as byte array */
+ gI32* src, /* Input block data (de-quantized and pre-scaled for Arai Algorithm) */
+ gU8* dst /* Pointer to the destination to store the block as byte array */
)
{
- const int32_t M13 = (int32_t)(1.41421*4096), M2 = (int32_t)(1.08239*4096), M4 = (int32_t)(2.61313*4096), M5 = (int32_t)(1.84776*4096);
- int32_t v0, v1, v2, v3, v4, v5, v6, v7;
- int32_t t10, t11, t12, t13;
+ const gI32 M13 = (gI32)(1.41421*4096), M2 = (gI32)(1.08239*4096), M4 = (gI32)(2.61313*4096), M5 = (gI32)(1.84776*4096);
+ gI32 v0, v1, v2, v3, v4, v5, v6, v7;
+ gI32 t10, t11, t12, t13;
unsigned i;
/* Process columns */
@@ -685,13 +685,13 @@ gdispImageError mcu_load (
JDEC* jd /* Pointer to the decompressor object */
)
{
- int32_t *tmp = (int32_t*)jd->workbuf; /* Block working buffer for de-quantize and IDCT */
+ gI32 *tmp = (gI32*)jd->workbuf; /* Block working buffer for de-quantize and IDCT */
unsigned blk, nby, nbc, i, z, id, cmp;
int b, d, e;
- uint8_t *bp;
- const uint8_t *hb, *hd;
- const uint16_t *hc;
- const int32_t *dqf;
+ gU8 *bp;
+ const gU8 *hb, *hd;
+ const gU16 *hc;
+ const gI32 *dqf;
nby = jd->msx * jd->msy; /* Number of Y blocks (1, 2 or 4) */
@@ -715,7 +715,7 @@ gdispImageError mcu_load (
b = 1 << (b - 1); /* MSB position */
if (!(e & b)) e -= (b << 1) - 1; /* Restore sign if needed */
d += e; /* Get current value */
- jd->dcv[cmp] = (int16_t)d; /* Save current DC value for next block */
+ jd->dcv[cmp] = (gI16)d; /* Save current DC value for next block */
}
dqf = jd->qttbl[jd->qtid[cmp]]; /* De-quantizer table ID for this component */
tmp[0] = d * dqf[0] >> 8; /* De-quantize, apply scale factor of Arai algorithm and descale 8 bits */
@@ -774,7 +774,7 @@ gdispImageError mcu_output (
const int CVACC = (sizeof (int) > 2) ? 1024 : 128;
unsigned ix, iy, mx, my, rx, ry;
int yy, cb, cr;
- uint8_t *py, *pc, *rgb24;
+ gU8 *py, *pc, *rgb24;
JRECT rect;
@@ -793,7 +793,7 @@ gdispImageError mcu_output (
if (!JD_USE_SCALE || jd->scale != 3) { /* Not for 1/8 scaling */
/* Build an RGB MCU from discrete comopnents */
- rgb24 = (uint8_t*)jd->workbuf;
+ rgb24 = (gU8*)jd->workbuf;
for (iy = 0; iy < my; iy++) {
pc = jd->mcubuf;
py = pc + iy * 8;
@@ -824,16 +824,16 @@ gdispImageError mcu_output (
/* Descale the MCU rectangular if needed */
if (JD_USE_SCALE && jd->scale) {
unsigned x, y, r, g, b, s, w, a;
- uint8_t *op;
+ gU8 *op;
/* Get averaged RGB value of each square correcponds to a pixel */
s = jd->scale * 2; /* Bumber of shifts for averaging */
w = 1 << jd->scale; /* Width of square */
a = (mx - w) * 3; /* Bytes to skip for next line in the square */
- op = (uint8_t*)jd->workbuf;
+ op = (gU8*)jd->workbuf;
for (iy = 0; iy < my; iy += w) {
for (ix = 0; ix < mx; ix += w) {
- rgb24 = (uint8_t*)jd->workbuf + (iy * mx + ix) * 3;
+ rgb24 = (gU8*)jd->workbuf + (iy * mx + ix) * 3;
r = g = b = 0;
for (y = 0; y < w; y++) { /* Accumulate RGB value in the square */
for (x = 0; x < w; x++) {
@@ -843,9 +843,9 @@ gdispImageError mcu_output (
}
rgb24 += a;
} /* Put the averaged RGB value as a pixel */
- *op++ = (uint8_t)(r >> s);
- *op++ = (uint8_t)(g >> s);
- *op++ = (uint8_t)(b >> s);
+ *op++ = (gU8)(r >> s);
+ *op++ = (gU8)(g >> s);
+ *op++ = (gU8)(b >> s);
}
}
}
@@ -853,7 +853,7 @@ gdispImageError mcu_output (
} else { /* For only 1/8 scaling (left-top pixel in each block are the DC value of the block) */
/* Build a 1/8 descaled RGB MCU from discrete comopnents */
- rgb24 = (uint8_t*)jd->workbuf;
+ rgb24 = (gU8*)jd->workbuf;
pc = jd->mcubuf + mx * my;
cb = pc[0] - 128; /* Get Cb/Cr component and restore right level */
cr = pc[64] - 128;
@@ -875,10 +875,10 @@ gdispImageError mcu_output (
/* Squeeze up pixel table if a part of MCU is to be truncated */
mx >>= jd->scale;
if (rx < mx) {
- uint8_t *s, *d;
+ gU8 *s, *d;
unsigned x, y;
- s = d = (uint8_t*)jd->workbuf;
+ s = d = (gU8*)jd->workbuf;
for (y = 0; y < ry; y++) {
for (x = 0; x < rx; x++) { /* Copy effective pixels */
*d++ = *s++;
@@ -892,8 +892,8 @@ gdispImageError mcu_output (
#if 0
/* Convert RGB888 to RGB565 if needed */
if (JD_FORMAT == 1) {
- uint8_t *s = (uint8_t*)jd->workbuf;
- uint16_t w, *d = (uint16_t*)s;
+ gU8 *s = (gU8*)jd->workbuf;
+ gU16 w, *d = (gU16*)s;
unsigned n = rx * ry;
do {
@@ -919,12 +919,12 @@ gdispImageError mcu_output (
static
gdispImageError restart (
JDEC* jd, /* Pointer to the decompressor object */
- uint16_t rstn /* Expected restert sequense number */
+ gU16 rstn /* Expected restert sequense number */
)
{
unsigned i, dc;
- uint16_t d;
- uint8_t *dp;
+ gU16 d;
+ gU8 *dp;
/* Discard padding bits and get two bytes from the input stream */
@@ -966,9 +966,9 @@ gdispImageError jd_prepare (
gdispImage* img /* I/O device identifier for the session */
)
{
- uint8_t *seg, b;
- uint16_t marker;
- uint32_t ofs;
+ gU8 *seg, b;
+ gU16 marker;
+ gU32 ofs;
unsigned n, i, j, len;
gdispImageError rc;
@@ -1125,11 +1125,11 @@ gdispImageError jd_prepare (
gdispImageError jd_decomp (
JDEC* jd, /* Initialized decompression object */
unsigned (*outfunc)(gdispImage*, void*, JRECT*), /* RGB output function */
- uint8_t scale /* Output de-scaling factor (0 to 3) */
+ gU8 scale /* Output de-scaling factor (0 to 3) */
)
{
unsigned x, y, mx, my;
- uint16_t rst, rsc;
+ gU16 rst, rsc;
gdispImageError rc;
diff --git a/src/gdisp/gdisp_image_native.c b/src/gdisp/gdisp_image_native.c
index a7f9363f..4735d71f 100644
--- a/src/gdisp/gdisp_image_native.c
+++ b/src/gdisp/gdisp_image_native.c
@@ -23,8 +23,8 @@
/**
* Helper Routines Needed
*/
-void *gdispImageAlloc(gdispImage *img, size_t sz);
-void gdispImageFree(gdispImage *img, void *ptr, size_t sz);
+void *gdispImageAlloc(gdispImage *img, gMemSize sz);
+void gdispImageFree(gdispImage *img, void *ptr, gMemSize sz);
typedef struct gdispImagePrivate_NATIVE {
gPixel *frame0cache;
@@ -44,7 +44,7 @@ void gdispImageClose_NATIVE(gdispImage *img) {
}
gdispImageError gdispImageOpen_NATIVE(gdispImage *img) {
- uint8_t hdr[HEADER_SIZE_NATIVE];
+ gU8 hdr[HEADER_SIZE_NATIVE];
/* Read the 8 byte header */
if (gfileRead(img->f, hdr, 8) != 8)
@@ -58,8 +58,8 @@ gdispImageError gdispImageOpen_NATIVE(gdispImage *img) {
/* We know we are a native format image */
img->flags = 0;
- img->width = (((uint16_t)hdr[2])<<8) | (hdr[3]);
- img->height = (((uint16_t)hdr[4])<<8) | (hdr[5]);
+ img->width = (((gU16)hdr[2])<<8) | (hdr[3]);
+ img->height = (((gU16)hdr[4])<<8) | (hdr[5]);
if (img->width < 1 || img->height < 1)
return GDISP_IMAGE_ERR_BADDATA;
if (!(img->priv = gdispImageAlloc(img, sizeof(gdispImagePrivate_NATIVE))))
@@ -71,7 +71,7 @@ gdispImageError gdispImageOpen_NATIVE(gdispImage *img) {
}
gdispImageError gdispImageCache_NATIVE(gdispImage *img) {
- size_t len;
+ gMemSize len;
gdispImagePrivate_NATIVE * priv;
/* If we are already cached - just return OK */
@@ -95,7 +95,8 @@ gdispImageError gdispImageCache_NATIVE(gdispImage *img) {
gdispImageError gdispGImageDraw_NATIVE(GDisplay *g, gdispImage *img, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord sx, gCoord sy) {
gCoord mx, mcx;
- size_t pos, len;
+ gFileSize pos;
+ gMemSize len;
gdispImagePrivate_NATIVE * priv;
priv = (gdispImagePrivate_NATIVE *)img->priv;
diff --git a/src/gdisp/gdisp_image_png.c b/src/gdisp/gdisp_image_png.c
index ed353ce5..4cb3ca07 100644
--- a/src/gdisp/gdisp_image_png.c
+++ b/src/gdisp/gdisp_image_png.c
@@ -19,21 +19,21 @@ struct PNG_decode;
// PNG info (comes from the PNG header)
typedef struct PNG_info {
- uint8_t flags; // Flags (global)
+ gU8 flags; // Flags (global)
#define PNG_FLG_HEADERDONE 0x01 // The header has been processed
#define PNG_FLG_TRANSPARENT 0x02 // Has transparency
#define PNG_FLG_INTERLACE 0x04 // Is Interlaced
#define PNG_FLG_BACKGROUND 0x08 // Has a specified background color
- uint8_t bitdepth; // 1, 2, 4, 8, 16
- uint8_t mode; // The PNG color-mode
+ gU8 bitdepth; // 1, 2, 4, 8, 16
+ gU8 mode; // The PNG color-mode
#define PNG_COLORMODE_GRAY 0x00 // Grayscale
#define PNG_COLORMODE_RGB 0x02 // RGB
#define PNG_COLORMODE_PALETTE 0x03 // Pallete
#define PNG_COLORMODE_GRAYALPHA 0x04 // Grayscale with Alpha
#define PNG_COLORMODE_RGBA 0x06 // RGBA
- uint8_t bpp; // Bits per pixel
+ gU8 bpp; // Bits per pixel
- uint8_t *cache; // The image cache
+ gU8 *cache; // The image cache
unsigned cachesz; // The image cache size
void (*out)(struct PNG_decode *); // The scan line output function
@@ -42,13 +42,13 @@ typedef struct PNG_info {
gColor bg; // The background color
#endif
#if GDISP_NEED_IMAGE_PNG_TRANSPARENCY
- uint16_t trans_r; // Red/grayscale component of the transparent color (PNG_COLORMODE_GRAY and PNG_COLORMODE_RGB only)
- uint16_t trans_g; // Green component of the transparent color (PNG_COLORMODE_RGB only)
- uint16_t trans_b; // Blue component of the transparent color (PNG_COLORMODE_RGB only)
+ gU16 trans_r; // Red/grayscale component of the transparent color (PNG_COLORMODE_GRAY and PNG_COLORMODE_RGB only)
+ gU16 trans_g; // Green component of the transparent color (PNG_COLORMODE_RGB only)
+ gU16 trans_b; // Blue component of the transparent color (PNG_COLORMODE_RGB only)
#endif
#if GDISP_NEED_IMAGE_PNG_PALETTE_124 || GDISP_NEED_IMAGE_PNG_PALETTE_8
- uint16_t palsize; // palette size in number of colors
- uint8_t *palette; // palette in RGBA RGBA... order (4 bytes per entry - PNG_COLORMODE_PALETTE only)
+ gU16 palsize; // palette size in number of colors
+ gU8 *palette; // palette in RGBA RGBA... order (4 bytes per entry - PNG_COLORMODE_PALETTE only)
#endif
} PNG_info;
@@ -56,10 +56,10 @@ typedef struct PNG_info {
typedef struct PNG_input {
GFILE * f; // The gfile to retrieve data from
unsigned buflen; // The number of bytes left in the buffer
- uint8_t *pbuf; // The pointer to the next byte
- uint32_t chunklen; // The number of bytes left in the current PNG chunk
- uint32_t chunknext; // The file position of the next PNG chunk
- uint8_t buf[GDISP_IMAGE_PNG_FILE_BUFFER_SIZE]; // Must be a minimum of 8 bytes to hold a chunk header
+ gU8 *pbuf; // The pointer to the next byte
+ gU32 chunklen; // The number of bytes left in the current PNG chunk
+ gU32 chunknext; // The file position of the next PNG chunk
+ gU8 buf[GDISP_IMAGE_PNG_FILE_BUFFER_SIZE]; // Must be a minimum of 8 bytes to hold a chunk header
} PNG_input;
// Handle the display output and windowing
@@ -77,20 +77,20 @@ typedef struct PNG_output {
typedef struct PNG_filter {
unsigned scanbytes;
unsigned bytewidth;
- uint8_t *line;
- uint8_t *prev;
+ gU8 *line;
+ gU8 *prev;
} PNG_filter;
// Handle the PNG inflate decompression
typedef struct PNG_zTree {
- uint16_t table[16]; // Table of code length counts
- uint16_t trans[288]; // Code to symbol translation table
+ gU16 table[16]; // Table of code length counts
+ gU16 trans[288]; // Code to symbol translation table
} PNG_zTree;
typedef struct PNG_zinflate {
- uint8_t data; // The current input stream data byte
- uint8_t bits; // The number of bits left in the data byte
- uint8_t flags; // Decompression flags
+ gU8 data; // The current input stream data byte
+ gU8 bits; // The number of bits left in the data byte
+ gU8 flags; // Decompression flags
#define PNG_ZFLG_EOF 0x01 // No more input data
#define PNG_ZFLG_FINAL 0x02 // This is the final block
#define PNG_ZFLG_RESUME_MASK 0x0C // The mask of bits for the resume state
@@ -104,8 +104,8 @@ typedef struct PNG_zinflate {
PNG_zTree ltree; // The dynamic length tree
PNG_zTree dtree; // The dynamic distance tree
- uint8_t tmp[288+32]; // Temporary space for decoding dynamic trees and other temporary uses
- uint8_t buf[GDISP_IMAGE_PNG_Z_BUFFER_SIZE]; // The decoding buffer and sliding window
+ gU8 tmp[288+32]; // Temporary space for decoding dynamic trees and other temporary uses
+ gU8 buf[GDISP_IMAGE_PNG_Z_BUFFER_SIZE]; // The decoding buffer and sliding window
} PNG_zinflate;
// Put all the decoding structures together.
@@ -139,7 +139,7 @@ static void PNG_iInit(PNG_decode *d) {
// Load the next byte of image data from the PNG file
static gBool PNG_iLoadData(PNG_decode *d) {
- uint32_t sz;
+ gU32 sz;
// Is there data still left in the buffer?
if (d->i.buflen)
@@ -188,7 +188,7 @@ gotchunk:
}
// Get the last loaded byte of image data from the PNG file
-static uint8_t PNG_iGetByte(PNG_decode *d) {
+static gU8 PNG_iGetByte(PNG_decode *d) {
d->i.buflen--;
return *d->i.pbuf++;
}
@@ -338,9 +338,9 @@ static unsigned PNG_zGetBits(PNG_decode *d, unsigned num) {
}
// Build an inflate dynamic tree using a string of byte lengths
-static void PNG_zBuildTree(PNG_zTree *t, const uint8_t *lengths, unsigned num) {
+static void PNG_zBuildTree(PNG_zTree *t, const gU8 *lengths, unsigned num) {
unsigned i, sum;
- uint16_t offs[16];
+ gU16 offs[16];
for (i = 0; i < 16; ++i)
t->table[i] = 0;
@@ -360,7 +360,7 @@ static void PNG_zBuildTree(PNG_zTree *t, const uint8_t *lengths, unsigned num) {
}
// Get an inflate decode symbol
-static uint16_t PNG_zGetSymbol(PNG_decode *d, PNG_zTree *t) {
+static gU16 PNG_zGetSymbol(PNG_decode *d, PNG_zTree *t) {
int sum, cur;
unsigned len;
@@ -401,11 +401,11 @@ static void PNG_zBuildFixedTrees(PNG_decode *d) {
// Build inflate dynamic length and distance trees
static gBool PNG_zDecodeTrees(PNG_decode *d) {
- static const uint8_t IndexLookup[19] = { 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 };
+ static const gU8 IndexLookup[19] = { 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 };
unsigned hlit, hdist, hclen;
unsigned i, num;
- uint16_t symbol;
- uint8_t val;
+ gU16 symbol;
+ gU8 val;
hlit = PNG_zGetBits(d, 5) + 257; // 257 - 286
hdist = PNG_zGetBits(d, 5) + 1; // 1 - 32
@@ -501,7 +501,7 @@ static gBool PNG_zUncompressedBlock(PNG_decode *d) {
length = gdispImageGetAlignedLE16(d->z.tmp, 0);
// Check length
- if ((uint16_t)length != (uint16_t)~gdispImageGetAlignedLE16(d->z.tmp, 2)) {
+ if ((gU16)length != (gU16)~gdispImageGetAlignedLE16(d->z.tmp, 2)) {
d->z.flags |= PNG_ZFLG_EOF;
return gFalse;
}
@@ -512,12 +512,12 @@ static gBool PNG_zUncompressedBlock(PNG_decode *d) {
// Inflate a compressed inflate block into the output
static gBool PNG_zInflateBlock(PNG_decode *d) {
- static const uint8_t lbits[30] = { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 6 };
- static const uint16_t lbase[30] = { 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 323 };
- static const uint8_t dbits[30] = { 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13 };
- static const uint16_t dbase[30] = { 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577 };
+ static const gU8 lbits[30] = { 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 6 };
+ static const gU16 lbase[30] = { 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 323 };
+ static const gU8 dbits[30] = { 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13 };
+ static const gU16 dbase[30] = { 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577 };
unsigned length, dist, offset;
- uint16_t symbol;
+ gU16 symbol;
while(1) {
symbol = PNG_zGetSymbol(d, &d->z.ltree); // EOF?
@@ -532,7 +532,7 @@ static gBool PNG_zInflateBlock(PNG_decode *d) {
if (symbol < 256) {
// The symbol is the data
- d->z.buf[d->z.bufend++] = (uint8_t)symbol;
+ d->z.buf[d->z.bufend++] = (gU8)symbol;
WRAP_ZBUF(d->z.bufend);
if (d->z.bufend == d->z.bufpos) { // Buffer full?
d->z.flags = (d->z.flags & ~PNG_ZFLG_RESUME_MASK) | PNG_ZFLG_RESUME_INFLATE;
@@ -643,8 +643,8 @@ static gBool PNG_zResumeOffset(PNG_decode *d, unsigned length, unsigned offset)
}
// Get a fully decompressed byte from the inflate data stream
-static uint8_t PNG_zGetByte(PNG_decode *d) {
- uint8_t data;
+static gU8 PNG_zGetByte(PNG_decode *d) {
+ gU8 data;
// Do we have any data in the buffers
while (d->z.bufpos == d->z.bufend) {
@@ -688,7 +688,7 @@ static uint8_t PNG_zGetByte(PNG_decode *d) {
*---------------------------------------------------------------*/
// Initialise the scan-line engine
-static void PNG_fInit(PNG_filter *f, uint8_t *buf, unsigned bytewidth, unsigned scanbytes) {
+static void PNG_fInit(PNG_filter *f, gU8 *buf, unsigned bytewidth, unsigned scanbytes) {
f->scanbytes = scanbytes;
f->bytewidth = bytewidth;
f->line = buf;
@@ -707,21 +707,21 @@ static void PNG_fNext(PNG_filter *f) {
}
// Predictor function for filter0 mode 4
-static uint8_t PNG_fCalcPath(uint16_t a, uint16_t b, uint16_t c) {
- uint16_t pa = b > c ? (b - c) : (c - b);
- uint16_t pb = a > c ? (a - c) : (c - a);
- uint16_t pc = a + b > c + c ? (a + b - c - c) : (c + c - a - b);
+static gU8 PNG_fCalcPath(gU16 a, gU16 b, gU16 c) {
+ gU16 pa = b > c ? (b - c) : (c - b);
+ gU16 pb = a > c ? (a - c) : (c - a);
+ gU16 pc = a + b > c + c ? (a + b - c - c) : (c + c - a - b);
if (pc < pa && pc < pb)
- return (uint8_t)c;
+ return (gU8)c;
if (pb < pa)
- return (uint8_t)b;
- return (uint8_t)a;
+ return (gU8)b;
+ return (gU8)a;
}
// Scan-line filter type 0
static gBool PNG_unfilter_type0(PNG_decode *d) { // PNG filter method 0
- uint8_t ft;
+ gU8 ft;
unsigned i;
// Get the filter type and check for validity (eg not EOF)
@@ -781,15 +781,15 @@ static gBool PNG_unfilter_type0(PNG_decode *d) { // PNG filter method 0
static void PNG_OutGRAY124(PNG_decode *d) {
unsigned i;
PNG_info *pinfo;
- uint8_t px;
- uint8_t bits;
+ gU8 px;
+ gU8 bits;
pinfo = d->pinfo;
for(i = 0; i < d->f.scanbytes; i++) {
for(bits = 8; bits; bits -= pinfo->bitdepth) {
px = (d->f.line[i] >> (bits - pinfo->bitdepth)) & ((1U << pinfo->bitdepth)-1);
#if GDISP_NEED_IMAGE_PNG_TRANSPARENCY
- if ((pinfo->flags & PNG_FLG_TRANSPARENT) && (uint16_t)px == pinfo->trans_r) {
+ if ((pinfo->flags & PNG_FLG_TRANSPARENT) && (gU16)px == pinfo->trans_r) {
#if GDISP_NEED_IMAGE_PNG_BACKGROUND
if ((pinfo->flags & PNG_FLG_BACKGROUND)) {
PNG_oColor(&d->o, pinfo->bg);
@@ -810,7 +810,7 @@ static gBool PNG_unfilter_type0(PNG_decode *d) { // PNG filter method 0
#if GDISP_NEED_IMAGE_PNG_GRAYSCALE_8
static void PNG_OutGRAY8(PNG_decode *d) {
unsigned i;
- uint8_t px;
+ gU8 px;
#if GDISP_NEED_IMAGE_PNG_TRANSPARENCY
PNG_info *pinfo = d->pinfo;
#endif
@@ -818,7 +818,7 @@ static gBool PNG_unfilter_type0(PNG_decode *d) { // PNG filter method 0
for(i = 0; i < d->f.scanbytes; i++) {
px = d->f.line[i];
#if GDISP_NEED_IMAGE_PNG_TRANSPARENCY
- if ((pinfo->flags & PNG_FLG_TRANSPARENT) && (uint16_t)px == pinfo->trans_r) {
+ if ((pinfo->flags & PNG_FLG_TRANSPARENT) && (gU16)px == pinfo->trans_r) {
#if GDISP_NEED_IMAGE_PNG_BACKGROUND
if ((pinfo->flags & PNG_FLG_BACKGROUND)) {
PNG_oColor(&d->o, pinfo->bg);
@@ -836,7 +836,7 @@ static gBool PNG_unfilter_type0(PNG_decode *d) { // PNG filter method 0
#if GDISP_NEED_IMAGE_PNG_GRAYSCALE_16
static void PNG_OutGRAY16(PNG_decode *d) {
unsigned i;
- uint8_t px;
+ gU8 px;
#if GDISP_NEED_IMAGE_PNG_TRANSPARENCY
PNG_info *pinfo = d->pinfo;
#endif
@@ -869,9 +869,9 @@ static gBool PNG_unfilter_type0(PNG_decode *d) { // PNG filter method 0
for(i = 0; i < d->f.scanbytes; i+=3) {
#if GDISP_NEED_IMAGE_PNG_TRANSPARENCY
if ((pinfo->flags & PNG_FLG_TRANSPARENT)
- && (uint16_t)d->f.line[i+0] == pinfo->trans_r
- && (uint16_t)d->f.line[i+1] == pinfo->trans_g
- && (uint16_t)d->f.line[i+2] == pinfo->trans_b) {
+ && (gU16)d->f.line[i+0] == pinfo->trans_r
+ && (gU16)d->f.line[i+1] == pinfo->trans_g
+ && (gU16)d->f.line[i+2] == pinfo->trans_b) {
#if GDISP_NEED_IMAGE_PNG_BACKGROUND
if ((pinfo->flags & PNG_FLG_BACKGROUND)) {
PNG_oColor(&d->o, pinfo->bg);
@@ -918,14 +918,14 @@ static gBool PNG_unfilter_type0(PNG_decode *d) { // PNG filter method 0
unsigned i;
PNG_info *pinfo;
unsigned idx;
- uint8_t bits;
+ gU8 bits;
pinfo = d->pinfo;
for(i = 0; i < d->f.scanbytes; i++) {
for(bits = 8; bits; bits -= pinfo->bitdepth) {
idx = (d->f.line[i] >> (bits - pinfo->bitdepth)) & ((1U << pinfo->bitdepth)-1);
- if ((uint16_t)idx >= pinfo->palsize) {
+ if ((gU16)idx >= pinfo->palsize) {
PNG_oColor(&d->o, RGB2COLOR(0, 0, 0));
continue;
}
@@ -967,7 +967,7 @@ static gBool PNG_unfilter_type0(PNG_decode *d) { // PNG filter method 0
for(i = 0; i < d->f.scanbytes; i++) {
idx = (unsigned)d->f.line[i];
- if ((uint16_t)idx >= pinfo->palsize) {
+ if ((gU16)idx >= pinfo->palsize) {
PNG_oColor(&d->o, RGB2COLOR(0, 0, 0));
continue;
}
@@ -1143,9 +1143,9 @@ void gdispImageClose_PNG(gdispImage *img) {
gdispImageError gdispImageOpen_PNG(gdispImage *img) {
PNG_info *pinfo;
- uint32_t pos;
- uint32_t len;
- uint8_t buf[13];
+ gU32 pos;
+ gU32 len;
+ gU8 buf[13];
/* Read the file identifier */
if (gfileRead(img->f, buf, 8) != 8)
@@ -1199,9 +1199,9 @@ gdispImageError gdispImageOpen_PNG(gdispImage *img) {
img->width = gdispImageGetAlignedBE16(buf, 2);
img->height = gdispImageGetAlignedBE16(buf, 6);
- pinfo->bitdepth = gdispImageGetVar(uint8_t, buf, 8);
- pinfo->mode = gdispImageGetVar(uint8_t, buf, 9);
- if (gdispImageGetVar(uint8_t, buf, 12)) {
+ pinfo->bitdepth = gdispImageGetVar(gU8, buf, 8);
+ pinfo->mode = gdispImageGetVar(gU8, buf, 9);
+ if (gdispImageGetVar(gU8, buf, 12)) {
pinfo->flags |= PNG_FLG_INTERLACE;
#if !GDISP_NEED_IMAGE_PNG_INTERLACED
goto exit_unsupported;
@@ -1209,11 +1209,11 @@ gdispImageError gdispImageOpen_PNG(gdispImage *img) {
}
// Check width and height, filter, compression and interlacing
- if (gdispImageGetVar(uint16_t, buf, 0) != 0 || img->width <= 0 // width
- || gdispImageGetVar(uint16_t, buf, 4) != 0 || img->height <= 0 // height
- || gdispImageGetVar(uint8_t, buf, 10) != 0 // compression
- || gdispImageGetVar(uint8_t, buf, 11) != 0 // filter
- || gdispImageGetVar(uint8_t, buf, 12) > 1 // interlace
+ if (gdispImageGetVar(gU16, buf, 0) != 0 || img->width <= 0 // width
+ || gdispImageGetVar(gU16, buf, 4) != 0 || img->height <= 0 // height
+ || gdispImageGetVar(gU8, buf, 10) != 0 // compression
+ || gdispImageGetVar(gU8, buf, 11) != 0 // filter
+ || gdispImageGetVar(gU8, buf, 12) > 1 // interlace
)
goto exit_unsupported;
@@ -1343,8 +1343,8 @@ gdispImageError gdispImageOpen_PNG(gdispImage *img) {
// Read the palette
{
- uint16_t idx;
- uint8_t *p;
+ gU16 idx;
+ gU8 *p;
for(idx=pinfo->palsize, p=pinfo->palette; idx; p += 4, idx--) {
if (gfileRead(img->f, p, 3) != 3)
@@ -1373,8 +1373,8 @@ gdispImageError gdispImageOpen_PNG(gdispImage *img) {
// Adjust the palette
{
- uint16_t idx;
- uint8_t *p;
+ gU16 idx;
+ gU8 *p;
for(idx=len, p=pinfo->palette+3; idx; p += 4, idx--) {
if (gfileRead(img->f, p, 1) != 1)
@@ -1427,7 +1427,7 @@ gdispImageError gdispImageOpen_PNG(gdispImage *img) {
#if GDISP_NEED_IMAGE_PNG_PALETTE_124 || GDISP_NEED_IMAGE_PNG_PALETTE_8
case PNG_COLORMODE_PALETTE:
- if (!pinfo->palette || len < 1 || gfileRead(img->f, buf, 1) != 1 || (uint16_t)buf[0] >= pinfo->palsize)
+ if (!pinfo->palette || len < 1 || gfileRead(img->f, buf, 1) != 1 || (gU16)buf[0] >= pinfo->palsize)
goto exit_baddata;
pinfo->bg = RGB2COLOR(pinfo->palette[((unsigned)buf[0])*4+0],
pinfo->palette[((unsigned)buf[0])*4+1],
@@ -1526,7 +1526,7 @@ gdispImageError gdispGImageDraw_PNG(GDisplay *g, gdispImage *img, gCoord x, gCoo
#endif
{
// Non-interlaced decoding
- PNG_fInit(&d->f, (uint8_t *)(d+1), (pinfo->bpp + 7) / 8, (img->width * pinfo->bpp + 7) / 8);
+ PNG_fInit(&d->f, (gU8 *)(d+1), (pinfo->bpp + 7) / 8, (img->width * pinfo->bpp + 7) / 8);
for(y = 0; y < sy+cy; PNG_fNext(&d->f), y++) {
if (!PNG_unfilter_type0(d))
goto exit_baddata;
@@ -1550,8 +1550,8 @@ gdispImageError gdispImageCache_PNG(gdispImage *img) {
PNG_info *pinfo;
unsigned chunknext;
unsigned chunklen;
- uint8_t *pcache;
- uint8_t buf[8];
+ gU8 *pcache;
+ gU8 buf[8];
// If we are already cached - just return OK
pinfo = (PNG_info *)img->priv;
diff --git a/src/gdisp/gdisp_image_support.h b/src/gdisp/gdisp_image_support.h
index d64eef5b..5a114fc6 100644
--- a/src/gdisp/gdisp_image_support.h
+++ b/src/gdisp/gdisp_image_support.h
@@ -18,50 +18,50 @@
#define _GDISP_IMAGE_SUPPORT_H
/* Base endian handling routines */
-#define gdispImageGetVar(type, p, idx) (*(type *)(((uint8_t *)(p))+(idx)))
-#define gdispImageGetByte(type, p, idx, shift) (((type)gdispImageGetVar(uint8_t, p, idx))<<(shift))
-#define gdispImageSwap16(w) ((((uint16_t)(w))>>8)|(((uint16_t)(w))<<8))
-#define gdispImageSwap32(dw) ((((uint32_t)(dw))>>24)|((((uint32_t)(dw))&0x00FF0000)>>8)\
- |((((uint32_t)(dw))&0x0000FF00)<<8)|(((uint32_t)(dw))<<24))
-#define gdispImageSwapWords32(dw) ((((uint32_t)(dw))>>16)|(((uint32_t)(dw))<<16))
-#define gdispImageSwapBytes32(dw) (((((uint32_t)(dw))&0xFF000000)>>8)|((((uint32_t)(dw))&0x00FF0000)<<8)\
- |((((uint32_t)(dw))&0x0000FF00)>>8)|(((uint32_t)(dw))<<8))
+#define gdispImageGetVar(type, p, idx) (*(type *)(((gU8 *)(p))+(idx)))
+#define gdispImageGetByte(type, p, idx, shift) (((type)gdispImageGetVar(gU8, p, idx))<<(shift))
+#define gdispImageSwap16(w) ((((gU16)(w))>>8)|(((gU16)(w))<<8))
+#define gdispImageSwap32(dw) ((((gU32)(dw))>>24)|((((gU32)(dw))&0x00FF0000)>>8)\
+ |((((gU32)(dw))&0x0000FF00)<<8)|(((gU32)(dw))<<24))
+#define gdispImageSwapWords32(dw) ((((gU32)(dw))>>16)|(((gU32)(dw))<<16))
+#define gdispImageSwapBytes32(dw) (((((gU32)(dw))&0xFF000000)>>8)|((((gU32)(dw))&0x00FF0000)<<8)\
+ |((((gU32)(dw))&0x0000FF00)>>8)|(((gU32)(dw))<<8))
/*
- * Get a uint16_t/uint32_t from memory in the required endianness.
+ * Get a gU16/gU32 from memory in the required endianness.
* There is no alignment requirement.
*/
#if GFX_CPU_ENDIAN == GFX_CPU_ENDIAN_LITTLE && GFX_CPU_NO_ALIGNMENT_FAULTS
- #define gdispImageGetLE16(p, idx) gdispImageGetVar(uint16_t, (p), (idx))
- #define gdispImageGetLE32(p, idx) gdispImageGetVar(uint32_t, (p), (idx))
+ #define gdispImageGetLE16(p, idx) gdispImageGetVar(gU16, (p), (idx))
+ #define gdispImageGetLE32(p, idx) gdispImageGetVar(gU32, (p), (idx))
#else
- #define gdispImageGetLE16(p, idx) ( gdispImageGetByte(uint16_t, (p), (idx) , 0) | gdispImageGetByte(uint16_t, (p), (idx)+1, 8))
- #define gdispImageGetLE32(p, idx) ( gdispImageGetByte(uint32_t, (p), (idx) , 0) | gdispImageGetByte(uint32_t, (p), (idx)+1, 8)\
- |gdispImageGetByte(uint32_t, (p), (idx)+2, 16) | gdispImageGetByte(uint32_t, (p), (idx)+3, 24))
+ #define gdispImageGetLE16(p, idx) ( gdispImageGetByte(gU16, (p), (idx) , 0) | gdispImageGetByte(gU16, (p), (idx)+1, 8))
+ #define gdispImageGetLE32(p, idx) ( gdispImageGetByte(gU32, (p), (idx) , 0) | gdispImageGetByte(gU32, (p), (idx)+1, 8)\
+ |gdispImageGetByte(gU32, (p), (idx)+2, 16) | gdispImageGetByte(gU32, (p), (idx)+3, 24))
#endif
#if GFX_CPU_ENDIAN == GFX_CPU_ENDIAN_BIG && GFX_CPU_NO_ALIGNMENT_FAULTS
- #define gdispImageGetBE16(p, idx) gdispImageGetVar(uint16_t, (p), (idx))
- #define gdispImageGetBE32(p, idx) gdispImageGetVar(uint32_t, (p), (idx))
+ #define gdispImageGetBE16(p, idx) gdispImageGetVar(gU16, (p), (idx))
+ #define gdispImageGetBE32(p, idx) gdispImageGetVar(gU32, (p), (idx))
#else
- #define gdispImageGetBE16(p, idx) ( gdispImageGetByte(uint16_t, (p), (idx) , 8) | gdispImageGetByte(uint16_t, (p), (idx)+1, 0))
- #define gdispImageGetBE32(p, idx) ( gdispImageGetByte(uint32_t, (p), (idx) , 24) | gdispImageGetByte(uint32_t, (p), (idx)+1, 16)\
- |gdispImageGetByte(uint32_t, (p), (idx)+2, 8) | gdispImageGetByte(uint32_t, (p), (idx)+3, 0))
+ #define gdispImageGetBE16(p, idx) ( gdispImageGetByte(gU16, (p), (idx) , 8) | gdispImageGetByte(gU16, (p), (idx)+1, 0))
+ #define gdispImageGetBE32(p, idx) ( gdispImageGetByte(gU32, (p), (idx) , 24) | gdispImageGetByte(gU32, (p), (idx)+1, 16)\
+ |gdispImageGetByte(gU32, (p), (idx)+2, 8) | gdispImageGetByte(gU32, (p), (idx)+3, 0))
#endif
/*
- * Get a uint16_t/uint32_t from memory in the required endianness.
+ * Get a gU16/gU32 from memory in the required endianness.
* These are optimised routines but the memory must be word/dword aligned.
*/
#if GFX_CPU_ENDIAN == GFX_CPU_ENDIAN_LITTLE
- #define gdispImageGetAlignedLE16(p, idx) gdispImageGetVar(uint16_t, (p), (idx))
+ #define gdispImageGetAlignedLE16(p, idx) gdispImageGetVar(gU16, (p), (idx))
#define gdispImageGetAlignedBE16(p, idx) gdispImageGetBE16(p, (idx))
- #define gdispImageGetAlignedLE32(p, idx) gdispImageGetVar(uint32_t, (p), (idx))
+ #define gdispImageGetAlignedLE32(p, idx) gdispImageGetVar(gU32, (p), (idx))
#define gdispImageGetAlignedBE32(p, idx) gdispImageGetBE32(p, (idx))
#elif GFX_CPU_ENDIAN == GFX_CPU_ENDIAN_BIG
#define gdispImageGetAlignedLE16(p, idx) gdispImageGetLE16(p, (idx))
- #define gdispImageGetAlignedBE16(p, idx) gdispImageGetVar(uint16_t, (p), (idx))
+ #define gdispImageGetAlignedBE16(p, idx) gdispImageGetVar(gU16, (p), (idx))
#define gdispImageGetAlignedLE32(p, idx) gdispImageGetLE32(p, (idx))
- #define gdispImageGetAlignedBE32(p, idx) gdispImageGetVar(uint32_t, (p), (idx))
+ #define gdispImageGetAlignedBE32(p, idx) gdispImageGetVar(gU32, (p), (idx))
#else
#define gdispImageGetAlignedLE16(p, idx) gdispImageGetLE16(p, (idx))
#define gdispImageGetAlignedBE16(p, idx) gdispImageGetBE16(p, (idx))
@@ -109,10 +109,10 @@
#define gdispImageMakeLE32(dw) { dw = gdispImageH32toLE32(dw); }
#define gdispImageMakeBE32(dw) { dw = gdispImageH32toBE32(dw); }
#else
- uint16_t gdispImageH16toLE16(uint16_t w);
- uint16_t gdispImageH16toBE16(uint16_t w);
- uint32_t gdispImageH32toLE32(uint32_t dw);
- uint32_t gdispImageH32toBE32(uint32_t dw);
+ gU16 gdispImageH16toLE16(gU16 w);
+ gU16 gdispImageH16toBE16(gU16 w);
+ gU32 gdispImageH32toLE32(gU32 dw);
+ gU32 gdispImageH32toBE32(gU32 dw);
#define gdispImageMakeLE16(w) { w = gdispImageH16toLE16(w); }
#define gdispImageMakeBE16(w) { w = gdispImageH16toBE16(w); }
#define gdispImageMakeLE32(dw) { dw = gdispImageH32toLE32(dw); }
@@ -120,11 +120,11 @@
#endif
-void *gdispImageAlloc(gdispImage *img, size_t sz);
-void gdispImageFree(gdispImage *img, void *ptr, size_t sz);
+void *gdispImageAlloc(gdispImage *img, gMemSize sz);
+void gdispImageFree(gdispImage *img, void *ptr, gMemSize sz);
#if GFX_CPU_ENDIAN == GFX_CPU_ENDIAN_UNKNOWN
- extern const uint8_t gdispImageEndianArray[4];
+ extern const gU8 gdispImageEndianArray[4];
#endif
#endif /* _GDISP_IMAGE_SUPPORT_H */
diff --git a/src/gdisp/gdisp_pixmap.c b/src/gdisp/gdisp_pixmap.c
index 339e5cd2..c6a1e21e 100644
--- a/src/gdisp/gdisp_pixmap.c
+++ b/src/gdisp/gdisp_pixmap.c
@@ -44,7 +44,7 @@
typedef struct pixmap {
#if GDISP_NEED_PIXMAP_IMAGE
- uint8_t imghdr[8]; // This field must come just before the data member.
+ gU8 imghdr[8]; // This field must come just before the data member.
#endif
gColor pixels[1]; // We really want pixels[0] but some compilers don't allow that even though it is C standard.
} pixmap;
@@ -67,12 +67,12 @@ GDisplay *gdispPixmapCreate(gCoord width, gCoord height) {
#if GDISP_NEED_PIXMAP_IMAGE
p->imghdr[0] = 'N';
p->imghdr[1] = 'I';
- p->imghdr[2] = (uint8_t)(width >> 8);
- p->imghdr[3] = (uint8_t)width;
- p->imghdr[4] = (uint8_t)(height >> 8);
- p->imghdr[5] = (uint8_t)height;
- p->imghdr[6] = (uint8_t)(GDISP_PIXELFORMAT >> 8);
- p->imghdr[7] = (uint8_t)(GDISP_PIXELFORMAT);
+ p->imghdr[2] = (gU8)(width >> 8);
+ p->imghdr[3] = (gU8)width;
+ p->imghdr[4] = (gU8)(height >> 8);
+ p->imghdr[5] = (gU8)height;
+ p->imghdr[6] = (gU8)(GDISP_PIXELFORMAT >> 8);
+ p->imghdr[7] = (gU8)(GDISP_PIXELFORMAT);
#endif
// Save the width and height so the driver can retrieve it.
diff --git a/src/gdisp/mcufont/mf_bwfont.c b/src/gdisp/mcufont/mf_bwfont.c
index a17a1673..b2b17a21 100644
--- a/src/gdisp/mcufont/mf_bwfont.c
+++ b/src/gdisp/mcufont/mf_bwfont.c
@@ -13,7 +13,7 @@
/* Find the character range and index that contains a given glyph.. */
static const struct mf_bwfont_char_range_s *find_char_range(
- const struct mf_bwfont_s *font, uint16_t character, uint16_t *index_ret)
+ const struct mf_bwfont_s *font, gU16 character, gU16 *index_ret)
{
unsigned i, index;
const struct mf_bwfont_char_range_s *range;
@@ -31,7 +31,7 @@ static const struct mf_bwfont_char_range_s *find_char_range(
return 0;
}
-static uint8_t get_width(const struct mf_bwfont_char_range_s *r, uint16_t index)
+static gU8 get_width(const struct mf_bwfont_char_range_s *r, gU16 index)
{
if (r->width)
{
@@ -43,15 +43,15 @@ static uint8_t get_width(const struct mf_bwfont_char_range_s *r, uint16_t index)
}
}
-static uint8_t render_char(const struct mf_bwfont_char_range_s *r,
- int16_t x0, int16_t y0, uint16_t index,
+static gU8 render_char(const struct mf_bwfont_char_range_s *r,
+ gI16 x0, gI16 y0, gU16 index,
mf_pixel_callback_t callback,
void *state)
{
- const uint8_t *data, *p;
- uint8_t stride, runlen;
- uint8_t x, y, height, num_cols;
- uint8_t bit, byte, mask;
+ const gU8 *data, *p;
+ gU8 stride, runlen;
+ gU8 x, y, height, num_cols;
+ gU8 bit, byte, mask;
bool oldstate, newstate;
if (r->width)
@@ -112,15 +112,15 @@ static uint8_t render_char(const struct mf_bwfont_char_range_s *r,
return get_width(r, index);
}
-uint8_t mf_bwfont_render_character(const struct mf_font_s *font,
- int16_t x0, int16_t y0,
- uint16_t character,
+gU8 mf_bwfont_render_character(const struct mf_font_s *font,
+ gI16 x0, gI16 y0,
+ gU16 character,
mf_pixel_callback_t callback,
void *state)
{
const struct mf_bwfont_s *bwfont = (const struct mf_bwfont_s*)font;
const struct mf_bwfont_char_range_s *range;
- uint16_t index;
+ gU16 index;
range = find_char_range(bwfont, character, &index);
if (!range)
@@ -129,12 +129,12 @@ uint8_t mf_bwfont_render_character(const struct mf_font_s *font,
return render_char(range, x0, y0, index, callback, state);
}
-uint8_t mf_bwfont_character_width(const struct mf_font_s *font,
- uint16_t character)
+gU8 mf_bwfont_character_width(const struct mf_font_s *font,
+ gU16 character)
{
const struct mf_bwfont_s *bwfont = (const struct mf_bwfont_s*)font;
const struct mf_bwfont_char_range_s *range;
- uint16_t index;
+ gU16 index;
range = find_char_range(bwfont, character, &index);
if (!range)
diff --git a/src/gdisp/mcufont/mf_bwfont.h b/src/gdisp/mcufont/mf_bwfont.h
index 537ba22e..e8de21a7 100644
--- a/src/gdisp/mcufont/mf_bwfont.h
+++ b/src/gdisp/mcufont/mf_bwfont.h
@@ -21,37 +21,37 @@
struct mf_bwfont_char_range_s
{
/* The number of the first character in this range. */
- uint16_t first_char;
+ gU16 first_char;
/* The total count of characters in this range. */
- uint16_t char_count;
+ gU16 char_count;
/* The left and top skips of the characters in this range.
* This is the number of empty rows at left and at top. */
- uint8_t offset_x;
- uint8_t offset_y;
+ gU8 offset_x;
+ gU8 offset_y;
/* Column height for glyphs in this range, in bytes and pixels. */
- uint8_t height_bytes;
- uint8_t height_pixels;
+ gU8 height_bytes;
+ gU8 height_pixels;
/* Positive value if the width of all glyphs in this range is the
* same, or zero if it is not. */
- uint8_t width;
+ gU8 width;
/* Lookup table for the character widths. NULL if width is specified. */
- const uint8_t *glyph_widths;
+ const gU8 *glyph_widths;
/* Lookup table for the character offsets. Multiply by height_bytes
* to get the byte offset. Also allows lookup of the number of columns.
* NULL if width is specified. */
- const uint16_t *glyph_offsets;
+ const gU16 *glyph_offsets;
/* Table for the glyph data.
* The data for each glyph is column-by-column, with N bytes per each
* column. The LSB of the first byte is the top left pixel.
*/
- const uint8_t *glyph_data;
+ const gU8 *glyph_data;
};
/* Structure for the font */
@@ -60,10 +60,10 @@ struct mf_bwfont_s
struct mf_font_s font;
/* Version of the font format. */
- const uint8_t version;
+ const gU8 version;
/* Number of character ranges. */
- const uint16_t char_range_count;
+ const gU16 char_range_count;
/* Array of the character ranges */
const struct mf_bwfont_char_range_s *char_ranges;
@@ -71,14 +71,14 @@ struct mf_bwfont_s
#ifdef MF_BWFONT_INTERNALS
/* 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,
- uint16_t character,
+MF_EXTERN gU8 mf_bwfont_render_character(const struct mf_font_s *font,
+ gI16 x0, gI16 y0,
+ gU16 character,
mf_pixel_callback_t callback,
void *state);
-MF_EXTERN uint8_t mf_bwfont_character_width(const struct mf_font_s *font,
- uint16_t character);
+MF_EXTERN gU8 mf_bwfont_character_width(const struct mf_font_s *font,
+ gU16 character);
#endif
#endif
diff --git a/src/gdisp/mcufont/mf_encoding.c b/src/gdisp/mcufont/mf_encoding.c
index afa16b18..ba9fc7c0 100644
--- a/src/gdisp/mcufont/mf_encoding.c
+++ b/src/gdisp/mcufont/mf_encoding.c
@@ -13,9 +13,9 @@
mf_char mf_getchar(mf_str *str)
{
- uint8_t c;
- uint8_t tmp, seqlen;
- uint16_t result;
+ gU8 c;
+ gU8 tmp, seqlen;
+ gU16 result;
c = **str;
if (!c)
diff --git a/src/gdisp/mcufont/mf_encoding.h b/src/gdisp/mcufont/mf_encoding.h
index 18ffb892..7c49f02a 100644
--- a/src/gdisp/mcufont/mf_encoding.h
+++ b/src/gdisp/mcufont/mf_encoding.h
@@ -20,9 +20,9 @@
/* Type used to represent characters internally. */
#if MF_ENCODING == MF_ENCODING_ASCII
typedef char mf_char;
- #define MFCHAR2UINT16(c) ((uint16_t)(uint8_t)(c))
+ #define MFCHAR2UINT16(c) ((gU16)(gU8)(c))
#else
- typedef uint16_t mf_char;
+ typedef gU16 mf_char;
#define MFCHAR2UINT16(c) (c)
#endif
@@ -32,7 +32,7 @@ typedef const char * mf_str;
#elif MF_ENCODING == MF_ENCODING_UTF8
typedef const char * mf_str;
#elif MF_ENCODING == MF_ENCODING_UTF16
-typedef const uint16_t * mf_str;
+typedef const gU16 * mf_str;
#elif MF_ENCODING == MF_ENCODING_WCHAR
#include <stddef.h>
typedef const wchar_t * mf_str;
diff --git a/src/gdisp/mcufont/mf_font.c b/src/gdisp/mcufont/mf_font.c
index 9a313f8c..09182b56 100644
--- a/src/gdisp/mcufont/mf_font.c
+++ b/src/gdisp/mcufont/mf_font.c
@@ -26,13 +26,13 @@
#include MF_FONT_FILE_NAME
/* Include fonts end here */
-uint8_t mf_render_character(const struct mf_font_s *font,
- int16_t x0, int16_t y0,
+gU8 mf_render_character(const struct mf_font_s *font,
+ gI16 x0, gI16 y0,
mf_char character,
mf_pixel_callback_t callback,
void *state)
{
- uint8_t width;
+ gU8 width;
width = font->render_character(font, x0, y0, MFCHAR2UINT16(character), callback, state);
if (!width)
@@ -44,10 +44,10 @@ uint8_t mf_render_character(const struct mf_font_s *font,
return width;
}
-uint8_t mf_character_width(const struct mf_font_s *font,
+gU8 mf_character_width(const struct mf_font_s *font,
mf_char character)
{
- uint8_t width;
+ gU8 width;
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 1812d576..b69cc782 100644
--- a/src/gdisp/mcufont/mf_font.h
+++ b/src/gdisp/mcufont/mf_font.h
@@ -22,8 +22,8 @@
* alpha: The "opaqueness" of the pixels, 0 for background, 255 for text.
* state: Free variable that was passed to render_character().
*/
-typedef void (*mf_pixel_callback_t) (int16_t x, int16_t y, uint8_t count,
- uint8_t alpha, void *state);
+typedef void (*mf_pixel_callback_t) (gI16 x, gI16 y, gU8 count,
+ gU8 alpha, void *state);
/* General information about a font. */
struct mf_font_s
@@ -35,35 +35,35 @@ struct mf_font_s
const char *short_name;
/* Width and height of the character bounding box. */
- uint8_t width;
- uint8_t height;
+ gU8 width;
+ gU8 height;
/* Minimum and maximum tracking width of characters. */
- uint8_t min_x_advance;
- uint8_t max_x_advance;
+ gU8 min_x_advance;
+ gU8 max_x_advance;
/* Location of the text baseline relative to character. */
- int8_t baseline_x;
- uint8_t baseline_y;
+ gI8 baseline_x;
+ gU8 baseline_y;
/* Line height of the font (vertical advance). */
- uint8_t line_height;
+ gU8 line_height;
/* Flags identifying various aspects of the font. */
- uint8_t flags;
+ gU8 flags;
/* Fallback character to use for missing glyphs. */
- uint16_t fallback_character;
+ gU16 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, uint16_t character);
+ gU8 (*character_width)(const struct mf_font_s *font, gU16 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,
- uint16_t character,
+ gU8 (*render_character)(const struct mf_font_s *font,
+ gI16 x0, gI16 y0,
+ gU16 character,
mf_pixel_callback_t callback,
void *state);
};
@@ -90,8 +90,8 @@ struct mf_font_list_s
*
* Returns width of the character.
*/
-MF_EXTERN uint8_t mf_render_character(const struct mf_font_s *font,
- int16_t x0, int16_t y0,
+MF_EXTERN gU8 mf_render_character(const struct mf_font_s *font,
+ gI16 x0, gI16 y0,
mf_char character,
mf_pixel_callback_t callback,
void *state);
@@ -105,7 +105,7 @@ MF_EXTERN uint8_t mf_render_character(const struct mf_font_s *font,
*
* Returns width of the character in pixels.
*/
-MF_EXTERN uint8_t mf_character_width(const struct mf_font_s *font,
+MF_EXTERN gU8 mf_character_width(const struct mf_font_s *font,
mf_char character);
/* Find a font based on name. The name can be either short name or full name.
diff --git a/src/gdisp/mcufont/mf_justify.c b/src/gdisp/mcufont/mf_justify.c
index 5314ab45..58f87cc3 100644
--- a/src/gdisp/mcufont/mf_justify.c
+++ b/src/gdisp/mcufont/mf_justify.c
@@ -12,10 +12,10 @@
#if MF_USE_TABS
/* Round the X coordinate up to the nearest tab stop. */
-static int16_t mf_round_to_tab(const struct mf_font_s *font,
- int16_t x0, int16_t x)
+static gI16 mf_round_to_tab(const struct mf_font_s *font,
+ gI16 x0, gI16 x)
{
- int16_t tabw, dx;
+ gI16 tabw, dx;
tabw = mf_character_width(font, 'm') * MF_TABSIZE;
@@ -30,10 +30,10 @@ static int16_t mf_round_to_tab(const struct mf_font_s *font,
}
/* Round the X coordinate down to the nearest tab stop. */
-static int16_t mf_round_to_prev_tab(const struct mf_font_s *font,
- int16_t x0, int16_t x)
+static gI16 mf_round_to_prev_tab(const struct mf_font_s *font,
+ gI16 x0, gI16 x)
{
- int16_t tabw, dx;
+ gI16 tabw, dx;
tabw = mf_character_width(font, 'm') * MF_TABSIZE;
@@ -48,11 +48,11 @@ static int16_t mf_round_to_prev_tab(const struct mf_font_s *font,
}
#endif
-int16_t mf_get_string_width(const struct mf_font_s *font, mf_str text,
- uint16_t count, bool kern)
+gI16 mf_get_string_width(const struct mf_font_s *font, mf_str text,
+ gU16 count, bool kern)
{
- int16_t result = 0;
- uint16_t c1 = 0, c2;
+ gI16 result = 0;
+ gU16 c1 = 0, c2;
if (!count)
count = 0xFFFF;
@@ -83,9 +83,9 @@ int16_t mf_get_string_width(const struct mf_font_s *font, mf_str text,
}
/* Return the length of the string without trailing spaces. */
-static uint16_t strip_spaces(mf_str text, uint16_t count, mf_char *last_char)
+static gU16 strip_spaces(mf_str text, gU16 count, mf_char *last_char)
{
- uint16_t i = 0, result = 0;
+ gU16 i = 0, result = 0;
mf_char tmp = 0;
if (!count)
@@ -115,12 +115,12 @@ static uint16_t strip_spaces(mf_str text, uint16_t count, mf_char *last_char)
/* Render left-aligned string, left edge at x0. */
static void render_left(const struct mf_font_s *font,
- int16_t x0, int16_t y0,
- mf_str text, uint16_t count,
+ gI16 x0, gI16 y0,
+ mf_str text, gU16 count,
mf_character_callback_t callback,
void *state)
{
- int16_t x;
+ gI16 x;
mf_char c1 = 0, c2;
x = x0 - font->baseline_x;
@@ -150,13 +150,13 @@ static void render_left(const struct mf_font_s *font,
#if !MF_USE_ALIGN
void mf_render_aligned(const struct mf_font_s *font,
- int16_t x0, int16_t y0,
+ gI16 x0, gI16 y0,
enum mf_align_t align,
- mf_str text, uint16_t count,
+ mf_str text, gU16 count,
mf_character_callback_t callback,
void *state)
{
- int16_t string_width;
+ gI16 string_width;
count = strip_spaces(text, count, 0);
render_left(font, x0, y0, text, count, callback, state);
}
@@ -165,13 +165,13 @@ void mf_render_aligned(const struct mf_font_s *font,
/* Render right-aligned string, right edge at x0. */
static void render_right(const struct mf_font_s *font,
- int16_t x0, int16_t y0,
- mf_str text, uint16_t count,
+ gI16 x0, gI16 y0,
+ mf_str text, gU16 count,
mf_character_callback_t callback,
void *state)
{
- int16_t x;
- uint16_t i;
+ gI16 x;
+ gU16 i;
mf_char c1, c2 = 0;
mf_str tmp;
@@ -211,13 +211,13 @@ static void render_right(const struct mf_font_s *font,
}
void mf_render_aligned(const struct mf_font_s *font,
- int16_t x0, int16_t y0,
+ gI16 x0, gI16 y0,
enum mf_align_t align,
- mf_str text, uint16_t count,
+ mf_str text, gU16 count,
mf_character_callback_t callback,
void *state)
{
- int16_t string_width;
+ gI16 string_width;
count = strip_spaces(text, count, 0);
if (align == MF_ALIGN_LEFT)
@@ -242,8 +242,8 @@ void mf_render_aligned(const struct mf_font_s *font,
#if !MF_USE_JUSTIFY
void mf_render_justified(const struct mf_font_s *font,
- int16_t x0, int16_t y0, int16_t width,
- mf_str text, uint16_t count,
+ gI16 x0, gI16 y0, gI16 width,
+ mf_str text, gU16 count,
mf_character_callback_t callback,
void *state)
{
@@ -255,15 +255,15 @@ void mf_render_justified(const struct mf_font_s *font,
/* Returns true if the character is a justification point, i.e. expands
* when the text is being justified. */
-static bool is_justify_space(uint16_t c)
+static bool is_justify_space(gU16 c)
{
return c == ' ' || c == 0xA0;
}
/* Count the number of space characters in string */
-static uint16_t count_spaces(mf_str text, uint16_t count)
+static gU16 count_spaces(mf_str text, gU16 count)
{
- uint16_t spaces = 0;
+ gU16 spaces = 0;
while (count-- && *text)
{
if (is_justify_space(mf_getchar(&text)))
@@ -273,13 +273,13 @@ static uint16_t count_spaces(mf_str text, uint16_t count)
}
void mf_render_justified(const struct mf_font_s *font,
- int16_t x0, int16_t y0, int16_t width,
- mf_str text, uint16_t count,
+ gI16 x0, gI16 y0, gI16 width,
+ mf_str text, gU16 count,
mf_character_callback_t callback,
void *state)
{
- int16_t string_width, adjustment;
- uint16_t num_spaces;
+ gI16 string_width, adjustment;
+ gU16 num_spaces;
mf_char last_char;
count = strip_spaces(text, count, &last_char);
@@ -296,7 +296,7 @@ void mf_render_justified(const struct mf_font_s *font,
num_spaces = count_spaces(text, count);
{
- int16_t x, tmp;
+ gI16 x, tmp;
mf_char c1 = 0, c2;
x = x0 - font->baseline_x;
diff --git a/src/gdisp/mcufont/mf_justify.h b/src/gdisp/mcufont/mf_justify.h
index 3c7622fc..4e4eda9e 100644
--- a/src/gdisp/mcufont/mf_justify.h
+++ b/src/gdisp/mcufont/mf_justify.h
@@ -29,7 +29,7 @@ enum mf_align_t
* state: Free state variable for use by the callback.
* Returns the width of the character.
*/
-typedef uint8_t (*mf_character_callback_t) (int16_t x0, int16_t y0,
+typedef gU8 (*mf_character_callback_t) (gI16 x0, gI16 y0,
mf_char character, void *state);
/* Get width of a string in pixels.
@@ -39,8 +39,8 @@ typedef uint8_t (*mf_character_callback_t) (int16_t x0, int16_t y0,
* count: Number of characters on the line or 0 to read until end of string.
* kern: True to consider kerning (slower).
*/
-MF_EXTERN int16_t mf_get_string_width(const struct mf_font_s *font,
- mf_str text, uint16_t count, bool kern);
+MF_EXTERN gI16 mf_get_string_width(const struct mf_font_s *font,
+ mf_str text, gU16 count, bool kern);
/* Render a single line of aligned text.
*
@@ -54,9 +54,9 @@ MF_EXTERN int16_t mf_get_string_width(const struct mf_font_s *font,
* state: Free variable for use in the callback.
*/
MF_EXTERN void mf_render_aligned(const struct mf_font_s *font,
- int16_t x0, int16_t y0,
+ gI16 x0, gI16 y0,
enum mf_align_t align,
- mf_str text, uint16_t count,
+ mf_str text, gU16 count,
mf_character_callback_t callback,
void *state);
@@ -72,8 +72,8 @@ MF_EXTERN void mf_render_aligned(const struct mf_font_s *font,
* state: Free variable for use in the callback.
*/
MF_EXTERN void mf_render_justified(const struct mf_font_s *font,
- int16_t x0, int16_t y0, int16_t width,
- mf_str text, uint16_t count,
+ gI16 x0, gI16 y0, gI16 width,
+ mf_str text, gU16 count,
mf_character_callback_t callback,
void *state);
diff --git a/src/gdisp/mcufont/mf_kerning.c b/src/gdisp/mcufont/mf_kerning.c
index 5a5aa65b..1e29b6e2 100644
--- a/src/gdisp/mcufont/mf_kerning.c
+++ b/src/gdisp/mcufont/mf_kerning.c
@@ -16,12 +16,12 @@
/* Structure for keeping track of the edge of the glyph as it is rendered. */
struct kerning_state_s
{
- uint8_t edgepos[MF_KERNING_ZONES];
- uint8_t zoneheight;
+ gU8 edgepos[MF_KERNING_ZONES];
+ gU8 zoneheight;
};
/* Pixel callback for analyzing the left edge of a glyph. */
-static void fit_leftedge(int16_t x, int16_t y, uint8_t count, uint8_t alpha,
+static void fit_leftedge(gI16 x, gI16 y, gU8 count, gU8 alpha,
void *state)
{
struct kerning_state_s *s = state;
@@ -29,21 +29,21 @@ static void fit_leftedge(int16_t x, int16_t y, uint8_t count, uint8_t alpha,
if (alpha > 7)
{
- uint8_t zone = y / s->zoneheight;
+ gU8 zone = y / s->zoneheight;
if (x < s->edgepos[zone])
s->edgepos[zone] = x;
}
}
/* Pixel callback for analyzing the right edge of a glyph. */
-static void fit_rightedge(int16_t x, int16_t y, uint8_t count, uint8_t alpha,
+static void fit_rightedge(gI16 x, gI16 y, gU8 count, gU8 alpha,
void *state)
{
struct kerning_state_s *s = state;
if (alpha > 7)
{
- uint8_t zone = y / s->zoneheight;
+ gU8 zone = y / s->zoneheight;
x += count - 1;
if (x > s->edgepos[zone])
s->edgepos[zone] = x;
@@ -65,16 +65,16 @@ static bool do_kerning(mf_char c)
return true;
}
-//static int16_t min16(int16_t a, int16_t b) { return (a < b) ? a : b; }
-static int16_t max16(int16_t a, int16_t b) { return (a > b) ? a : b; }
-static int16_t avg16(int16_t a, int16_t b) { return (a + b) / 2; }
+//static gI16 min16(gI16 a, gI16 b) { return (a < b) ? a : b; }
+static gI16 max16(gI16 a, gI16 b) { return (a > b) ? a : b; }
+static gI16 avg16(gI16 a, gI16 b) { return (a + b) / 2; }
-int8_t mf_compute_kerning(const struct mf_font_s *font,
+gI8 mf_compute_kerning(const struct mf_font_s *font,
mf_char c1, mf_char c2)
{
struct kerning_state_s leftedge, rightedge;
- uint8_t w1, w2, i, min_space;
- int16_t normal_space, adjust, max_adjust;
+ gU8 w1, w2, i, min_space;
+ gI16 normal_space, adjust, max_adjust;
if (font->flags & MF_FONT_FLAG_MONOSPACE)
return 0; /* No kerning for monospace fonts */
@@ -102,7 +102,7 @@ int8_t mf_compute_kerning(const struct mf_font_s *font,
min_space = 255;
for (i = 0; i < MF_KERNING_ZONES; i++)
{
- uint8_t space;
+ gU8 space;
if (leftedge.edgepos[i] == 255 || rightedge.edgepos[i] == 0)
continue; /* Outside glyph area. */
diff --git a/src/gdisp/mcufont/mf_kerning.h b/src/gdisp/mcufont/mf_kerning.h
index 844d99c3..c6c2dcc7 100644
--- a/src/gdisp/mcufont/mf_kerning.h
+++ b/src/gdisp/mcufont/mf_kerning.h
@@ -25,7 +25,7 @@
* Returns the offset to add to the x position for c2.
*/
#if MF_USE_KERNING
-MF_EXTERN int8_t mf_compute_kerning(const struct mf_font_s *font,
+MF_EXTERN gI8 mf_compute_kerning(const struct mf_font_s *font,
mf_char c1, mf_char c2);
#else
#define mf_compute_kerning(font, c1, c2) 0
diff --git a/src/gdisp/mcufont/mf_rlefont.c b/src/gdisp/mcufont/mf_rlefont.c
index db217425..1da265c3 100644
--- a/src/gdisp/mcufont/mf_rlefont.c
+++ b/src/gdisp/mcufont/mf_rlefont.c
@@ -35,8 +35,8 @@
* through the character ranges. If the character is not found, return
* pointer to the default glyph.
*/
-static const uint8_t *find_glyph(const struct mf_rlefont_s *font,
- uint16_t character)
+static const gU8 *find_glyph(const struct mf_rlefont_s *font,
+ gU16 character)
{
unsigned i, index;
const struct mf_rlefont_char_range_s *range;
@@ -58,21 +58,21 @@ static const uint8_t *find_glyph(const struct mf_rlefont_s *font,
* and also the bounds of the character. */
struct renderstate_r
{
- int16_t x_begin;
- int16_t x_end;
- int16_t x;
- int16_t y;
- int16_t y_end;
+ gI16 x_begin;
+ gI16 x_end;
+ gI16 x;
+ gI16 y;
+ gI16 y_end;
mf_pixel_callback_t callback;
void *state;
};
/* Call the callback to write one pixel to screen, and advance to next
* pixel position. */
-static void write_pixels(struct renderstate_r *rstate, uint16_t count,
- uint8_t alpha)
+static void write_pixels(struct renderstate_r *rstate, gU16 count,
+ gU8 alpha)
{
- uint8_t rowlen;
+ gU8 rowlen;
/* Write row-by-row if the run spans multiple rows. */
while (rstate->x + count >= rstate->x_end)
@@ -93,7 +93,7 @@ static void write_pixels(struct renderstate_r *rstate, uint16_t count,
}
/* Skip the given number of pixels (0 alpha) */
-static void skip_pixels(struct renderstate_r *rstate, uint16_t count)
+static void skip_pixels(struct renderstate_r *rstate, gU16 count)
{
rstate->x += count;
while (rstate->x >= rstate->x_end)
@@ -106,15 +106,15 @@ static void skip_pixels(struct renderstate_r *rstate, uint16_t count)
/* Decode and write out a RLE-encoded dictionary entry. */
static void write_rle_dictentry(const struct mf_rlefont_s *font,
struct renderstate_r *rstate,
- uint8_t index)
+ gU8 index)
{
- uint16_t offset = font->dictionary_offsets[index];
- uint16_t length = font->dictionary_offsets[index + 1] - offset;
- uint16_t i;
+ gU16 offset = font->dictionary_offsets[index];
+ gU16 length = font->dictionary_offsets[index + 1] - offset;
+ gU16 i;
for (i = 0; i < length; i++)
{
- uint8_t code = font->dictionary_data[offset + i];
+ gU8 code = font->dictionary_data[offset + i];
if ((code & RLE_CODEMASK) == RLE_ZEROS)
{
skip_pixels(rstate, code & RLE_VALMASK);
@@ -129,7 +129,7 @@ static void write_rle_dictentry(const struct mf_rlefont_s *font,
}
else if ((code & RLE_CODEMASK) == RLE_SHADE)
{
- uint8_t count, alpha;
+ gU8 count, alpha;
count = ((code & RLE_VALMASK) >> 4) + 1;
alpha = ((code & RLE_VALMASK) & 0xF) * 0x11;
write_pixels(rstate, count, alpha);
@@ -138,7 +138,7 @@ static void write_rle_dictentry(const struct mf_rlefont_s *font,
}
/* Get bit count for the "fill entries" */
-static uint8_t fillentry_bitcount(uint8_t index)
+static gU8 fillentry_bitcount(gU8 index)
{
if (index >= DICT_START2BIT)
return 2;
@@ -157,11 +157,11 @@ static uint8_t fillentry_bitcount(uint8_t index)
/* Decode and write out a direct binary codeword */
static void write_bin_codeword(const struct mf_rlefont_s *font,
struct renderstate_r *rstate,
- uint8_t code)
+ gU8 code)
{
- uint8_t bitcount = fillentry_bitcount(code);
- uint8_t byte = code - DICT_START7BIT;
- uint8_t runlen = 0;
+ gU8 bitcount = fillentry_bitcount(code);
+ gU8 byte = code - DICT_START7BIT;
+ gU8 runlen = 0;
(void) font;
while (bitcount--)
@@ -191,7 +191,7 @@ static void write_bin_codeword(const struct mf_rlefont_s *font,
/* Decode and write out a reference codeword */
static void write_ref_codeword(const struct mf_rlefont_s *font,
struct renderstate_r *rstate,
- uint8_t code)
+ gU8 code)
{
if (code <= 15)
{
@@ -219,15 +219,15 @@ static void write_ref_codeword(const struct mf_rlefont_s *font,
/* Decode and write out a reference encoded dictionary entry. */
static void write_ref_dictentry(const struct mf_rlefont_s *font,
struct renderstate_r *rstate,
- uint8_t index)
+ gU8 index)
{
- uint16_t offset = font->dictionary_offsets[index];
- uint16_t length = font->dictionary_offsets[index + 1] - offset;
- uint16_t i;
+ gU16 offset = font->dictionary_offsets[index];
+ gU16 length = font->dictionary_offsets[index + 1] - offset;
+ gU16 i;
for (i = 0; i < length; i++)
{
- uint8_t code = font->dictionary_data[offset + i];
+ gU8 code = font->dictionary_data[offset + i];
write_ref_codeword(font, rstate, code);
}
}
@@ -235,7 +235,7 @@ static void write_ref_dictentry(const struct mf_rlefont_s *font,
/* Decode and write out an arbitrary glyph codeword */
static void write_glyph_codeword(const struct mf_rlefont_s *font,
struct renderstate_r *rstate,
- uint8_t code)
+ gU8 code)
{
if (code >= DICT_START + font->rle_entry_count &&
code < DICT_START + font->dict_entry_count)
@@ -249,14 +249,14 @@ static void write_glyph_codeword(const struct mf_rlefont_s *font,
}
-uint8_t mf_rlefont_render_character(const struct mf_font_s *font,
- int16_t x0, int16_t y0,
- uint16_t character,
+gU8 mf_rlefont_render_character(const struct mf_font_s *font,
+ gI16 x0, gI16 y0,
+ gU16 character,
mf_pixel_callback_t callback,
void *state)
{
- const uint8_t *p;
- uint8_t width;
+ const gU8 *p;
+ gU8 width;
struct renderstate_r rstate;
rstate.x_begin = x0;
@@ -280,10 +280,10 @@ uint8_t mf_rlefont_render_character(const struct mf_font_s *font,
return width;
}
-uint8_t mf_rlefont_character_width(const struct mf_font_s *font,
- uint16_t character)
+gU8 mf_rlefont_character_width(const struct mf_font_s *font,
+ gU16 character)
{
- const uint8_t *p;
+ const gU8 *p;
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 8978f2a3..be21fe88 100644
--- a/src/gdisp/mcufont/mf_rlefont.h
+++ b/src/gdisp/mcufont/mf_rlefont.h
@@ -23,16 +23,16 @@
struct mf_rlefont_char_range_s
{
/* The number of the first character in this range. */
- uint16_t first_char;
+ gU16 first_char;
/* The total count of characters in this range. */
- uint16_t char_count;
+ gU16 char_count;
/* Lookup table with the start indices into glyph_data. */
- const uint16_t *glyph_offsets;
+ const gU16 *glyph_offsets;
/* The encoded glyph data for glyphs in this range. */
- const uint8_t *glyph_data;
+ const gU8 *glyph_data;
};
/* Structure for a single encoded font. */
@@ -41,26 +41,26 @@ struct mf_rlefont_s
struct mf_font_s font;
/* Version of the font definition used. */
- const uint8_t version;
+ const gU8 version;
/* Big array of the data for all the dictionary entries. */
- const uint8_t *dictionary_data;
+ const gU8 *dictionary_data;
/* Lookup table with the start indices into dictionary_data.
* Contains N+1 entries, so that the length of the entry can
* be determined by subtracting from the next offset. */
- const uint16_t *dictionary_offsets;
+ const gU16 *dictionary_offsets;
/* Number of dictionary entries using the RLE encoding.
* Entries starting at this index use the dictionary encoding. */
- const uint8_t rle_entry_count;
+ const gU8 rle_entry_count;
/* Total number of dictionary entries.
* Entries after this are nonexistent. */
- const uint8_t dict_entry_count;
+ const gU8 dict_entry_count;
/* Number of discontinuous character ranges */
- const uint16_t char_range_count;
+ const gU16 char_range_count;
/* Array of the character ranges */
const struct mf_rlefont_char_range_s *char_ranges;
@@ -68,14 +68,14 @@ struct mf_rlefont_s
#ifdef MF_RLEFONT_INTERNALS
/* 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,
- uint16_t character,
+MF_EXTERN gU8 mf_rlefont_render_character(const struct mf_font_s *font,
+ gI16 x0, gI16 y0,
+ gU16 character,
mf_pixel_callback_t callback,
void *state);
-MF_EXTERN uint8_t mf_rlefont_character_width(const struct mf_font_s *font,
- uint16_t character);
+MF_EXTERN gU8 mf_rlefont_character_width(const struct mf_font_s *font,
+ gU16 character);
#endif
#endif
diff --git a/src/gdisp/mcufont/mf_scaledfont.c b/src/gdisp/mcufont/mf_scaledfont.c
index b3c70a7f..9e0903cc 100644
--- a/src/gdisp/mcufont/mf_scaledfont.c
+++ b/src/gdisp/mcufont/mf_scaledfont.c
@@ -13,17 +13,17 @@ struct scaled_renderstate
{
mf_pixel_callback_t orig_callback;
void *orig_state;
- uint8_t x_scale;
- uint8_t y_scale;
- int16_t x0;
- int16_t y0;
+ gU8 x_scale;
+ gU8 y_scale;
+ gI16 x0;
+ gI16 y0;
};
-static void scaled_pixel_callback(int16_t x, int16_t y, uint8_t count,
- uint8_t alpha, void *state)
+static void scaled_pixel_callback(gI16 x, gI16 y, gU8 count,
+ gU8 alpha, void *state)
{
struct scaled_renderstate *rstate = state;
- uint8_t dy;
+ gU8 dy;
count *= rstate->x_scale;
x = rstate->x0 + x * rstate->x_scale;
@@ -35,26 +35,26 @@ 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,
- uint16_t character)
+gU8 mf_scaled_character_width(const struct mf_font_s *font,
+ gU16 character)
{
struct mf_scaledfont_s *sfont = (struct mf_scaledfont_s*)font;
- uint8_t basewidth;
+ gU8 basewidth;
basewidth = sfont->basefont->character_width(sfont->basefont, character);
return sfont->x_scale * basewidth;
}
-uint8_t mf_scaled_render_character(const struct mf_font_s *font,
- int16_t x0, int16_t y0,
- uint16_t character,
+gU8 mf_scaled_render_character(const struct mf_font_s *font,
+ gI16 x0, gI16 y0,
+ gU16 character,
mf_pixel_callback_t callback,
void *state)
{
struct mf_scaledfont_s *sfont = (struct mf_scaledfont_s*)font;
struct scaled_renderstate rstate;
- uint8_t basewidth;
+ gU8 basewidth;
rstate.orig_callback = callback;
rstate.orig_state = state;
@@ -71,7 +71,7 @@ uint8_t mf_scaled_render_character(const struct mf_font_s *font,
void mf_scale_font(struct mf_scaledfont_s *newfont,
const struct mf_font_s *basefont,
- uint8_t x_scale, uint8_t y_scale)
+ gU8 x_scale, gU8 y_scale)
{
newfont->font = *basefont;
newfont->basefont = basefont;
diff --git a/src/gdisp/mcufont/mf_scaledfont.h b/src/gdisp/mcufont/mf_scaledfont.h
index c82c2093..da9f47aa 100644
--- a/src/gdisp/mcufont/mf_scaledfont.h
+++ b/src/gdisp/mcufont/mf_scaledfont.h
@@ -19,24 +19,24 @@ struct mf_scaledfont_s
struct mf_font_s font;
const struct mf_font_s *basefont;
- uint8_t x_scale;
- uint8_t y_scale;
+ gU8 x_scale;
+ gU8 y_scale;
};
MF_EXTERN void mf_scale_font(struct mf_scaledfont_s *newfont,
const struct mf_font_s *basefont,
- uint8_t x_scale, uint8_t y_scale);
+ gU8 x_scale, gU8 y_scale);
#ifdef MF_SCALEDFONT_INTERNALS
/* 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,
- uint16_t character,
+MF_EXTERN gU8 mf_scaled_render_character(const struct mf_font_s *font,
+ gI16 x0, gI16 y0,
+ gU16 character,
mf_pixel_callback_t callback,
void *state);
-MF_EXTERN uint8_t mf_scaled_character_width(const struct mf_font_s *font,
- uint16_t character);
+MF_EXTERN gU8 mf_scaled_character_width(const struct mf_font_s *font,
+ gU16 character);
#endif
#endif
diff --git a/src/gdisp/mcufont/mf_wordwrap.c b/src/gdisp/mcufont/mf_wordwrap.c
index 06101b32..0b303ace 100644
--- a/src/gdisp/mcufont/mf_wordwrap.c
+++ b/src/gdisp/mcufont/mf_wordwrap.c
@@ -10,7 +10,7 @@
#ifndef MF_NO_COMPILE
/* Returns true if the line can be broken at this character. */
-static bool is_wrap_space(uint16_t c)
+static bool is_wrap_space(gU16 c)
{
return c == ' ' || c == '\n' || c == '\t' || c == '\r' || c == '-';
}
@@ -20,9 +20,9 @@ static bool is_wrap_space(uint16_t c)
/* Represents a single word and the whitespace after it. */
struct wordlen_s
{
- int16_t word; /* Length of the word in pixels. */
- int16_t space; /* Length of the whitespace in pixels. */
- uint16_t chars; /* Number of characters in word + space, combined. */
+ gI16 word; /* Length of the word in pixels. */
+ gI16 space; /* Length of the whitespace in pixels. */
+ gU16 chars; /* Number of characters in word + space, combined. */
};
/* Take the next word from the string and compute its width.
@@ -76,8 +76,8 @@ static bool get_wordlen(const struct mf_font_s *font, mf_str *text,
struct linelen_s
{
mf_str start; /* Start of the text for line. */
- uint16_t chars; /* Total number of characters on the line. */
- int16_t width; /* Total length of all words + whitespace on the line in pixels. */
+ gU16 chars; /* Total number of characters on the line. */
+ gI16 width; /* Total length of all words + whitespace on the line in pixels. */
bool linebreak; /* True if line ends in a linebreak */
struct wordlen_s last_word; /* Last word on the line. */
struct wordlen_s last_word_2; /* Second to last word on the line. */
@@ -85,7 +85,7 @@ struct linelen_s
/* Append word onto the line if it fits. If it would overflow, don't add and
* return false. */
-static bool append_word(const struct mf_font_s *font, int16_t width,
+static bool append_word(const struct mf_font_s *font, gI16 width,
struct linelen_s *current, mf_str *text)
{
mf_str tmp = *text;
@@ -111,12 +111,12 @@ static bool append_word(const struct mf_font_s *font, int16_t width,
}
/* Append a character to the line if it fits. */
-static bool append_char(const struct mf_font_s *font, int16_t width,
+static bool append_char(const struct mf_font_s *font, gI16 width,
struct linelen_s *current, mf_str *text)
{
mf_str tmp = *text;
mf_char c;
- uint16_t w;
+ gU16 w;
c = mf_getchar(&tmp);
w = mf_character_width(font, c);
@@ -134,16 +134,16 @@ static bool append_char(const struct mf_font_s *font, int16_t width,
}
}
-static int32_t sq16(int16_t x) { return (int32_t)x * x; }
+static gI32 sq16(gI16 x) { return (gI32)x * x; }
/* Try to balance the lines by potentially moving one word from the previous
* line to the the current one. */
static void tune_lines(struct linelen_s *current, struct linelen_s *previous,
- int16_t max_width)
+ gI16 max_width)
{
- int16_t curw1, prevw1;
- int16_t curw2, prevw2;
- int32_t delta1, delta2;
+ gI16 curw1, prevw1;
+ gI16 curw2, prevw2;
+ gI32 delta1, delta2;
/* If the lines are rendered as is */
curw1 = current->width - current->last_word.space;
@@ -160,7 +160,7 @@ static void tune_lines(struct linelen_s *current, struct linelen_s *previous,
if (delta1 > delta2 && curw2 <= max_width)
{
/* Do the change. */
- uint16_t chars;
+ gU16 chars;
chars = previous->last_word.chars;
previous->chars -= chars;
@@ -173,13 +173,13 @@ static void tune_lines(struct linelen_s *current, struct linelen_s *previous,
}
}
-void mf_wordwrap(const struct mf_font_s *font, int16_t width,
+void mf_wordwrap(const struct mf_font_s *font, gI16 width,
mf_str text, mf_line_callback_t callback, void *state)
{
struct linelen_s current = { 0 };
struct linelen_s previous = { 0 };
bool full;
- uint32_t giveUp = 2048; /* Do while-loop a maximum of x times */
+ gU32 giveUp = 2048; /* Do while-loop a maximum of x times */
current.start = text;
@@ -236,16 +236,16 @@ void mf_wordwrap(const struct mf_font_s *font, int16_t width,
#else
-void mf_wordwrap(const struct mf_font_s *font, int16_t width,
+void mf_wordwrap(const struct mf_font_s *font, gI16 width,
mf_str text, mf_line_callback_t callback, void *state)
{
mf_str linestart;
/* Current line width and character count */
- int16_t lw_cur = 0, cc_cur = 0;
+ gI16 lw_cur = 0, cc_cur = 0;
/* Previous wrap point */
- int16_t cc_prev;
+ gI16 cc_prev;
mf_str ls_prev;
linestart = text;
@@ -258,7 +258,7 @@ void mf_wordwrap(const struct mf_font_s *font, int16_t width,
while (*text)
{
mf_char c;
- int16_t new_width;
+ gI16 new_width;
mf_str tmp;
tmp = text;
diff --git a/src/gdisp/mcufont/mf_wordwrap.h b/src/gdisp/mcufont/mf_wordwrap.h
index a1a051fa..91ac8cad 100644
--- a/src/gdisp/mcufont/mf_wordwrap.h
+++ b/src/gdisp/mcufont/mf_wordwrap.h
@@ -23,7 +23,7 @@
*
* Returns: true to continue, false to stop after this line.
*/
-typedef bool (*mf_line_callback_t) (mf_str line, uint16_t count,
+typedef bool (*mf_line_callback_t) (mf_str line, gU16 count,
void *state);
/* Word wrap a piece of text. Calls the callback function for each line.
@@ -33,7 +33,7 @@ typedef bool (*mf_line_callback_t) (mf_str line, uint16_t count,
* text: Pointer to the start of the text to process.
* state: Free variable for caller to use (can be NULL).
*/
-MF_EXTERN void mf_wordwrap(const struct mf_font_s *font, int16_t width,
+MF_EXTERN void mf_wordwrap(const struct mf_font_s *font, gI16 width,
mf_str text, mf_line_callback_t callback, void *state);
#endif