Ignore:
Timestamp:
Apr 20, 2011, 9:02:33 PM (11 years ago)
Author:
Sam Hocevar
Message:

imlib: refactor dirty_rect clipping coordiantes so that the upper
bound is no longer inclusive. It will make things easier in the future.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • abuse/trunk/src/imlib/filter.cpp

    r515 r518  
    179179                       char transparent)
    180180{
    181     short cx1, cy1, cx2, cy2, x1 = 0, y1 = 0,
    182           x2 = im->Size().x - 1, y2 = im->Size().y - 1;
    183     screen->get_clip(cx1,cy1,cx2,cy2);
     181    int cx1, cy1, cx2, cy2, x1 = 0, y1 = 0,
     182          x2 = im->Size().x, y2 = im->Size().y;
     183    screen->GetClip(cx1, cy1, cx2, cy2);
    184184
    185185    // see if the image gets clipped off the screen
    186     if(x > cx2 || y > cy2 || x + (x2 - x1) < cx1 || y + (y2 - y1) < cy1)
     186    if(x >= cx2 || y >= cy2 || x + (x2 - x1) <= cx1 || y + (y2 - y1) <= cy1)
    187187        return;
    188188
     
    198198    }
    199199
    200     if(x + x2 - x1 + 1 > cx2)
     200    if(x + x2 - x1 >= cx2)
    201201        x2 = cx2 - x + x1;
    202202
    203     if(y + y2 - y1 + 1 > cy2)
     203    if(y + y2 - y1 >= cy2)
    204204        y2 = cy2 - y + y1;
    205205
    206     if(x1 > x2 || y1 > y2)
     206    if(x1 >= x2 || y1 >= y2)
    207207        return;
    208208
    209     int xl = x2 - x1 + 1;
    210     int yl = y2 - y1 + 1;
    211 
    212     screen->add_dirty(x, y, x + xl - 1, y + yl - 1);
     209    int xl = x2 - x1;
     210    int yl = y2 - y1;
     211
     212    screen->AddDirty(x, y, x + xl, y + yl);
    213213
    214214    screen->Lock();
Note: See TracChangeset for help on using the changeset viewer.