From 94e08c4fb86eed1351faedd903e4707a490414c3 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Sat, 11 Jul 2020 12:18:20 -0700 Subject: setbrwindow: stop adjusting rrect for alignment rrect of any size/place should be perfectly usable now --- recordmydesktop/src/rmd_setbrwindow.c | 90 +---------------------------------- recordmydesktop/src/rmd_types.h | 2 +- 2 files changed, 3 insertions(+), 89 deletions(-) (limited to 'recordmydesktop') diff --git a/recordmydesktop/src/rmd_setbrwindow.c b/recordmydesktop/src/rmd_setbrwindow.c index 837d597..34bde1d 100644 --- a/recordmydesktop/src/rmd_setbrwindow.c +++ b/recordmydesktop/src/rmd_setbrwindow.c @@ -30,84 +30,6 @@ #include "rmd_types.h" -/** -*Align the recording window to a divisible by 2 pixel start and -*and a size divisible by 16. -* -* \param start x or y of the recording window -* -* \param size width or height of the recording window -* -* \param limit width or height of the Display -* -* \note This is called separately for width and height. -*/ -static void rmdSizePack2_8_16(short *start, unsigned short *size, unsigned short limit) { - int octoffset,hexoffset; - - //align in two - //an odd x can always go down and still be in recording area. - //Resolutions come in even numbers - //so if x is an odd numer, width max is an odd number, too - //thus since x will go down one then width can go up one too and still - //be inbounds - (*size)+=((*size)%2)|((*start)%2); - //but if x goes down 1 and width is already even,it becomes odd so: - (*size)+=((*size)%2); - (*start)-=(*start)%2; - - //32 bit pack align - //we already have disible by two width,so - //it's 2, 4 or 6 - octoffset=((*size)%8); - if (octoffset==2) { - (*size)-=2; - } else if (octoffset==6) { - if ((*size)+(*start)+2<=limit) - (*size)+=2; - else if ((*start)>=2) { - (*start)-=2; - (*size)+=2; - } else{ - (*start)+=2; - (*size)-=4; - } - } else if (octoffset==4) { - if (((*size)+(*start)+2<=limit)&&((*start)>=2)) { - (*start)-=2; - (*size)+=4; - } else if ((*size)+(*start)+4<=limit) { - (*size)+=4; - } else if ((*start)>=4) { - (*start)-=4; - (*size)+=4; - } else { - (*start)+=2; - (*size)-=4; - } - } - - //16 divisble width(needed for shared memory only, - //but applied anyway since theora wants it, too) - //we already have divisibility by 8 so module - //by 16 is euther 8 or 0 - hexoffset=((*size)%16); - if (hexoffset) { - if (((*size)+(*start)+4<=limit)&&((*start)>=4)) { - (*start)-=4; - (*size)+=8; - } else if ((*size)+(*start)+8<=limit) { - (*size)+=8; - } else if ((*start)>=8) { - (*start)-=8; - (*size)+=8; - } else { - (*start)+=4; - (*size)-=8; - } - } -} - boolean rmdSetBRWindow( Display *dpy, BRWindow *brwin, DisplaySpecs *specs, @@ -178,16 +100,8 @@ boolean rmdSetBRWindow( Display *dpy, fprintf(stderr, "Initial recording window is set to:\n" "X:%d Y:%d Width:%d Height:%d\n", - brwin->rrect.x,brwin->rrect.y, - brwin->rrect.width,brwin->rrect.height); - - rmdSizePack2_8_16(&brwin->rrect.x,&brwin->rrect.width,specs->width); - rmdSizePack2_8_16(&brwin->rrect.y,&brwin->rrect.height,specs->height); - - fprintf(stderr, "Adjusted recording window is set to:\n" - "X:%d Y:%d Width:%d Height:%d\n", - brwin->rrect.x,brwin->rrect.y, - brwin->rrect.width,brwin->rrect.height); + brwin->rrect.x, brwin->rrect.y, + brwin->rrect.width, brwin->rrect.height); return TRUE; } diff --git a/recordmydesktop/src/rmd_types.h b/recordmydesktop/src/rmd_types.h index e80b73f..f85390f 100644 --- a/recordmydesktop/src/rmd_types.h +++ b/recordmydesktop/src/rmd_types.h @@ -110,7 +110,7 @@ typedef struct _RectArea{ //an area that has been damaged gets stored typedef struct _BRWindow{ //'basic recorded window' specs XRectangle winrect; //window attributes - XRectangle rrect; //part of window that is recorded (rounded to alignment) + XRectangle rrect; //recorded window rect in screen space coordinates Window windowid; //id }BRWindow; -- cgit v1.2.3