Procházet zdrojové kódy

* Only redraw dirty rectangle in x11 driver

tags/v0.99.beta17
Pascal Terjan pterjan před 15 roky
rodič
revize
44f5d172f0
1 změnil soubory, kde provedl 9 přidání a 4 odebrání
  1. +9
    -4
      caca/driver/x11.c

+ 9
- 4
caca/driver/x11.c Zobrazit soubor

@@ -294,12 +294,17 @@ static void x11_display(caca_display_t *dp)
int width = caca_get_canvas_width(dp->cv);
int height = caca_get_canvas_height(dp->cv);
int x, y, len;
int xmin, ymin, xmax, ymax;

caca_get_dirty_rectangle(dp->cv, &xmin, &ymin, &xmax, &ymax);
if(xmin < 0 || ymin < 0 || xmax < 0 || ymax < 0 || xmin >= width || ymin >= height)
return;

/* First draw the background colours. Splitting the process in two
* loops like this is actually slightly faster. */
for(y = 0; y < height; y++)
for(y = ymin; y <= ymax; y++)
{
for(x = 0; x < width; x += len)
for(x = xmin; x <= xmax; x += len)
{
uint32_t const *attrs = cvattrs + x + y * width;
uint16_t bg = caca_attr_to_rgb12_bg(*attrs);
@@ -320,14 +325,14 @@ static void x11_display(caca_display_t *dp)
}

/* Then print the foreground characters */
for(y = 0; y < height; y++)
for(y = ymin; y <= ymax; y++)
{
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;

for(x = 0; x < width; x++, chars++, attrs++)
for(x = xmin; x <= xmax; x++, chars++, attrs++)
{
XSetForeground(dp->drv.p->dpy, dp->drv.p->gc,
dp->drv.p->colors[caca_attr_to_rgb12_fg(*attrs)]);


Načítá se…
Zrušit
Uložit