diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2011-07-01 12:22:30 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2011-07-01 12:22:30 +0100 |
commit | 2eb8c3a0a0f51bedb2b2614e1d0829ca809d3416 (patch) | |
tree | f9fd0bd1d6191b50210c895cb5dcfd79841f56ba | |
parent | b891fdc824bd72533797187c8b3faa0d2e5eb8ca (diff) |
spiral: Add option to hide the images
-rw-r--r-- | spiral-demo.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/spiral-demo.c b/spiral-demo.c index c085a16..7ce2675 100644 --- a/spiral-demo.c +++ b/spiral-demo.c @@ -223,6 +223,7 @@ int main(int argc, char **argv) int theta, frames, n; int show_path = 1; int show_outline = 1; + int show_images = 1; int show_fps = 1; device = device_open(argc, argv); @@ -235,6 +236,8 @@ int main(int argc, char **argv) show_path = 0; } else if (strcmp (argv[n], "--hide-outline") == 0) { show_outline = 0; + } else if (strcmp (argv[n], "--hide-images") == 0) { + show_images = 0; } else if (strcmp (argv[n], "--hide-fps") == 0) { show_fps = 0; } @@ -300,18 +303,20 @@ int main(int argc, char **argv) int h = 2*ceil(step/M_SQRT2/5*3 * (1+theta/360.)); cairo_save(cr); - cairo_translate(cr, width/2+dx, height/2+dy); - cairo_rotate(cr, M_PI/2+spin+(rotation+theta)/180.*M_PI); - cairo_scale(cr, - w/(double)source->width, - h/(double)source->height); - cairo_set_source_surface(cr, source->surface, - -source->width/2, - -source->height/2); - cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_NONE); - cairo_pattern_set_filter(cairo_get_source(cr), CAIRO_FILTER_BILINEAR); - cairo_identity_matrix(cr); - cairo_paint(cr); + if (show_images) { + cairo_translate(cr, width/2+dx, height/2+dy); + cairo_rotate(cr, M_PI/2+spin+(rotation+theta)/180.*M_PI); + cairo_scale(cr, + w/(double)source->width, + h/(double)source->height); + cairo_set_source_surface(cr, source->surface, + -source->width/2, + -source->height/2); + cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_NONE); + cairo_pattern_set_filter(cairo_get_source(cr), CAIRO_FILTER_BILINEAR); + cairo_identity_matrix(cr); + cairo_paint(cr); + } if (show_outline) { cairo_set_source_rgb(cr, 1, 1, 1); |