[gtk+/rendering-cleanup: 13/75] API: remove gdk_draw_image()



commit afe787085fe1efe4602d3aca90c3f1455997f3c6
Author: Benjamin Otte <otte redhat com>
Date:   Tue Jul 13 18:22:51 2010 +0200

    API: remove gdk_draw_image()

 docs/reference/gdk/gdk3-sections.txt |    1 -
 docs/reference/gdk/tmpl/drawing.sgml |   15 --------
 gdk/directfb/gdkdrawable-directfb.c  |   61 ----------------------------------
 gdk/gdk.symbols                      |    1 -
 gdk/gdkdraw.c                        |   41 -----------------------
 gdk/gdkdrawable.h                    |   19 ----------
 gdk/gdkoffscreenwindow.c             |   28 ---------------
 gdk/gdkpixmap.c                      |   28 ---------------
 gdk/gdkwindow.c                      |   32 ------------------
 gdk/quartz/gdkdrawable-quartz.c      |   47 --------------------------
 gdk/win32/gdkdrawable-win32.c        |   28 ---------------
 gdk/x11/gdkdrawable-x11.c            |   38 ---------------------
 12 files changed, 0 insertions(+), 339 deletions(-)
---
diff --git a/docs/reference/gdk/gdk3-sections.txt b/docs/reference/gdk/gdk3-sections.txt
index 7b95eb6..eddea9a 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_draw_image
 gdk_drawable_get_image
 gdk_drawable_copy_to_image
 
diff --git a/docs/reference/gdk/tmpl/drawing.sgml b/docs/reference/gdk/tmpl/drawing.sgml
index fe7986c..88c9f14 100644
--- a/docs/reference/gdk/tmpl/drawing.sgml
+++ b/docs/reference/gdk/tmpl/drawing.sgml
@@ -354,21 +354,6 @@ bottom edges.
 @height: 
 
 
-<!-- ##### FUNCTION gdk_draw_image ##### -->
-<para>
-</para>
-
- drawable: 
- gc: 
- image: 
- xsrc: 
- ysrc: 
- xdest: 
- ydest: 
- width: 
- height: 
-
-
 <!-- ##### FUNCTION gdk_drawable_get_image ##### -->
 <para>
 
diff --git a/gdk/directfb/gdkdrawable-directfb.c b/gdk/directfb/gdkdrawable-directfb.c
index de50d7b..312645b 100644
--- a/gdk/directfb/gdkdrawable-directfb.c
+++ b/gdk/directfb/gdkdrawable-directfb.c
@@ -890,66 +890,6 @@ gdk_directfb_draw_lines (GdkDrawable *drawable,
   temp_region_deinit( &clip );
 }
 
