source: abuse/trunk/src/imlib/video.cpp @ 682

Last change on this file since 682 was 670, checked in by Sam Hocevar, 10 years ago

imlib: started refactoring the dirty rectangle system.

  • Property svn:keywords set to Id
File size: 1.4 KB
RevLine 
[524]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
[555]7 *  domain software, no warranty is made or implied by Crack dot Com, by
8 *  Jonathan Clark, or by Sam Hocevar.
[524]9 */
10
[555]11#if defined HAVE_CONFIG_H
12#   include "config.h"
13#endif
[524]14
15#include <stdlib.h>
16
17#include "common.h"
18
19#include "image.h"
20#include "video.h"
21
22void 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
[670]27    if (im->m_special->keep_dirt == 0)
[524]28    {
29        put_image(im, xoff, yoff);
30    }
31    else
32    {
[534]33        int count = im->m_special->dirties.Count();
[524]34        dirty_rect *dr = (dirty_rect *)(im->m_special->dirties.first());
[670]35        while (count > 0)
[524]36        {
[670]37            put_part_image(im, xoff + dr->m_aa.x, yoff + dr->m_aa.y,
38                           dr->m_aa.x, dr->m_aa.y,
39                           dr->m_bb.x + 1, dr->m_bb.y + 1);
[524]40            dirty_rect *tmp = dr;
[534]41            dr = (dirty_rect *)(dr->Next());
[524]42            im->m_special->dirties.unlink(tmp);
43            delete tmp;
44            count--;
45        }
46    }
47
48    update_window_done();
49}
50
51void put_image(image * im, int x, int y)
52{
53    put_part_image(im, x, y, 0, 0, im->Size().x - 1, im->Size().y - 1);
54}
55
Note: See TracBrowser for help on using the repository browser.