]> Pileus Git - ~andy/gtk/commitdiff
API: gdk_pixbuf_get_from_drawable() => gdk_pixbuf_get_from_window()
authorBenjamin Otte <otte@redhat.com>
Sat, 28 Aug 2010 21:51:58 +0000 (23:51 +0200)
committerBenjamin Otte <otte@redhat.com>
Sun, 26 Sep 2010 13:11:32 +0000 (15:11 +0200)
The Colormap argument needed to be removed, so the renaming is just a
side effect.

demos/testpixbuf-color.c
demos/testpixbuf-save.c
docs/reference/gdk/gdk3-sections.txt
docs/tools/shooter.c
gdk/gdk.symbols
gdk/gdkpixbuf-drawable.c
gdk/gdkpixbuf.h
gtk/gtkcolorsel.c

index 003f33384974ea68842002568f650c4e0efe62cf..5ce086cf9092421cbeb6fcba7e40469dba9f90bf 100644 (file)
@@ -112,8 +112,8 @@ main (int argc, char **argv)
        gtk_init (&argc, &argv);
 
        root = gdk_get_default_root_window ();
-       pixbuf = gdk_pixbuf_get_from_drawable (NULL, root, NULL,
-                                              0, 0, 0, 0, 150, 160);
+       pixbuf = gdk_pixbuf_get_from_window (NULL, root,
+                                            0, 0, 0, 0, 150, 160);
 
        /* PASS */
        g_debug ("try to save PNG with a profile");
index c8a6679ce2e63b0a11658a664d7492e0aa93e0c8..f3e9f046d968c4516030f5d0505a1db0ed41602c 100644 (file)
@@ -340,8 +340,8 @@ configure_cb (GtkWidget *drawing_area, GdkEventConfigure *evt, gpointer data)
                 GdkPixbuf *new_pixbuf;
 
                 root = gdk_get_default_root_window ();
-                new_pixbuf = gdk_pixbuf_get_from_drawable (NULL, root, NULL,
-                                                           0, 0, 0, 0, evt->width, evt->height);
+                new_pixbuf = gdk_pixbuf_get_from_window (NULL, root,
+                                                         0, 0, 0, 0, evt->width, evt->height);
                 g_object_set_data_full (G_OBJECT (drawing_area), "pixbuf", new_pixbuf,
                                         (GDestroyNotify) g_object_unref);
         }
@@ -361,8 +361,8 @@ main (int argc, char **argv)
         gtk_init (&argc, &argv);   
 
         root = gdk_get_default_root_window ();
