Skip to content

Commit

Permalink
Avoid rendering filled background color boxes when _KEEPBACKGROUND is…
Browse files Browse the repository at this point in the history
… set
  • Loading branch information
a740g committed Sep 21, 2023
1 parent 45b68b3 commit b40edfb
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions internal/c/libqb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13934,13 +13934,19 @@ void tab() {
x2 = (x / 112 + 1) * 112; // next position
if (x2 >= write_page->width) { // it doesn't fit on line
// box fill x to end of line with background color
fast_boxfill(x, (write_page->cursor_y - 1) * fontheight[write_page->font], write_page->width - 1,

if (write_page->print_mode != 1) // only draw the box if _PRINTMODE != _KEEPBACKGROUND
fast_boxfill(x, (write_page->cursor_y - 1) * fontheight[write_page->font], write_page->width - 1,
write_page->cursor_y * fontheight[write_page->font] - 1, write_page->background_color);

newline();
} else { // fits on line
// box fill x to x2-1 with background color
fast_boxfill(x, (write_page->cursor_y - 1) * fontheight[write_page->font], x2 - 1, write_page->cursor_y * fontheight[write_page->font] - 1,

if (write_page->print_mode != 1) // only draw the box if _PRINTMODE != _KEEPBACKGROUND
fast_boxfill(x, (write_page->cursor_y - 1) * fontheight[write_page->font], x2 - 1, write_page->cursor_y * fontheight[write_page->font] - 1,
write_page->background_color);

write_page->cursor_x = x2;
}

Expand Down Expand Up @@ -14200,14 +14206,20 @@ void qbs_print(qbs *str, int32 finish_on_new_line) {
x2 = (x / 64 + 1) * 64; // next position
if (x2 >= write_page->width) { // it doesn't fit on line
// box fill x to end of line with background color
fast_boxfill(x, (write_page->cursor_y - 1) * fontheight[write_page->font], write_page->width - 1,

if (write_page->print_mode != 1) // only draw the box if _PRINTMODE != _KEEPBACKGROUND
fast_boxfill(x, (write_page->cursor_y - 1) * fontheight[write_page->font], write_page->width - 1,
write_page->cursor_y * fontheight[write_page->font] - 1, write_page->background_color);

newline();
entered_new_line = 1;
} else { // fits on line
// box fill x to x2-1 with background color
fast_boxfill(x, (write_page->cursor_y - 1) * fontheight[write_page->font], x2 - 1, write_page->cursor_y * fontheight[write_page->font] - 1,

if (write_page->print_mode != 1) // only draw the box if _PRINTMODE != _KEEPBACKGROUND
fast_boxfill(x, (write_page->cursor_y - 1) * fontheight[write_page->font], x2 - 1, write_page->cursor_y * fontheight[write_page->font] - 1,
write_page->background_color);

write_page->cursor_x = x2;
}
goto skip;
Expand Down

0 comments on commit b40edfb

Please sign in to comment.