int fill_char_vertically(uchar *pfont, void **line, struct video_priv *vid_priv,
bool direction)
{
- int step, line_step, pbytes, ret;
+ int step, line_step, pbytes, bitcount, width_remainder, ret;
void *dst;
ret = check_bpix_support(vid_priv->bpix);
line_step = vid_priv->line_length;
}
+ width_remainder = VIDEO_FONT_WIDTH % 8;
for (int row = 0; row < VIDEO_FONT_HEIGHT; row++) {
+ uchar bits;
+
+ bitcount = 8;
dst = *line;
- uchar bits = pfont[row];
-
- for (int i = 0; i < VIDEO_FONT_WIDTH; i++) {
- u32 value = (bits & 0x80) ?
- vid_priv->colour_fg :
- vid_priv->colour_bg;
-
- fill_pixel_and_goto_next(&dst,
- value,
- pbytes,
- step
- );
- bits <<= 1;
+ for (int col = 0; col < VIDEO_FONT_BYTE_WIDTH; col++) {
+ if (width_remainder) {
+ bool is_last_iteration = (VIDEO_FONT_BYTE_WIDTH - col == 1);
+
+ if (is_last_iteration)
+ bitcount = width_remainder;
+ }
+ bits = pfont[col];
+
+ for (int bit = 0; bit < bitcount; bit++) {
+ u32 value = (bits & 0x80) ?
+ vid_priv->colour_fg :
+ vid_priv->colour_bg;
+
+ fill_pixel_and_goto_next(&dst,
+ value,
+ pbytes,
+ step
+ );
+ bits <<= 1;
+ }
}
*line += line_step;
+ pfont += VIDEO_FONT_BYTE_WIDTH;
}
return ret;
}
int fill_char_horizontally(uchar *pfont, void **line, struct video_priv *vid_priv,
bool direction)
{
- int step, line_step, pbytes, ret;
+ int step, line_step, pbytes, bitcount = 8, width_remainder, ret;
void *dst;
- u8 mask = 0x80;
+ u8 mask;
ret = check_bpix_support(vid_priv->bpix);
if (ret)
step = pbytes;
line_step = -vid_priv->line_length;
}
- for (int col = 0; col < VIDEO_FONT_WIDTH; col++) {
- dst = *line;
- for (int row = 0; row < VIDEO_FONT_HEIGHT; row++) {
- u32 value = (pfont[row * VIDEO_FONT_BYTE_WIDTH] & mask) ?
- vid_priv->colour_fg :
- vid_priv->colour_bg;
-
- fill_pixel_and_goto_next(&dst,
- value,
- pbytes,
- step
- );
+
+ width_remainder = VIDEO_FONT_WIDTH % 8;
+ for (int col = 0; col < VIDEO_FONT_BYTE_WIDTH; col++) {
+ mask = 0x80;
+ if (width_remainder) {
+ bool is_last_iteration = (VIDEO_FONT_BYTE_WIDTH - col == 1);
+
+ if (is_last_iteration)
+ bitcount = width_remainder;
+ }
+ for (int bit = 0; bit < bitcount; bit++) {
+ dst = *line;
+ for (int row = 0; row < VIDEO_FONT_HEIGHT; row++) {
+ u32 value = (pfont[row * VIDEO_FONT_BYTE_WIDTH] & mask) ?
+ vid_priv->colour_fg :
+ vid_priv->colour_bg;
+
+ fill_pixel_and_goto_next(&dst,
+ value,
+ pbytes,
+ step
+ );
+ }
+ *line += line_step;
+ mask >>= 1;
}
- *line += line_step;
- mask >>= 1;
}
return ret;
}
int pbytes = VNBYTES(vid_priv->bpix);
int x, linenum, ret;
void *start, *line;
- uchar *pfont = video_fontdata + (u8)ch * VIDEO_FONT_HEIGHT;
+ uchar *pfont = video_fontdata + (u8)ch * VIDEO_FONT_CHAR_PIXEL_BYTES;
if (x_frac + VID_TO_POS(vc_priv->x_charsize) > vc_priv->xsize_frac)
return -EAGAIN;
int pbytes = VNBYTES(vid_priv->bpix);
int linenum, x, ret;
void *start, *line;
- uchar *pfont = video_fontdata + (u8)ch * VIDEO_FONT_HEIGHT;
+ uchar *pfont = video_fontdata + (u8)ch * VIDEO_FONT_CHAR_PIXEL_BYTES;
if (x_frac + VID_TO_POS(vc_priv->x_charsize) > vc_priv->xsize_frac)
return -EAGAIN;
int pbytes = VNBYTES(vid_priv->bpix);
int linenum, x, ret;
void *start, *line;
- uchar *pfont = video_fontdata + (u8)ch * VIDEO_FONT_HEIGHT;
+ uchar *pfont = video_fontdata + (u8)ch * VIDEO_FONT_CHAR_PIXEL_BYTES;
if (x_frac + VID_TO_POS(vc_priv->x_charsize) > vc_priv->xsize_frac)
return -EAGAIN;