diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2012-03-21 11:27:37 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2012-03-21 11:27:37 +0000 |
commit | e3a33957d3f300829c477a81753ce03189fbf486 (patch) | |
tree | aeb10c40ae43b5e7fa5b684d5e4ce848bd096cf9 | |
parent | 4cce564fe294f16369f26a62a8e7d48bbf39591c (diff) |
A small step towards portability: wean off gdk-pixbuf-2.0
Still lots of UNIXy code...
-rw-r--r-- | Makefile | 22 | ||||
-rw-r--r-- | chart-demo.c | 3 | ||||
-rw-r--r-- | demo.c | 2 | ||||
-rw-r--r-- | demo.h | 6 | ||||
-rw-r--r-- | dragon-demo.c | 7 | ||||
-rw-r--r-- | fish-demo.c | 3 | ||||
-rw-r--r-- | flowers-demo.c | 1 | ||||
-rw-r--r-- | gears-demo.c | 3 | ||||
-rw-r--r-- | gradient-demo.c | 3 | ||||
-rw-r--r-- | maze-demo.c | 3 | ||||
-rw-r--r-- | pythagoras-demo.c | 7 | ||||
-rw-r--r-- | sierpinski-demo.c | 3 | ||||
-rw-r--r-- | spiral-demo.c | 3 | ||||
-rw-r--r-- | tiger-demo.c | 3 | ||||
-rw-r--r-- | waterfall-demo.c | 3 | ||||
-rw-r--r-- | wave-demo.c | 3 |
16 files changed, 68 insertions, 7 deletions
@@ -1,6 +1,5 @@ -SOURCES:=demo.c xlib.c ximage.c -REQUIRES:=cairo-xlib xext gdk-pixbuf-2.0 -DEFINES:=-DHAVE_XLIB=1 -DHAVE_XIMAGE=1 +SOURCES:=demo.c +REQUIRES:= DRM:=0 ifneq ($(DRM),0) @@ -11,6 +10,15 @@ else DEFINES+=-DHAVE_DRM=0 endif +XLIB:=$(shell pkg-config --exists cairo-xcb && echo 1 || echo 0) +ifneq ($(XLIB),0) +DEFINES+=-DHAVE_XLIB=1 -DHAVE_XIMAGE=1 +SOURCES+=xlib.c ximage.c +REQUIRES+=cairo-xlib xext +else +DEFINES+=-DHAVE_XLIB=0 +endif + XCB:=$(shell pkg-config --exists cairo-xcb && echo 1 || echo 0) ifneq ($(XCB),0) DEFINES+=-DHAVE_XCB=1 @@ -38,13 +46,19 @@ else DEFINES+=-DHAVE_COGL=0 endif -all: spinner-demo spiral-demo slideshow-demo tiger-demo fish-demo flowers-demo gears-demo gradient-demo chart-demo waterfall-demo dragon-demo pythagoras-demo wave-demo sierpinski-demo maze-demo +all: spiral-demo tiger-demo fish-demo flowers-demo gears-demo gradient-demo chart-demo waterfall-demo dragon-demo pythagoras-demo wave-demo sierpinski-demo maze-demo ifeq ($(shell pkg-config --exists poppler-glib && echo 1), 1) all: poppler-demo REQUIRES+=poppler-glib endif +ifeq ($(shell pkg-config --exists gdk-pixbuf-2.0 && echo 1), 1) +all: spinner-demo slideshow-demo +REQUIRES+=gdk-pixbuf-2.0 +DEFINES+=-DHAVE_GDK_PIXBUF +endif + CFLAGS:=$(shell pkg-config --cflags $(REQUIRES)) -Wall -g3 LIBS:=$(shell pkg-config --libs $(REQUIRES)) diff --git a/chart-demo.c b/chart-demo.c index 9ab3d51..a7c7b36 100644 --- a/chart-demo.c +++ b/chart-demo.c @@ -1,7 +1,10 @@ #include <cairo.h> #include <sys/time.h> #include <stdlib.h> +#include <stdio.h> +#include <signal.h> #include <string.h> +#include <unistd.h> #include <math.h> #include "demo.h" @@ -214,6 +214,7 @@ struct device *device_open(int argc, char **argv) return device; } +#if HAVE_GDK_PIXBUF cairo_surface_t * _cairo_image_surface_create_from_pixbuf(const GdkPixbuf *pixbuf) { @@ -291,6 +292,7 @@ _cairo_image_surface_create_from_pixbuf(const GdkPixbuf *pixbuf) return surface; } +#endif #define N_FILTER 25 static double filter[N_FILTER]; @@ -1,7 +1,7 @@ #include <stdint.h> +#include <sys/time.h> #include <cairo.h> -#include <gdk-pixbuf/gdk-pixbuf.h> struct device; struct framebuffer; @@ -93,8 +93,12 @@ struct device *drm_open (int argc, char **argv); static inline struct device *drm_open (int argc, char **argv) { return 0; } #endif +#if HAVE_GDK_PIXBUF +#include <gdk-pixbuf/gdk-pixbuf.h> + cairo_surface_t * _cairo_image_surface_create_from_pixbuf(const GdkPixbuf *pixbuf); +#endif void fps_draw (cairo_t *cr, const char *name, const char *version, diff --git a/dragon-demo.c b/dragon-demo.c index fb19799..a9dd81e 100644 --- a/dragon-demo.c +++ b/dragon-demo.c @@ -28,12 +28,15 @@ #include "demo.h" #include <string.h> +#include <stdio.h> +#include <signal.h> +#include <unistd.h> #include <sys/time.h> -static cairo_bool_t +static int direction (int i, int np2) { - cairo_bool_t ret = TRUE; + int ret = 1; while (i >= 2 && i + 1 < np2) { i = np2 - i - 2; diff --git a/fish-demo.c b/fish-demo.c index 91aa383..52191a5 100644 --- a/fish-demo.c +++ b/fish-demo.c @@ -1,6 +1,9 @@ #include <cairo.h> #include <sys/time.h> #include <stdlib.h> +#include <stdio.h> +#include <signal.h> +#include <unistd.h> #include <string.h> #include "demo.h" diff --git a/flowers-demo.c b/flowers-demo.c index 370ac63..a875a10 100644 --- a/flowers-demo.c +++ b/flowers-demo.c @@ -9,6 +9,7 @@ #include <stdlib.h> #include <stdio.h> #include <string.h> +#include <signal.h> #include <unistd.h> #include <math.h> #include <assert.h> diff --git a/gears-demo.c b/gears-demo.c index ee6fbb0..c7dd78e 100644 --- a/gears-demo.c +++ b/gears-demo.c @@ -28,7 +28,10 @@ #include <cairo.h> #include <sys/time.h> #include <stdlib.h> +#include <stdio.h> +#include <signal.h> #include <string.h> +#include <unistd.h> #include <math.h> #include "demo.h" diff --git a/gradient-demo.c b/gradient-demo.c index 4a272e0..d368a09 100644 --- a/gradient-demo.c +++ b/gradient-demo.c @@ -28,7 +28,10 @@ #include <cairo.h> #include <sys/time.h> #include <stdlib.h> +#include <stdio.h> +#include <signal.h> #include <string.h> +#include <unistd.h> #include <math.h> #include "demo.h" diff --git a/maze-demo.c b/maze-demo.c index 276c01c..e6b51b7 100644 --- a/maze-demo.c +++ b/maze-demo.c @@ -1,5 +1,8 @@ #include "demo.h" #include <stdlib.h> +#include <stdio.h> +#include <signal.h> +#include <unistd.h> #include <string.h> #include <sys/time.h> #include <math.h> diff --git a/pythagoras-demo.c b/pythagoras-demo.c index cd0221a..a84785e 100644 --- a/pythagoras-demo.c +++ b/pythagoras-demo.c @@ -28,8 +28,15 @@ #define _USE_MATH_DEFINES /* for M_SQRT2 on win32 */ #include <math.h> #include <string.h> +#include <stdio.h> +#include <signal.h> +#include <unistd.h> #include <sys/time.h> +#ifndef MAX +#define MAX(a,b) ((a) >= (b) ? (a) : (b)) +#endif + static void add_rectangle (cairo_t *cr, double size) { diff --git a/sierpinski-demo.c b/sierpinski-demo.c index 5bd78a2..9188e24 100644 --- a/sierpinski-demo.c +++ b/sierpinski-demo.c @@ -1,5 +1,8 @@ #include "demo.h" #include <string.h> +#include <stdio.h> +#include <signal.h> +#include <unistd.h> #include <sys/time.h> #include <math.h> diff --git a/spiral-demo.c b/spiral-demo.c index cf7f2a7..e434eb6 100644 --- a/spiral-demo.c +++ b/spiral-demo.c @@ -1,7 +1,10 @@ #include <cairo.h> #include <sys/time.h> #include <stdlib.h> +#include <stdio.h> #include <string.h> +#include <signal.h> +#include <unistd.h> #include <math.h> #include "demo.h" diff --git a/tiger-demo.c b/tiger-demo.c index a607f30..678e8c4 100644 --- a/tiger-demo.c +++ b/tiger-demo.c @@ -16,6 +16,9 @@ #include <cairo.h> #include <sys/time.h> +#include <stdio.h> +#include <signal.h> +#include <unistd.h> #include "demo.h" diff --git a/waterfall-demo.c b/waterfall-demo.c index 61957dc..a91ce6a 100644 --- a/waterfall-demo.c +++ b/waterfall-demo.c @@ -1,6 +1,9 @@ #include <cairo.h> #include <sys/time.h> #include <stdlib.h> +#include <stdio.h> +#include <signal.h> +#include <unistd.h> #include <string.h> #include <math.h> diff --git a/wave-demo.c b/wave-demo.c index 67b9d62..0ec585b 100644 --- a/wave-demo.c +++ b/wave-demo.c @@ -27,6 +27,9 @@ #include "demo.h" #include <stdlib.h> #include <string.h> +#include <stdio.h> +#include <unistd.h> +#include <signal.h> #include <sys/time.h> static unsigned int seed = 0xdeadbeef; |