API: gdk_pixbuf_get_from_drawable() => gdk_pixbuf_get_from_window()
The Colormap argument needed to be removed, so the renaming is just a side effect.
This commit is contained in:
		@ -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");
 | 
			
		||||
 | 
			
		||||
@ -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",
 | 
			
		||||
 | 
			
		||||
@ -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>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -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);
 | 
			
		||||
 | 
			
		||||
@ -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
 | 
			
		||||
 | 
			
		||||
@ -34,10 +34,9 @@
 | 
			
		||||
/* 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.
 | 
			
		||||
@ -50,11 +49,6 @@
 | 
			
		||||
 * 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
 | 
			
		||||
@ -86,27 +80,16 @@
 | 
			
		||||
 * 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,
 | 
			
		||||
 | 
			
		||||
@ -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,
 | 
			
		||||
 | 
			
		||||
@ -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;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user