summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasmine Hassan <[email protected]>2012-10-18 13:26:31 +0200
committerJasmine Hassan <[email protected]>2012-11-13 06:25:03 +0200
commitef8b06eaa8c26e592e9028b8a93361653abfb8ed (patch)
tree00ba1ff626da063af3cc5249d4aaada692d31d15
parent92ff8b1860812a2cb58bfb492765b109411d8fd5 (diff)
downloadcaja-ef8b06eaa8c26e592e9028b8a93361653abfb8ed.tar.bz2
caja-ef8b06eaa8c26e592e9028b8a93361653abfb8ed.tar.xz
[eel] port eel-gdk-pixbuf-extensions to cairo drawing
http://git.gnome.org/browse/nautilus/commit/?id=172af77cfbdc4910034a100a99aa1ec2cb843495
-rw-r--r--eel/eel-gdk-pixbuf-extensions.c28
-rw-r--r--eel/eel-gdk-pixbuf-extensions.h7
2 files changed, 10 insertions, 25 deletions
diff --git a/eel/eel-gdk-pixbuf-extensions.c b/eel/eel-gdk-pixbuf-extensions.c
index a75158db..62bc58eb 100644
--- a/eel/eel-gdk-pixbuf-extensions.c
+++ b/eel/eel-gdk-pixbuf-extensions.c
@@ -649,13 +649,9 @@ eel_gdk_pixbuf_unref_if_not_null (GdkPixbuf *pixbuf_or_null)
void
eel_gdk_pixbuf_draw_to_drawable (const GdkPixbuf *pixbuf,
GdkDrawable *drawable,
- GdkGC *gc,
int source_x,
int source_y,
- EelIRect destination_area,
- GdkRgbDither dither,
- GdkPixbufAlphaMode alpha_compositing_mode,
- int alpha_threshold)
+ EelIRect destination_area)
{
EelDimensions dimensions;
EelIRect target;
@@ -664,15 +660,11 @@ eel_gdk_pixbuf_draw_to_drawable (const GdkPixbuf *pixbuf,
int target_height;
int source_width;
int source_height;
+ cairo_t *cr;
g_return_if_fail (eel_gdk_pixbuf_is_valid (pixbuf));
g_return_if_fail (drawable != NULL);
- g_return_if_fail (gc != NULL);
g_return_if_fail (!eel_irect_is_empty (&destination_area));
- g_return_if_fail (alpha_threshold > EEL_OPACITY_FULLY_TRANSPARENT);
- g_return_if_fail (alpha_threshold <= EEL_OPACITY_FULLY_OPAQUE);
- g_return_if_fail (alpha_compositing_mode >= GDK_PIXBUF_ALPHA_BILEVEL);
- g_return_if_fail (alpha_compositing_mode <= GDK_PIXBUF_ALPHA_FULL);
dimensions = eel_gdk_pixbuf_get_dimensions (pixbuf);
@@ -707,16 +699,14 @@ eel_gdk_pixbuf_draw_to_drawable (const GdkPixbuf *pixbuf,
target.x1 = target.x0 + MIN (target_width, source_width);
target.y1 = target.y0 + MIN (target_height, source_height);
- gdk_draw_pixbuf (drawable, gc, (GdkPixbuf *) pixbuf,
- source.x0,
- source.y0,
- target.x0,
- target.y0,
+ cr = gdk_cairo_create (drawable);
+ gdk_cairo_set_source_pixbuf (cr, (GdkPixbuf *) pixbuf,
+ source.x0 - target.x0, source.y0 - target.y0);
+ cairo_rectangle (cr, target.x0, target.y0,
target.x1 - target.x0,
- target.y1 - target.y0,
- dither,
- 0,
- 0);
+ target.y1 - target.y0);
+ cairo_fill (cr);
+ cairo_destroy (cr);
}
/**
diff --git a/eel/eel-gdk-pixbuf-extensions.h b/eel/eel-gdk-pixbuf-extensions.h
index 7d7956e4..ae649e55 100644
--- a/eel/eel-gdk-pixbuf-extensions.h
+++ b/eel/eel-gdk-pixbuf-extensions.h
@@ -31,7 +31,6 @@
#include <gdk/gdk.h>
#include <gio/gio.h>
-#define EEL_STANDARD_ALPHA_THRESHHOLD 128
#define EEL_OPACITY_FULLY_TRANSPARENT 0
#define EEL_OPACITY_FULLY_OPAQUE 255
@@ -100,13 +99,9 @@ void eel_gdk_pixbuf_unref_if_not_null (GdkPixbuf
/* Copy a pixbuf to an area of a GdkDrawable */
void eel_gdk_pixbuf_draw_to_drawable (const GdkPixbuf *pixbuf,
GdkDrawable *drawable,
- GdkGC *gc,
int source_x,
int source_y,
- EelIRect destination_area,
- GdkRgbDither dither,
- GdkPixbufAlphaMode alpha_compositing_mode,
- int alpha_threshold);
+ EelIRect destination_area);
/* Copy a pixbuf to an area of another pixbuf */
void eel_gdk_pixbuf_draw_to_pixbuf (const GdkPixbuf *pixbuf,