diff options
author | Kristian Høgsberg <krh@bitplanet.net> | 2013-01-28 16:01:22 -0500 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2013-02-14 15:58:40 -0500 |
commit | cc7ad840788cbbddfcfb3d0bc2a1ec77fb46d5e8 (patch) | |
tree | 78df996bf6ca61570942f07aae4b22ffcf03cf9a | |
parent | b4ca478afdc80727683ac6c266a1c5d874f66364 (diff) | |
download | weston-cc7ad840788cbbddfcfb3d0bc2a1ec77fb46d5e8.tar.gz |
Add new shared/image-loader.h to separate include dependencies
Before, cairo-util.h would combine pixman and cairo includes. X11 and
Wayland compositors uses this to load an image as a pixman_image_t but are
forced to include cairo headers. Clients use load_cairo_surface to
load images as cairo_surface_t's, but are forced to include pixman.h.
We move the load_image pixman prototype to its own header, so compositors
can get at the pixman prototype without including cairo.h and clients
can include the cairo based function without including pixman.h.
Conflicts:
src/compositor-wayland.c
-rw-r--r-- | shared/Makefile.am | 1 | ||||
-rw-r--r-- | shared/cairo-util.c | 3 | ||||
-rw-r--r-- | shared/cairo-util.h | 4 | ||||
-rw-r--r-- | shared/image-loader.c | 2 | ||||
-rw-r--r-- | shared/image-loader.h | 31 | ||||
-rw-r--r-- | src/compositor-wayland.c | 2 | ||||
-rw-r--r-- | src/compositor-x11.c | 2 |
7 files changed, 37 insertions, 8 deletions
diff --git a/shared/Makefile.am b/shared/Makefile.am index b38cb95d..1b06c89f 100644 --- a/shared/Makefile.am +++ b/shared/Makefile.am @@ -26,5 +26,6 @@ libshared_cairo_la_LIBADD = \ libshared_cairo_la_SOURCES = \ $(libshared_la_SOURCES) \ image-loader.c \ + image-loader.h \ cairo-util.c \ cairo-util.h diff --git a/shared/cairo-util.c b/shared/cairo-util.c index 360099ed..8b41f413 100644 --- a/shared/cairo-util.c +++ b/shared/cairo-util.c @@ -31,7 +31,8 @@ #include <cairo.h> #include "cairo-util.h" -#include "../shared/config-parser.h" +#include "image-loader.h" +#include "config-parser.h" #define ARRAY_LENGTH(a) (sizeof (a) / sizeof (a)[0]) diff --git a/shared/cairo-util.h b/shared/cairo-util.h index 3b93d40d..aff46690 100644 --- a/shared/cairo-util.h +++ b/shared/cairo-util.h @@ -24,7 +24,6 @@ #define _CAIRO_UTIL_H #include <cairo.h> -#include <pixman.h> void surface_flush_device(cairo_surface_t *surface); @@ -90,7 +89,4 @@ enum theme_location { enum theme_location theme_get_location(struct theme *t, int x, int y, int width, int height, int flags); -pixman_image_t * -load_image(const char *filename); - #endif diff --git a/shared/image-loader.c b/shared/image-loader.c index 64ba2aea..c9f15d49 100644 --- a/shared/image-loader.c +++ b/shared/image-loader.c @@ -29,7 +29,7 @@ #include <png.h> #include <pixman.h> -#include "cairo-util.h" +#include "image-loader.h" #define ARRAY_LENGTH(a) (sizeof (a) / sizeof (a)[0]) diff --git a/shared/image-loader.h b/shared/image-loader.h new file mode 100644 index 00000000..445e651e --- /dev/null +++ b/shared/image-loader.h @@ -0,0 +1,31 @@ +/* + * Copyright © 2013 Intel Corporation + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#ifndef _IMAGE_LOADER_H +#define _IMAGE_LOADER_H + +#include <pixman.h> + +pixman_image_t * +load_image(const char *filename); + +#endif diff --git a/src/compositor-wayland.c b/src/compositor-wayland.c index c675e83e..7fe7d5da 100644 --- a/src/compositor-wayland.c +++ b/src/compositor-wayland.c @@ -42,7 +42,7 @@ #include <EGL/eglext.h> #include "compositor.h" -#include "../shared/cairo-util.h" +#include "../shared/image-loader.h" struct wayland_compositor { struct weston_compositor base; diff --git a/src/compositor-x11.c b/src/compositor-x11.c index a5462630..d1b6ec7f 100644 --- a/src/compositor-x11.c +++ b/src/compositor-x11.c @@ -50,7 +50,7 @@ #include "compositor.h" #include "../shared/config-parser.h" -#include "../shared/cairo-util.h" +#include "../shared/image-loader.h" #define DEFAULT_AXIS_STEP_DISTANCE wl_fixed_from_int(10) |