From b48f094490651a8ee23cd70bd512a29231c23fcc Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Tue, 16 Sep 2008 19:46:03 +0200 Subject: [PATCH] draw: remove GdkPixBuf support Signed-off-by: Julien Danjou --- README | 2 +- awesomeConfig.cmake | 12 ------- common/version.c | 10 ------ draw.c | 82 --------------------------------------------- 4 files changed, 1 insertion(+), 105 deletions(-) diff --git a/README b/README index 891e3fbd3..188dbf269 100644 --- a/README +++ b/README @@ -14,7 +14,7 @@ In order to build awesome itself, you need header files and libs of: - pango and pangocairo - libev - glib - - Imlib2 or GdkPixBuf (use -DWITH_IMLIB2=OFF with cmake) + - Imlib2 - dbus (optional, use -DWITH_DBUS=OFF with cmake to disable) - gperf diff --git a/awesomeConfig.cmake b/awesomeConfig.cmake index ee5aefa95..007b61065 100644 --- a/awesomeConfig.cmake +++ b/awesomeConfig.cmake @@ -213,18 +213,6 @@ if(WITH_IMLIB2) message(STATUS "Imlib2 not found. Disabled.") endif() endif() - -if(NOT WITH_IMLIB2) - pkg_check_modules(GDK_PIXBUF REQUIRED gdk-2.0>=2.2 gdk-pixbuf-2.0>=2.2) - if(GDK_PIXBUF_FOUND) - set(AWESOME_OPTIONAL_LIBRARIES ${AWESOME_OPTIONAL_LIBRARIES} - ${GDK_PIXBUF_LIBRARIES}) - set(AWESOME_OPTIONAL_INCLUDE_DIRS ${AWESOME_OPTIONAL_INCLUDE_DIRS} - ${GDK_PIXBUF_INCLUDE_DIRS}) - else() - message(FATAL_ERROR "GdkPixBuf not found.") - endif() -endif() # }}} # {{{ Install path and configuration variables diff --git a/common/version.c b/common/version.c index 294d014d2..f6474c2e5 100644 --- a/common/version.c +++ b/common/version.c @@ -26,10 +26,6 @@ #include "common/version.h" #include "awesome-version-internal.h" -#ifndef WITH_IMLIB2 -#include -#endif - /** \brief Print version message and quit program. * \param executable program name */ @@ -51,12 +47,6 @@ eprint_version(const char *const executable) __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__); #endif printf(" (%s@%s)\n", AWESOME_COMPILE_BY, AWESOME_COMPILE_HOSTNAME); - printf(" • Image drawing engine: "); -#ifdef WITH_IMLIB2 - printf("Imlib2\n"); -#else - printf("GdkPixBuf " GDK_PIXBUF_VERSION "\n"); -#endif printf(" • D-Bus support: "); #ifdef WITH_DBUS printf("✔\n"); diff --git a/draw.c b/draw.c index 8e94cecce..51eadd78f 100644 --- a/draw.c +++ b/draw.c @@ -22,12 +22,7 @@ #include #include "config.h" -#ifdef WITH_IMLIB2 #include -#else -#include -#include -#endif #include #include @@ -773,81 +768,6 @@ draw_image_from_argb_data(draw_context_t *ctx, int x, int y, int w, int h, cairo_surface_destroy(source); } -#ifndef WITH_IMLIB2 - -/** Load an image from filename. - * \param filename The image file to load. - * \return A new image. - */ -draw_image_t * -draw_image_new(const char *filename) -{ - draw_image_t *image = NULL; - GdkPixbuf *pixbuf; - GError *error = NULL; - - if(filename) - { - if(!(pixbuf = gdk_pixbuf_new_from_file(filename,&error))) - { - warn("cannot load image %s: %s", filename, error ? error->message : "unknown error"); - if(error) - g_error_free(error); - } - else - { - image = p_new(draw_image_t, 1); - image->data = pixbuf; - image->width = gdk_pixbuf_get_width(pixbuf); - image->height = gdk_pixbuf_get_height(pixbuf); - } - } - - return image; -} - -/** Delete an image. - * \param image The image to delete. - */ -void -draw_image_delete(draw_image_t **image) -{ - if(*image) - { - gdk_pixbuf_unref((*image)->data); - p_delete(image); - } -} - -/** Draw an image to a draw context. - * \param ctx Draw context to draw to. - * \param x x coordinate. - * \param y y coordinate. - * \param wanted_h Wanted height: if > 0, image will be resized. - * \param image The image to draw. - */ -void -draw_image(draw_context_t *ctx, int x, int y, int wanted_h, draw_image_t *image) -{ - cairo_t *cr; - - cr = cairo_create(ctx->surface); - if(wanted_h > 0 && image->height > 0) - { - double ratio = (double) wanted_h / (double) image->height; - cairo_scale(cr, ratio, ratio); - gdk_cairo_set_source_pixbuf(cr, image->data, x / ratio, y / ratio); - } - else - gdk_cairo_set_source_pixbuf(cr, image->data, x, y); - - cairo_paint(cr); - - cairo_destroy(cr); -} - -#else /* WITH_IMLIB2 */ - static const char * draw_imlib_load_strerror(Imlib_Load_Error e) { @@ -971,8 +891,6 @@ draw_image(draw_context_t *ctx, int x, int y, int wanted_h, draw_image_t *image) draw_image_from_argb_data(ctx, x, y, image->width, image->height, wanted_h, image->data); } -#endif /* WITH_IMLIB2 */ - /** Rotate a pixmap. * \param ctx Draw context to draw with. * \param src Drawable to draw from.