[gtk+/rendering-cleanup: 19/95] API: remove gdk_drawable_copy_to_image()



commit ba2beb6dbb7ad54ef6a58c7aa194b9c66343370a
Author: Benjamin Otte <otte redhat com>
Date:   Tue Jul 13 23:28:20 2010 +0200

    API: remove gdk_drawable_copy_to_image()

 docs/reference/gdk/gdk3-sections.txt |    1 -
 docs/reference/gdk/tmpl/drawing.sgml |   16 ---
 gdk/directfb/gdkdrawable-directfb.c  |    1 -
 gdk/directfb/gdkimage-directfb.c     |   70 -------------
 gdk/directfb/gdkprivate-directfb.h   |    9 --
 gdk/gdk.symbols                      |    1 -
 gdk/gdkdraw.c                        |   76 --------------
 gdk/gdkdrawable.h                    |   18 ---
 gdk/gdkinternals.h                   |    9 --
 gdk/gdkoffscreenwindow.c             |   21 ----
 gdk/gdkpixmap.c                      |   28 -----
 gdk/gdkwindow.c                      |   44 --------
 gdk/quartz/gdkdrawable-quartz.c      |    2 -
 gdk/quartz/gdkimage-quartz.c         |  149 --------------------------
 gdk/quartz/gdkprivate-quartz.h       |   10 --
 gdk/win32/gdkdrawable-win32.c        |    2 -
 gdk/win32/gdkimage-win32.c           |   33 ------
 gdk/win32/gdkprivate-win32.h         |    9 --
 gdk/x11/gdkdrawable-x11.c            |    2 -
 gdk/x11/gdkimage-x11.c               |  190 ----------------------------------
 gdk/x11/gdkprivate-x11.h             |    8 --
 gdk/x11/gdktestutils-x11.c           |    9 ++-
 22 files changed, 7 insertions(+), 701 deletions(-)
---
diff --git a/docs/reference/gdk/gdk3-sections.txt b/docs/reference/gdk/gdk3-sections.txt
index ff854fd..7c37548 100644
--- a/docs/reference/gdk/gdk3-sections.txt
+++ b/docs/reference/gdk/gdk3-sections.txt
@@ -391,7 +391,6 @@ gdk_draw_layout_with_colors
 
 <SUBSECTION>
 gdk_draw_drawable
-gdk_drawable_copy_to_image
 
 <SUBSECTION Standard>
 GDK_DRAWABLE
diff --git a/docs/reference/gdk/tmpl/drawing.sgml b/docs/reference/gdk/tmpl/drawing.sgml
index 58c6377..20f89ef 100644
--- a/docs/reference/gdk/tmpl/drawing.sgml
+++ b/docs/reference/gdk/tmpl/drawing.sgml
@@ -354,19 +354,3 @@ bottom edges.
 @height: 
 
 
-<!-- ##### FUNCTION gdk_drawable_copy_to_image ##### -->
-<para>
-
-</para>
-
- drawable: 
- image: 
- src_x: 
- src_y: 
- dest_x: 
- dest_y: 
- width: 
- height: 
- Returns: 
-
-
diff --git a/gdk/directfb/gdkdrawable-directfb.c b/gdk/directfb/gdkdrawable-directfb.c
index 312645b..167d51a 100644
--- a/gdk/directfb/gdkdrawable-directfb.c
+++ b/gdk/directfb/gdkdrawable-directfb.c
@@ -1003,7 +1003,6 @@ gdk_drawable_impl_directfb_class_init (GdkDrawableImplDirectFBClass *klass)
 
   drawable_class->get_size       = gdk_directfb_get_size;
 
-  drawable_class->_copy_to_image = _gdk_directfb_copy_to_image;
         drawable_class->get_screen = gdk_directfb_get_screen;
 
 
diff --git a/gdk/directfb/gdkimage-directfb.c b/gdk/directfb/gdkimage-directfb.c
index fe7b6aa..e9533c5 100644
--- a/gdk/directfb/gdkimage-directfb.c
+++ b/gdk/directfb/gdkimage-directfb.c
@@ -217,76 +217,6 @@ _gdk_image_new_for_depth (GdkScreen    *screen,
   return image;
 }
 