-        pixbuf = gdk_pixbuf_get_from_drawable (NULL, root, NULL,
-                                               0, 0, 0, 0, 150, 160);
+        pixbuf = gdk_pixbuf_get_from_window (NULL, root,
+                                             0, 0, 0, 0, 150, 160);
    
         window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
         g_signal_connect (window, "delete_event",
index 0ff8a795696a358e9179eefc305cfdab82722032..f00de0bab858ec858e7bf9e30da26afbc446e03e 100644 (file)
@@ -243,7 +243,7 @@ gdk_screen_get_type
 <SECTION>
 <TITLE>Pixbufs</TITLE>
 <FILE>pixbufs</FILE>
-gdk_pixbuf_get_from_drawable
+gdk_pixbuf_get_from_window
 gdk_pixbuf_get_from_surface
 </SECTION>
 
index d73117bcc9b92dfcd9d2057d2041df9c80b8d957..4b31f034ae615cd5cac8105af16f4c96257b36f0 100644 (file)
@@ -163,8 +163,8 @@ take_window_shot (Window   child,
   if (y_orig + height > gdk_screen_height ())
     height = gdk_screen_height () - y_orig;
 
-  tmp = gdk_pixbuf_get_from_drawable (NULL, window, NULL,
-                                     x, y, 0, 0, width, height);
+  tmp = gdk_pixbuf_get_from_window (NULL, window,
+                                   x, y, 0, 0, width, height);
 
   if (include_decoration)
     tmp2 = remove_shaped_area (tmp, xid);
index aff488af2a883353836c68d527efbad6810698b2..e4a625bbea712713fb0adc499dea7ac097e4d3f0 100644 (file)
@@ -802,7 +802,7 @@ gdk_pango_layout_line_get_clip_region
 
 #if IN_HEADER(__GDK_PIXBUF_H__)
 #if IN_FILE(__GDK_PIXBUF_DRAWABLE_C__)
-gdk_pixbuf_get_from_drawable
+gdk_pixbuf_get_from_window
 gdk_pixbuf_get_from_surface
 #endif
 #endif
index 6cc35fc9691e3631cf9bb68248519b79bc723af4..c9a84643b32b13e6bcdd0cc1ec2bb3674dbe1a25 100644 (file)
 /* Exported functions */
 
 /**
- * gdk_pixbuf_get_from_drawable:
+ * gdk_pixbuf_get_from_window:
  * @dest: (allow-none): Destination pixbuf, or %NULL if a new pixbuf should be created.
  * @src: Source drawable.
- * @cmap: A colormap if @src doesn't have one set.
  * @src_x: Source X coordinate within drawable.
  * @src_y: Source Y coordinate within drawable.
  * @dest_x: Destination X coordinate in pixbuf, or 0 if @dest is NULL.
  * image data from a server-side drawable to a client-side RGB(A) buffer.
  * This allows you to efficiently read individual pixels on the client side.
  * 
- * If the drawable @src has no colormap (gdk_drawable_get_colormap()
- * returns %NULL), then a suitable colormap must be specified.
- * If the drawable has a colormap, the @cmap argument will be
- * ignored.
- *
  * If the specified destination pixbuf @dest is %NULL, then this
  * function will create an RGB pixbuf with 8 bits per channel and no
  * alpha, with the same size specified by the @width and @height
  * pixbuf with a reference count of 1 if no destination pixbuf was specified, or %NULL on error
  **/
 GdkPixbuf *
-gdk_pixbuf_get_from_drawable (GdkPixbuf   *dest,
-                             GdkDrawable *src,
-                             GdkColormap *cmap,
-                             int src_x,  int src_y,
-                             int dest_x, int dest_y,
-                             int width,  int height)
+gdk_pixbuf_get_from_window (GdkPixbuf   *dest,
+                            GdkWindow   *src,
+                            int src_x,  int src_y,
+                            int dest_x, int dest_y,
+                            int width,  int height)
 {
   cairo_surface_t *surface;
-  int depth;
   
-  /* General sanity checks */
-
-  g_return_val_if_fail (src != NULL, NULL);
-
-  if (GDK_IS_WINDOW (src))
-    /* FIXME: this is not perfect, since is_viewable() only tests
-     * recursively up the Gdk parent window tree, but stops at
-     * foreign windows or Gdk toplevels.  I.e. if a window manager
-     * unmapped one of its own windows, this won't work.
-     */
-    g_return_val_if_fail (gdk_window_is_viewable (src), NULL);
+  g_return_val_if_fail (GDK_IS_WINDOW (src), NULL);
+  g_return_val_if_fail (gdk_window_is_viewable (src), NULL);
 
   if (!dest)
     g_return_val_if_fail (dest_x == 0 && dest_y == 0, NULL);
@@ -118,29 +101,6 @@ gdk_pixbuf_get_from_drawable (GdkPixbuf   *dest,
       g_return_val_if_fail (gdk_pixbuf_get_bits_per_sample (dest) == 8, NULL);
     }
 
-  if (cmap == NULL)
-    cmap = gdk_drawable_get_colormap (src);
-
-  depth = gdk_drawable_get_depth (src);
-  
-  if (depth != 1 && cmap == NULL)
-    {
-      g_warning ("%s: Source drawable has no colormap; either pass "
-                 "in a colormap, or set the colormap on the drawable "
-                 "with gdk_drawable_set_colormap()", G_STRLOC);
-      return NULL;
-    }
-  
-  if (cmap != NULL && depth != cmap->visual->depth)
-    {
-      g_warning ("%s: Depth of the source drawable is %d where as "
-                 "the visual depth of the colormap passed is %d",
-                 G_STRLOC, depth, cmap->visual->depth);
-      return NULL;
-    } 
-  /* Coordinate sanity checks */
-  
   surface = _gdk_drawable_ref_cairo_surface (src);
   dest = gdk_pixbuf_get_from_surface (dest,
                                       surface,
index 99e718df63cd2274d507ce13d2b1c1e5e46a7984..6b21078edb167e7e0601ed901b9df736e8eac6a0 100644 (file)
@@ -38,9 +38,8 @@
 G_BEGIN_DECLS
 
 /* Fetching a region from a drawable */
-GdkPixbuf *gdk_pixbuf_get_from_drawable (GdkPixbuf   *dest,
-                                        GdkDrawable *src,
-                                        GdkColormap *cmap,
+GdkPixbuf *gdk_pixbuf_get_from_window   (GdkPixbuf   *dest,
+                                        GdkWindow   *window,
                                         int          src_x,
                                         int          src_y,
                                         int          dest_x,
index 200d35b5cd32a25943816daefdfd9185edf9bae9..280a8148273a4e7ec36f59011c622e59205aaed5 100644 (file)
@@ -1687,10 +1687,10 @@ grab_color_at_pointer (GdkScreen *screen,
   
   priv = colorsel->private_data;
   
-  pixbuf = gdk_pixbuf_get_from_drawable (NULL, root_window, NULL,
-                                         x_root, y_root,
-                                         0, 0,
-                                         1, 1);
+  pixbuf = gdk_pixbuf_get_from_window (NULL, root_window,
+                                       x_root, y_root,
+                                       0, 0,
+                                       1, 1);
   if (!pixbuf)
     {
       gint x, y;
@@ -1698,10 +1698,10 @@ grab_color_at_pointer (GdkScreen *screen,
       GdkWindow *window = gdk_display_get_window_at_device_position (display, device, &x, &y);
       if (!window)
        return;
-      pixbuf = gdk_pixbuf_get_from_drawable (NULL, window, NULL,
-                                             x, y,
-                                             0, 0,
-                                             1, 1);
+      pixbuf = gdk_pixbuf_get_from_window (NULL, window,
+                                           x, y,
+                                           0, 0,
+                                           1, 1);
       if (!pixbuf)
        return;
     }