Changeset 3581


Ignore:
Timestamp:
07/26/09 21:17:20 (4 years ago)
Author:
sam
Message:

Do not add a dirty rectangle at the cursor's position. It's up to the
display driver to clean up its shit. Fixed X11 driver accordingly.

Location:
libcaca/trunk/caca
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/caca/driver/x11.c

    r3569 r3581  
    6464    uint32_t max_char; 
    6565    int cursor_flags; 
     66    int dirty_cursor_x, dirty_cursor_y; 
    6667}; 
    6768 
     
    250251 
    251252    dp->drv.p->cursor_flags = 0; 
     253    dp->drv.p->dirty_cursor_x = -1; 
     254    dp->drv.p->dirty_cursor_y = -1; 
    252255 
    253256    return 0; 
     
    297300    int x, y, i, len; 
    298301 
    299     for(i = 0; i < caca_get_dirty_rect_count(dp->cv); i++) 
     302    /* XXX: the magic value -1 is used to handle the cursor area */ 
     303    for(i = -1; i < caca_get_dirty_rect_count(dp->cv); i++) 
    300304    { 
    301305        int dx, dy, dw, dh; 
    302306 
    303         caca_get_dirty_rect(dp->cv, i, &dx, &dy, &dw, &dh); 
     307        /* Get the dirty rectangle coordinates, either from the previous 
     308         * cursor position, or from the canvas's list. */ 
     309        if(i == -1) 
     310        { 
     311            if(dp->drv.p->dirty_cursor_x < 0 || dp->drv.p->dirty_cursor_y < 0 
     312                || dp->drv.p->dirty_cursor_x >= width 
     313                || dp->drv.p->dirty_cursor_y >= height) 
     314                continue; 
     315 
     316            dx = dp->drv.p->dirty_cursor_x; 
     317            dy = dp->drv.p->dirty_cursor_y; 
     318            dw = dh = 1; 
     319 
     320            dp->drv.p->dirty_cursor_x = -1; 
     321            dp->drv.p->dirty_cursor_y = -1; 
     322        } 
     323        else 
     324        { 
     325            caca_get_dirty_rect(dp->cv, i, &dx, &dy, &dw, &dh); 
     326        } 
    304327 
    305328        /* First draw the background colours. Splitting the process in two 
     
    349372    } 
    350373 
    351     /* Print the cursor if necessary. FIXME: handle dirty rectangles! */ 
     374    /* Print the cursor if necessary. */ 
    352375    if(dp->drv.p->cursor_flags) 
    353376    { 
     
    359382                       x * dp->drv.p->font_width, y * dp->drv.p->font_height, 
    360383                       dp->drv.p->font_width, dp->drv.p->font_height); 
     384 
     385        /* Mark the area as dirty */ 
     386        dp->drv.p->dirty_cursor_x = x; 
     387        dp->drv.p->dirty_cursor_y = y; 
    361388    } 
    362389 
  • libcaca/trunk/caca/string.c

    r3559 r3581  
    5454int caca_gotoxy(caca_canvas_t *cv, int x, int y) 
    5555{ 
    56     /* FIXME Not needed if cursor is invisible */ 
    57     caca_add_dirty_rect(cv, cv->frames[cv->frame].x, cv->frames[cv->frame].y, 1, 1); 
    58     caca_add_dirty_rect(cv, x, y, 1, 1); 
    59  
    6056    cv->frames[cv->frame].x = x; 
    6157    cv->frames[cv->frame].y = y; 
Note: See TracChangeset for help on using the changeset viewer.