-
-GdkImage*
-_gdk_directfb_copy_to_image (GdkDrawable *drawable,
-                             GdkImage    *image,
-                             gint         src_x,
-                             gint         src_y,
-                             gint         dest_x,
-                             gint         dest_y,
-                             gint         width,
-                             gint         height)
-{
-  GdkDrawableImplDirectFB *impl;
-  GdkImageDirectFB        *private;
-  int                      pitch;
-  DFBRectangle             rect = { src_x, src_y, width, height };
-  IDirectFBDisplayLayer *layer = _gdk_display->layer;
-
-  g_return_val_if_fail (GDK_IS_DRAWABLE_IMPL_DIRECTFB (drawable), NULL);
-  g_return_val_if_fail (image != NULL || (dest_x == 0 && dest_y == 0), NULL);
-
-  impl = GDK_DRAWABLE_IMPL_DIRECTFB (drawable);
-
-  if (impl->wrapper == _gdk_parent_root)
-    {
-      DFBResult ret;
-
-      ret = layer->SetCooperativeLevel (layer, DLSCL_ADMINISTRATIVE);
-      if (ret)
-        {
-          DirectFBError ("_gdk_directfb_copy_to_image - SetCooperativeLevel",
-                         ret);
-          return NULL;
-        }
-
-      ret = layer->GetSurface (layer, &impl->surface);
-      if (ret)
-        {
-          layer->SetCooperativeLevel (layer, DLSCL_SHARED);
-          DirectFBError ("_gdk_directfb_copy_to_image - GetSurface", ret);
-          return NULL;
-        }
-    }
-
-  if (! impl->surface)
-    return NULL;
-
-  if (!image)
-    image =  gdk_image_new (GDK_IMAGE_NORMAL,
-                            gdk_drawable_get_visual (drawable), width, height);
-
-  private = image->windowing_data;
-
-  private->surface->Unlock( private->surface );
-
-  private->surface->Blit( private->surface,
-                          impl->surface, &rect, dest_x, dest_y );
-
-  private->surface->Lock( private->surface, DSLF_READ | DSLF_WRITE, &image->mem, &pitch );
-  image->bpl = pitch;
-
-  if (impl->wrapper == _gdk_parent_root)
-    {
-      impl->surface->Release (impl->surface);
-      impl->surface = NULL;
-      layer->SetCooperativeLevel (layer, DLSCL_SHARED);
-    }
-
-  return image;
-}
-
 guint32
 gdk_image_get_pixel (GdkImage *image,
                      gint      x,
diff --git a/gdk/directfb/gdkprivate-directfb.h b/gdk/directfb/gdkprivate-directfb.h
index db04f92..a8147d1 100644
--- a/gdk/directfb/gdkprivate-directfb.h
+++ b/gdk/directfb/gdkprivate-directfb.h
@@ -229,15 +229,6 @@ GdkGC *   _gdk_directfb_gc_new      (GdkDrawable     *drawable,
                                      GdkGCValues     *values,
                                      GdkGCValuesMask  values_mask);
 
-GdkImage* _gdk_directfb_copy_to_image (GdkDrawable  *drawable,
-                                       GdkImage     *image,
-                                       gint          src_x,
-                                       gint          src_y,
-                                       gint          dest_x,
-                                       gint          dest_y,
-                                       gint          width,
-                                       gint          height);
-
 void       gdk_directfb_event_windows_add    (GdkWindow *window);
 void       gdk_directfb_event_windows_remove (GdkWindow *window);
 
diff --git a/gdk/gdk.symbols b/gdk/gdk.symbols
index 1fee3cb..070116f 100644
--- a/gdk/gdk.symbols
+++ b/gdk/gdk.symbols
@@ -539,7 +539,6 @@ gdk_drag_get_protocol
 
 #if IN_HEADER(__GDK_DRAWABLE_H__)
 #if IN_FILE(__GDK_DRAW_C__)
-gdk_drawable_copy_to_image
 gdk_drawable_get_clip_region
 gdk_drawable_get_colormap
 gdk_drawable_get_depth
diff --git a/gdk/gdkdraw.c b/gdk/gdkdraw.c
index ce29629..e8a0a17 100644
--- a/gdk/gdkdraw.c
+++ b/gdk/gdkdraw.c
@@ -731,82 +731,6 @@ gdk_draw_trapezoids (GdkDrawable        *drawable,
   cairo_destroy (cr);
 }
 
-/**
- * gdk_drawable_copy_to_image:
- * @drawable: a #GdkDrawable
- * @image: (allow-none): a #GdkDrawable, or %NULL if a new @image should be created.
- * @src_x: x coordinate on @drawable
- * @src_y: y coordinate on @drawable
- * @dest_x: x coordinate within @image. Must be 0 if @image is %NULL
- * @dest_y: y coordinate within @image. Must be 0 if @image is %NULL
- * @width: width of region to get
- * @height: height or region to get
- *
- * Copies a portion of @drawable into the client side image structure
- * @image. If @image is %NULL, creates a new image of size @width x @height
- * and copies into that. See gdk_drawable_get_image() for further details.
- * 
- * Return value: @image, or a new a #GdkImage containing the contents
- *               of @drawable
- * 
- * Since: 2.4
- **/
-GdkImage*
-gdk_drawable_copy_to_image (GdkDrawable *drawable,
-			    GdkImage    *image,
-			    gint         src_x,
-			    gint         src_y,
-			    gint         dest_x,
-			    gint         dest_y,
-			    gint         width,
-			    gint         height)
-{
-  GdkDrawable *composite;
-  gint composite_x_offset = 0;
-  gint composite_y_offset = 0;
-  GdkImage *retval;
-  GdkColormap *cmap;
-  
-  g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), NULL);
-  g_return_val_if_fail (src_x >= 0, NULL);
-  g_return_val_if_fail (src_y >= 0, NULL);
-
-  /* FIXME? Note race condition since we get the size then
-   * get the image, and the size may have changed.
-   */
-  
-  if (width < 0 || height < 0)
-    gdk_drawable_get_size (drawable,
-                           width < 0 ? &width : NULL,
-                           height < 0 ? &height : NULL);
-  
-  composite =
-    GDK_DRAWABLE_GET_CLASS (drawable)->get_composite_drawable (drawable,
-                                                               src_x, src_y,
-                                                               width, height,
-                                                               &composite_x_offset,
-                                                               &composite_y_offset); 
-  
-  retval = GDK_DRAWABLE_GET_CLASS (composite)->_copy_to_image (composite,
-							       image,
-							       src_x - composite_x_offset,
-							       src_y - composite_y_offset,
-							       dest_x, dest_y,
-							       width, height);
-
-  g_object_unref (composite);
-
-  if (!image && retval)
-    {
-      cmap = gdk_drawable_get_colormap (drawable);
-      
-      if (cmap)
-	gdk_image_set_colormap (retval, cmap);
-    }
-  
-  return retval;
-}
-
 static GdkDrawable *
 gdk_drawable_real_get_composite_drawable (GdkDrawable *drawable,
                                           gint         x,
diff --git a/gdk/gdkdrawable.h b/gdk/gdkdrawable.h
index 9716f16..fcad892 100644
--- a/gdk/gdkdrawable.h
+++ b/gdk/gdkdrawable.h
@@ -134,15 +134,6 @@ struct _GdkDrawableClass
                                           gint        *composite_x_offset,
                                           gint        *composite_y_offset);
 
