From 46974eec6744f1c6a61e493dcdfe2471aec87c00 Mon Sep 17 00:00:00 2001 From: iovar Date: Sat, 22 Nov 2008 16:39:04 +0000 Subject: src/rmd_cache.c, src/rmd_cache_frame.c, src/rmd_get_frame.c, src/rmd_init_encoder.c, src/rmd_poll_events.c, src/rmd_rectinsert.c, src/rmd_rectinsert.h, src/rmd_rescue.c, src/rmd_setbrwindow.c, src/rmd_specsfile.c, src/rmd_types.h, src/rmd_update_image.c, src/test-rectinsert-data.c, src/test-rectinsert-types.h, src/test-rectinsert.c: Replaced the custom WGeometry struct-type with the Xlib-provided XRectangle type. Since XRectangle has unsigned width and height, any places in the code where -1 was used in these members of WGeometry to denote invalid rects, where changed to 0 ( zero width or height rects are also considered invalid, wherever met). Also, the following variable renames happened : wgeom => xrect, rgeom => rrect, geom => rect and so on. Some other minor changes in this commit are all related to this type change and also the fact that WGeometry had members of type int, while XRectangle is comprised of short members. git-svn-id: https://recordmydesktop.svn.sourceforge.net/svnroot/recordmydesktop/trunk@580 f606c939-3180-4ac9-a4b8-4b8779d57d0a --- recordmydesktop/src/test-rectinsert.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'recordmydesktop/src/test-rectinsert.c') diff --git a/recordmydesktop/src/test-rectinsert.c b/recordmydesktop/src/test-rectinsert.c index 28eb665..b63e5ce 100644 --- a/recordmydesktop/src/test-rectinsert.c +++ b/recordmydesktop/src/test-rectinsert.c @@ -51,11 +51,11 @@ static boolean GetPixel(boolean *state, int x, int y) { return state[y * STATE_WIDTH + x]; } -static void WriteGeomToState(WGeometry *geom, boolean *state) { +static void WriteGeomToState(XRectangle *rect, boolean *state) { int x, y; - for (y = geom->y; y < geom->y + geom->height; y++) { - for (x = geom->x; x < geom->x + geom->width; x++) { + for (y = rect->y; y < rect->y + rect->height; y++) { + for (x = rect->x; x < rect->x + rect->width; x++) { SetPixel(state, x, y, TRUE); } } @@ -71,19 +71,19 @@ static void ClearState(boolean *state) { } } -static void WarnIfNonOptimal(WGeometry *geom) { - if (geom->x < 0 || geom->x >= STATE_WIDTH || - geom->y < 0 || geom->y >= STATE_HEIGHT || - geom->width < 0 || geom->width > STATE_WIDTH || - geom->height < 0 || geom->height > STATE_HEIGHT) +static void WarnIfNonOptimal(XRectangle *rect) { + if (rect->x < 0 || rect->x >= STATE_WIDTH || + rect->y < 0 || rect->y >= STATE_HEIGHT || + rect->width == 0 || rect->width > STATE_WIDTH || + rect->height == 0 || rect->height > STATE_HEIGHT) { // The RectInsert() implementation is not optimal - printf(" Non-optimal geom (and RectInsert() implementation) encountered!\n" - " geom x = %d, y = %d, width = %d, height = %d\n", - geom->x, - geom->y, - geom->width, - geom->height); + printf(" Non-optimal rect (and RectInsert() implementation) encountered!\n" + " rect x = %d, y = %d, width = %hu, height = %hu\n", + rect->x, + rect->y, + rect->width, + rect->height); } } @@ -94,9 +94,9 @@ static void GetState(RectArea *root, boolean *state) { while (current) { - WarnIfNonOptimal(¤t->geom); + WarnIfNonOptimal(¤t->rect); - WriteGeomToState(¤t->geom, state); + WriteGeomToState(¤t->rect, state); current = current->next; } @@ -150,7 +150,7 @@ int main(int argc, char **argv) { while (rectinsert_test_data[i].description != NULL) { printf("Test #%d: %s\n", i + 1, rectinsert_test_data[i].description); - RectInsert(&root, &rectinsert_test_data[i].new_geom); + RectInsert(&root, &rectinsert_test_data[i].new_rect); GetState(root, current_state); if (!StatesEqual(current_state, rectinsert_test_data[i].expected_state)) { -- cgit v1.2.3