Fonts improvement on 9XR-PRO / Sky9x
|
@ -51,7 +51,87 @@ uint8_t lcdLastPos;
|
|||
uint8_t lcdNextPos;
|
||||
|
||||
#if defined(CPUARM)
|
||||
void lcdPutPattern(xcoord_t x, uint8_t y, const uint8_t * pattern, uint8_t width, uint8_t height, LcdFlags flags);
|
||||
void lcdPutPattern(xcoord_t x, uint8_t y, const uint8_t * pattern, uint8_t width, uint8_t height, LcdFlags flags)
|
||||
{
|
||||
bool blink = false;
|
||||
bool inv = false;
|
||||
if (flags & BLINK) {
|
||||
if (BLINK_ON_PHASE) {
|
||||
if (flags & INVERS)
|
||||
inv = true;
|
||||
else {
|
||||
blink = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (flags & INVERS) {
|
||||
inv = true;
|
||||
}
|
||||
|
||||
uint8_t lines = (height+7)/8;
|
||||
assert(lines <= 5);
|
||||
|
||||
for (int8_t i=0; i<width+2; i++) {
|
||||
if (x<LCD_W) {
|
||||
uint8_t b[5] = { 0 };
|
||||
if (i==0) {
|
||||
if (x==0 || !inv) {
|
||||
lcdNextPos++;
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
// we need to work on the previous x when INVERS
|
||||
x--;
|
||||
}
|
||||
}
|
||||
else if (i<=width) {
|
||||
uint8_t skip = true;
|
||||
for (uint8_t j=0; j<lines; j++) {
|
||||
b[j] = pgm_read_byte(pattern++); /*top byte*/
|
||||
if (b[j] != 0xff) {
|
||||
skip = false;
|
||||
}
|
||||
}
|
||||
if (skip) {
|
||||
if (flags & FIXEDWIDTH) {
|
||||
for (uint8_t j=0; j<lines; j++) {
|
||||
b[j] = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((flags & CONDENSED) && i==2) {
|
||||
/*condense the letter by skipping column 3 */
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
for (int8_t j=-1; j<=height; j++) {
|
||||
bool plot;
|
||||
if (j < 0 || j == height) {
|
||||
plot = false;
|
||||
if (height >= 12) continue;
|
||||
if (j<0 && !inv) continue;
|
||||
}
|
||||
else {
|
||||
uint8_t line = (j / 8);
|
||||
uint8_t pixel = (j % 8);
|
||||
plot = b[line] & (1 << pixel);
|
||||
}
|
||||
if (inv) plot = !plot;
|
||||
if (!blink) {
|
||||
lcd_plot(x, y+j, plot ? FORCE : ERASE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
x++;
|
||||
lcdNextPos++;
|
||||
}
|
||||
}
|
||||
|
||||
void lcd_putcAtt(xcoord_t x, uint8_t y, const unsigned char c, LcdFlags flags)
|
||||
{
|
||||
#if !defined(BOOT)
|
||||
|
@ -94,7 +174,7 @@ void lcd_putcAtt(xcoord_t x, uint8_t y, const unsigned char c, LcdFlags flags)
|
|||
}
|
||||
else if (flags & MIDSIZE) {
|
||||
q = &font_8x10[((uint16_t)c-0x20)*16];
|
||||
lcdPutPattern(x, y, q, 8, 11, flags);
|
||||
lcdPutPattern(x, y, q, 8, 12, flags);
|
||||
}
|
||||
else if (flags & SMLSIZE) {
|
||||
q = (c < 0xc0 ? &font_4x6[(c-0x20)*5] : &font_4x6_extra[(c-0xc0)*5]);
|
||||
|
|
|
@ -38,110 +38,7 @@
|
|||
|
||||
#define LCD_BYTE_FILTER(p, keep, add) *(p) = (*(p) & (keep)) | (add)
|
||||
|
||||
#if defined(CPUARM)
|
||||
void lcdPutPattern(xcoord_t x, uint8_t y, const uint8_t * pattern, uint8_t width, uint8_t height, LcdFlags flags)
|
||||
{
|
||||
uint8_t *p = &displayBuf[ y / 8 * LCD_W + x ];
|
||||
uint8_t *end = &displayBuf[ y / 8 * LCD_W + LCD_W ];
|
||||
|
||||
bool blink = false;
|
||||
bool inv = false;
|
||||
if (flags & BLINK) {
|
||||
if (BLINK_ON_PHASE) {
|
||||
if (flags & INVERS)
|
||||
inv = true;
|
||||
else {
|
||||
blink = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (flags & INVERS) {
|
||||
inv = true;
|
||||
}
|
||||
|
||||
uint8_t lines = (height+7)/8;
|
||||
assert(lines <= 5);
|
||||
|
||||
for (int8_t i=0; i<width+2; i++) {
|
||||
if (p<end) {
|
||||
uint8_t b[5] = { 0 };
|
||||
if (i==0) {
|
||||
if (x==0 || !inv) {
|
||||
lcdNextPos++;
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
// we need to work on the previous byte when INVERS
|
||||
p--;
|
||||
}
|
||||
}
|
||||
else if (i<=width) {
|
||||
uint8_t skip = true;
|
||||
for (uint8_t j=0; j<lines; j++) {
|
||||
b[j] = pgm_read_byte(pattern++); /*top byte*/
|
||||
if (b[j] != 0xff) {
|
||||
skip = false;
|
||||
}
|
||||
}
|
||||
if (skip) {
|
||||
if (flags & FIXEDWIDTH) {
|
||||
for (uint8_t j=0; j<lines; j++) {
|
||||
b[j] = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if ((flags & CONDENSED) && i==2) {
|
||||
/*condense the letter by skipping column 3 */
|
||||
continue;
|
||||
}
|
||||
}
|
||||
const uint8_t ym8 = (y & 0x07);
|
||||
const uint8_t keepref = (1 << ((height&0x07)+1)) - 1;
|
||||
uint8_t * dest = p;
|
||||
for (uint8_t j=0; j<lines+1; j++) {
|
||||
if (dest < DISPLAY_END) {
|
||||
uint8_t b1=0, b2=0, keep=0;
|
||||
if (j>0) {
|
||||
b1 = b[j-1] >> (8-ym8);
|
||||
}
|
||||
else {
|
||||
keep = ~(keepref << ym8);
|
||||
}
|
||||
if (j<lines) {
|
||||
if (inv) {
|
||||
b[j] = ~b[j];
|
||||
}
|
||||
b2 = b[j] << ym8;
|
||||
}
|
||||
else {
|
||||
keep = ~(keepref >> (8-ym8));
|
||||
}
|
||||
if (!blink) {
|
||||
LCD_BYTE_FILTER(dest, keep, b1|b2);
|
||||
}
|
||||
dest += LCD_W;
|
||||
}
|
||||
}
|
||||
|
||||
if (inv && height<8) {
|
||||
if (ym8) {
|
||||
lcd_mask(p, 0x01 << (ym8-1), FORCE);
|
||||
}
|
||||
else if (y) {
|
||||
ASSERT_IN_DISPLAY(p - LCD_W);
|
||||
lcd_mask(p - LCD_W, 0x80, FORCE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
p++;
|
||||
lcdNextPos++;
|
||||
}
|
||||
}
|
||||
#else
|
||||
#if !defined(CPUARM)
|
||||
void lcd_putcAtt(xcoord_t x, uint8_t y, const unsigned char c, LcdFlags flags)
|
||||
{
|
||||
uint8_t *p = &displayBuf[ y / 8 * LCD_W + x ];
|
||||
|
|
BIN
radio/src/tests/dblsize_128x64.png
Executable file
After Width: | Height: | Size: 513 B |
BIN
radio/src/tests/dblsize_212x64.png
Normal file
After Width: | Height: | Size: 558 B |
|
@ -191,3 +191,36 @@ TEST(Lcd, vline)
|
|||
}
|
||||
EXPECT_TRUE(checkScreenshot("vline"));
|
||||
}
|
||||
|
||||
TEST(Lcd, Stdsize)
|
||||
{
|
||||
lcd_clear();
|
||||
lcd_putsAtt(0, 0, "TEST", 0);
|
||||
lcd_putsAtt(10, 22, "TEST", INVERS);
|
||||
lcd_filled_rect(8, 40, 100, 20);
|
||||
lcd_putsAtt(10, 42, "TEST", 0);
|
||||
EXPECT_TRUE(checkScreenshot("stdsize"));
|
||||
}
|
||||
|
||||
#if defined(CPUARM)
|
||||
TEST(Lcd, Midsize)
|
||||
{
|
||||
lcd_clear();
|
||||
lcd_putsAtt(0, 0, "TEST", MIDSIZE);
|
||||
lcd_putsAtt(10, 22, "TEST", MIDSIZE|INVERS);
|
||||
lcd_filled_rect(8, 40, 100, 20);
|
||||
lcd_putsAtt(10, 42, "TEST", MIDSIZE);
|
||||
EXPECT_TRUE(checkScreenshot("midsize"));
|
||||
}
|
||||
|
||||
TEST(Lcd, Dblsize)
|
||||
{
|
||||
lcd_clear();
|
||||
lcd_putsAtt(2, 10, "TST", DBLSIZE);
|
||||
lcd_putsAtt(42, 10, "TST", DBLSIZE|INVERS);
|
||||
lcd_filled_rect(80, 8, 46, 24);
|
||||
lcd_putsAtt(82, 10, "TST", DBLSIZE);
|
||||
EXPECT_TRUE(checkScreenshot("dblsize"));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
BIN
radio/src/tests/midsize_128x64.png
Executable file
After Width: | Height: | Size: 503 B |
BIN
radio/src/tests/midsize_212x64.png
Normal file
After Width: | Height: | Size: 532 B |
Before Width: | Height: | Size: 387 B After Width: | Height: | Size: 389 B |
BIN
radio/src/tests/stdsize_128x64.png
Normal file
After Width: | Height: | Size: 483 B |
BIN
radio/src/tests/stdsize_212x64.png
Normal file
After Width: | Height: | Size: 507 B |