1 /*
2  *  Abuse - dark 2D side-scrolling platform game
3  *  Copyright (c) 1995 Crack dot Com
4  *  Copyright (c) 2005-2011 Sam Hocevar <sam@hocevar.net>
5  *
6  *  This software was released into the Public Domain. As with most public
7  *  domain software, no warranty is made or implied by Crack dot Com, by
8  *  Jonathan Clark, or by Sam Hocevar.
9  */
10 
11 #if defined HAVE_CONFIG_H
12 #   include "config.h"
13 #endif
14 
15 #include <stdlib.h>
16 
17 #include "common.h"
18 
19 #include "image.h"
20 #include "video.h"
21 
update_dirty(image * im,int xoff,int yoff)22 void update_dirty(image *im, int xoff, int yoff)
23 {
24     // make sure the image has the ability to contain dirty areas
25     CHECK(im->m_special);
26 
27     if(im->m_special->keep_dirt == 0)
28     {
29         put_image(im, xoff, yoff);
30     }
31     else
32     {
33         int count = im->m_special->dirties.Count();
34         dirty_rect *dr = (dirty_rect *)(im->m_special->dirties.first());
35         while(count > 0)
36         {
37             put_part_image(im, xoff + dr->dx1, yoff + dr->dy1,
38                            dr->dx1, dr->dy1, dr->dx2 + 1, dr->dy2 + 1);
39             dirty_rect *tmp = dr;
40             dr = (dirty_rect *)(dr->Next());
41             im->m_special->dirties.unlink(tmp);
42             delete tmp;
43             count--;
44         }
45     }
46 
47     update_window_done();
48 }
49 
put_image(image * im,int x,int y)50 void put_image(image * im, int x, int y)
51 {
52     put_part_image(im, x, y, 0, 0, im->Size().x - 1, im->Size().y - 1);
53 }
54 
55