[gtk+/gtk-2-90: 73/161] Remove deprecated code from GdkImage
- From: Javier Jardón <jjardon src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-2-90: 73/161] Remove deprecated code from GdkImage
- Date: Tue, 23 Mar 2010 21:09:39 +0000 (UTC)
commit 5fa32499b0322b91af55883c831732bf7252688c
Author: Javier Jardón <javierjc1982 gmail com>
Date: Fri Oct 9 18:13:00 2009 +0200
Remove deprecated code from GdkImage
.../gdk-pixbuf/tmpl/gdk-pixbuf-unused.sgml | 6 --
docs/reference/gdk/gdk-sections.txt | 5 --
docs/reference/gdk/tmpl/images.sgml | 52 +---------------
gdk/directfb/gdkimage-directfb.c | 36 +-----------
gdk/gdk.symbols | 8 ---
gdk/gdkimage.c | 65 --------------------
gdk/gdkimage.h | 22 -------
gdk/quartz/gdkimage-quartz.c | 10 ---
gdk/testgdk.c | 40 ++++++------
gdk/win32/gdkimage-win32.c | 35 -----------
gdk/x11/gdkimage-x11.c | 56 -----------------
11 files changed, 22 insertions(+), 313 deletions(-)
---
diff --git a/docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf-unused.sgml b/docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf-unused.sgml
index dbacc90..128ca4a 100644
--- a/docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf-unused.sgml
+++ b/docs/reference/gdk-pixbuf/tmpl/gdk-pixbuf-unused.sgml
@@ -8,12 +8,6 @@
</para>
-<!-- ##### SECTION ./tmpl/from-drawables.sgml:See_Also ##### -->
- <para>
- gdk_image_get().
- </para>
-
-
<!-- ##### SECTION ./tmpl/from-drawables.sgml:Short_Description ##### -->
Getting parts of a drawable's image data into a pixbuf.
diff --git a/docs/reference/gdk/gdk-sections.txt b/docs/reference/gdk/gdk-sections.txt
index 0bcc942..e24d308 100644
--- a/docs/reference/gdk/gdk-sections.txt
+++ b/docs/reference/gdk/gdk-sections.txt
@@ -281,11 +281,6 @@ GdkPixmapObjectClass
GdkImage
gdk_image_new
GdkImageType
-gdk_image_new_bitmap
-gdk_image_get
-gdk_image_ref
-gdk_image_unref
-gdk_image_destroy
gdk_image_get_colormap
gdk_image_set_colormap
diff --git a/docs/reference/gdk/tmpl/images.sgml b/docs/reference/gdk/tmpl/images.sgml
index 1c560af..a9a6cd7 100644
--- a/docs/reference/gdk/tmpl/images.sgml
+++ b/docs/reference/gdk/tmpl/images.sgml
@@ -12,7 +12,6 @@ It has now been superceded to a large extent by the much more flexible
</para>
<para>
To create an empty #GdkImage use gdk_image_new().
-To create a #GdkImage from bitmap data use gdk_image_new_bitmap().
To create an image from part of a #GdkWindow use gdk_drawable_get_image().
</para>
<para>
@@ -25,7 +24,7 @@ the different formats that may be used.
To draw a #GdkImage in a #GdkWindow or #GdkPixmap use gdk_draw_image().
</para>
<para>
-To destroy a #GdkImage use gdk_image_destroy().
+To destroy a #GdkImage use g_object_unref().
</para>
<!-- ##### SECTION See_Also ##### -->
@@ -105,55 +104,6 @@ is supported by the server.
@GDK_IMAGE_FASTEST: Specifies that %GDK_IMAGE_SHARED should be tried first,
and if that fails then %GDK_IMAGE_NORMAL will be used.
-<!-- ##### FUNCTION gdk_image_new_bitmap ##### -->
-<para>
-</para>
-
- visual:
- data:
- width:
- height:
- Returns:
-
-
-<!-- ##### FUNCTION gdk_image_get ##### -->
-<para>
-</para>
-
- drawable:
- x:
- y:
- width:
- height:
- Returns:
-
-
-<!-- ##### FUNCTION gdk_image_ref ##### -->
-<para>
-
-</para>
-
- image:
- Returns:
-
-
-<!-- ##### FUNCTION gdk_image_unref ##### -->
-<para>
-
-</para>
-
- image:
-
-
-<!-- ##### MACRO gdk_image_destroy ##### -->
-<para>
-Destroys a #GdkImage, freeing any resources allocated for it.
-</para>
-
-<!-- # Unused Parameters # -->
- image: a #GdkImage.
-
-
<!-- ##### FUNCTION gdk_image_get_colormap ##### -->
<para>
diff --git a/gdk/directfb/gdkimage-directfb.c b/gdk/directfb/gdkimage-directfb.c
index 0485dfd..8e1ed66 100644
--- a/gdk/directfb/gdkimage-directfb.c
+++ b/gdk/directfb/gdkimage-directfb.c
@@ -131,40 +131,6 @@ _gdk_image_exit (void)
}
}
-GdkImage *
-gdk_image_new_bitmap (GdkVisual *visual,
- gpointer data,
- gint w,
- gint h)
-{
- GdkImage *image;
- GdkImageDirectFB *private;
-
- image = g_object_new (gdk_image_get_type (), NULL);
- private = image->windowing_data;
-
- image->type = GDK_IMAGE_SHARED;
- image->visual = visual;
- image->width = w;
- image->height = h;
- image->depth = 1;
-
- GDK_NOTE (MISC, g_print ("gdk_image_new_bitmap: %dx%d\n", w, h));
-
- g_message ("not fully implemented %s", G_STRFUNC);
-
- image->bpl = (w + 7) / 8;
- image->mem = g_malloc (image->bpl * h);
-#if G_BYTE_ORDER == G_BIG_ENDIAN
- image->byte_order = GDK_MSB_FIRST;
-#else
- image->byte_order = GDK_LSB_FIRST;
-#endif
- image->bpp = 1;
-
- return image;
-}
-
void
_gdk_windowing_image_init (void)
{
@@ -229,7 +195,7 @@ _gdk_image_new_for_depth (GdkScreen *screen,
if (ret)
{
DirectFBError( "IDirectFBSurface::Lock() for writing failed!\n", ret );
- gdk_image_unref( image );
+ g_object_unref( image );
return NULL;
}
diff --git a/gdk/gdk.symbols b/gdk/gdk.symbols
index 8197da4..0eaaa94 100644
--- a/gdk/gdk.symbols
+++ b/gdk/gdk.symbols
@@ -790,11 +790,6 @@ gdk_window_configure_finished
#if IN_HEADER(__GDK_IMAGE_H__)
#if IN_FILE(__GDK_IMAGE_C__)
-#ifndef GDK_DISABLE_DEPRECATED
-gdk_image_ref
-gdk_image_unref
-gdk_image_get
-#endif
gdk_image_set_colormap
gdk_image_get_colormap
gdk_image_new
@@ -803,9 +798,6 @@ gdk_image_new
#if IN_HEADER(__GDK_IMAGE_H__)
#if IN_FILE(__GDK_IMAGE_X11_C__)
-#ifdef GDK_ENABLE_BROKEN
-gdk_image_new_bitmap
-#endif
gdk_image_get_pixel
gdk_image_put_pixel
gdk_image_get_type G_GNUC_CONST
diff --git a/gdk/gdkimage.c b/gdk/gdkimage.c
index 9c9b1a3..9b6aa97 100644
--- a/gdk/gdkimage.c
+++ b/gdk/gdkimage.c
@@ -35,71 +35,6 @@
#include "gdkalias.h"
/**
- * gdk_image_ref:
- * @image: a #GdkImage
- *
- * Deprecated function; use g_object_ref() instead.
- *
- * Return value: the image
- *
- * Deprecated: 2.0: Use g_object_ref() instead.
- **/
-GdkImage *
-gdk_image_ref (GdkImage *image)
-{
- g_return_val_if_fail (GDK_IS_IMAGE (image), NULL);
-
- return g_object_ref (image);
-}
-
-/**
- * gdk_image_unref:
- * @image: a #GdkImage
- *
- * Deprecated function; use g_object_unref() instead.
- *
- * Deprecated: 2.0: Use g_object_unref() instead.
- **/
-void
-gdk_image_unref (GdkImage *image)
-{
- g_return_if_fail (GDK_IS_IMAGE (image));
-
- g_object_unref (image);
-}
-
-/**
- * gdk_image_get:
- * @drawable: a #GdkDrawable
- * @x: x coordinate in @window
- * @y: y coordinate in @window
- * @width: width of area in @window
- * @height: height of area in @window
- *
- * This is a deprecated wrapper for gdk_drawable_get_image();
- * gdk_drawable_get_image() should be used instead. Or even better: in
- * most cases gdk_pixbuf_get_from_drawable() is the most convenient
- * choice.
- *
- * Return value: a new #GdkImage or %NULL
- **/
-GdkImage*
-gdk_image_get (GdkWindow *drawable,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), NULL);
- g_return_val_if_fail (x >= 0, NULL);
- g_return_val_if_fail (y >= 0, NULL);
- g_return_val_if_fail (width >= 0, NULL);
- g_return_val_if_fail (height >= 0, NULL);
-
- return gdk_drawable_get_image (drawable, x, y, width, height);
-}
-
-/**
* gdk_image_set_colormap:
* @image: a #GdkImage
* @colormap: a #GdkColormap
diff --git a/gdk/gdkimage.h b/gdk/gdkimage.h
index 92ac4ff..34fb651 100644
--- a/gdk/gdkimage.h
+++ b/gdk/gdkimage.h
@@ -97,17 +97,6 @@ GdkImage* gdk_image_new (GdkImageType type,
gint width,
gint height);
-#ifndef GDK_DISABLE_DEPRECATED
-GdkImage* gdk_image_get (GdkDrawable *drawable,
- gint x,
- gint y,
- gint width,
- gint height);
-
-GdkImage * gdk_image_ref (GdkImage *image);
-void gdk_image_unref (GdkImage *image);
-#endif
-
void gdk_image_put_pixel (GdkImage *image,
gint x,
gint y,
@@ -121,17 +110,6 @@ void gdk_image_set_colormap (GdkImage *image,
GdkColormap* gdk_image_get_colormap (GdkImage *image);
-#ifdef GDK_ENABLE_BROKEN
-GdkImage* gdk_image_new_bitmap (GdkVisual *visual,
- gpointer data,
- gint width,
- gint height);
-#endif /* GDK_ENABLE_BROKEN */
-
-#ifndef GDK_DISABLE_DEPRECATED
-#define gdk_image_destroy g_object_unref
-#endif /* GDK_DISABLE_DEPRECATED */
-
G_END_DECLS
#endif /* __GDK_IMAGE_H__ */
diff --git a/gdk/quartz/gdkimage-quartz.c b/gdk/quartz/gdkimage-quartz.c
index c8e37bc..cbe2b3b 100644
--- a/gdk/quartz/gdkimage-quartz.c
+++ b/gdk/quartz/gdkimage-quartz.c
@@ -224,16 +224,6 @@ gdk_image_get_type (void)
return object_type;
}
-GdkImage *
-gdk_image_new_bitmap (GdkVisual *visual, gpointer data, gint width, gint height)
-{
- /* We don't implement this function because it's broken, deprecated and
- * tricky to implement. */
- g_warning ("This function is unimplemented");
-
- return NULL;
-}
-
GdkImage*
_gdk_image_new_for_depth (GdkScreen *screen,
GdkImageType type,
diff --git a/gdk/testgdk.c b/gdk/testgdk.c
index 2209e44..9b4687c 100644
--- a/gdk/testgdk.c
+++ b/gdk/testgdk.c
@@ -364,12 +364,12 @@ test_pixmaps (gint depth)
gdk_window_get_size (pixmap, &w, &h);
QTESTF (w == width, (" w:%d", w));
QTESTF (h == height, (" h:%d", h));
- image = gdk_image_get (pixmap, 0, 0, w, h);
+ image = gdk_drawable_get_image (pixmap, 0, 0, w, h);
QTEST (image != NULL);
QTEST (image->width == width);
QTEST (image->height == height);
QTEST (image->depth == depth);
- gdk_image_destroy (image);
+ g_object_unref (image);
g_object_unref (pixmap);
}
TEST (retval);
@@ -405,7 +405,7 @@ test_images (void)
QTEST (image->depth == system_visual->depth);
QTEST (image->bpp >= (image->depth-1)/8 + 1);
QTEST (image->mem != NULL);
- gdk_image_destroy (image);
+ g_object_unref (image);
}
}
TEST (retval);
@@ -512,14 +512,14 @@ test_one_point_on_drawable (GdkDrawable *drawable,
gdk_gc_get_values (gc, &gcvalues);
- image = gdk_image_get (drawable, x+-1, y+-1, 3, 3);
+ image = gdk_drawable_get_image (drawable, x+-1, y+-1, 3, 3);
QTEST (image != NULL);
for (xoff = -1; xoff <= 1; xoff++)
for (yoff = -1; yoff <= 1; yoff++)
{
oldpixels[xoff+1][yoff+1] = gdk_image_get_pixel (image, xoff+1, yoff+1);
}
- gdk_image_destroy (image);
+ g_object_unref (image);
if (depth == 32)
mask = 0xFFFFFFFF;
@@ -528,7 +528,7 @@ test_one_point_on_drawable (GdkDrawable *drawable,
gdk_draw_point (drawable, gc, x, y);
- image = gdk_image_get (drawable, x-1, y-1, 3, 3);
+ image = gdk_drawable_get_image (drawable, x-1, y-1, 3, 3);
QTEST (image != NULL);
for (xoff = -1; xoff <= 1; xoff++)
for (yoff = -1; yoff <= 1; yoff++)
@@ -540,7 +540,7 @@ test_one_point_on_drawable (GdkDrawable *drawable,
else
QTEST (newpixel == oldpixels[xoff+1][yoff+1]);
}
- gdk_image_destroy (image);
+ g_object_unref (image);
}
@@ -601,7 +601,7 @@ test_one_line_on_drawable (GdkDrawable *drawable,
w_up = w_left = line_width/2;
w_down = w_right = (line_width & 1) ? line_width/2 : line_width/2-1;
gdk_window_get_size (drawable, &w, &h);
- oldimage = gdk_image_get (drawable, 0, 0, w, h);
+ oldimage = gdk_drawable_get_image (drawable, 0, 0, w, h);
if (depth == 32)
mask = 0xFFFFFFFF;
@@ -616,7 +616,7 @@ test_one_line_on_drawable (GdkDrawable *drawable,
const gint y2 = y1;
gdk_draw_line (drawable, gc, x1, y1, x2, y2);
- newimage = gdk_image_get (drawable, 0, 0, w, h);
+ newimage = gdk_drawable_get_image (drawable, 0, 0, w, h);
for (x = x1-1; x <= x2+1; x++)
for (y = y1-w_up-1; y <= y1+w_down+1; y++)
{
@@ -637,7 +637,7 @@ test_one_line_on_drawable (GdkDrawable *drawable,
const gint y2 = 13;
gdk_draw_line (drawable, gc, x1, y1, x2, y2);
- newimage = gdk_image_get (drawable, 0, 0, w, h);
+ newimage = gdk_drawable_get_image (drawable, 0, 0, w, h);
for (x = x1-w_left-1; x <= x1+w_right+1; x++)
for (y = y1-1; y <= y2+1; y++)
{
@@ -651,8 +651,8 @@ test_one_line_on_drawable (GdkDrawable *drawable,
}
}
- gdk_image_destroy (oldimage);
- gdk_image_destroy (newimage);
+ g_object_unref (oldimage);
+ g_object_unref (newimage);
}
/* Test drawing lines.
@@ -715,7 +715,7 @@ test_one_rectangle_on_drawable (GdkDrawable *drawable,
}
gdk_window_get_size (drawable, &w, &h);
- oldimage = gdk_image_get (drawable, 0, 0, w, h);
+ oldimage = gdk_drawable_get_image (drawable, 0, 0, w, h);
if (depth == 32)
mask = 0xFFFFFFFF;
@@ -723,7 +723,7 @@ test_one_rectangle_on_drawable (GdkDrawable *drawable,
mask = (1 << depth) - 1;
gdk_draw_rectangle (drawable, gc, filled, x0, y0, width, height);
- newimage = gdk_image_get (drawable, 0, 0, w, h);
+ newimage = gdk_drawable_get_image (drawable, 0, 0, w, h);
for (x = x0 - 1; x <= x0 + width + 1; x++)
for (y = y0 - 1; y < y0 + height + 1; y++)
@@ -757,8 +757,8 @@ test_one_rectangle_on_drawable (GdkDrawable *drawable,
}
}
- gdk_image_destroy (oldimage);
- gdk_image_destroy (newimage);
+ g_object_unref (oldimage);
+ g_object_unref (newimage);
}
/* Test drawing rectangles.
@@ -821,7 +821,7 @@ test_some_arcs_on_drawable (GdkDrawable *drawable,
}
gdk_window_get_size (drawable, &w, &h);
- oldimage = gdk_image_get (drawable, 0, 0, w, h);
+ oldimage = gdk_drawable_get_image (drawable, 0, 0, w, h);
if (depth == 32)
mask = 0xFFFFFFFF;
@@ -829,7 +829,7 @@ test_some_arcs_on_drawable (GdkDrawable *drawable,
mask = (1 << depth) - 1;
/* XXX */
- newimage = gdk_image_get (drawable, 0, 0, w, h);
+ newimage = gdk_drawable_get_image (drawable, 0, 0, w, h);
for (x = x0 - 1; x <= x0 + width + 1; x++)
for (y = y0 - 1; y < y0 + height + 1; y++)
@@ -847,8 +847,8 @@ test_some_arcs_on_drawable (GdkDrawable *drawable,
}
}
- gdk_image_destroy (oldimage);
- gdk_image_destroy (newimage);
+ g_object_unref (oldimage);
+ g_object_unref (newimage);
}
/* Test drawing arcs. Results don't have to be exactly as on X11,
diff --git a/gdk/win32/gdkimage-win32.c b/gdk/win32/gdkimage-win32.c
index 5292f20..de54884 100644
--- a/gdk/win32/gdkimage-win32.c
+++ b/gdk/win32/gdkimage-win32.c
@@ -163,41 +163,6 @@ _gdk_win32_new_image (GdkVisual *visual,
return image;
}
-GdkImage *
-gdk_image_new_bitmap (GdkVisual *visual,
- gpointer data,
- gint w,
- gint h)
-{
- GdkPixmap *pixmap;
- GdkImage *image;
- guchar *bits;
- gint data_bpl = (w-1)/8 + 1;
- gint i;
-
- pixmap = gdk_pixmap_new (NULL, w, h, 1);
-
- if (pixmap == NULL)
- return NULL;
-
- GDK_NOTE (IMAGE, g_print ("gdk_image_new_bitmap: %dx%d=%p\n",
- w, h, GDK_PIXMAP_HBITMAP (pixmap)));
-
- bits = GDK_PIXMAP_IMPL_WIN32 (GDK_PIXMAP_OBJECT (pixmap)->impl)->bits;
- image = _gdk_win32_new_image (visual, w, h, 1, bits);
- image->windowing_data = pixmap;
-
- if (data_bpl != image->bpl)
- {
- for (i = 0; i < h; i++)
- memmove ((guchar *) image->mem + i*image->bpl, ((guchar *) data) + i*data_bpl, data_bpl);
- }
- else
- memmove (image->mem, data, data_bpl*h);
-
- return image;
-}
-
void
_gdk_windowing_image_init (void)
{
diff --git a/gdk/x11/gdkimage-x11.c b/gdk/x11/gdkimage-x11.c
index 6bc1a79..1c217a0 100644
--- a/gdk/x11/gdkimage-x11.c
+++ b/gdk/x11/gdkimage-x11.c
@@ -116,62 +116,6 @@ _gdk_image_exit (void)
}
}
-/**
- * gdk_image_new_bitmap:
- * @visual: the #GdkVisual to use for the image.
- * @data: the pixel data.
- * @width: the width of the image in pixels.
- * @height: the height of the image in pixels.
- *
- * Creates a new #GdkImage with a depth of 1 from the given data.
- * <warning><para>THIS FUNCTION IS INCREDIBLY BROKEN. The passed-in data must
- * be allocated by malloc() (NOT g_malloc()) and will be freed when the
- * image is freed.</para></warning>
- *
- * Return value: a new #GdkImage.
- **/
-GdkImage *
-gdk_image_new_bitmap (GdkVisual *visual,
- gpointer data,
- gint width,
- gint height)
-{
- Visual *xvisual;
- GdkImage *image;
- GdkDisplay *display;
- GdkImagePrivateX11 *private;
-
- image = g_object_new (gdk_image_get_type (), NULL);
- private = PRIVATE_DATA (image);
- private->screen = gdk_visual_get_screen (visual);
- display = GDK_SCREEN_DISPLAY (private->screen);
-
- image->type = GDK_IMAGE_NORMAL;
- image->visual = visual;
- image->width = width;
- image->height = height;
- image->depth = 1;
- image->bits_per_pixel = 1;
- if (display->closed)
- private->ximage = NULL;
- else
- {
- xvisual = ((GdkVisualPrivate*) visual)->xvisual;
- private->ximage = XCreateImage (GDK_SCREEN_XDISPLAY (private->screen),
- xvisual, 1, XYBitmap,
- 0, NULL, width, height, 8, 0);
- private->ximage->data = data;
- private->ximage->bitmap_bit_order = MSBFirst;
- private->ximage->byte_order = MSBFirst;
- }
-
- image->byte_order = MSBFirst;
- image->mem = private->ximage->data;
- image->bpl = private->ximage->bytes_per_line;
- image->bpp = 1;
- return image;
-}
-
void
_gdk_windowing_image_init (GdkDisplay *display)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]