-static void
-gdk_directfb_draw_image (GdkDrawable *drawable,
-                         GdkGC       *gc,
-                         GdkImage    *image,
-                         gint         xsrc,
-                         gint         ysrc,
-                         gint         xdest,
-                         gint         ydest,
-                         gint         width,
-                         gint         height)
-{
-  GdkDrawableImplDirectFB *impl;
-  GdkImageDirectFB        *image_private;
-  cairo_region_t                clip;
-  GdkRectangle             dest_rect = { xdest, ydest, width, height };
-
-  gint pitch = 0;
-  gint i;
-
-  g_return_if_fail (GDK_IS_DRAWABLE (drawable));
-  g_return_if_fail (image != NULL);
-
-  D_DEBUG_AT( GDKDFB_Drawable, "%s( %p, %p, %p, %4d,%4d -> %4d,%4d - %dx%d )\n", G_STRFUNC,
-              drawable, gc, image, xsrc, ysrc, xdest, ydest, width, height );
-
-  impl = GDK_DRAWABLE_IMPL_DIRECTFB (drawable);
-  image_private = image->windowing_data;
-
-  if (!impl->surface)
-    return;
-
-  gdk_directfb_clip_region (drawable, gc, &dest_rect, &clip);
-
-  if (!cairo_region_is_empty (&clip))
-    {
-      DFBRectangle  src_rect = { xsrc, ysrc, width, height };
-
-      image_private->surface->Unlock (image_private->surface);
-
-      impl->surface->SetBlittingFlags (impl->surface, DSBLIT_NOFX);
-
-      for (i = 0; i < clip.numRects; i++)
-        {
-          DFBRegion reg = { clip.rects[i].x1,     clip.rects[i].y1,
-                            clip.rects[i].x2 , clip.rects[i].y2  };
-
-          impl->surface->SetClip (impl->surface, &reg);
-          impl->surface->Blit (impl->surface,
-                               image_private->surface, &src_rect,
-                               xdest, ydest);
-        }
-
-      image_private->surface->Lock (image_private->surface, DSLF_WRITE,
-                                    &image->mem, &pitch);
-      image->bpl = pitch;
-    }
-
-  temp_region_deinit( &clip );
-}
-
 static inline void
 convert_rgba_pixbuf_to_image (guint32 *src,
                               guint    src_pitch,
@@ -1053,7 +993,6 @@ gdk_drawable_impl_directfb_class_init (GdkDrawableImplDirectFBClass *klass)
   drawable_class->draw_points    = gdk_directfb_draw_points;
   drawable_class->draw_segments  = gdk_directfb_draw_segments;
   drawable_class->draw_lines     = gdk_directfb_draw_lines;
-  drawable_class->draw_image     = gdk_directfb_draw_image;
 
   drawable_class->ref_cairo_surface = gdk_directfb_ref_cairo_surface;
   drawable_class->set_colormap   = gdk_directfb_set_colormap;
diff --git a/gdk/gdk.symbols b/gdk/gdk.symbols
index bc5d270..ddf1efd 100644
--- a/gdk/gdk.symbols
+++ b/gdk/gdk.symbols
@@ -555,7 +555,6 @@ gdk_draw_arc
 gdk_draw_drawable
 gdk_draw_glyphs
 gdk_draw_glyphs_transformed
-gdk_draw_image
 gdk_draw_line
 gdk_draw_lines
 gdk_draw_point
diff --git a/gdk/gdkdraw.c b/gdk/gdkdraw.c
index cc584f8..79ccc00 100644
--- a/gdk/gdkdraw.c
+++ b/gdk/gdkdraw.c
@@ -498,47 +498,6 @@ gdk_draw_drawable (GdkDrawable *drawable,
 }
 
 /**
- * gdk_draw_image:
- * @drawable: a #GdkDrawable (a #GdkWindow or a #GdkPixmap).
- * @gc: a #GdkGC.
- * @image: the #GdkImage to draw.
- * @xsrc: the left edge of the source rectangle within @image.
- * @ysrc: the top of the source rectangle within @image.
- * @xdest: the x coordinate of the destination within @drawable.
- * @ydest: the y coordinate of the destination within @drawable.
- * @width: the width of the area to be copied, or -1 to make the area 
- *     extend to the right edge of @image.
- * @height: the height of the area to be copied, or -1 to make the area 
- *     extend to the bottom edge of @image.
- * 
- * Draws a #GdkImage onto a drawable.
- * The depth of the #GdkImage must match the depth of the #GdkDrawable.
- **/
-void
-gdk_draw_image (GdkDrawable *drawable,
-		GdkGC       *gc,
-		GdkImage    *image,
-		gint         xsrc,
-		gint         ysrc,
-		gint         xdest,
-		gint         ydest,
-		gint         width,
-		gint         height)
-{
-  g_return_if_fail (GDK_IS_DRAWABLE (drawable));
-  g_return_if_fail (GDK_IS_IMAGE (image));
-  g_return_if_fail (GDK_IS_GC (gc));
-
-  if (width == -1)
-    width = image->width;
-  if (height == -1)
-    height = image->height;
-
-  GDK_DRAWABLE_GET_CLASS (drawable)->draw_image (drawable, gc, image, xsrc, ysrc,
-                                                 xdest, ydest, width, height);
-}
-
-/**
  * gdk_draw_points:
  * @drawable: a #GdkDrawable (a #GdkWindow or a #GdkPixmap).
  * @gc: a #GdkGC.
diff --git a/gdk/gdkdrawable.h b/gdk/gdkdrawable.h
index f4c6bfe..d1844bc 100644
--- a/gdk/gdkdrawable.h
+++ b/gdk/gdkdrawable.h
@@ -111,16 +111,6 @@ struct _GdkDrawableClass
 			  gint              y,
 			  PangoGlyphString *glyphs);
 
-  void (*draw_image)     (GdkDrawable *drawable,
-                          GdkGC	      *gc,
-                          GdkImage    *image,
-                          gint	       xsrc,
-                          gint	       ysrc,
-                          gint	       xdest,
-                          gint	       ydest,
-                          gint	       width,
-                          gint	       height);
-  
   gint (*get_depth)      (GdkDrawable  *drawable);
   void (*get_size)       (GdkDrawable  *drawable,
                           gint         *width,
@@ -266,15 +256,6 @@ void gdk_draw_drawable  (GdkDrawable      *drawable,
 			 gint              ydest,
 			 gint              width,
 			 gint              height);
-void gdk_draw_image     (GdkDrawable      *drawable,
-			 GdkGC            *gc,
-			 GdkImage         *image,
-			 gint              xsrc,
-			 gint              ysrc,
-			 gint              xdest,
-			 gint              ydest,
-			 gint              width,
-			 gint              height);
 void gdk_draw_points    (GdkDrawable      *drawable,
 			 GdkGC            *gc,
 			 const GdkPoint   *points,
diff --git a/gdk/gdkoffscreenwindow.c b/gdk/gdkoffscreenwindow.c
index faf3c4b..72cc794 100644
--- a/gdk/gdkoffscreenwindow.c
+++ b/gdk/gdkoffscreenwindow.c
@@ -504,33 +504,6 @@ gdk_offscreen_window_draw_lines (GdkDrawable  *drawable,
   add_damage (offscreen, 0, 0, private->width, private->height, TRUE);
 }
 
-static void
-gdk_offscreen_window_draw_image (GdkDrawable *drawable,
-				 GdkGC	      *gc,
-				 GdkImage    *image,
-				 gint	       xsrc,
-				 gint	       ysrc,
-				 gint	       xdest,
-				 gint	       ydest,
-				 gint	       width,
-				 gint	       height)
-{
-  GdkOffscreenWindow *offscreen = GDK_OFFSCREEN_WINDOW (drawable);
-  GdkDrawable *real_drawable = get_real_drawable (offscreen);
-
-  gdk_draw_image (real_drawable,
-		  gc,
-		  image,
-		  xsrc,
-		  ysrc,
-		  xdest,
-		  ydest,
-		  width,
-		  height);
-
-  add_damage (offscreen, xdest, ydest, width, height, FALSE);
-}
-
 void
 _gdk_offscreen_window_new (GdkWindow     *window,
 			   GdkScreen     *screen,
@@ -1163,7 +1136,6 @@ gdk_offscreen_window_class_init (GdkOffscreenWindowClass *klass)
   drawable_class->draw_points = gdk_offscreen_window_draw_points;
   drawable_class->draw_segments = gdk_offscreen_window_draw_segments;
   drawable_class->draw_lines = gdk_offscreen_window_draw_lines;
-  drawable_class->draw_image = gdk_offscreen_window_draw_image;
 }
 
 static void
diff --git a/gdk/gdkpixmap.c b/gdk/gdkpixmap.c
index f71152a..a4ef7d7 100644
--- a/gdk/gdkpixmap.c
+++ b/gdk/gdkpixmap.c
@@ -92,15 +92,6 @@ static void gdk_pixmap_draw_glyphs_transformed (GdkDrawable      *drawable,
 						gint              y,
 						PangoGlyphString *glyphs);
 
-static void   gdk_pixmap_draw_image     (GdkDrawable     *drawable,
-                                         GdkGC           *gc,
-                                         GdkImage        *image,
-                                         gint             xsrc,
-                                         gint             ysrc,
-                                         gint             xdest,
-                                         gint             ydest,
-                                         gint             width,
-                                         gint             height);
 static void  gdk_pixmap_draw_trapezoids (GdkDrawable     *drawable,
 					 GdkGC	         *gc,
 					 GdkTrapezoid    *trapezoids,
@@ -181,7 +172,6 @@ gdk_pixmap_class_init (GdkPixmapObjectClass *klass)
   drawable_class->draw_lines = gdk_pixmap_draw_lines;
   drawable_class->draw_glyphs = gdk_pixmap_draw_glyphs;
   drawable_class->draw_glyphs_transformed = gdk_pixmap_draw_glyphs_transformed;
-  drawable_class->draw_image = gdk_pixmap_draw_image;
   drawable_class->draw_trapezoids = gdk_pixmap_draw_trapezoids;
   drawable_class->get_depth = gdk_pixmap_real_get_depth;
   drawable_class->get_screen = gdk_pixmap_real_get_screen;
@@ -400,24 +390,6 @@ gdk_pixmap_draw_glyphs_transformed (GdkDrawable      *drawable,
 }
 
 static void
-gdk_pixmap_draw_image (GdkDrawable     *drawable,
-                       GdkGC           *gc,
-                       GdkImage        *image,
-                       gint             xsrc,
-                       gint             ysrc,
-                       gint             xdest,
-                       gint             ydest,
-                       gint             width,
-                       gint             height)
-{
-  GdkPixmapObject *private = (GdkPixmapObject *)drawable;
-
-  _gdk_gc_remove_drawable_clip (gc);  
-  gdk_draw_image (private->impl, gc, image, xsrc, ysrc, xdest, ydest,
-                  width, height);
-}
-
-static void
 gdk_pixmap_draw_trapezoids (GdkDrawable     *drawable,
 			    GdkGC	    *gc,
 			    GdkTrapezoid    *trapezoids,
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index 68bb363..91dcdcf 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -287,16 +287,6 @@ static void gdk_window_draw_glyphs_transformed (GdkDrawable      *drawable,
 						gint              y,
 						PangoGlyphString *glyphs);
 
-static void   gdk_window_draw_image     (GdkDrawable     *drawable,
-					 GdkGC           *gc,
-					 GdkImage        *image,
-					 gint             xsrc,
-					 gint             ysrc,
-					 gint             xdest,
-					 gint             ydest,
-					 gint             width,
-					 gint             height);
-
 static void gdk_window_draw_trapezoids (GdkDrawable   *drawable,
 					GdkGC	      *gc,
 					GdkTrapezoid  *trapezoids,
@@ -497,7 +487,6 @@ gdk_window_class_init (GdkWindowObjectClass *klass)
   drawable_class->draw_lines = gdk_window_draw_lines;
   drawable_class->draw_glyphs = gdk_window_draw_glyphs;
   drawable_class->draw_glyphs_transformed = gdk_window_draw_glyphs_transformed;
-  drawable_class->draw_image = gdk_window_draw_image;
   drawable_class->draw_trapezoids = gdk_window_draw_trapezoids;
   drawable_class->get_depth = gdk_window_real_get_depth;
   drawable_class->get_screen = gdk_window_real_get_screen;
@@ -4815,27 +4804,6 @@ gdk_window_clear_area_e (GdkWindow *window,
 }
 
 static void
-gdk_window_draw_image (GdkDrawable *drawable,
-		       GdkGC       *gc,
-		       GdkImage    *image,
-		       gint         xsrc,
-		       gint         ysrc,
-		       gint         xdest,
-		       gint         ydest,
-		       gint         width,
-		       gint         height)
-{
-  if (GDK_WINDOW_DESTROYED (drawable))
-    return;
-
-  BEGIN_DRAW;
-  gdk_draw_image (impl, gc, image, xsrc, ysrc,
-		  xdest - x_offset, ydest - y_offset,
-		  width, height);
-  END_DRAW;
-}
-
-static void
 gdk_window_draw_trapezoids (GdkDrawable   *drawable,
 			    GdkGC	  *gc,
 			    GdkTrapezoid  *trapezoids,
diff --git a/gdk/quartz/gdkdrawable-quartz.c b/gdk/quartz/gdkdrawable-quartz.c
index a8fdd63..3cc4bb3 100644
--- a/gdk/quartz/gdkdrawable-quartz.c
+++ b/gdk/quartz/gdkdrawable-quartz.c
@@ -507,52 +507,6 @@ gdk_quartz_draw_lines (GdkDrawable *drawable,
 }
 
 static void
-gdk_quartz_draw_image (GdkDrawable     *drawable,
-		       GdkGC           *gc,
-		       GdkImage        *image,
-		       gint             xsrc,
-		       gint             ysrc,
-		       gint             xdest,
-		       gint             ydest,
-		       gint             width,
-		       gint             height)
-{
-  CGContextRef context = gdk_quartz_drawable_get_context (drawable, FALSE);
-  CGColorSpaceRef colorspace;
-  CGDataProviderRef data_provider;
-  CGImageRef cgimage;
-
-  if (!context)
-    return;
-
-  colorspace = CGColorSpaceCreateDeviceRGB ();
-  data_provider = CGDataProviderCreateWithData (NULL, image->mem, image->height * image->bpl, NULL);
-
-  /* FIXME: Make sure that this function draws 32-bit images correctly,
-  * also check endianness wrt kCGImageAlphaNoneSkipFirst */
-  cgimage = CGImageCreate (image->width, image->height, 8,
-			   32, image->bpl,
-			   colorspace,
-			   kCGImageAlphaNoneSkipFirst, 
-			   data_provider, NULL, FALSE, kCGRenderingIntentDefault);
-
-  CGDataProviderRelease (data_provider);
-  CGColorSpaceRelease (colorspace);
-
-  _gdk_quartz_gc_update_cg_context (gc, drawable, context,
-				    GDK_QUARTZ_CONTEXT_STROKE);
-
-  CGContextClipToRect (context, CGRectMake (xdest, ydest, width, height));
-  CGContextTranslateCTM (context, xdest - xsrc, ydest - ysrc + image->height);
-  CGContextScaleCTM (context, 1, -1);
-
-  CGContextDrawImage (context, CGRectMake (0, 0, image->width, image->height), cgimage);
-  CGImageRelease (cgimage);
-
-  gdk_quartz_drawable_release_context (drawable, context);
-}
-
-static void
 gdk_drawable_impl_quartz_finalize (GObject *object)
 {
   GdkDrawableImplQuartz *impl = GDK_DRAWABLE_IMPL_QUARTZ (object);
@@ -581,7 +535,6 @@ gdk_drawable_impl_quartz_class_init (GdkDrawableImplQuartzClass *klass)
   drawable_class->draw_points = gdk_quartz_draw_points;
   drawable_class->draw_segments = gdk_quartz_draw_segments;
   drawable_class->draw_lines = gdk_quartz_draw_lines;
-  drawable_class->draw_image = gdk_quartz_draw_image;
 
   drawable_class->ref_cairo_surface = gdk_quartz_ref_cairo_surface;
 
diff --git a/gdk/win32/gdkdrawable-win32.c b/gdk/win32/gdkdrawable-win32.c
index 78c7152..80ecb49 100644
--- a/gdk/win32/gdkdrawable-win32.c
+++ b/gdk/win32/gdkdrawable-win32.c
@@ -91,15 +91,6 @@ static void gdk_win32_draw_lines     (GdkDrawable    *drawable,
 				      GdkGC          *gc,
 				      GdkPoint       *points,
 				      gint            npoints);
-static void gdk_win32_draw_image     (GdkDrawable     *drawable,
-				      GdkGC           *gc,
-				      GdkImage        *image,
-				      gint             xsrc,
-				      gint             ysrc,
-				      gint             xdest,
-				      gint             ydest,
-				      gint             width,
-				      gint             height);
 
 static cairo_surface_t *gdk_win32_ref_cairo_surface (GdkDrawable *drawable);
      
@@ -137,7 +128,6 @@ _gdk_drawable_impl_win32_class_init (GdkDrawableImplWin32Class *klass)
   drawable_class->draw_points = gdk_win32_draw_points;
   drawable_class->draw_segments = gdk_win32_draw_segments;
   drawable_class->draw_lines = gdk_win32_draw_lines;
-  drawable_class->draw_image = gdk_win32_draw_image;
   
   drawable_class->ref_cairo_surface = gdk_win32_ref_cairo_surface;
   
@@ -1603,24 +1593,6 @@ _gdk_win32_blit (gboolean              use_fg_bg,
   gdk_win32_hdc_release (&draw_impl->parent_instance, gc, GDK_GC_FOREGROUND);
 }
 
-static void
-gdk_win32_draw_image (GdkDrawable     *drawable,
-		      GdkGC           *gc,
-		      GdkImage        *image,
-		      gint             xsrc,
-		      gint             ysrc,
-		      gint             xdest,
-		      gint             ydest,
-		      gint             width,
-		      gint             height)
-{
-  g_assert (GDK_IS_DRAWABLE_IMPL_WIN32 (drawable));
-
-  _gdk_win32_blit (TRUE, (GdkDrawableImplWin32 *) drawable,
-		   gc, (GdkPixmap *) image->windowing_data,
-		   xsrc, ysrc, xdest, ydest, width, height);
-}
-
 /**
  * _gdk_win32_drawable_acquire_dc
  * @drawable: a Win32 #GdkDrawable implementation
diff --git a/gdk/x11/gdkdrawable-x11.c b/gdk/x11/gdkdrawable-x11.c
index 95aebf9..5ee06a8 100644
--- a/gdk/x11/gdkdrawable-x11.c
+++ b/gdk/x11/gdkdrawable-x11.c
@@ -92,16 +92,6 @@ static void gdk_x11_draw_lines     (GdkDrawable    *drawable,
 				    GdkPoint       *points,
 				    gint            npoints);
 
-static void gdk_x11_draw_image     (GdkDrawable     *drawable,
-                                    GdkGC           *gc,
-                                    GdkImage        *image,
-                                    gint             xsrc,
-                                    gint             ysrc,
-                                    gint             xdest,
-                                    gint             ydest,
-                                    gint             width,
-                                    gint             height);
-
 static cairo_surface_t *gdk_x11_ref_cairo_surface (GdkDrawable *drawable);
      
 static void gdk_x11_set_colormap   (GdkDrawable    *drawable,
@@ -134,7 +124,6 @@ _gdk_drawable_impl_x11_class_init (GdkDrawableImplX11Class *klass)
   drawable_class->draw_points = gdk_x11_draw_points;
   drawable_class->draw_segments = gdk_x11_draw_segments;
   drawable_class->draw_lines = gdk_x11_draw_lines;
-  drawable_class->draw_image = gdk_x11_draw_image;
   
   drawable_class->ref_cairo_surface = gdk_x11_ref_cairo_surface;
 
@@ -620,33 +609,6 @@ gdk_x11_draw_lines (GdkDrawable *drawable,
   g_free (tmp_points);
 }
 
-static void
-gdk_x11_draw_image     (GdkDrawable     *drawable,
-                        GdkGC           *gc,
-                        GdkImage        *image,
-                        gint             xsrc,
-                        gint             ysrc,
-                        gint             xdest,
-                        gint             ydest,
-                        gint             width,
-                        gint             height)
-{
-  GdkDrawableImplX11 *impl;
-
-  impl = GDK_DRAWABLE_IMPL_X11 (drawable);
-
-#ifdef USE_SHM  
-  if (image->type == GDK_IMAGE_SHARED)
-    XShmPutImage (GDK_SCREEN_XDISPLAY (impl->screen), impl->xid,
-                  GDK_GC_GET_XGC (gc), GDK_IMAGE_XIMAGE (image),
-                  xsrc, ysrc, xdest, ydest, width, height, False);
-  else
-#endif
-    XPutImage (GDK_SCREEN_XDISPLAY (impl->screen), impl->xid,
-               GDK_GC_GET_XGC (gc), GDK_IMAGE_XIMAGE (image),
-               xsrc, ysrc, xdest, ydest, width, height);
-}
-
 static gint
 gdk_x11_get_depth (GdkDrawable *drawable)
 {



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