summaryrefslogtreecommitdiff
path: root/gdk/gdkpixbuf-render.c
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2005-05-07 18:51:18 +0000
committerOwen Taylor <otaylor@src.gnome.org>2005-05-07 18:51:18 +0000
commit274e49f37e16830d4eed74092653062d67ae78cd (patch)
treecec385199452bc0f0c5ec41d962eaca5015dd495 /gdk/gdkpixbuf-render.c
parent778b99a403c1a69e33f96cd140666fe7278195e5 (diff)
downloadgtk+-274e49f37e16830d4eed74092653062d67ae78cd.tar.gz
Change prototype to match cairo_set_source_surface().
2005-05-07 Owen Taylor <otaylor@redhat.com> * gdk/gdkpixbuf-render.c gdk/gdkpixbuf.h (gdk_pixbuf_set_as_cairo_source): Change prototype to match cairo_set_source_surface(). * gdk/gdkdraw.c gdk/gdkgc.c gdk/gdkpixbuf-render.c gdk/gdkwindow.c gtk/gtkhsv.c tests/testcairo.c.
Diffstat (limited to 'gdk/gdkpixbuf-render.c')
-rw-r--r--gdk/gdkpixbuf-render.c23
1 files changed, 7 insertions, 16 deletions
diff --git a/gdk/gdkpixbuf-render.c b/gdk/gdkpixbuf-render.c
index 6e3891f758..d8eda5eb69 100644
--- a/gdk/gdkpixbuf-render.c
+++ b/gdk/gdkpixbuf-render.c
@@ -333,14 +333,18 @@ gdk_pixbuf_render_pixmap_and_mask_for_colormap (GdkPixbuf *pixbuf,
* gdk_pixbuf_set_as_cairo_source:
* @pixbuf: a #GdkPixbuf
* @cr: a #Cairo context
+ * @pixbuf_x: X coordinate of location to place upper left corner of @pixbuf
+ * @pixbuf_y: Y coordinate of location to place upper left corner of @pixbuf
*
* Sets the given pixbuf as the source pattern for the Cairo context.
* The pattern has an extend mode of %CAIRO_EXTEND_NONE and is aligned
- * so that the origin of @pixbuf is at the current point.
+ * so that the origin of @pixbuf is @pixbuf_x, @pixbuf_y
**/
void
gdk_pixbuf_set_as_cairo_source (GdkPixbuf *pixbuf,
- cairo_t *cr)
+ cairo_t *cr,
+ double pixbuf_x,
+ double pixbuf_y)
{
gint width = gdk_pixbuf_get_width (pixbuf);
gint height = gdk_pixbuf_get_height (pixbuf);
@@ -350,10 +354,7 @@ gdk_pixbuf_set_as_cairo_source (GdkPixbuf *pixbuf,
guchar *cairo_pixels;
cairo_format_t format;
cairo_surface_t *surface;
- cairo_pattern_t *pattern;
static const cairo_user_data_key_t key;
- cairo_matrix_t *matrix;
- double x, y;
int j;
if (n_channels == 3)
@@ -424,17 +425,7 @@ gdk_pixbuf_set_as_cairo_source (GdkPixbuf *pixbuf,
cairo_pixels += 4 * width;
}
- pattern = cairo_pattern_create_for_surface (surface);
- cairo_surface_destroy (surface);
-
- cairo_current_point (cr, &x, &y);
- matrix = cairo_matrix_create ();
- cairo_matrix_translate (matrix, -x, -y);
- cairo_pattern_set_matrix (pattern, matrix);
- cairo_matrix_destroy (matrix);
-
- cairo_set_source (cr, pattern);
- cairo_pattern_destroy (pattern);
+ cairo_set_source_surface (cr, surface, pixbuf_x, pixbuf_y);
}
#define __GDK_PIXBUF_RENDER_C__