[nautilus] [eel] port eel-gdk-pixbuf-extensions to cairo drawing



commit 172af77cfbdc4910034a100a99aa1ec2cb843495
Author: Benjamin Otte <otte redhat com>
Date:   Fri Aug 13 17:37:38 2010 +0200

    [eel] port eel-gdk-pixbuf-extensions to cairo drawing

 eel/eel-gdk-pixbuf-extensions.c |   28 +++++++++-------------------
 eel/eel-gdk-pixbuf-extensions.h |    8 +-------
 2 files changed, 10 insertions(+), 26 deletions(-)
---
diff --git a/eel/eel-gdk-pixbuf-extensions.c b/eel/eel-gdk-pixbuf-extensions.c
index 95fdd4c..dd83550 100644
--- a/eel/eel-gdk-pixbuf-extensions.c
+++ b/eel/eel-gdk-pixbuf-extensions.c
@@ -611,13 +611,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;
@@ -626,15 +622,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);
 	
@@ -668,16 +660,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 d9919f6..2dca7bf 100644
--- a/eel/eel-gdk-pixbuf-extensions.h
+++ b/eel/eel-gdk-pixbuf-extensions.h
@@ -10,7 +10,6 @@
    License, or (at your option) any later version.
 
    The Gnome Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Library General Public License for more details.
 
@@ -31,7 +30,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 +98,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,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]