From c717994102c1e190c0131b57915693b951ed81b7 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 1 Feb 2016 13:48:43 -0800 Subject: Start using stdbool.h instead of Xlib or custom bools. I have a hard time typing anything else at this point. Signed-off-by: Eric Anholt --- main.c | 21 ++++++++++-------- ops.c | 2 +- rendercheck.h | 58 +++++++++++++++++++++++------------------------- t_blend.c | 8 +++---- t_bug7366.c | 32 +++++++++++++-------------- t_composite.c | 12 +++++----- t_dstcoords.c | 6 ++--- t_fill.c | 6 ++--- t_gradient.c | 32 +++++++++++++-------------- t_gtk_argb_xbgr.c | 8 +++---- t_libreoffice_xrgb.c | 10 ++++----- t_repeat.c | 22 +++++++++---------- t_srccoords.c | 14 ++++++------ t_triangles.c | 24 ++++++++++---------- t_tsrccoords.c | 12 +++++----- t_tsrccoords2.c | 14 ++++++------ tests.c | 62 ++++++++++++++++++++++++++-------------------------- 17 files changed, 171 insertions(+), 172 deletions(-) diff --git a/main.c b/main.c index a7035b9..b5d67cc 100644 --- a/main.c +++ b/main.c @@ -27,7 +27,7 @@ #include #include -Bool is_verbose = FALSE, minimalrendering = FALSE; +bool is_verbose = false, minimalrendering = false; int enabled_tests = ~0; /* Enable all tests by default */ int format_whitelist_len = 0; @@ -163,7 +163,8 @@ int main(int argc, char **argv) Display *dpy; XEvent ev; int i, o, maj, min; - static Bool is_sync = FALSE, print_version = FALSE; + static int is_sync = false, print_version = false; + static int longopt_minimalrendering = 0; XWindowAttributes a; XSetWindowAttributes as; picture_info window; @@ -177,10 +178,10 @@ int main(int argc, char **argv) { "tests", required_argument, NULL, 't' }, { "ops", required_argument, NULL, 'o' }, { "verbose", no_argument, NULL, 'v' }, - { "sync", no_argument, &is_sync, TRUE}, - { "minimalrendering", no_argument, &minimalrendering, - TRUE}, - { "version", no_argument, &print_version, TRUE }, + { "sync", no_argument, &is_sync, true}, + { "minimalrendering", no_argument, + &longopt_minimalrendering, true}, + { "version", no_argument, &print_version, true }, { NULL, 0, NULL, 0 } }; @@ -194,7 +195,7 @@ int main(int argc, char **argv) break; case 'o': for (i = 0; i < num_ops; i++) - ops[i].disabled = TRUE; + ops[i].disabled = true; nextname = optarg; while ((opname = strsep(&nextname, ",")) != NULL) { @@ -202,7 +203,7 @@ int main(int argc, char **argv) if (strcasecmp(ops[i].name, opname) != 0) continue; - ops[i].disabled = FALSE; + ops[i].disabled = false; break; } if (i == num_ops) @@ -252,7 +253,7 @@ int main(int argc, char **argv) break; case 'v': - is_verbose = TRUE; + is_verbose = true; break; case 0: break; @@ -262,6 +263,8 @@ int main(int argc, char **argv) } } + minimalrendering = longopt_minimalrendering; + /* Print the version string. Bail out if --version was requested and * continue otherwise. */ diff --git a/ops.c b/ops.c index 0e03550..b7803da 100644 --- a/ops.c +++ b/ops.c @@ -210,7 +210,7 @@ do_composite(int op, const color4d *mask, const color4d *dst, color4d *result, - Bool componentAlpha) + bool componentAlpha) { color4d srcval, srcalpha; diff --git a/rendercheck.h b/rendercheck.h index 67efdbf..55ffcff 100644 --- a/rendercheck.h +++ b/rendercheck.h @@ -22,6 +22,7 @@ #include #include +#include #include #if HAVE_ERR_H @@ -44,11 +45,6 @@ static inline void errx(int eval, const char *fmt, ...) { #define min(a, b) (a < b ? a : b) #define max(a, b) (a > b ? a : b) -#ifndef TRUE -#define TRUE 1 -#define FALSE 0 -#endif - typedef struct _color4d { double r, g, b, a; @@ -65,7 +61,7 @@ typedef struct _picture_info { struct op_info { int op; const char *name; - Bool disabled; + bool disabled; }; #define TEST_FILL 0x0001 @@ -87,7 +83,7 @@ struct op_info { extern int pixmap_move_iter; extern int win_width, win_height; extern struct op_info ops[]; -extern Bool is_verbose, minimalrendering; +extern bool is_verbose, minimalrendering; extern color4d colors[]; extern int enabled_tests; extern int format_whitelist_len; @@ -147,7 +143,7 @@ void argb_fill(Display *dpy, picture_info *p, int x, int y, int w, int h, float a, float r, float g, float b); -Bool +bool do_tests(Display *dpy, picture_info *win); void @@ -161,69 +157,69 @@ do_composite(int op, const color4d *mask, const color4d *dst, color4d *result, - Bool componentAlpha); + bool componentAlpha); /* The tests */ -Bool +bool blend_test(Display *dpy, picture_info *win, picture_info *dst, const int *op, int num_op, const picture_info **src_color, int num_src, const picture_info **dst_color, int num_dst); -Bool +bool composite_test(Display *dpy, picture_info *win, picture_info *dst, const int *op, int num_op, const picture_info **src_color, int num_src, const picture_info **mask_color, int num_mask, const picture_info **dst_color, int num_dst, - Bool componentAlpha); + bool componentAlpha); -Bool +bool dstcoords_test(Display *dpy, picture_info *win, int op, picture_info *dst, picture_info *bg, picture_info *fg); -Bool +bool fill_test(Display *dpy, picture_info *win, picture_info *src); -Bool +bool srccoords_test(Display *dpy, picture_info *win, picture_info *white, - Bool test_mask); + bool test_mask); -Bool +bool trans_coords_test(Display *dpy, picture_info *win, picture_info *white, - Bool test_mask); + bool test_mask); -Bool +bool trans_srccoords_test_2(Display *dpy, picture_info *win, picture_info *white, - Bool test_mask); + bool test_mask); -Bool render_to_gradient_test(Display *dpy, picture_info *src); +bool render_to_gradient_test(Display *dpy, picture_info *src); -Bool linear_gradient_test(Display *dpy, picture_info *win, +bool linear_gradient_test(Display *dpy, picture_info *win, picture_info *dst, int op, picture_info *dst_color); -Bool +bool repeat_test(Display *dpy, picture_info *win, picture_info *dst, int op, picture_info *dst_color, picture_info *c1, picture_info *c2, - Bool test_mask); + bool test_mask); -Bool +bool triangles_test(Display *dpy, picture_info *win, picture_info *dst, int op, picture_info *src_color, picture_info *dst_color); -Bool +bool tristrip_test(Display *dpy, picture_info *win, picture_info *dst, int op, picture_info *src_color, picture_info *dst_color); -Bool +bool trifan_test(Display *dpy, picture_info *win, picture_info *dst, int op, picture_info *src_color, picture_info *dst_color); -Bool +bool bug7366_test(Display *dpy); -Bool +bool gtk_argb_xbgr_test(Display *dpy); -Bool -libreoffice_xrgb_test(Display *dpy, Bool invert); +bool +libreoffice_xrgb_test(Display *dpy, bool invert); diff --git a/t_blend.c b/t_blend.c index b436fe4..2d761ce 100644 --- a/t_blend.c +++ b/t_blend.c @@ -26,7 +26,7 @@ #include "rendercheck.h" /* Test a composite of a given operation, source, and destination picture. */ -Bool +bool blend_test(Display *dpy, picture_info *win, picture_info *dst, const int *op, int num_op, const picture_info **src_color, int num_src, @@ -106,7 +106,7 @@ blend_test(Display *dpy, picture_info *win, picture_info *dst, NULL, &tdst, &expected, - FALSE); + false); color_correct(dst, &expected); if (eval_diff(&acc, &expected, &tested) > 3.) { @@ -127,7 +127,7 @@ blend_test(Display *dpy, picture_info *win, picture_info *dst, dst_color[k]->color.a); printf("src: %s, dst: %s\n", src_color[j]->name, dst->name); free(srcformat); - return FALSE; + return false; } } y++; @@ -139,5 +139,5 @@ blend_test(Display *dpy, picture_info *win, picture_info *dst, } } - return TRUE; + return true; } diff --git a/t_bug7366.c b/t_bug7366.c index 34ac004..8e06629 100644 --- a/t_bug7366.c +++ b/t_bug7366.c @@ -29,13 +29,13 @@ static int expecting_error(Display *dpy, XErrorEvent *event) { - return TRUE; + return true; } /** * Check SetPictureTransform on a source picture causing a crash. */ -static Bool +static bool bug7366_test_set_picture_transform(Display *dpy) { Picture source_pict; @@ -48,17 +48,17 @@ bug7366_test_set_picture_transform(Display *dpy) memset(&transform, 0, sizeof(transform)); XRenderSetPictureTransform(dpy, source_pict, &transform); - XSync(dpy, FALSE); + XSync(dpy, false); XRenderFreePicture(dpy, source_pict); - return TRUE; + return true; } /** * Check setting of AlphaMap to a source picture causing a crash. */ -static Bool +static bool bug7366_test_set_alpha_map(Display *dpy) { Picture source_pict, pict; @@ -76,20 +76,20 @@ bug7366_test_set_alpha_map(Display *dpy) XSetErrorHandler(expecting_error); pa.alpha_map = source_pict; XRenderChangePicture(dpy, pict, CPAlphaMap, &pa); - XSync(dpy, FALSE); + XSync(dpy, false); XSetErrorHandler(NULL); XFreePixmap(dpy, pixmap); XRenderFreePicture(dpy, pict); XRenderFreePicture(dpy, source_pict); - return TRUE; + return true; } /** * Check SetPictureClipRectangles on a source potentially causing a crash. */ -static Bool +static bool bug7366_test_set_picture_clip_rectangles(Display *dpy) { Picture source_pict; @@ -102,18 +102,18 @@ bug7366_test_set_picture_clip_rectangles(Display *dpy) memset(&rectangle, 0, sizeof(rectangle)); XSetErrorHandler(expecting_error); XRenderSetPictureClipRectangles(dpy, source_pict, 0, 0, &rectangle, 1); - XSync(dpy, FALSE); + XSync(dpy, false); XSetErrorHandler(NULL); XRenderFreePicture(dpy, source_pict); - return TRUE; + return true; } /** * Check SetPictureFilter on a source potentially causing a crash. */ -static Bool +static bool bug7366_test_set_picture_filter(Display *dpy) { Picture source_pict; @@ -123,15 +123,15 @@ bug7366_test_set_picture_filter(Display *dpy) source_pict = XRenderCreateSolidFill(dpy, &color); XRenderSetPictureFilter(dpy, source_pict, "bilinear", NULL, 0); - XSync(dpy, FALSE); + XSync(dpy, false); XSetErrorHandler(NULL); XRenderFreePicture(dpy, source_pict); - return TRUE; + return true; } -Bool +bool bug7366_test(Display *dpy) { int maj, min; @@ -139,7 +139,7 @@ bug7366_test(Display *dpy) /* Make sure we actually have gradients available */ XRenderQueryVersion(dpy, &maj, &min); if (maj != 0 || min < 10) - return TRUE; + return true; bug7366_test_set_picture_transform(dpy); bug7366_test_set_alpha_map(dpy); @@ -147,5 +147,5 @@ bug7366_test(Display *dpy) bug7366_test_set_picture_filter(dpy); /* If the server isn't gone, then we've succeeded. */ - return TRUE; + return true; } diff --git a/t_composite.c b/t_composite.c index 73133db..eec0033 100644 --- a/t_composite.c +++ b/t_composite.c @@ -27,13 +27,13 @@ /* Test a composite of a given operation, source, mask, and destination picture. * Fills the window, and samples from the 0,0 pixel corner. */ -Bool +bool composite_test(Display *dpy, picture_info *win, picture_info *dst, const int *op, int num_op, const picture_info **src_color, int num_src, const picture_info **mask_color, int num_mask, const picture_info **dst_color, int num_dst, - Bool componentAlpha) + bool componentAlpha) { color4d expected, tested, tdst, tmsk; char testname[40]; @@ -59,7 +59,7 @@ composite_test(Display *dpy, picture_info *win, picture_info *dst, if (componentAlpha) { XRenderPictureAttributes pa; - pa.component_alpha = TRUE; + pa.component_alpha = true; XRenderChangePicture(dpy, mask_color[m]->pict, CPComponentAlpha, &pa); } @@ -90,7 +90,7 @@ composite_test(Display *dpy, picture_info *win, picture_info *dst, if (componentAlpha) { XRenderPictureAttributes pa; - pa.component_alpha = FALSE; + pa.component_alpha = false; XRenderChangePicture(dpy, mask_color[m]->pict, CPComponentAlpha, &pa); } @@ -157,7 +157,7 @@ composite_test(Display *dpy, picture_info *win, picture_info *dst, mask_color[m]->name, dst->name); XDestroyImage(image); - return FALSE; + return false; } } } @@ -167,5 +167,5 @@ composite_test(Display *dpy, picture_info *win, picture_info *dst, } } - return TRUE; + return true; } diff --git a/t_dstcoords.c b/t_dstcoords.c index 8944dec..bb8bd7d 100644 --- a/t_dstcoords.c +++ b/t_dstcoords.c @@ -33,14 +33,14 @@ * Otherwise, we're likely to hit a path that maps PictOpOver -> PictOpSrc, * for example. */ -Bool +bool dstcoords_test(Display *dpy, picture_info *win, int op, picture_info *dst, picture_info *bg, picture_info *fg) { color4d expected, tested; XImage *image; int x, y, i; - Bool failed = FALSE; + bool failed = false; for (i = 0; i < pixmap_move_iter; i++) { XRenderComposite(dpy, PictOpSrc, bg->pict, 0, dst->pict, 0, 0, @@ -68,7 +68,7 @@ dstcoords_test(Display *dpy, picture_info *win, int op, picture_info *dst, print_fail("dst coords", &expected, &tested, x, y, eval_diff(&dst->format->direct, &expected, &tested)); - failed = TRUE; + failed = true; } } } diff --git a/t_fill.c b/t_fill.c index 7e071c0..4d9f639 100644 --- a/t_fill.c +++ b/t_fill.c @@ -29,7 +29,7 @@ /* Test that filling of the 1x1 repeating pictures worked as expected. This is * pretty basic to most of the tests. */ -Bool +bool fill_test(Display *dpy, picture_info *win, picture_info *src) { color4d tested; @@ -43,8 +43,8 @@ fill_test(Display *dpy, picture_info *win, picture_info *src) print_fail(name, &src->color, &tested, 0, 0, eval_diff(&src->format->direct, &src->color, &tested)); free(name); - return FALSE; + return false; } - return TRUE; + return true; } diff --git a/t_gradient.c b/t_gradient.c index 32df8c4..a489fe2 100644 --- a/t_gradient.c +++ b/t_gradient.c @@ -85,20 +85,20 @@ static const pixel test_pixels [] = { static const int n_linear_gradient_points = sizeof(linear_gradient_points)/(2*sizeof(point)); -static Bool got_bad_drawable; +static bool got_bad_drawable; static int expecting_bad_drawable(Display *dpy, XErrorEvent *event) { if (event->error_code == BadDrawable) - got_bad_drawable = TRUE; + got_bad_drawable = true; - return TRUE; + return true; } /* Tests that rendering to a linear gradient returns an error as expected. */ -Bool +bool render_to_gradient_test(Display *dpy, picture_info *src) { XLinearGradient g; @@ -124,39 +124,39 @@ render_to_gradient_test(Display *dpy, picture_info *src) gradient = XRenderCreateLinearGradient(dpy, &g, stops, colors, i); /* Clear out any failing requests before our expected to fail ones. */ - XSync(dpy, FALSE); + XSync(dpy, false); - got_bad_drawable = FALSE; + got_bad_drawable = false; XSetErrorHandler(expecting_bad_drawable); /* Try a real compositing path */ XRenderComposite(dpy, PictOpOver, src->pict, 0, gradient, 0, 0, 0, 0, 0, 0, win_width, win_height); - XSync(dpy, FALSE); + XSync(dpy, false); if (!got_bad_drawable) { printf("render_to_gradient: Failed to get BadDrawable with " "Over\n"); - return FALSE; + return false; } else { - got_bad_drawable = FALSE; + got_bad_drawable = false; } /* Try the copy path to catch bad short-circuiting to 2d. */ XRenderComposite(dpy, PictOpSrc, src->pict, 0, gradient, 0, 0, 0, 0, 0, 0, win_width, win_height); - XSync(dpy, FALSE); + XSync(dpy, false); if (!got_bad_drawable) { printf("render_to_gradient: Failed to get BadDrawable with " "Src\n"); - return FALSE; + return false; } else { - got_bad_drawable = FALSE; + got_bad_drawable = false; } XSetErrorHandler(NULL); XRenderFreePicture(dpy, gradient); - return TRUE; + return true; } static void gradientPixel(const stop *stops, double pos, unsigned int spread, color4d *result) @@ -247,14 +247,14 @@ static void calculate_linear_gradient_color(int x, int y, -Bool linear_gradient_test(Display *dpy, picture_info *win, +bool linear_gradient_test(Display *dpy, picture_info *win, picture_info *dst, int op, picture_info *dst_color) { color4d expected, tested, tdst, tgradient; int i, s, p, repeat; Picture gradient; char testname[40]; - Bool success = True; + bool success = true; for (s = 0; s < n_stop_list; ++s) { for (p = 0; p < n_linear_gradient_points; p += 2) { @@ -321,7 +321,7 @@ Bool linear_gradient_test(Display *dpy, picture_info *win, tgradient.b, tgradient.a, dst_color->color.r, dst_color->color.g, dst_color->color.b, dst_color->color.a); - success = FALSE; + success = false; } else if (is_verbose) { printf("src: %d/%d, dst: %s\n", s, p, dst->name); } diff --git a/t_gtk_argb_xbgr.c b/t_gtk_argb_xbgr.c index b80e58b..2b004d5 100644 --- a/t_gtk_argb_xbgr.c +++ b/t_gtk_argb_xbgr.c @@ -31,7 +31,7 @@ #define PIXEL_ABGR 0xff886644 #define PIXEL_RGB 0x446688 -Bool +bool gtk_argb_xbgr_test(Display *dpy) { int x, y; @@ -95,7 +95,7 @@ gtk_argb_xbgr_test(Display *dpy) if (!pic_argb_format || !pic_xbgr_format || !pic_rgb_format) { printf("Couldn't find xBGR and ARGB formats\n"); - return FALSE; + return false; } pix_32 = XCreatePixmap(dpy, RootWindow(dpy, DefaultScreen(dpy)), @@ -141,10 +141,10 @@ gtk_argb_xbgr_test(Display *dpy) printf("fail: pixel value is %08lx " "should be %08x\n", pixel, PIXEL_RGB); - return FALSE; + return false; } } } - return TRUE; + return true; } diff --git a/t_libreoffice_xrgb.c b/t_libreoffice_xrgb.c index 7f79444..9efca58 100644 --- a/t_libreoffice_xrgb.c +++ b/t_libreoffice_xrgb.c @@ -39,8 +39,8 @@ #define PIXEL_ARGB 0xff886644 #define INVERT_PIXEL_ARGB 0xff7799bb -Bool -libreoffice_xrgb_test(Display *dpy, Bool invert) +bool +libreoffice_xrgb_test(Display *dpy, bool invert) { int x, y; Pixmap src_pix, dst_pix; @@ -100,7 +100,7 @@ libreoffice_xrgb_test(Display *dpy, Bool invert) if (!pic_argb_format || !pic_xrgb_format || !pic_rgb_format) { printf("Couldn't find xRGB and ARGB formats\n"); - return FALSE; + return false; } src_pix = XCreatePixmap(dpy, RootWindow(dpy, DefaultScreen(dpy)), @@ -155,11 +155,11 @@ libreoffice_xrgb_test(Display *dpy, Bool invert) printf("fail: pixel value is %08lx, " "should be %08lx\n", pixel, expected); - return FALSE; + return false; } } } XDestroyImage(image); - return TRUE; + return true; } diff --git a/t_repeat.c b/t_repeat.c index 0c25b60..36e69e1 100644 --- a/t_repeat.c +++ b/t_repeat.c @@ -45,9 +45,9 @@ static const int sizes[] = {1, 2, 4, 8, 10, 16, 20, 32, 64, 100}; * test_mask is set, the repeating picture is used as a component-alpha mask, * with argb32white as the source. */ -Bool +bool repeat_test(Display *dpy, picture_info *win, picture_info *dst, int op, - picture_info *dst_color, picture_info *c1, picture_info *c2, Bool test_mask) + picture_info *dst_color, picture_info *c1, picture_info *c2, bool test_mask) { unsigned int wi, hi; @@ -64,10 +64,10 @@ repeat_test(Display *dpy, picture_info *win, picture_info *dst, int op, XRenderPictureAttributes pa; XRenderDirectFormat acc; XImage *image; - Bool failed = FALSE; + bool failed = false; pa.component_alpha = test_mask; - pa.repeat = TRUE; + pa.repeat = true; src.d = XCreatePixmap(dpy, DefaultRootWindow(dpy), w, h, 32); src.format = XRenderFindStandardFormat(dpy, PictStandardARGB32); @@ -118,14 +118,14 @@ repeat_test(Display *dpy, picture_info *win, picture_info *dst, int op, if (!test_mask) { do_composite(ops[op].op, &c1->color, NULL, &tdst, - &c1expected, FALSE); + &c1expected, false); do_composite(ops[op].op, &c2->color, NULL, &tdst, - &c2expected, FALSE); + &c2expected, false); } else { do_composite(ops[op].op, &argb32white->color, - &c1->color, &tdst, &c1expected, TRUE); + &c1->color, &tdst, &c1expected, true); do_composite(ops[op].op, &argb32white->color, - &c2->color, &tdst, &c2expected, TRUE); + &c2->color, &tdst, &c2expected, true); } color_correct(dst, &c1expected); color_correct(dst, &c2expected); @@ -154,7 +154,7 @@ repeat_test(Display *dpy, picture_info *win, picture_info *dst, int op, print_fail(name, expected, &tested, x, y, eval_diff(&acc, expected, &tested)); - failed = TRUE; + failed = true; goto out; } } @@ -165,8 +165,8 @@ out: XFreePixmap(dpy, src.d); if (failed) - return FALSE; + return false; } } - return TRUE; + return true; } diff --git a/t_srccoords.c b/t_srccoords.c index 1eae7d8..c498468 100644 --- a/t_srccoords.c +++ b/t_srccoords.c @@ -72,21 +72,21 @@ static void destroy_target_picture(Display *dpy, picture_info *p) * !test_mask case, to avoid getting CopyArea acceleration (easy to implement) * rather than a more general Composite implementation. */ -Bool +bool srccoords_test(Display *dpy, picture_info *win, picture_info *white, - Bool test_mask) + bool test_mask) { color4d expected, tested; int i; XRenderPictureAttributes pa; - Bool failed = FALSE; + bool failed = false; int tested_colors[5][5]; picture_info *src; src = create_target_picture(dpy); if (src == NULL) { fprintf(stderr, "couldn't allocate picture for test\n"); - return FALSE; + return false; } for (i = 0; i < 25; i++) { @@ -100,12 +100,12 @@ srccoords_test(Display *dpy, picture_info *win, picture_info *white, * alpha, the mask color should be written to the * destination. */ - pa.component_alpha = TRUE; + pa.component_alpha = true; XRenderChangePicture(dpy, src->pict, CPComponentAlpha, &pa); XRenderComposite(dpy, PictOpSrc, white->pict, src->pict, win->pict, 0, 0, x, y, 0, 0, 1, 1); - pa.component_alpha = FALSE; + pa.component_alpha = false; XRenderChangePicture(dpy, src->pict, CPComponentAlpha, &pa); } @@ -126,7 +126,7 @@ srccoords_test(Display *dpy, picture_info *win, picture_info *white, print_fail(test_mask ? "mask coords" : "src coords", &expected, &tested, x, y, eval_diff(&win->format->direct, &expected, &tested)); - failed = TRUE; + failed = true; } } if (failed) { diff --git a/t_triangles.c b/t_triangles.c index 960d21a..05f98d8 100644 --- a/t_triangles.c +++ b/t_triangles.c @@ -60,14 +60,14 @@ get_dest_color (int op, color4d *in, color4d *out) * probably (nobody has used them yet), but we can trivially test by filling * doing two triangles that will exactly cover the rectangle from 2,2 to 4,4. */ -Bool +bool triangles_test(Display *dpy, picture_info *win, picture_info *dst, int op, picture_info *src_color, picture_info *dst_color) { XTriangle triangles[2]; color4d tdst, tsrc; int x, y; - Bool success = TRUE; + bool success = true; XImage *image; triangles[0].p1.x = XDoubleToFixed(2); @@ -98,7 +98,7 @@ triangles_test(Display *dpy, picture_info *win, picture_info *dst, int op, color_correct(dst, &tdst); /* Color expected inside of the triangles */ - do_composite(ops[op].op, &src_color->color, NULL, &dst_color->color, &tsrc, FALSE); + do_composite(ops[op].op, &src_color->color, NULL, &dst_color->color, &tsrc, false); color_correct(dst, &tsrc); image = XGetImage(dpy, dst->d, @@ -120,7 +120,7 @@ triangles_test(Display *dpy, picture_info *win, picture_info *dst, int op, if (eval_diff(&dst->format->direct, &expected, &tested) > 2.) { print_fail("triangles", &expected, &tested, x, y, eval_diff(&dst->format->direct, &expected, &tested)); - success = FALSE; + success = false; } } } @@ -137,14 +137,14 @@ triangles_test(Display *dpy, picture_info *win, picture_info *dst, int op, return success; } -Bool +bool trifan_test(Display *dpy, picture_info *win, picture_info *dst, int op, picture_info *src_color, picture_info *dst_color) { XPointFixed points[4]; color4d tdst, tsrc; int x, y; - Bool success = TRUE; + bool success = true; XImage *image; points[0].x = XDoubleToFixed(2); @@ -170,7 +170,7 @@ trifan_test(Display *dpy, picture_info *win, picture_info *dst, int op, color_correct(dst, &tdst); /* Color expected inside of the triangles */ - do_composite(ops[op].op, &src_color->color, NULL, &dst_color->color, &tsrc, FALSE); + do_composite(ops[op].op, &src_color->color, NULL, &dst_color->color, &tsrc, false); color_correct(dst, &tsrc); image = XGetImage(dpy, dst->d, @@ -192,7 +192,7 @@ trifan_test(Display *dpy, picture_info *win, picture_info *dst, int op, if (eval_diff(&dst->format->direct, &expected, &tested) > 2.) { print_fail("triangles", &expected, &tested, x,y, eval_diff(&dst->format->direct, &expected, &tested)); - success = FALSE; + success = false; } } } @@ -209,14 +209,14 @@ trifan_test(Display *dpy, picture_info *win, picture_info *dst, int op, return success; } -Bool +bool tristrip_test(Display *dpy, picture_info *win, picture_info *dst, int op, picture_info *src_color, picture_info *dst_color) { XPointFixed points[4]; color4d tdst, tsrc; int x, y; - Bool success = TRUE; + bool success = true; XImage *image; points[0].x = XDoubleToFixed(2); @@ -242,7 +242,7 @@ tristrip_test(Display *dpy, picture_info *win, picture_info *dst, int op, color_correct(dst, &tdst); /* Color expected inside of the triangles */ - do_composite(ops[op].op, &src_color->color, NULL, &dst_color->color, &tsrc, FALSE); + do_composite(ops[op].op, &src_color->color, NULL, &dst_color->color, &tsrc, false); color_correct(dst, &tsrc); image = XGetImage(dpy, dst->d, @@ -264,7 +264,7 @@ tristrip_test(Display *dpy, picture_info *win, picture_info *dst, int op, if (eval_diff(&dst->format->direct, &expected, &tested) > 2.) { print_fail("triangles", &expected, &tested, x, y, eval_diff(&dst->format->direct, &expected, &tested)); - success = FALSE; + success = false; } } } diff --git a/t_tsrccoords.c b/t_tsrccoords.c index b931c4a..7d6550e 100644 --- a/t_tsrccoords.c +++ b/t_tsrccoords.c @@ -77,12 +77,12 @@ static void init_transform (XTransform *t) /* Test drawing a 5x5 source image scaled 8x, as either a source or mask. */ -Bool +bool trans_coords_test(Display *dpy, picture_info *win, picture_info *white, - Bool test_mask) + bool test_mask) { color4d tested; - Bool failed = FALSE; + bool failed = false; int tested_colors[TEST_HEIGHT][TEST_WIDTH], expected_colors[TEST_HEIGHT][TEST_WIDTH]; XTransform t; picture_info *src; @@ -94,13 +94,13 @@ trans_coords_test(Display *dpy, picture_info *win, picture_info *white, * yet. */ if (win->format->type == PictTypeIndexed) { - return TRUE; + return true; } src = create_dot_picture(dpy); if (src == NULL) { fprintf(stderr, "couldn't allocate picture for test\n"); - return FALSE; + return false; } init_transform(&t); @@ -139,7 +139,7 @@ trans_coords_test(Display *dpy, picture_info *win, picture_info *white, tested_colors[y][x] = 9; } if (tested_colors[y][x] != expected_colors[y][x]) - failed = TRUE; + failed = true; } } diff --git a/t_tsrccoords2.c b/t_tsrccoords2.c index b083577..af593aa 100644 --- a/t_tsrccoords2.c +++ b/t_tsrccoords2.c @@ -70,14 +70,14 @@ static void destroy_target_picture(Display *dpy, picture_info *p) /* Test source or mask coordinates by drawing from a 5x5 picture into the 0,0 * pixel, rotated 90 degrees to the left. */ -Bool +bool trans_srccoords_test_2(Display *dpy, picture_info *win, picture_info *white, - Bool test_mask) + bool test_mask) { color4d expected, tested; int i; XRenderPictureAttributes pa; - Bool failed = FALSE; + bool failed = false; int tested_colors[5][5]; picture_info *src; XTransform t; @@ -86,7 +86,7 @@ trans_srccoords_test_2(Display *dpy, picture_info *win, picture_info *white, src = create_target_picture(dpy); if (src == NULL) { fprintf(stderr, "couldn't allocate picture for test\n"); - return FALSE; + return false; } /* Transform that rotates right from the destination coords to the @@ -111,12 +111,12 @@ trans_srccoords_test_2(Display *dpy, picture_info *win, picture_info *white, * alpha, the mask color should be written to the * destination. */ - pa.component_alpha = TRUE; + pa.component_alpha = true; XRenderChangePicture(dpy, src->pict, CPComponentAlpha, &pa); XRenderComposite(dpy, PictOpSrc, white->pict, src->pict, win->pict, 0, 0, 0, 0, 0, 0, 5, 5); - pa.component_alpha = FALSE; + pa.component_alpha = false; XRenderChangePicture(dpy, src->pict, CPComponentAlpha, &pa); } @@ -150,7 +150,7 @@ trans_srccoords_test_2(Display *dpy, picture_info *win, picture_info *white, print_fail(test_mask ? "mask coords" : "src coords", &expected, &tested, x, y, eval_diff(&win->format->direct, &expected, &tested)); - failed = TRUE; + failed = true; } } if (failed) { diff --git a/tests.c b/tests.c index f452b3d..62fa34b 100644 --- a/tests.c +++ b/tests.c @@ -283,12 +283,12 @@ create_formats_list(Display *dpy) describe_format(&name, NULL, format_list[nformats]); if (format_whitelist_len != 0) { - Bool ok = FALSE; + bool ok = false; int j; for (j = 0; j < format_whitelist_len; j++) { if (strcmp(format_whitelist[j], name) == 0) { - ok = TRUE; + ok = true; break; } } @@ -313,7 +313,7 @@ create_formats_list(Display *dpy) } } -Bool +bool do_tests(Display *dpy, picture_info *win) { int i, j, src; @@ -358,7 +358,7 @@ do_tests(Display *dpy, picture_info *win) pictures_1x1[i].format = format_list[i % nformats]; pictures_1x1[i].d = XCreatePixmap(dpy, DefaultRootWindow(dpy), 1, 1, pictures_1x1[i].format->depth); - pa.repeat = TRUE; + pa.repeat = true; pictures_1x1[i].pict = XRenderCreatePicture(dpy, pictures_1x1[i].d, pictures_1x1[i].format, CPRepeat, &pa); @@ -462,7 +462,7 @@ do { \ } if (enabled_tests & TEST_FILL) { - Bool ok, group_ok = TRUE; + bool ok, group_ok = true; printf("Beginning testing of filling of 1x1R pictures\n"); for (i = 0; i < num_tests; i++) { @@ -480,7 +480,7 @@ do { \ } if (enabled_tests & TEST_DSTCOORDS) { - Bool ok, group_ok = TRUE; + bool ok, group_ok = true; printf("Beginning dest coords test\n"); for (i = 0; i < 2; i++) { @@ -494,48 +494,48 @@ do { \ } if (enabled_tests & TEST_SRCCOORDS) { - Bool ok, group_ok = TRUE; + bool ok, group_ok = true; printf("Beginning src coords test\n"); - ok = srccoords_test(dpy, win, argb32white, FALSE); + ok = srccoords_test(dpy, win, argb32white, false); RECORD_RESULTS(); if (group_ok) success_mask |= TEST_SRCCOORDS; } if (enabled_tests & TEST_MASKCOORDS) { - Bool ok, group_ok = TRUE; + bool ok, group_ok = true; printf("Beginning mask coords test\n"); - ok = srccoords_test(dpy, win, argb32white, TRUE); + ok = srccoords_test(dpy, win, argb32white, true); RECORD_RESULTS(); if (group_ok) success_mask |= TEST_MASKCOORDS; } if (enabled_tests & TEST_TSRCCOORDS) { - Bool ok, group_ok = TRUE; + bool ok, group_ok = true; printf("Beginning transformed src coords test\n"); - ok = trans_coords_test(dpy, win, argb32white, FALSE); + ok = trans_coords_test(dpy, win, argb32white, false); RECORD_RESULTS(); printf("Beginning transformed src coords test 2\n"); - ok = trans_srccoords_test_2(dpy, win, argb32white, FALSE); + ok = trans_srccoords_test_2(dpy, win, argb32white, false); RECORD_RESULTS(); if (group_ok) success_mask |= TEST_TSRCCOORDS; } if (enabled_tests & TEST_TMASKCOORDS) { - Bool ok, group_ok = TRUE; + bool ok, group_ok = true; printf("Beginning transformed mask coords test\n"); - ok = trans_coords_test(dpy, win, argb32white, TRUE); + ok = trans_coords_test(dpy, win, argb32white, true); RECORD_RESULTS(); printf("Beginning transformed mask coords test 2\n"); - ok = trans_srccoords_test_2(dpy, win, argb32white, TRUE); + ok = trans_srccoords_test_2(dpy, win, argb32white, true); RECORD_RESULTS(); if (group_ok) @@ -543,7 +543,7 @@ do { \ } if (enabled_tests & TEST_BLEND) { - Bool ok, group_ok = TRUE; + bool ok, group_ok = true; for (j = 0; j <= num_dests; j++) { picture_info *pi; @@ -566,7 +566,7 @@ do { \ } if (enabled_tests & TEST_COMPOSITE) { - Bool ok, group_ok = TRUE; + bool ok, group_ok = true; for (j = 0; j <= num_dests; j++) { picture_info *pi; @@ -583,7 +583,7 @@ do { \ test_src, num_test_src, test_mask, num_test_mask, test_dst, num_test_dst, - FALSE); + false); RECORD_RESULTS(); } if (group_ok) @@ -591,7 +591,7 @@ do { \ } if (enabled_tests & TEST_CACOMPOSITE) { - Bool ok, group_ok = TRUE; + bool ok, group_ok = true; for (j = 0; j <= num_dests; j++) { picture_info *pi; @@ -608,7 +608,7 @@ do { \ test_src, num_test_src, test_mask, num_test_mask, test_dst, num_test_dst, - TRUE); + true); RECORD_RESULTS(); } if (group_ok) @@ -616,7 +616,7 @@ do { \ } if (enabled_tests & TEST_GRADIENTS) { - Bool ok, group_ok = TRUE; + bool ok, group_ok = true; printf("Beginning render to linear gradient test\n"); ok = render_to_gradient_test(dpy, &pictures_1x1[0]); @@ -648,7 +648,7 @@ do { \ } if (enabled_tests & TEST_REPEAT) { - Bool ok, group_ok = TRUE; + bool ok, group_ok = true; for (i = 0; i < num_ops; i++) { if (ops[i].disabled) @@ -667,7 +667,7 @@ do { \ * consisting of colors 1 and 2 (r, g). */ ok = repeat_test(dpy, win, pi, i, argb32white, argb32red, - argb32green, FALSE); + argb32green, false); RECORD_RESULTS(); printf("Beginning %s mask repeat test on %s\n", @@ -676,7 +676,7 @@ do { \ * repeating mask consisting of colors 1 and 2 (r, g). */ ok = repeat_test(dpy, win, pi, i, argb32white, argb32red, - argb32green, TRUE); + argb32green, true); RECORD_RESULTS(); } } @@ -685,7 +685,7 @@ do { \ } if (enabled_tests & TEST_TRIANGLES) { - Bool ok, group_ok = TRUE; + bool ok, group_ok = true; for (i = 0; i < num_ops; i++) { if (ops[i].disabled) @@ -723,7 +723,7 @@ do { \ } if (enabled_tests & TEST_BUG7366) { - Bool ok, group_ok = TRUE; + bool ok, group_ok = true; ok = bug7366_test(dpy); RECORD_RESULTS(); @@ -733,7 +733,7 @@ do { \ } if (enabled_tests & TEST_GTK_ARGB_XBGR) { - Bool ok, group_ok = TRUE; + bool ok, group_ok = true; ok = gtk_argb_xbgr_test(dpy); RECORD_RESULTS(); @@ -743,12 +743,12 @@ do { \ } if (enabled_tests & TEST_LIBREOFFICE_XRGB) { - Bool ok, group_ok = TRUE; + bool ok, group_ok = true; - ok = libreoffice_xrgb_test(dpy, FALSE); + ok = libreoffice_xrgb_test(dpy, false); RECORD_RESULTS(); - ok = libreoffice_xrgb_test(dpy, TRUE); + ok = libreoffice_xrgb_test(dpy, true); RECORD_RESULTS(); if (group_ok) -- cgit v1.2.3