2 /****************************************************************************
3 * Copyright (C) 2002 by Leo Khramov
4 * email: leo@xnc.dubna.su
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 ****************************************************************************/
16 // $Id: wellsimpledraw.cxx,v 1.2 2003/02/19 09:51:39 leo Exp $
18 /// module description
19 /// WellSimpleDrawing - class that implements simple drawing algorithm
20 /// with dirty rectangles
22 #include "wellsimpledraw.h"
24 //===========================================================================
25 /// global WellSimpleDraw()
26 /// constructor of the class - init's variables.
27 /// tags WellSimpleDraw
28 WellSimpleDraw::WellSimpleDraw()
33 //===========================================================================
34 /// global ~WellSimpleDraw()
35 /// destructor of the class.
36 /// tags WellSimpleDraw
37 WellSimpleDraw::~WellSimpleDraw()
42 //===========================================================================
43 /// global new_dirty_rec(int dx, int dy)
44 /// create new dirty rec and remember delta position for main screen
45 /// tags WellSimpleDraw
46 void WellSimpleDraw::new_dirty_rec(int dx
, int dy
)
48 current_dirty
.delta_x
=dx
;
49 current_dirty
.delta_y
=dy
;
51 min_x
=min_y
=99999; //Hope we will never have screen bigger :)
54 //===========================================================================
55 /// global dirty_add_xy(int x, int y)
56 /// we add dot to current dirty rec - need detect max and min corners
57 /// tags WellSimpleDraw
58 void WellSimpleDraw::dirty_add_xy(int x
, int y
)
70 //===========================================================================
71 /// global finish_dirty_rec()
72 /// finish dots definition of current dirty rec - add it to the dirty queue
73 /// tags WellSimpleDraw
74 void WellSimpleDraw::finish_dirty_rec()
76 current_dirty
.x
=min_x
;
77 current_dirty
.y
=min_y
;
78 current_dirty
.l
=max_x
-min_x
+1;
79 current_dirty
.h
=max_y
-min_y
+1;
80 DirtyList
*plist
=new DirtyList(current_dirty
);
81 dirty_list
.add(plist
);
85 //===========================================================================
86 /// global clear_dirty_list()
87 /// clear all the list and free allocated memory
88 /// tags WellSimpleDraw
89 void WellSimpleDraw::clear_dirty_list()
94 plist
=dirty_list
.get_next();
104 //===========================================================================
105 /// global dirty_add_rec(DirtyRect r)
106 /// directly add the whole rec to the dirty queue
107 /// tags WellSimpleDraw
108 void WellSimpleDraw::dirty_add_rec(DirtyRect r
)
110 DirtyList
*plist
=new DirtyList(r
);
111 dirty_list
.add(plist
);