-  GdkImage*    (*_copy_to_image) (GdkDrawable    *drawable,
-				  GdkImage       *image,
-				  gint            src_x,
-				  gint            src_y,
-				  gint            dest_x,
-				  gint            dest_y,
-				  gint            width,
-				  gint            height);
-  
   void (*draw_glyphs_transformed) (GdkDrawable      *drawable,
 				   GdkGC	    *gc,
 				   PangoMatrix      *matrix,
@@ -308,15 +299,6 @@ void gdk_draw_trapezoids         (GdkDrawable        *drawable,
 				  gint                n_trapezoids);
 
 
-GdkImage *gdk_drawable_copy_to_image (GdkDrawable  *drawable,
-				      GdkImage     *image,
-				      gint          src_x,
-				      gint          src_y,
-				      gint          dest_x,
-				      gint          dest_y,
-				      gint          width,
-				      gint          height);
-
 cairo_region_t *gdk_drawable_get_clip_region    (GdkDrawable *drawable);
 cairo_region_t *gdk_drawable_get_visible_region (GdkDrawable *drawable);
 
diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h
index 2691bfc..f46edd9 100644
--- a/gdk/gdkinternals.h
+++ b/gdk/gdkinternals.h
@@ -333,15 +333,6 @@ GdkImage *_gdk_image_get_scratch (GdkScreen *screen,
 				  gint	    *x,
 				  gint	    *y);
 
-GdkImage *_gdk_drawable_copy_to_image (GdkDrawable  *drawable,
-				       GdkImage     *image,
-				       gint          src_x,
-				       gint          src_y,
-				       gint          dest_x,
-				       gint          dest_y,
-				       gint          width,
-				       gint          height);
-
 cairo_surface_t *_gdk_drawable_ref_cairo_surface (GdkDrawable *drawable);
 
 GdkDrawable *_gdk_drawable_get_source_drawable (GdkDrawable *drawable);
diff --git a/gdk/gdkoffscreenwindow.c b/gdk/gdkoffscreenwindow.c
index 72cc794..92c4905 100644
--- a/gdk/gdkoffscreenwindow.c
+++ b/gdk/gdkoffscreenwindow.c
@@ -151,26 +151,6 @@ gdk_offscreen_window_create_gc (GdkDrawable     *drawable,
   return gdk_gc_new_with_values (offscreen->pixmap, values, values_mask);
 }
 
-static GdkImage*
-gdk_offscreen_window_copy_to_image (GdkDrawable    *drawable,
-				    GdkImage       *image,
-				    gint            src_x,
-				    gint            src_y,
-				    gint            dest_x,
-				    gint            dest_y,
-				    gint            width,
-				    gint            height)
-{
-  GdkOffscreenWindow *offscreen = GDK_OFFSCREEN_WINDOW (drawable);
-
-  return gdk_drawable_copy_to_image (offscreen->pixmap,
-				     image,
-				     src_x,
-				     src_y,
-				     dest_x, dest_y,
-				     width, height);
-}
-
 static cairo_surface_t *
 gdk_offscreen_window_ref_cairo_surface (GdkDrawable *drawable)
 {
@@ -1119,7 +1099,6 @@ gdk_offscreen_window_class_init (GdkOffscreenWindowClass *klass)
   object_class->finalize = gdk_offscreen_window_finalize;
 
   drawable_class->create_gc = gdk_offscreen_window_create_gc;
-  drawable_class->_copy_to_image = gdk_offscreen_window_copy_to_image;
   drawable_class->ref_cairo_surface = gdk_offscreen_window_ref_cairo_surface;
   drawable_class->set_colormap = gdk_offscreen_window_set_colormap;
   drawable_class->get_colormap = gdk_offscreen_window_get_colormap;
diff --git a/gdk/gdkpixmap.c b/gdk/gdkpixmap.c
index a4ef7d7..8319977 100644
--- a/gdk/gdkpixmap.c
+++ b/gdk/gdkpixmap.c
@@ -101,15 +101,6 @@ static void   gdk_pixmap_real_get_size  (GdkDrawable     *drawable,
                                          gint            *width,
                                          gint            *height);
 
-static GdkImage* gdk_pixmap_copy_to_image (GdkDrawable *drawable,
-					   GdkImage    *image,
-					   gint         src_x,
-					   gint         src_y,
-					   gint         dest_x,
-					   gint         dest_y,
-					   gint         width,
-					   gint         height);
-
 static cairo_surface_t *gdk_pixmap_ref_cairo_surface (GdkDrawable *drawable);
 static cairo_surface_t *gdk_pixmap_create_cairo_surface (GdkDrawable *drawable,
 							 int width,
@@ -179,7 +170,6 @@ gdk_pixmap_class_init (GdkPixmapObjectClass *klass)
   drawable_class->set_colormap = gdk_pixmap_real_set_colormap;
   drawable_class->get_colormap = gdk_pixmap_real_get_colormap;
   drawable_class->get_visual = gdk_pixmap_real_get_visual;
-  drawable_class->_copy_to_image = gdk_pixmap_copy_to_image;
   drawable_class->ref_cairo_surface = gdk_pixmap_ref_cairo_surface;
   drawable_class->create_cairo_surface = gdk_pixmap_create_cairo_surface;
 }
@@ -452,24 +442,6 @@ gdk_pixmap_real_get_colormap (GdkDrawable *drawable)
   return gdk_drawable_get_colormap (((GdkPixmapObject*)drawable)->impl);
 }
 
-static GdkImage*
-gdk_pixmap_copy_to_image (GdkDrawable     *drawable,
-			  GdkImage        *image,
-			  gint             src_x,
-			  gint             src_y,
-			  gint             dest_x,
-			  gint             dest_y,
-			  gint             width,
-			  gint             height)
-{
-  g_return_val_if_fail (GDK_IS_PIXMAP (drawable), NULL);
-  
-  return gdk_drawable_copy_to_image (((GdkPixmapObject*)drawable)->impl,
-				     image,
-				     src_x, src_y, dest_x, dest_y,
-				     width, height);
-}
-
 static cairo_surface_t *
 gdk_pixmap_ref_cairo_surface (GdkDrawable *drawable)
 {
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index 91dcdcf..ef1822b 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -292,15 +292,6 @@ static void gdk_window_draw_trapezoids (GdkDrawable   *drawable,
 					GdkTrapezoid  *trapezoids,
 					gint           n_trapezoids);
 
-static GdkImage* gdk_window_copy_to_image (GdkDrawable *drawable,
-					   GdkImage    *image,
-					   gint         src_x,
-					   gint         src_y,
-					   gint         dest_x,
-					   gint         dest_y,
-					   gint         width,
-					   gint         height);
-
 static cairo_surface_t *gdk_window_ref_cairo_surface (GdkDrawable *drawable);
 static cairo_surface_t *gdk_window_create_cairo_surface (GdkDrawable *drawable,
 							 int width,
@@ -494,7 +485,6 @@ gdk_window_class_init (GdkWindowObjectClass *klass)
   drawable_class->set_colormap = gdk_window_real_set_colormap;
   drawable_class->get_colormap = gdk_window_real_get_colormap;
   drawable_class->get_visual = gdk_window_real_get_visual;
-  drawable_class->_copy_to_image = gdk_window_copy_to_image;
   drawable_class->ref_cairo_surface = gdk_window_ref_cairo_surface;
   drawable_class->create_cairo_surface = gdk_window_create_cairo_surface;
   drawable_class->set_cairo_clip = gdk_window_set_cairo_clip;
@@ -4911,40 +4901,6 @@ gdk_window_real_get_colormap (GdkDrawable *drawable)
   return gdk_drawable_get_colormap (((GdkWindowObject*)drawable)->impl);
 }
 
-static GdkImage*
-gdk_window_copy_to_image (GdkDrawable     *drawable,
-			  GdkImage        *image,
-			  gint             src_x,
-			  gint             src_y,
-			  gint             dest_x,
-			  gint             dest_y,
-			  gint             width,
-			  gint             height)
-{
-  GdkWindowObject *private = (GdkWindowObject *) drawable;
-  gint x_offset, y_offset;
-
-  g_return_val_if_fail (GDK_IS_WINDOW (drawable), NULL);
-
-  if (GDK_WINDOW_DESTROYED (drawable))
-    return NULL;
-
-  /* If we're here, a composite image was not necessary, so
-   * we can ignore the paint stack.
-   */
-
-  /* TODO: Is this right? */
-  x_offset = 0;
-  y_offset = 0;
-
-  return gdk_drawable_copy_to_image (private->impl,
-				     image,
-				     src_x - x_offset,
-				     src_y - y_offset,
-				     dest_x, dest_y,
-				     width, height);
-}
-
 static void
 gdk_window_drop_cairo_surface (GdkWindowObject *private)
 {
diff --git a/gdk/quartz/gdkdrawable-quartz.c b/gdk/quartz/gdkdrawable-quartz.c
index 3cc4bb3..9e11530 100644
--- a/gdk/quartz/gdkdrawable-quartz.c
+++ b/gdk/quartz/gdkdrawable-quartz.c
@@ -544,8 +544,6 @@ gdk_drawable_impl_quartz_class_init (GdkDrawableImplQuartzClass *klass)
   drawable_class->get_depth = gdk_quartz_get_depth;
   drawable_class->get_screen = gdk_quartz_get_screen;
   drawable_class->get_visual = gdk_quartz_get_visual;
-
-  drawable_class->_copy_to_image = _gdk_quartz_image_copy_to_image;
 }
 
 GType
diff --git a/gdk/quartz/gdkimage-quartz.c b/gdk/quartz/gdkimage-quartz.c
index cbe2b3b..3af2cec 100644
--- a/gdk/quartz/gdkimage-quartz.c
+++ b/gdk/quartz/gdkimage-quartz.c
@@ -26,155 +26,6 @@
 
 static GObjectClass *parent_class;
 
-GdkImage *
-_gdk_quartz_image_copy_to_image (GdkDrawable *drawable,
-				 GdkImage    *image,
-				 gint         src_x,
-				 gint         src_y,
-				 gint         dest_x,
-				 gint         dest_y,
-				 gint         width,
-				 gint         height)
-{
-  GdkScreen *screen;
-  
-  g_return_val_if_fail (GDK_IS_DRAWABLE_IMPL_QUARTZ (drawable), NULL);
-  g_return_val_if_fail (image != NULL || (dest_x == 0 && dest_y == 0), NULL);
-
-  screen = gdk_drawable_get_screen (drawable);
-  if (!image)
-    image = _gdk_image_new_for_depth (screen, GDK_IMAGE_FASTEST, NULL, 
-				      width, height,
-				      gdk_drawable_get_depth (drawable));
-  
-  if (GDK_IS_PIXMAP_IMPL_QUARTZ (drawable))
-    {
-      GdkPixmapImplQuartz *pix_impl;
-      gint bytes_per_row;
-      guchar *data;
-      int x, y;
-
-      pix_impl = GDK_PIXMAP_IMPL_QUARTZ (drawable);
-      data = (guchar *)(pix_impl->data);
-
-      if (src_x + width > pix_impl->width || src_y + height > pix_impl->height)
-      	{
-          g_warning ("Out of bounds copy-area for pixmap -> image conversion\n");
-          return image;
-        }
-
-      switch (gdk_drawable_get_depth (drawable))
-        {
-        case 24:
-          bytes_per_row = pix_impl->width * 4;
-          for (y = 0; y < height; y++)
-            {
-              guchar *src = data + ((y + src_y) * bytes_per_row) + (src_x * 4);
-
-              for (x = 0; x < width; x++)
-                {
-                  gint32 pixel;
-	  
-                  /* RGB24, 4 bytes per pixel, skip first. */
-                  pixel = src[0] << 16 | src[1] << 8 | src[2];
-                  src += 4;
-
-                  gdk_image_put_pixel (image, dest_x + x, dest_y + y, pixel);
-                }
-            }
-          break;
-
-        case 32:
-          bytes_per_row = pix_impl->width * 4;
-          for (y = 0; y < height; y++)
-            {
-              guchar *src = data + ((y + src_y) * bytes_per_row) + (src_x * 4);
-
-              for (x = 0; x < width; x++)
-                {
-                  gint32 pixel;
-	  
-                  /* ARGB32, 4 bytes per pixel. */
-                  pixel = src[0] << 24 | src[1] << 16 | src[2] << 8 | src[3];
-                  src += 4;
-
-                  gdk_image_put_pixel (image, dest_x + x, dest_y + y, pixel);
-                }
-            }
-          break;
-
-        case 1: /* TODO: optimize */
-          bytes_per_row = pix_impl->width;
-          for (y = 0; y < height; y++)
-            {
-              guchar *src = data + ((y + src_y) * bytes_per_row) + src_x;
-
-              for (x = 0; x < width; x++)
-                {
-                  gint32 pixel;
-	  
-                  /* 8 bits */
-                  pixel = src[0];
-                  src++;
-
-                  gdk_image_put_pixel (image, dest_x + x, dest_y + y, pixel);
-                }
-            }
-          break;
-
-        default:
-          g_warning ("Unsupported bit depth %d\n", gdk_drawable_get_depth (drawable));
-          return image;
-        }
-    }
-  else if (GDK_IS_WINDOW_IMPL_QUARTZ (drawable))
-    {
-      GdkQuartzView *view;
-      NSBitmapImageRep *rep;
-      NSRect rect;
-      guchar *data;
-      int x, y;
-      NSSize size;
-
-      view = GDK_WINDOW_IMPL_QUARTZ (drawable)->view;
-
-      /* We return the image even if we can't copy to it. */
-      if (![view lockFocusIfCanDraw])
-        return image;
-
-      rect = NSMakeRect (src_x, src_y, width, height);
-
-      rep = [[NSBitmapImageRep alloc] initWithFocusedViewRect: rect];
-      [view unlockFocus];
-	  
-      data = [rep bitmapData];
-      size = [rep size];
-
-      for (y = 0; y < size.height; y++)
-	{
-	  guchar *src = data + y * [rep bytesPerRow];
-
-	  for (x = 0; x < size.width; x++)
-	    {
-	      gint32 pixel;
-
-	      if (image->byte_order == GDK_LSB_FIRST)
-		pixel = src[0] << 8 | src[1] << 16 |src[2] << 24;
-	      else
-		pixel = src[0] << 16 | src[1] << 8 |src[2];
-
-	      src += 3;
-
-	      gdk_image_put_pixel (image, dest_x + x, dest_y + y, pixel);
-	    }
-	}
-
-      [rep release];
-    }
-
-  return image;
-}
-
 static void
 gdk_image_finalize (GObject *object)
 {
diff --git a/gdk/quartz/gdkprivate-quartz.h b/gdk/quartz/gdkprivate-quartz.h
index dc747e4..89e2e0c 100644
--- a/gdk/quartz/gdkprivate-quartz.h
+++ b/gdk/quartz/gdkprivate-quartz.h
@@ -180,16 +180,6 @@ gboolean   _gdk_quartz_event_loop_check_pending (void);
 NSEvent *  _gdk_quartz_event_loop_get_pending   (void);
 void       _gdk_quartz_event_loop_release_event (NSEvent *event);
 
-/* FIXME: image */
-GdkImage *_gdk_quartz_image_copy_to_image (GdkDrawable *drawable,
-					    GdkImage    *image,
-					    gint         src_x,
-					    gint         src_y,
-					    gint         dest_x,
-					    gint         dest_y,
-					    gint         width,
-					    gint         height);
-
 /* Keys */
 GdkEventType _gdk_quartz_keys_event_type  (NSEvent   *event);
 gboolean     _gdk_quartz_keys_is_modifier (guint      keycode);
diff --git a/gdk/win32/gdkdrawable-win32.c b/gdk/win32/gdkdrawable-win32.c
index 80ecb49..b93432e 100644
--- a/gdk/win32/gdkdrawable-win32.c
+++ b/gdk/win32/gdkdrawable-win32.c
@@ -137,8 +137,6 @@ _gdk_drawable_impl_win32_class_init (GdkDrawableImplWin32Class *klass)
   drawable_class->get_depth = gdk_win32_get_depth;
   drawable_class->get_screen = gdk_win32_get_screen;
   drawable_class->get_visual = gdk_win32_get_visual;
-
-  drawable_class->_copy_to_image = _gdk_win32_copy_to_image;
 }
 
 static void
diff --git a/gdk/win32/gdkimage-win32.c b/gdk/win32/gdkimage-win32.c
index de54884..bcc3363 100644
--- a/gdk/win32/gdkimage-win32.c
+++ b/gdk/win32/gdkimage-win32.c
@@ -203,39 +203,6 @@ _gdk_image_new_for_depth (GdkScreen    *screen,
   return image;
 }
 
-GdkImage*
-_gdk_win32_copy_to_image (GdkDrawable    *drawable,
-			  GdkImage       *image,
-			  gint            src_x,
-			  gint            src_y,
-			  gint            dest_x,
-			  gint            dest_y,
-			  gint            width,
-			  gint            height)
-{
-  GdkGC *gc;
-  GdkScreen *screen = gdk_drawable_get_screen (drawable);
-  
-  g_return_val_if_fail (GDK_IS_DRAWABLE_IMPL_WIN32 (drawable), NULL);
-  g_return_val_if_fail (image != NULL || (dest_x == 0 && dest_y == 0), NULL);
-
-  GDK_NOTE (IMAGE, g_print ("_gdk_win32_copy_to_image: %p\n",
-			    GDK_DRAWABLE_HANDLE (drawable)));
-
-  if (!image)
-    image = _gdk_image_new_for_depth (screen, GDK_IMAGE_FASTEST, NULL, width, height,
-				      gdk_drawable_get_depth (drawable));
-
-  gc = gdk_gc_new ((GdkDrawable *) image->windowing_data);
-  _gdk_win32_blit
-    (FALSE,
-     GDK_DRAWABLE_IMPL_WIN32 (GDK_PIXMAP_OBJECT (image->windowing_data)->impl),
-     gc, drawable, src_x, src_y, dest_x, dest_y, width, height);
-  g_object_unref (gc);
-
-  return image;
-}
-
 guint32
 gdk_image_get_pixel (GdkImage *image,
 		     gint      x,
diff --git a/gdk/win32/gdkprivate-win32.h b/gdk/win32/gdkprivate-win32.h
index 0945d6e..0439522 100644
--- a/gdk/win32/gdkprivate-win32.h
+++ b/gdk/win32/gdkprivate-win32.h
@@ -242,15 +242,6 @@ GdkImage *_gdk_win32_get_image 		(GdkDrawable *drawable,
 					 gint         width,
 					 gint         height);
 
-GdkImage *_gdk_win32_copy_to_image      (GdkDrawable *drawable,
-					 GdkImage    *image,
-					 gint         src_x,
-					 gint         src_y,
-					 gint         dest_x,
-					 gint         dest_y,
-					 gint         width,
-					 gint         height);
-
 void      _gdk_win32_blit               (gboolean              use_fg_bg,
 					 GdkDrawableImplWin32 *drawable,
 					 GdkGC       	       *gc,
diff --git a/gdk/x11/gdkdrawable-x11.c b/gdk/x11/gdkdrawable-x11.c
index 5ee06a8..5eff383 100644
--- a/gdk/x11/gdkdrawable-x11.c
+++ b/gdk/x11/gdkdrawable-x11.c
@@ -133,8 +133,6 @@ _gdk_drawable_impl_x11_class_init (GdkDrawableImplX11Class *klass)
   drawable_class->get_depth = gdk_x11_get_depth;
   drawable_class->get_screen = gdk_x11_get_screen;
   drawable_class->get_visual = gdk_x11_get_visual;
-  
-  drawable_class->_copy_to_image = _gdk_x11_copy_to_image;
 }
 
 static void
diff --git a/gdk/x11/gdkimage-x11.c b/gdk/x11/gdkimage-x11.c
index f0329fb..70cb715 100644
--- a/gdk/x11/gdkimage-x11.c
+++ b/gdk/x11/gdkimage-x11.c
@@ -404,196 +404,6 @@ get_full_image (GdkDrawable    *drawable,
   return image;
 }
 
-GdkImage*
-_gdk_x11_copy_to_image (GdkDrawable    *drawable,
-			GdkImage       *image,
-			gint            src_x,
-			gint            src_y,
-			gint            dest_x,
-			gint            dest_y,
-			gint            width,
-			gint            height)
-{
-  GdkImagePrivateX11 *private;
-  GdkDrawableImplX11 *impl;
-  GdkVisual *visual;
-  GdkDisplay *display;
-  Display *xdisplay;
-  gboolean have_grab;
-  GdkRectangle req;
-  GdkRectangle window_rect;
-  Pixmap shm_pixmap = None;
-  gboolean success = TRUE;
-  
-  g_return_val_if_fail (GDK_IS_DRAWABLE_IMPL_X11 (drawable), NULL);
-  g_return_val_if_fail (image != NULL || (dest_x == 0 && dest_y == 0), NULL);
-
-  visual = gdk_drawable_get_visual (drawable);
-  impl = GDK_DRAWABLE_IMPL_X11 (drawable);
-  display = gdk_drawable_get_display (drawable);
-  xdisplay = gdk_x11_display_get_xdisplay (display);
-
-  if (display->closed)
-    return NULL;
-  
-  have_grab = FALSE;
-
-#define UNGRAB() G_STMT_START {					\
-    if (have_grab) {						\
-      gdk_x11_display_ungrab (display);				\
-      have_grab = FALSE; }					\
-  } G_STMT_END
-
-  if (!image && !GDK_IS_WINDOW_IMPL_X11 (drawable))
-    return get_full_image (drawable, src_x, src_y, width, height);
-
-  if (image && image->type == GDK_IMAGE_SHARED)
-    {
-      shm_pixmap = _gdk_x11_image_get_shm_pixmap (image);
-      if (shm_pixmap)
-	{
-	  GC xgc;
-	  XGCValues values;
-
-	  /* Again easy, we can just XCopyArea, and don't have to worry about clipping
-	   */
-	  values.subwindow_mode = IncludeInferiors;
-	  xgc = XCreateGC (xdisplay, impl->xid, GCSubwindowMode, &values);
-	  
-	  XCopyArea (xdisplay, impl->xid, shm_pixmap, xgc,
-		     src_x, src_y, width, height, dest_x, dest_y);
-	  XSync (xdisplay, FALSE);
-	  
-	  XFreeGC (xdisplay, xgc);
-	  
-	  return image;
-	}
-    }
-
-  /* Now the general case - we may have to worry about clipping to the screen
-   * bounds, in which case we'll have to grab the server and only get a piece
-   * of the window.
-   */
-  if (GDK_IS_WINDOW_IMPL_X11 (drawable))
-    {
-      GdkRectangle screen_rect;
-      Window child;
-
-      have_grab = TRUE;
-      gdk_x11_display_grab (display);
-
-      /* Translate screen area into window coordinates */
-      XTranslateCoordinates (xdisplay,
-			     GDK_SCREEN_XROOTWIN (impl->screen),
-			     impl->xid,
-			     0, 0, 
-			     &screen_rect.x, &screen_rect.y, 
-			     &child);
-
-      screen_rect.width = gdk_screen_get_width (impl->screen);
-      screen_rect.height = gdk_screen_get_height (impl->screen);
-      
-      gdk_error_trap_push ();
-
-      window_rect.x = 0;
-      window_rect.y = 0;
-      
-      gdk_window_get_geometry (GDK_WINDOW (impl->wrapper),
-                               NULL, NULL,
-                               &window_rect.width,
-                               &window_rect.height,
-                               NULL);
-      
-      /* compute intersection of screen and window, in window
-       * coordinates
-       */
-      if (gdk_error_trap_pop () ||
-          !gdk_rectangle_intersect (&window_rect, &screen_rect, 
-                                    &window_rect))
-	goto out;
-    }
-  else
-    {
-      window_rect.x = 0;
-      window_rect.y = 0;
-      gdk_drawable_get_size (drawable,
-			     &window_rect.width,
-			     &window_rect.height);
-    }
-      
-  req.x = src_x;
-  req.y = src_y;
-  req.width = width;
-  req.height = height;
-  
-  /* window_rect specifies the part of drawable which we can get from
-   * the server in window coordinates. 
-   * For pixmaps this is all of the pixmap, for windows it is just 
-   * the onscreen part.
-   */
-  if (!gdk_rectangle_intersect (&req, &window_rect, &req))
-    goto out;
-
-  gdk_error_trap_push ();
-  
-  if (!image &&
-      req.x == src_x && req.y == src_y && req.width == width && req.height == height)
-    {
-      image = get_full_image (drawable, src_x, src_y, width, height);
-      if (!image)
-	success = FALSE;
-    }
-  else
-    {
-      gboolean created_image = FALSE;
-      
-      if (!image)
-	{
-	  image = _gdk_image_new_for_depth (impl->screen, GDK_IMAGE_NORMAL, 
-					    visual, width, height,
-					    gdk_drawable_get_depth (drawable));
-	  created_image = TRUE;
-	}
-
-      private = PRIVATE_DATA (image);
-
-      /* In the ShmImage but no ShmPixmap case, we could use XShmGetImage when
-       * we are getting the entire image.
-       */
-      if (XGetSubImage (xdisplay, impl->xid,
-			req.x, req.y, req.width, req.height,
-			AllPlanes, ZPixmap,
-			private->ximage,
-			dest_x + req.x - src_x, dest_y + req.y - src_y) == None)
-	{
-	  if (created_image)
-	    g_object_unref (image);
-	  image = NULL;
-	  success = FALSE;
-	}
-    }
-
-  gdk_error_trap_pop ();
-
- out:
-  
-  if (have_grab)
-    {				
-      gdk_x11_display_ungrab (display);
-      have_grab = FALSE;
-    }
-  
-  if (success && !image)
-    {
-      /* We "succeeded", but could get no content for the image so return junk */
-      image = _gdk_image_new_for_depth (impl->screen, GDK_IMAGE_NORMAL, 
-					visual, width, height,
-					gdk_drawable_get_depth (drawable));
-    }
-      
-  return image;
-}
-
 guint32
 gdk_image_get_pixel (GdkImage *image,
 		     gint x,
diff --git a/gdk/x11/gdkprivate-x11.h b/gdk/x11/gdkprivate-x11.h
index 8a48dad..edc3914 100644
--- a/gdk/x11/gdkprivate-x11.h
+++ b/gdk/x11/gdkprivate-x11.h
@@ -106,14 +106,6 @@ GdkGC *_gdk_x11_gc_new                  (GdkDrawable     *drawable,
 					 GdkGCValues     *values,
 					 GdkGCValuesMask  values_mask);
 
-GdkImage *_gdk_x11_copy_to_image       (GdkDrawable *drawable,
-					GdkImage    *image,
-					gint         src_x,
-					gint         src_y,
-					gint         dest_x,
-					gint         dest_y,
-					gint         width,
-					gint         height);
 Pixmap   _gdk_x11_image_get_shm_pixmap (GdkImage    *image);
 
 /* Routines from gdkgeometry-x11.c */
diff --git a/gdk/x11/gdktestutils-x11.c b/gdk/x11/gdktestutils-x11.c
index 7793a83..f90bd04 100644
--- a/gdk/x11/gdktestutils-x11.c
+++ b/gdk/x11/gdktestutils-x11.c
@@ -37,11 +37,16 @@
 void
 gdk_test_render_sync (GdkWindow *window)
 {
-  static GdkImage *p1image = NULL;
+  Display *display = gdk_x11_drawable_get_xdisplay (window);
+  XImage *ximage;
+
   /* syncronize to X drawing queue, see:
    * http://mail.gnome.org/archives/gtk-devel-list/2006-October/msg00103.html
    */
-  p1image = gdk_drawable_copy_to_image (window, p1image, 0, 0, 0, 0, 1, 1);
+  ximage = XGetImage (display, DefaultRootWindow (display),
+	     	      0, 0, 1, 1, AllPlanes, ZPixmap);
+  if (ximage != NULL)
+    XDestroyImage (ximage);
 }
 
 /**



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