4
int levels_reg(struct Region *region)
8
struct Region region_buff;
10
/* save region stucture */
11
copy_reg(region, ®ion_buff);
14
reg_to_wdht(region, &wd, &ht);
15
while ((wd > 2) && (ht > 2)) {
18
reg_to_wdht(region, &wd, &ht);
21
/* restore region structure */
22
copy_reg(®ion_buff, region);
27
void dec_reg(struct Region *region)
29
region->xmin = region->xmin / 2;
30
region->xmax = region->xmax / 2;
31
region->ymin = region->ymin / 2;
32
region->ymax = region->ymax / 2;
35
void copy_reg(struct Region *region1, struct Region *region2)
37
region2->xmin = region1->xmin;
38
region2->xmax = region1->xmax;
39
region2->ymin = region1->ymin;
40
region2->ymax = region1->ymax;
42
region2->free.left = region1->free.left;
43
region2->free.right = region1->free.right;
44
region2->free.top = region1->free.top;
45
region2->free.bottom = region1->free.bottom;
48
void reg_to_wdht(struct Region *region, int *wd, int *ht)
50
*wd = region->xmax - region->xmin;
51
*ht = region->ymax - region->ymin;