Browse Source

Fix dirty rectangle handling in the X11 and SLang drivers.

tags/v0.99.beta17
Sam Hocevar sam 15 years ago
parent
commit
222e165d21
2 changed files with 15 additions and 8 deletions
  1. +11
    -4
      caca/driver/slang.c
  2. +4
    -4
      caca/driver/x11.c

+ 11
- 4
caca/driver/slang.c View File

@@ -220,20 +220,24 @@ static int slang_get_display_height(caca_display_t const *dp)

static void slang_display(caca_display_t *dp)
{
uint32_t const *cvchars = (uint32_t const *)caca_get_canvas_chars(dp->cv);
uint32_t const *cvattrs = (uint32_t const *)caca_get_canvas_attrs(dp->cv);
int x, y, i;

for(i = 0; i < caca_get_dirty_rectangle_count(dp->cv); i++)
{
uint32_t const *cvchars, *cvattrs;
int xmin, ymin, xmax, ymax;

caca_get_dirty_rectangle(dp->cv, i, &xmin, &ymin, &xmax, &ymax);

cvchars = (uint32_t const *)caca_get_canvas_chars(dp->cv)
+ xmin + ymin * dp->cv->width;
cvattrs = (uint32_t const *)caca_get_canvas_attrs(dp->cv)
+ xmin + ymin * dp->cv->width;

for(y = ymin; y <= ymax; y++)
{
SLsmg_gotorc(y, 0);
for(x = xmax; x >= xmin; x--)
SLsmg_gotorc(y, xmin);
for(x = xmin; x <= xmax; x++)
{
uint32_t ch = *cvchars++;

@@ -277,6 +281,9 @@ static void slang_display(caca_display_t *dp)
slang_write_utf32(ch);
#endif
}

cvchars += dp->cv->width - (xmax - xmin) - 1;
cvattrs += dp->cv->width - (xmax - xmin) - 1;
}
}
SLsmg_gotorc(caca_get_cursor_y(dp->cv), caca_get_cursor_x(dp->cv));


+ 4
- 4
caca/driver/x11.c View File

@@ -142,7 +142,7 @@ static int x11_init_graphics(caca_display_t *dp)
else
dp->drv.p->max_char = 0x7f;

font_max_char =
font_max_char =
(dp->drv.p->font_struct->max_byte1 << 8)
| dp->drv.p->font_struct->max_char_or_byte2;
if(font_max_char && (font_max_char < dp->drv.p->max_char))
@@ -153,7 +153,7 @@ static int x11_init_graphics(caca_display_t *dp)

/* Reset the default X11 error handler */
XSetErrorHandler(old_error_handler);
dp->drv.p->font_width = 0;
if(dp->drv.p->font_struct->per_char
&& !dp->drv.p->font_struct->min_byte1
@@ -331,8 +331,8 @@ static void x11_display(caca_display_t *dp)
{
int yoff = (y + 1) * dp->drv.p->font_height
- dp->drv.p->font_offset;
uint32_t const *chars = cvchars + y * width;
uint32_t const *attrs = cvattrs + y * width;
uint32_t const *chars = cvchars + xmin + y * width;
uint32_t const *attrs = cvattrs + xmin + y * width;

for(x = xmin; x <= xmax; x++, chars++, attrs++)
{


Loading…
Cancel
Save