diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2012-03-08 16:43:43 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2012-03-08 16:46:25 +0000 |
commit | 31e08645dcc8263736436796752018c1df4f8d73 (patch) | |
tree | 42fa1c39c77f376bd7bcb1691774a7b41278824f | |
parent | 9d732d7c92c14300d100303d84af9a25b84e79d0 (diff) |
demo: Make the antialias hint options dependent upon cairo-1.11.4
-rw-r--r-- | demo.c | 16 | ||||
-rw-r--r-- | demo.h | 2 | ||||
-rw-r--r-- | tiger-demo.c | 13 |
3 files changed, 19 insertions, 12 deletions
@@ -94,16 +94,32 @@ static cairo_antialias_t str_to_antialias(const char *str) { if (strcmp (str, "none") == 0) return CAIRO_ANTIALIAS_NONE; +#if CAIRO_VERSION > CAIRO_VERSION_ENCODE(1,11,3) else if (strcmp (str, "fast") == 0) return CAIRO_ANTIALIAS_FAST; else if (strcmp (str, "good") == 0) return CAIRO_ANTIALIAS_GOOD; else if (strcmp (str, "best") == 0) return CAIRO_ANTIALIAS_BEST; +#endif else return CAIRO_ANTIALIAS_DEFAULT; } +const char *device_antialias_to_string(cairo_antialias_t antialias) +{ + switch (antialias) { + case CAIRO_ANTIALIAS_NONE: return "none"; +#if CAIRO_VERSION > CAIRO_VERSION_ENCODE(1,11,3) + case CAIRO_ANTIALIAS_FAST: return "fast"; + case CAIRO_ANTIALIAS_BEST: return "best"; +#endif + case CAIRO_ANTIALIAS_GRAY: return "gray"; + case CAIRO_ANTIALIAS_SUBPIXEL: return "subpixel"; + default: return "default"; + } +} + cairo_antialias_t device_get_antialias(int argc, char **argv) { int n; @@ -43,6 +43,8 @@ enum split { } device_get_split(int argc, char **argv); cairo_antialias_t device_get_antialias(int argc, char **argv); +const char *device_antialias_to_string(cairo_antialias_t antialias); + int device_get_benchmark(int argc, char **argv); enum clip { CLIP_NONE, diff --git a/tiger-demo.c b/tiger-demo.c index 7bffc19..a607f30 100644 --- a/tiger-demo.c +++ b/tiger-demo.c @@ -74,17 +74,6 @@ static void tiger(struct device *device, cairo_destroy (cr); } -static const char *antialias_to_string(cairo_antialias_t antialias) -{ - switch (antialias) { - case CAIRO_ANTIALIAS_NONE: return "none"; - case CAIRO_ANTIALIAS_FAST: return "fast"; - case CAIRO_ANTIALIAS_GRAY: return "gray"; - case CAIRO_ANTIALIAS_SUBPIXEL: return "subpixel"; - default: return "best"; - } -} - static int done; static void signal_handler(int sig) { @@ -156,7 +145,7 @@ int main (int argc, char **argv) delta += (now.tv_usec - start.tv_usec)*1e-6; if (delta > benchmark) { printf("tiger-%s: %.2f fps\n", - antialias_to_string(antialias), + device_antialias_to_string(antialias), frame / delta); break; } |