1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-09-06 23:44:43 -04:00

[screen] try to replace dirty_from and dirty_to with was_dirty

This commit is contained in:
Witold Filipczyk 2022-12-15 14:55:38 +01:00
parent df5dd1515e
commit f3dffb9fd8
2 changed files with 7 additions and 12 deletions

View File

@ -449,8 +449,7 @@ set_screen_dirty(struct terminal_screen *screen, int from, int to)
for (unsigned int i = from; i <= to; i++) { for (unsigned int i = from; i <= to; i++) {
set_bitfield_bit(screen->dirty, i); set_bitfield_bit(screen->dirty, i);
} }
int_upper_bound(&screen->dirty_from, from); screen->was_dirty = 1;
int_lower_bound(&screen->dirty_to, to);
} }
/** Set screen_driver.opt according to screen_driver.type and @a term_spec. /** Set screen_driver.opt according to screen_driver.type and @a term_spec.
@ -1316,13 +1315,11 @@ add_char_true(struct string *screen, struct screen_driver *driver,
#define add_chars(image_, term_, driver_, state_, ADD_CHAR, compare_bg_color, compare_fg_color) \ #define add_chars(image_, term_, driver_, state_, ADD_CHAR, compare_bg_color, compare_fg_color) \
{ \ { \
struct terminal_screen *screen = (term_)->screen; \ struct terminal_screen *screen = (term_)->screen; \
int y = screen->dirty_from; \ int y = 0; \
int xmax = (term_)->width - 1; \ int xmax = (term_)->width - 1; \
int ymax = (term_)->height - 1; \ int ymax = (term_)->height - 1; \
\ \
int_upper_bound(&screen->dirty_to, ymax); \ for (; y <= ymax; y++) { \
\
for (; y <= screen->dirty_to; y++) { \
if (!test_bitfield_bit(screen->dirty, y)) continue; \ if (!test_bitfield_bit(screen->dirty, y)) continue; \
int ypos = y * (term_)->width; \ int ypos = y * (term_)->width; \
struct screen_char *current = &screen->last_image[ypos]; \ struct screen_char *current = &screen->last_image[ypos]; \
@ -1383,7 +1380,7 @@ redraw_screen(struct terminal *term)
struct screen_state state = INIT_SCREEN_STATE; struct screen_state state = INIT_SCREEN_STATE;
struct terminal_screen *screen = term->screen; struct terminal_screen *screen = term->screen;
if (!screen || screen->dirty_from > screen->dirty_to) return; if (!screen || !screen->was_dirty) return;
if (term->master && is_blocked()) return; if (term->master && is_blocked()) return;
driver = get_screen_driver(term); driver = get_screen_driver(term);
@ -1453,8 +1450,7 @@ redraw_screen(struct terminal *term)
done_string(&image); done_string(&image);
copy_screen_chars(screen->last_image, screen->image, term->width * term->height); copy_screen_chars(screen->last_image, screen->image, term->width * term->height);
screen->dirty_from = term->height; screen->was_dirty = 0;
screen->dirty_to = 0;
} }
void void

View File

@ -22,9 +22,8 @@ struct terminal_screen {
int cx, cy; int cx, cy;
int lcx, lcy; int lcx, lcy;
/** The range of line numbers that are out of sync with the physical /** Whether to redraw screen */
* screen. #dirty_from > #dirty_to means not dirty. */ unsigned int was_dirty:1;
int dirty_from, dirty_to;
struct bitfield *dirty; struct bitfield *dirty;
}; };