[gtk+/picture: 3/17] gdk: Make creating a surface from a pixbuf an intenral function
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/picture: 3/17] gdk: Make creating a surface from a pixbuf an intenral function
- Date: Thu, 10 Feb 2011 13:55:43 +0000 (UTC)
commit 714bfc584dd10b59d1963459ebc9fe5b17ad639e
Author: Benjamin Otte <otte redhat com>
Date: Thu Feb 3 17:39:03 2011 +0100
gdk: Make creating a surface from a pixbuf an intenral function
gdk/gdkcairo.c | 13 +++++++++++--
gdk/gdkinternals.h | 2 ++
2 files changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/gdk/gdkcairo.c b/gdk/gdkcairo.c
index 0d4b8bd..c7b8a36 100644
--- a/gdk/gdkcairo.c
+++ b/gdk/gdkcairo.c
@@ -193,6 +193,16 @@ gdk_cairo_set_source_pixbuf (cairo_t *cr,
double pixbuf_x,
double pixbuf_y)
{
+ cairo_surface_t *surface;
+
+ surface = _gdk_cairo_create_surface_for_pixbuf (pixbuf);
+ cairo_set_source_surface (cr, surface, pixbuf_x, pixbuf_y);
+ cairo_surface_destroy (surface);
+}
+
+cairo_surface_t *
+_gdk_cairo_create_surface_for_pixbuf (const GdkPixbuf *pixbuf)
+{
gint width = gdk_pixbuf_get_width (pixbuf);
gint height = gdk_pixbuf_get_height (pixbuf);
guchar *gdk_pixels = gdk_pixbuf_get_pixels (pixbuf);
@@ -275,8 +285,7 @@ gdk_cairo_set_source_pixbuf (cairo_t *cr,
cairo_pixels += cairo_stride;
}
- cairo_set_source_surface (cr, surface, pixbuf_x, pixbuf_y);
- cairo_surface_destroy (surface);
+ return surface;
}
/**
diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h
index bb33e09..938c020 100644
--- a/gdk/gdkinternals.h
+++ b/gdk/gdkinternals.h
@@ -285,6 +285,8 @@ void gdk_synthesize_window_state (GdkWindow *window,
gboolean _gdk_cairo_surface_extents (cairo_surface_t *surface,
GdkRectangle *extents);
+cairo_surface_t *_gdk_cairo_create_surface_for_pixbuf (const GdkPixbuf *pixbuf);
+
/*************************************
* Interfaces used by windowing code *
*************************************/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]