[gtk+/rendering-cleanup: 83/140] API: Rename gdk_set_source_pixmap() to gdk_set_source_window()



commit 503cc2149f629f5ed671d2b4a622be2b43bb9ef0
Author: Benjamin Otte <otte redhat com>
Date:   Fri Aug 27 12:52:59 2010 +0200

    API: Rename gdk_set_source_pixmap() to gdk_set_source_window()
    
    That's what it's used for now.

 docs/reference/gdk/gdk3-sections.txt |    2 +-
 gdk/gdk.symbols                      |    2 +-
 gdk/gdkcairo.c                       |   30 ++++++++++++++++++------------
 gdk/gdkcairo.h                       |    8 ++++----
 gtk/gtkmenu.c                        |    3 +--
 gtk/gtktoolitemgroup.c               |    2 +-
 tests/testgtk.c                      |    2 +-
 7 files changed, 27 insertions(+), 22 deletions(-)
---
diff --git a/docs/reference/gdk/gdk3-sections.txt b/docs/reference/gdk/gdk3-sections.txt
index a757594..d2207eb 100644
--- a/docs/reference/gdk/gdk3-sections.txt
+++ b/docs/reference/gdk/gdk3-sections.txt
@@ -642,7 +642,7 @@ gdk_window_create_similar_surface
 gdk_cairo_create
 gdk_cairo_set_source_color
 gdk_cairo_set_source_pixbuf
-gdk_cairo_set_source_pixmap
+gdk_cairo_set_source_window
 gdk_cairo_rectangle
 gdk_cairo_region
 gdk_cairo_reset_clip
diff --git a/gdk/gdk.symbols b/gdk/gdk.symbols
index de7ec97..7355292 100644
--- a/gdk/gdk.symbols
+++ b/gdk/gdk.symbols
@@ -289,7 +289,7 @@ gdk_cairo_create
 gdk_cairo_reset_clip
 gdk_cairo_set_source_color
 gdk_cairo_set_source_pixbuf
-gdk_cairo_set_source_pixmap
+gdk_cairo_set_source_window
 gdk_cairo_rectangle
 gdk_cairo_region
 gdk_cairo_region_create_from_surface
diff --git a/gdk/gdkcairo.c b/gdk/gdkcairo.c
index dfd50a1..3808778 100644
--- a/gdk/gdkcairo.c
+++ b/gdk/gdkcairo.c
@@ -266,28 +266,34 @@ gdk_cairo_set_source_pixbuf (cairo_t         *cr,
 }
 
 /**
- * gdk_cairo_set_source_pixmap:
+ * gdk_cairo_set_source_window:
  * @cr: a #Cairo context
- * @pixmap: a #GdkPixmap
- * @pixmap_x: X coordinate of location to place upper left corner of @pixmap
- * @pixmap_y: Y coordinate of location to place upper left corner of @pixmap
+ * @window: a #GdkWindow
+ * @x: X coordinate of location to place upper left corner of @window
+ * @y: Y coordinate of location to place upper left corner of @window
  * 
- * Sets the given pixmap as the source pattern for the Cairo context.
+ * Sets the given window 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 @pixmap is @pixmap_x, @pixmap_y
+ * so that the origin of @window is @x, @y. The window contains all its
+ * subwindows when rendering.
+ * Note that the contents of @window are undefined outside of the
+ * visible part of @window, so use this function with care.
  *
  * Since: 2.10
  **/
 void
-gdk_cairo_set_source_pixmap (cairo_t   *cr,
-			     GdkPixmap *pixmap,
-			     double     pixmap_x,
-			     double     pixmap_y)
+gdk_cairo_set_source_window (cairo_t   *cr,
+			     GdkWindow *window,
+			     double     x,
+			     double     y)
 {
   cairo_surface_t *surface;
   
-  surface = _gdk_drawable_ref_cairo_surface (GDK_DRAWABLE (pixmap));
-  cairo_set_source_surface (cr, surface, pixmap_x, pixmap_y);
+  g_return_if_fail (cr != NULL);
+  g_return_if_fail (GDK_IS_WINDOW (window));
+
+  surface = _gdk_drawable_ref_cairo_surface (GDK_DRAWABLE (window));
+  cairo_set_source_surface (cr, surface, x, y);
   cairo_surface_destroy (surface);
 }
 
diff --git a/gdk/gdkcairo.h b/gdk/gdkcairo.h
index c2a71e8..99afc06 100644
--- a/gdk/gdkcairo.h
+++ b/gdk/gdkcairo.h
@@ -40,10 +40,10 @@ void     gdk_cairo_set_source_pixbuf (cairo_t            *cr,
                                       const GdkPixbuf    *pixbuf,
                                       double              pixbuf_x,
                                       double              pixbuf_y);
-void     gdk_cairo_set_source_pixmap (cairo_t            *cr,
-                                      GdkPixmap          *pixmap,
-                                      double              pixmap_x,
-                                      double              pixmap_y);
+void     gdk_cairo_set_source_window (cairo_t            *cr,
+                                      GdkWindow          *window,
+                                      double              x,
+                                      double              y);
 
 void     gdk_cairo_rectangle         (cairo_t            *cr,
                                       const GdkRectangle *rectangle);
diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c
index 777ebaa..457472b 100644
--- a/gtk/gtkmenu.c
+++ b/gtk/gtkmenu.c
@@ -1357,8 +1357,7 @@ gtk_menu_tearoff_bg_copy (GtkMenu *menu)
                                                    height);
 
       cr = cairo_create (surface);
-      /* Let's hope that function never notices we're not passing it a pixmap */
-      gdk_cairo_set_source_pixmap (cr,
+      gdk_cairo_set_source_window (cr,
                                    menu->tearoff_window->window,
                                    0, 0);
       cairo_paint (cr);
diff --git a/gtk/gtktoolitemgroup.c b/gtk/gtktoolitemgroup.c
index 26a0815..5793b8d 100644
--- a/gtk/gtktoolitemgroup.c
+++ b/gtk/gtktoolitemgroup.c
@@ -2318,7 +2318,7 @@ _gtk_tool_item_group_paint (GtkToolItemGroup *group,
 
   gtk_widget_get_allocation (widget, &allocation);
 
-  gdk_cairo_set_source_pixmap (cr, gtk_widget_get_window (widget),
+  gdk_cairo_set_source_window (cr, gtk_widget_get_window (widget),
                                allocation.x,
                                allocation.y);
 
diff --git a/tests/testgtk.c b/tests/testgtk.c
index 6d78e7d..4bbda2d 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -397,7 +397,7 @@ window_expose_event (GtkWidget *widget,
   gtk_widget_get_allocation (child, &allocation);
 
   /* the source data is the (composited) event box */
-  gdk_cairo_set_source_pixmap (cr, gtk_widget_get_window (child),
+  gdk_cairo_set_source_window (cr, gtk_widget_get_window (child),
                                allocation.x,
                                allocation.y);
 



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