video: Use fractional units for X coordinates

With anti-aliased fonts we need a more fine-grained horizontal position
than a single pixel. Characters can be positioned to start part-way through
a pixel, with anti-aliasing (greyscale edges) taking care of the visual
effect.

To cope with this, use fractional units (1/256 pixel) for horizontal
positions in the text console.

Signed-off-by: Simon Glass <sjg@chromium.org>
[agust: rebased]
Signed-off-by: Anatolij Gustschin <agust@denx.de>
This commit is contained in:
Simon Glass
2016-01-14 18:10:37 -07:00
committed by Anatolij Gustschin
parent 6e42e25196
commit f266178698
5 changed files with 137 additions and 53 deletions

View File

@@ -106,14 +106,14 @@ static int dm_test_video_text(struct unit_test_state *uts)
ut_asserteq(46, compress_frame_buffer(dev));
for (i = 0; i < 20; i++)
vidconsole_putc_xy(con, i * 8, 0, ' ' + i);
vidconsole_putc_xy(con, VID_TO_POS(i * 8), 0, ' ' + i);
ut_asserteq(273, compress_frame_buffer(dev));
vidconsole_set_row(con, 0, WHITE);
ut_asserteq(46, compress_frame_buffer(dev));
for (i = 0; i < 20; i++)
vidconsole_putc_xy(con, i * 8, 0, ' ' + i);
vidconsole_putc_xy(con, VID_TO_POS(i * 8), 0, ' ' + i);
ut_asserteq(273, compress_frame_buffer(dev));
return 0;