summaryrefslogtreecommitdiff
path: root/recordmydesktop
diff options
context:
space:
mode:
authoriovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a>2008-09-01 18:05:49 +0000
committeriovar <iovar@f606c939-3180-4ac9-a4b8-4b8779d57d0a>2008-09-01 18:05:49 +0000
commit9b080cbfbabc23a216277f658c2d009fdead6f93 (patch)
tree20e5e78d6a39a5a3da7bce864f3629b162bd5214 /recordmydesktop
parent0296fbc168932d3054aaac990b926a1a05286d2a (diff)
src/rectinsert.c: cleanup of RectInsert() patch from Martin Nordholts
git-svn-id: https://recordmydesktop.svn.sourceforge.net/svnroot/recordmydesktop/trunk@502 f606c939-3180-4ac9-a4b8-4b8779d57d0a
Diffstat (limited to 'recordmydesktop')
-rw-r--r--recordmydesktop/src/rectinsert.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/recordmydesktop/src/rectinsert.c b/recordmydesktop/src/rectinsert.c
index 1eaa9ef..d65dc76 100644
--- a/recordmydesktop/src/rectinsert.c
+++ b/recordmydesktop/src/rectinsert.c
@@ -269,19 +269,27 @@ int CollideRects(WGeometry *wgeom1,
}
}
-int RectInsert(RectArea **root,WGeometry *wgeom){
+/**
+ * If needed, grow the passed geometry so its position and size
+ * becomes even.
+ */
+static void MakeGeometryEven(WGeometry *wgeom){
- int total_insertions=0;
- RectArea *temp=NULL,*newnode=(RectArea *)malloc(sizeof(RectArea));
- //align
- //we do need to know boundaries
wgeom->width+=(wgeom->width%2)|(wgeom->x%2);
wgeom->height+=(wgeom->height%2)|(wgeom->y%2);
wgeom->width+=(wgeom->width%2);
wgeom->height+=(wgeom->height%2);
wgeom->x-=wgeom->x%2;
wgeom->y-=wgeom->y%2;
-// fprintf(stderr," %d %d %d %d\n",wgeom->x,
+
+}
+
+int RectInsert(RectArea **root,WGeometry *wgeom){
+
+ int total_insertions=0;
+ RectArea *temp=NULL,*newnode=(RectArea *)malloc(sizeof(RectArea));
+
+ MakeGeometryEven(wgeom);
newnode->geom.x=wgeom->x;
newnode->geom.y=wgeom->y;
@@ -306,14 +314,7 @@ int RectInsert(RectArea **root,WGeometry *wgeom){
insert_ok=1;
else{
for(i=0;i<ngeoms;i++){
- wgeom_return[i]->width+=(wgeom_return[i]->width%2)|
- (wgeom_return[i]->x%2);
- wgeom_return[i]->height+=(wgeom_return[i]->height%2)|
- (wgeom_return[i]->y%2);
- wgeom_return[i]->width+=(wgeom_return[i]->width%2);
- wgeom_return[i]->height+=(wgeom_return[i]->height%2);
- wgeom_return[i]->x-=wgeom_return[i]->x%2;
- wgeom_return[i]->y-=wgeom_return[i]->y%2;
+ MakeGeometryEven(wgeom_return[i]);
}
insert_ok=0;
switch(collres){
© All Rights Reserved