summaryrefslogtreecommitdiff
path: root/gdk
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2010-07-14 00:22:45 +0200
committerBenjamin Otte <otte@redhat.com>2010-08-10 21:02:26 +0200
commit14fe04ec8931a1f6ae89af811cc44ea75a3e9d45 (patch)
tree280cad1b54ac9d3da8be3baa6bf9005b10b3621b /gdk
parent6f5084551a771120eefae91b8a514e237ff4d278 (diff)
downloadgtk+-14fe04ec8931a1f6ae89af811cc44ea75a3e9d45.tar.gz
API: remove GdkImage
It was unused and buggy.
Diffstat (limited to 'gdk')
-rw-r--r--gdk/Makefile.am3
-rw-r--r--gdk/directfb/Makefile.am1
-rw-r--r--gdk/directfb/TODO1
-rw-r--r--gdk/directfb/gdkdisplay-directfb.c1
-rw-r--r--gdk/directfb/gdkimage-directfb.c335
-rw-r--r--gdk/directfb/gdkprivate-directfb.h6
-rw-r--r--gdk/gdk.h1
-rw-r--r--gdk/gdk.symbols32
-rw-r--r--gdk/gdkimage.c566
-rw-r--r--gdk/gdkimage.h126
-rw-r--r--gdk/gdkinternals.h17
-rw-r--r--gdk/gdktypes.h1
-rw-r--r--gdk/makefile.msc2
-rw-r--r--gdk/quartz/Makefile.am1
-rw-r--r--gdk/quartz/gdkimage-quartz.c152
-rw-r--r--gdk/win32/Makefile.am1
-rw-r--r--gdk/win32/gdkdisplay-win32.c1
-rw-r--r--gdk/win32/gdkdrawable-win32.c3
-rw-r--r--gdk/win32/gdkimage-win32.c363
-rw-r--r--gdk/win32/gdkprivate-win32.h7
-rw-r--r--gdk/win32/makefile.msc1
-rw-r--r--gdk/x11/Makefile.am1
-rw-r--r--gdk/x11/gdkcolor-x11.c4
-rw-r--r--gdk/x11/gdkdisplay-x11.c2
-rw-r--r--gdk/x11/gdkdisplay-x11.h2
-rw-r--r--gdk/x11/gdkimage-x11.c564
-rw-r--r--gdk/x11/gdkprivate-x11.h3
-rw-r--r--gdk/x11/gdkx.h4
28 files changed, 2 insertions, 2199 deletions
diff --git a/gdk/Makefile.am b/gdk/Makefile.am
index 51dd0f478e..b63f502bd9 100644
--- a/gdk/Makefile.am
+++ b/gdk/Makefile.am
@@ -82,7 +82,6 @@ gdk_public_h_sources = \
gdkdrawable.h \
gdkevents.h \
gdkgc.h \
- gdkimage.h \
gdkinput.h \
gdkkeys.h \
gdkkeysyms.h \
@@ -124,7 +123,6 @@ gdk_c_sources = \
gdkevents.c \
gdkgc.c \
gdkglobals.c \
- gdkimage.c \
gdkkeys.c \
gdkkeyuni.c \
gdkoffscreenwindow.c \
@@ -214,7 +212,6 @@ x11_introspection_files = \
x11/gdkgc-x11.c \
x11/gdkgeometry-x11.c \
x11/gdkglobals-x11.c \
- x11/gdkimage-x11.c \
x11/gdkim-x11.c \
x11/gdkinput.c \
x11/gdkkeys-x11.c \
diff --git a/gdk/directfb/Makefile.am b/gdk/directfb/Makefile.am
index 57d3fed3c6..a11f9debac 100644
--- a/gdk/directfb/Makefile.am
+++ b/gdk/directfb/Makefile.am
@@ -31,7 +31,6 @@ libgdk_directfb_la_SOURCES = \
gdkgeometry-directfb.c \
gdkglobals-directfb.c \
gdkim-directfb.c \
- gdkimage-directfb.c \
gdkinput-directfb.c \
gdkinput-directfb.h \
gdkkeys-directfb.c \
diff --git a/gdk/directfb/TODO b/gdk/directfb/TODO
index 10215d3ea4..2833669eda 100644
--- a/gdk/directfb/TODO
+++ b/gdk/directfb/TODO
@@ -34,7 +34,6 @@ gdkevents-directfb.c
gdkgc-directfb.c
gdkgeometry-directfb.c
gdkglobals-directfb.c
-gdkimage-directfb.c
gdkim-directfb.c
gdkinput-directfb.c
gdkkeys-directfb.c
diff --git a/gdk/directfb/gdkdisplay-directfb.c b/gdk/directfb/gdkdisplay-directfb.c
index 78026bfc0c..895713f9d9 100644
--- a/gdk/directfb/gdkdisplay-directfb.c
+++ b/gdk/directfb/gdkdisplay-directfb.c
@@ -39,7 +39,6 @@ extern void _gdk_events_init (void);
extern void _gdk_input_init (void);
extern void _gdk_dnd_init (void);
extern void _gdk_windowing_window_init (void);
-extern void _gdk_windowing_image_init (void);
extern void _gdk_directfb_keyboard_init (void);
static gboolean gdk_directfb_argb_font = FALSE;
diff --git a/gdk/directfb/gdkimage-directfb.c b/gdk/directfb/gdkimage-directfb.c
deleted file mode 100644
index e9533c59f2..0000000000
--- a/gdk/directfb/gdkimage-directfb.c
+++ /dev/null
@@ -1,335 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team.
- */
-
-/*
- * GTK+ DirectFB backend
- * Copyright (C) 2001-2002 convergence integrated media GmbH
- * Copyright (C) 2002-2004 convergence GmbH
- * Written by Denis Oliver Kropp <dok@convergence.de> and
- * Sven Neumann <sven@convergence.de>
- */
-
-#include "config.h"
-#include "gdk.h"
-
-
-#include "gdkdirectfb.h"
-#include "gdkprivate-directfb.h"
-
-#include "gdkinternals.h"
-
-#include "gdkimage.h"
-
-
-static GList *image_list = NULL;
-static gpointer parent_class = NULL;
-
-static void gdk_directfb_image_destroy (GdkImage *image);
-static void gdk_image_init (GdkImage *image);
-static void gdk_image_class_init (GdkImageClass *klass);
-static void gdk_image_finalize (GObject *object);
-
-GType
-gdk_image_get_type (void)
-{
- static GType object_type = 0;
-
- if (!object_type)
- {
- const GTypeInfo object_info =
- {
- sizeof (GdkImageClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) gdk_image_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GdkImage),
- 0, /* n_preallocs */
- (GInstanceInitFunc) gdk_image_init,
- };
-
- object_type = g_type_register_static (G_TYPE_OBJECT,
- "GdkImage",
- &object_info, 0);
- }
-
- return object_type;
-}
-
-static void
-gdk_image_init (GdkImage *image)
-{
- image->windowing_data = g_new0 (GdkImageDirectFB, 1);
- image->mem = NULL;
-
- image_list = g_list_prepend (image_list, image);
-}
-
-static void
-gdk_image_class_init (GdkImageClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- object_class->finalize = gdk_image_finalize;
-}
-
-static void
-gdk_image_finalize (GObject *object)
-{
- GdkImage *image;
-
- image = GDK_IMAGE (object);
-
- image_list = g_list_remove (image_list, image);
-
- if (image->depth == 1)
- g_free (image->mem);
-
- gdk_directfb_image_destroy (image);
-
- if (G_OBJECT_CLASS (parent_class)->finalize)
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-
-/* this function is called from the atexit handler! */
-void
-_gdk_image_exit (void)
-{
- GObject *image;
-
- while (image_list)
- {
- image = image_list->data;
-
- gdk_image_finalize (image);
- }
-}
-
-void
-_gdk_windowing_image_init (void)
-{
-}
-
-GdkImage*
-_gdk_image_new_for_depth (GdkScreen *screen,
- GdkImageType type,
- GdkVisual *visual,
- gint width,
- gint height,
- gint depth)
-{
- GdkImage *image;
- GdkImageDirectFB *private;
- DFBResult ret;
- gint pitch;
- DFBSurfacePixelFormat format;
- IDirectFBSurface *surface;
-
- if (type == GDK_IMAGE_FASTEST || type == GDK_IMAGE_NORMAL)
- type = GDK_IMAGE_SHARED;
-
- if (visual)
- depth = visual->depth;
-
- switch (depth)
- {
- case 8:
- format = DSPF_LUT8;
- break;
- case 15:
- format = DSPF_ARGB1555;
- break;
- case 16:
- format = DSPF_RGB16;
- break;
- case 24:
- format = DSPF_RGB32;
- break;
- case 32:
- format = DSPF_ARGB;
- break;
- default:
- g_message ("unimplemented %s for depth %d", G_STRFUNC, depth);
- return NULL;
- }
-
- surface = gdk_display_dfb_create_surface(_gdk_display,format,width,height);
- if (!surface)
- {
- return NULL;
- }
- surface->GetPixelFormat( surface, &format );
-
- image = g_object_new (gdk_image_get_type (), NULL);
- private = image->windowing_data;
-
- private->surface = surface;
-
- ret = surface->Lock( surface, DSLF_WRITE, &image->mem, &pitch );
- if (ret)
- {
- DirectFBError( "IDirectFBSurface::Lock() for writing failed!\n", ret );
- g_object_unref( image );
- return NULL;
- }
-
- image->type = type;
- image->visual = visual;
-#if G_BYTE_ORDER == G_BIG_ENDIAN
- image->byte_order = GDK_MSB_FIRST;
-#else
- image->byte_order = GDK_LSB_FIRST;
-#endif
- image->width = width;
- image->height = height;
- image->depth = depth;
- image->bpp = DFB_BYTES_PER_PIXEL (format);
- image->bpl = pitch;
- image->bits_per_pixel = DFB_BITS_PER_PIXEL (format);
-
- image_list = g_list_prepend (image_list, image);
-
- return image;
-}
-
-guint32
-gdk_image_get_pixel (GdkImage *image,
- gint x,
- gint y)
-{
- guint32 pixel = 0;
-
- g_return_val_if_fail (GDK_IS_IMAGE (image), 0);
-
- if (!(x >= 0 && x < image->width && y >= 0 && y < image->height))
- return 0;
-
- if (image->depth == 1)
- pixel = (((guchar *) image->mem)[y * image->bpl + (x >> 3)] & (1 << (7 - (x & 0x7)))) != 0;
- else
- {
- guchar *pixelp = (guchar *) image->mem + y * image->bpl + x * image->bpp;
-
- switch (image->bpp)
- {
- case 1:
- pixel = *pixelp;
- break;
-
- case 2:
- pixel = pixelp[0] | (pixelp[1] << 8);
- break;
-
- case 3:
- pixel = pixelp[0] | (pixelp[1] << 8) | (pixelp[2] << 16);
- break;
-
- case 4:
- pixel = pixelp[0] | (pixelp[1] << 8) | (pixelp[2] << 16);
- break;
- }
- }
-
- return pixel;
-}
-
-void
-gdk_image_put_pixel (GdkImage *image,
- gint x,
- gint y,
- guint32 pixel)
-{
- g_return_if_fail (image != NULL);
-
- if (!(x >= 0 && x < image->width && y >= 0 && y < image->height))
- return;
-
- if (image->depth == 1)
- if (pixel & 1)
- ((guchar *) image->mem)[y * image->bpl + (x >> 3)] |= (1 << (7 - (x & 0x7)));
- else
- ((guchar *) image->mem)[y * image->bpl + (x >> 3)] &= ~(1 << (7 - (x & 0x7)));
- else
- {
- guchar *pixelp = (guchar *) image->mem + y * image->bpl + x * image->bpp;
-
- switch (image->bpp)
- {
- case 4:
- pixelp[3] = 0xFF;
- case 3:
- pixelp[2] = ((pixel >> 16) & 0xFF);
- case 2:
- pixelp[1] = ((pixel >> 8) & 0xFF);
- case 1:
- pixelp[0] = (pixel & 0xFF);
- }
- }
-}
-
-static void
-gdk_directfb_image_destroy (GdkImage *image)
-{
- GdkImageDirectFB *private;
-
- g_return_if_fail (GDK_IS_IMAGE (image));
-
- private = image->windowing_data;
-
- if (!private)
- return;
-
- GDK_NOTE (MISC, g_print ("gdk_directfb_image_destroy: %#lx\n",
- (gulong) private->surface));
-
- private->surface->Unlock( private->surface );
- private->surface->Release( private->surface );
-
- g_free (private);
- image->windowing_data = NULL;
-}
-
-gint
-_gdk_windowing_get_bits_for_depth (GdkDisplay *display,
- gint depth)
-{
- switch (depth)
- {
- case 1:
- case 8:
- return 8;
- case 15:
- case 16:
- return 16;
- case 24:
- case 32:
- return 32;
- }
-
- return 0;
-}
diff --git a/gdk/directfb/gdkprivate-directfb.h b/gdk/directfb/gdkprivate-directfb.h
index a8147d1319..9929998f40 100644
--- a/gdk/directfb/gdkprivate-directfb.h
+++ b/gdk/directfb/gdkprivate-directfb.h
@@ -198,12 +198,6 @@ typedef struct
DFBSurfacePixelFormat format;
} GdkVisualDirectFB;
-typedef struct
-{
- IDirectFBSurface *surface;
-} GdkImageDirectFB;
-
-
#define GDK_TYPE_GC_DIRECTFB (_gdk_gc_directfb_get_type ())
#define GDK_GC_DIRECTFB(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_GC_DIRECTFB, GdkGCDirectFB))
#define GDK_IS_GC_DIRECTFB(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_GC_DIRECTFB))
diff --git a/gdk/gdk.h b/gdk/gdk.h
index ba74d4dad0..4ff1e15bc9 100644
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -42,7 +42,6 @@
#include <gdk/gdkenumtypes.h>
#include <gdk/gdkevents.h>
#include <gdk/gdkgc.h>
-#include <gdk/gdkimage.h>
#include <gdk/gdkinput.h>
#include <gdk/gdkkeys.h>
#include <gdk/gdkpango.h>
diff --git a/gdk/gdk.symbols b/gdk/gdk.symbols
index 3832b9d286..31b9496f14 100644
--- a/gdk/gdk.symbols
+++ b/gdk/gdk.symbols
@@ -286,7 +286,6 @@ gdk_window_hints_get_type G_GNUC_CONST
gdk_window_state_get_type G_GNUC_CONST
gdk_window_type_get_type G_GNUC_CONST
gdk_window_type_hint_get_type G_GNUC_CONST
-gdk_image_type_get_type G_GNUC_CONST
gdk_visual_type_get_type G_GNUC_CONST
#endif
#endif
@@ -806,32 +805,6 @@ gdk_window_configure_finished
#endif
#endif
-#if IN_HEADER(__GDK_IMAGE_H__)
-#if IN_FILE(__GDK_IMAGE_C__)
-gdk_image_get_bits_per_pixel
-gdk_image_get_bytes_per_pixel
-gdk_image_get_bytes_per_line
-gdk_image_get_byte_order
-gdk_image_get_colormap
-gdk_image_get_depth
-gdk_image_get_height
-gdk_image_get_image_type
-gdk_image_get_visual
-gdk_image_get_width
-gdk_image_get_pixels
-gdk_image_set_colormap
-gdk_image_new
-#endif
-#endif
-
-#if IN_HEADER(__GDK_IMAGE_H__)
-#if IN_FILE(__GDK_IMAGE_X11_C__)
-gdk_image_get_pixel
-gdk_image_put_pixel
-gdk_image_get_type G_GNUC_CONST
-#endif
-#endif
-
#if IN_HEADER(__GDK_KEYS_H__)
#if IN_FILE(__GDK_KEYS_C__)
gdk_keymap_get_default
@@ -1186,11 +1159,6 @@ gdk_x11_grab_server
gdk_x11_ungrab_server
#endif
-#if IN_FILE(__GDK_IMAGE_X11_C__)
-gdk_x11_image_get_xdisplay
-gdk_x11_image_get_ximage
-#endif
-
#if IN_FILE(__GDK_SCREEN_X11_C__)
gdk_net_wm_supports
gdk_x11_screen_get_screen_number
diff --git a/gdk/gdkimage.c b/gdk/gdkimage.c
deleted file mode 100644
index 3cc2cb48e9..0000000000
--- a/gdk/gdkimage.c
+++ /dev/null
@@ -1,566 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#include "config.h"
-#include <stdlib.h>
-#include <sys/types.h>
-
-#include "gdk.h" /* For gdk_flush() */
-#include "gdkimage.h"
-#include "gdkprivate.h"
-#include "gdkinternals.h" /* For scratch_image code */
-
-/**
- * gdk_image_set_colormap:
- * @image: a #GdkImage
- * @colormap: a #GdkColormap
- *
- * Sets the colormap for the image to the given colormap. Normally
- * there's no need to use this function, images are created with the
- * correct colormap if you get the image from a drawable. If you
- * create the image from scratch, use the colormap of the drawable you
- * intend to render the image to.
- **/
-void
-gdk_image_set_colormap (GdkImage *image,
- GdkColormap *colormap)
-{
- g_return_if_fail (GDK_IS_IMAGE (image));
- g_return_if_fail (GDK_IS_COLORMAP (colormap));
-
- if (image->colormap != colormap)
- {
- if (image->colormap)
- g_object_unref (image->colormap);
-
- image->colormap = colormap;
- g_object_ref (image->colormap);
- }
-}
-
-/**
- * gdk_image_get_colormap:
- * @image: a #GdkImage
- *
- * Retrieves the colormap for a given image, if it exists. An image
- * will have a colormap if the drawable from which it was created has
- * a colormap, or if a colormap was set explicitely with
- * gdk_image_set_colormap().
- *
- * Return value: colormap for the image
- **/
-GdkColormap *
-gdk_image_get_colormap (GdkImage *image)
-{
- g_return_val_if_fail (GDK_IS_IMAGE (image), NULL);
-
- return image->colormap;
-}
-
-/**
- * gdk_image_get_image_type:
- * @image: a #GdkImage
- *
- * Determines the type of a given image.
- *
- * Return value: the #GdkImageType of the image
- *
- * Since: 2.22
- **/
-GdkImageType
-gdk_image_get_image_type (GdkImage *image)
-{
- g_return_val_if_fail (GDK_IS_IMAGE (image), 0);
-
- return image->type;
-}
-
-/**
- * gdk_image_get_visual:
- * @image: a #GdkImage
- *
- * Determines the visual that was used to create the image.
- *
- * Return value: a #GdkVisual
- *
- * Since: 2.22
- **/
-GdkVisual *
-gdk_image_get_visual (GdkImage *image)
-{
- g_return_val_if_fail (GDK_IS_IMAGE (image), NULL);
-
- return image->visual;
-}
-
-/**
- * gdk_image_get_byte_order:
- * @image: a #GdkImage
- *
- * Determines the byte order of the image.
- *
- * Return value: a #GdkVisual
- *
- * Since: 2.22
- **/
-GdkByteOrder
-gdk_image_get_byte_order (GdkImage *image)
-{
- g_return_val_if_fail (GDK_IS_IMAGE (image), 0);
-
- return image->byte_order;
-}
-
-/**
- * gdk_image_get_width:
- * @image: a #GdkImage
- *
- * Determines the width of the image.
- *
- * Return value: the width
- *
- * Since: 2.22
- **/
-gint
-gdk_image_get_width (GdkImage *image)
-{
- g_return_val_if_fail (GDK_IS_IMAGE (image), 0);
-
- return image->width;
-}
-
-/**
- * gdk_image_get_height:
- * @image: a #GdkImage
- *
- * Determines the height of the image.
- *
- * Return value: the height
- *
- * Since: 2.22
- **/
-gint
-gdk_image_get_height (GdkImage *image)
-{
- g_return_val_if_fail (GDK_IS_IMAGE (image), 0);
-
- return image->height;
-}
-
-/**
- * gdk_image_get_depth:
- * @image: a #GdkImage
- *
- * Determines the depth of the image.
- *
- * Return value: the depth
- *
- * Since: 2.22
- **/
-guint16
-gdk_image_get_depth (GdkImage *image)
-{
- g_return_val_if_fail (GDK_IS_IMAGE (image), 0);
-
- return image->depth;
-}
-
-/**
- * gdk_image_get_bytes_per_pixel:
- * @image: a #GdkImage
- *
- * Determines the number of bytes per pixel of the image.
- *
- * Return value: the bytes per pixel
- *
- * Since: 2.22
- **/
-guint16
-gdk_image_get_bytes_per_pixel (GdkImage *image)
-{
- g_return_val_if_fail (GDK_IS_IMAGE (image), 0);
-
- return image->bpp;
-}
-
-/**
- * gdk_image_get_bytes_per_line:
- * @image: a #GdkImage
- *
- * Determines the number of bytes per line of the image.
- *
- * Return value: the bytes per line
- *
- * Since: 2.22
- **/
-guint16
-gdk_image_get_bytes_per_line (GdkImage *image)
-{
- g_return_val_if_fail (GDK_IS_IMAGE (image), 0);
-
- return image->bpl;
-}
-
-/**
- * gdk_image_get_bits_per_pixel:
- * @image: a #GdkImage
- *
- * Determines the number of bits per pixel of the image.
- *
- * Return value: the bits per pixel
- *
- * Since: 2.22
- **/
-guint16
-gdk_image_get_bits_per_pixel (GdkImage *image)
-{
- g_return_val_if_fail (GDK_IS_IMAGE (image), 0);
-
- return image->bits_per_pixel;
-}
-
-/**
- * gdk_image_get_pixels:
- * @image: a #GdkImage
- *
- * Returns a pointer to the pixel data of the image.
- *
- * Returns: the pixel data of the image
- *
- * Since: 2.22
- */
-gpointer
-gdk_image_get_pixels (GdkImage *image)
-{
- g_return_val_if_fail (GDK_IS_IMAGE (image), NULL);
-
- return image->mem;
-}
-
-/* We have N_REGION GDK_SCRATCH_IMAGE_WIDTH x GDK_SCRATCH_IMAGE_HEIGHT regions divided
- * up between n_images different images. possible_n_images gives
- * various divisors of N_REGIONS. The reason for allowing this
- * flexibility is that we want to create as few images as possible,
- * but we want to deal with the abberant systems that have a SHMMAX
- * limit less than
- *
- * GDK_SCRATCH_IMAGE_WIDTH * GDK_SCRATCH_IMAGE_HEIGHT * N_REGIONS * 4 (384k)
- *
- * (Are there any such?)
- */
-#define N_REGIONS 6
-static const int possible_n_images[] = { 1, 2, 3, 6 };
-
-/* We allocate one GdkScratchImageInfo structure for each
- * depth where we are allocating scratch images. (Future: one
- * per depth, per display)
- */
-typedef struct _GdkScratchImageInfo GdkScratchImageInfo;
-
-struct _GdkScratchImageInfo {
- gint depth;
-
- gint n_images;
- GdkImage *static_image[N_REGIONS];
- gint static_image_idx;
-
- /* In order to optimize filling fractions, we simultaneously fill in up
- * to three regions of size GDK_SCRATCH_IMAGE_WIDTH * GDK_SCRATCH_IMAGE_HEIGHT: one
- * for images that are taller than GDK_SCRATCH_IMAGE_HEIGHT / 2, and must
- * be tiled horizontally. One for images that are wider than
- * GDK_SCRATCH_IMAGE_WIDTH / 2 and must be tiled vertically, and a third
- * for images smaller than GDK_SCRATCH_IMAGE_HEIGHT / 2 x GDK_SCRATCH_IMAGE_WIDTH x 2
- * that we tile in horizontal rows.
- */
- gint horiz_idx;
- gint horiz_y;
- gint vert_idx;
- gint vert_x;
-
- /* tile_y1 and tile_y2 define the horizontal band into
- * which we are tiling images. tile_x is the x extent to
- * which that is filled
- */
- gint tile_idx;
- gint tile_x;
- gint tile_y1;
- gint tile_y2;
-
- GdkScreen *screen;
-};
-
-static GSList *scratch_image_infos = NULL;
-
-static gboolean
-allocate_scratch_images (GdkScratchImageInfo *info,
- gint n_images,
- gboolean shared)
-{
- gint i;
-
- for (i = 0; i < n_images; i++)
- {
- info->static_image[i] = _gdk_image_new_for_depth (info->screen,
- shared ? GDK_IMAGE_SHARED : GDK_IMAGE_NORMAL,
- NULL,
- GDK_SCRATCH_IMAGE_WIDTH * (N_REGIONS / n_images),
- GDK_SCRATCH_IMAGE_HEIGHT,
- info->depth);
-
- if (!info->static_image[i])
- {
- gint j;
-
- for (j = 0; j < i; j++)
- g_object_unref (info->static_image[j]);
-
- return FALSE;
- }
- }
-
- return TRUE;
-}
-
-static void
-scratch_image_info_display_closed (GdkDisplay *display,
- gboolean is_error,
- GdkScratchImageInfo *image_info)
-{
- gint i;
-
- g_signal_handlers_disconnect_by_func (display,
- scratch_image_info_display_closed,
- image_info);
-
- scratch_image_infos = g_slist_remove (scratch_image_infos, image_info);
-
- for (i = 0; i < image_info->n_images; i++)
- g_object_unref (image_info->static_image[i]);
-
- g_free (image_info);
-}
-
-static GdkScratchImageInfo *
-scratch_image_info_for_depth (GdkScreen *screen,
- gint depth)
-{
- GSList *tmp_list;
- GdkScratchImageInfo *image_info;
- gint i;
-
- tmp_list = scratch_image_infos;
- while (tmp_list)
- {
- image_info = tmp_list->data;
- if (image_info->depth == depth && image_info->screen == screen)
- return image_info;
-
- tmp_list = tmp_list->next;
- }
-
- image_info = g_new (GdkScratchImageInfo, 1);
-
- image_info->depth = depth;
- image_info->screen = screen;
-
- g_signal_connect (gdk_screen_get_display (screen), "closed",
- G_CALLBACK (scratch_image_info_display_closed),
- image_info);
-
- /* Try to allocate as few possible shared images */
- for (i=0; i < G_N_ELEMENTS (possible_n_images); i++)
- {
- if (allocate_scratch_images (image_info, possible_n_images[i], TRUE))
- {
- image_info->n_images = possible_n_images[i];
- break;
- }
- }
-
- /* If that fails, just allocate N_REGIONS normal images */
- if (i == G_N_ELEMENTS (possible_n_images))
- {
- allocate_scratch_images (image_info, N_REGIONS, FALSE);
- image_info->n_images = N_REGIONS;
- }
-
- image_info->static_image_idx = 0;
-
- image_info->horiz_y = GDK_SCRATCH_IMAGE_HEIGHT;
- image_info->vert_x = GDK_SCRATCH_IMAGE_WIDTH;
- image_info->tile_x = GDK_SCRATCH_IMAGE_WIDTH;
- image_info->tile_y1 = image_info->tile_y2 = GDK_SCRATCH_IMAGE_HEIGHT;
-
- scratch_image_infos = g_slist_prepend (scratch_image_infos, image_info);
-
- return image_info;
-}
-
-/* Defining NO_FLUSH can cause inconsistent screen updates, but is useful
- for performance evaluation. */
-
-#undef NO_FLUSH
-
-#ifdef VERBOSE
-static gint sincelast;
-#endif
-
-static gint
-alloc_scratch_image (GdkScratchImageInfo *image_info)
-{
- if (image_info->static_image_idx == N_REGIONS)
- {
-#ifndef NO_FLUSH
- gdk_flush ();
-#endif
-#ifdef VERBOSE
- g_print ("flush, %d puts since last flush\n", sincelast);
- sincelast = 0;
-#endif
- image_info->static_image_idx = 0;
-
- /* Mark all regions that we might be filling in as completely
- * full, to force new tiles to be allocated for subsequent
- * images
- */
- image_info->horiz_y = GDK_SCRATCH_IMAGE_HEIGHT;
- image_info->vert_x = GDK_SCRATCH_IMAGE_WIDTH;
- image_info->tile_x = GDK_SCRATCH_IMAGE_WIDTH;
- image_info->tile_y1 = image_info->tile_y2 = GDK_SCRATCH_IMAGE_HEIGHT;
- }
- return image_info->static_image_idx++;
-}
-
-/**
- * _gdk_image_get_scratch:
- * @screen: a #GdkScreen
- * @width: desired width
- * @height: desired height
- * @depth: depth of image
- * @x: X location within returned image of scratch image
- * @y: Y location within returned image of scratch image
- *
- * Allocates an image of size width/height, up to a maximum
- * of GDK_SCRATCH_IMAGE_WIDTHxGDK_SCRATCH_IMAGE_HEIGHT that is
- * suitable to use on @screen.
- *
- * Return value: a scratch image. This must be used by a
- * call to gdk_image_put() before any other calls to
- * _gdk_image_get_scratch()
- **/
-GdkImage *
-_gdk_image_get_scratch (GdkScreen *screen,
- gint width,
- gint height,
- gint depth,
- gint *x,
- gint *y)
-{
- GdkScratchImageInfo *image_info;
- GdkImage *image;
- gint idx;
-
- g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
-
- image_info = scratch_image_info_for_depth (screen, depth);
-
- if (width >= (GDK_SCRATCH_IMAGE_WIDTH >> 1))
- {
- if (height >= (GDK_SCRATCH_IMAGE_HEIGHT >> 1))
- {
- idx = alloc_scratch_image (image_info);
- *x = 0;
- *y = 0;
- }
- else
- {
- if (height + image_info->horiz_y > GDK_SCRATCH_IMAGE_HEIGHT)
- {
- image_info->horiz_idx = alloc_scratch_image (image_info);
- image_info->horiz_y = 0;
- }
- idx = image_info->horiz_idx;
- *x = 0;
- *y = image_info->horiz_y;
- image_info->horiz_y += height;
- }
- }
- else
- {
- if (height >= (GDK_SCRATCH_IMAGE_HEIGHT >> 1))
- {
- if (width + image_info->vert_x > GDK_SCRATCH_IMAGE_WIDTH)
- {
- image_info->vert_idx = alloc_scratch_image (image_info);
- image_info->vert_x = 0;
- }
- idx = image_info->vert_idx;
- *x = image_info->vert_x;
- *y = 0;
- /* using 3 and -4 would be slightly more efficient on 32-bit machines
- with > 1bpp displays */
- image_info->vert_x += (width + 7) & -8;
- }
- else
- {
- if (width + image_info->tile_x > GDK_SCRATCH_IMAGE_WIDTH)
- {
- image_info->tile_y1 = image_info->tile_y2;
- image_info->tile_x = 0;
- }
- if (height + image_info->tile_y1 > GDK_SCRATCH_IMAGE_HEIGHT)
- {
- image_info->tile_idx = alloc_scratch_image (image_info);
- image_info->tile_x = 0;
- image_info->tile_y1 = 0;
- image_info->tile_y2 = 0;
- }
- if (height + image_info->tile_y1 > image_info->tile_y2)
- image_info->tile_y2 = height + image_info->tile_y1;
- idx = image_info->tile_idx;
- *x = image_info->tile_x;
- *y = image_info->tile_y1;
- image_info->tile_x += (width + 7) & -8;
- }
- }
- image = image_info->static_image[idx * image_info->n_images / N_REGIONS];
- *x += GDK_SCRATCH_IMAGE_WIDTH * (idx % (N_REGIONS / image_info->n_images));
-#ifdef VERBOSE
- g_print ("index %d, x %d, y %d (%d x %d)\n", idx, *x, *y, width, height);
- sincelast++;
-#endif
- return image;
-}
-
-GdkImage*
-gdk_image_new (GdkImageType type,
- GdkVisual *visual,
- gint width,
- gint height)
-{
- return _gdk_image_new_for_depth (gdk_visual_get_screen (visual), type,
- visual, width, height, -1);
-}
diff --git a/gdk/gdkimage.h b/gdk/gdkimage.h
deleted file mode 100644
index 52008018e0..0000000000
--- a/gdk/gdkimage.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
-#error "Only <gdk/gdk.h> can be included directly."
-#endif
-
-#ifndef __GDK_IMAGE_H__
-#define __GDK_IMAGE_H__
-
-#include <gdk/gdktypes.h>
-
-G_BEGIN_DECLS
-
-/* Types of images.
- * Normal: Normal X image type. These are slow as they involve passing
- * the entire image through the X connection each time a draw
- * request is required. On Win32, a bitmap.
- * Shared: Shared memory X image type. These are fast as the X server
- * and the program actually use the same piece of memory. They
- * should be used with care though as there is the possibility
- * for both the X server and the program to be reading/writing
- * the image simultaneously and producing undesired results.
- * On Win32, also a bitmap.
- */
-typedef enum
-{
- GDK_IMAGE_NORMAL,
- GDK_IMAGE_SHARED,
- GDK_IMAGE_FASTEST
-} GdkImageType;
-
-typedef struct _GdkImageClass GdkImageClass;
-
-#define GDK_TYPE_IMAGE (gdk_image_get_type ())
-#define GDK_IMAGE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_IMAGE, GdkImage))
-#define GDK_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_IMAGE, GdkImageClass))
-#define GDK_IS_IMAGE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_IMAGE))
-#define GDK_IS_IMAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_IMAGE))
-#define GDK_IMAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_IMAGE, GdkImageClass))
-
-struct _GdkImage
-{
- GObject parent_instance;
-
- /*< public >*/
-
- GdkImageType GSEAL (type); /* read only. */
- GdkVisual *GSEAL (visual); /* read only. visual used to create the image */
- GdkByteOrder GSEAL (byte_order); /* read only. */
- gint GSEAL (width); /* read only. */
- gint GSEAL (height); /* read only. */
- guint16 GSEAL (depth); /* read only. */
- guint16 GSEAL (bpp); /* read only. bytes per pixel */
- guint16 GSEAL (bpl); /* read only. bytes per line */
- guint16 GSEAL (bits_per_pixel); /* read only. bits per pixel */
- gpointer GSEAL (mem);
-
- GdkColormap *GSEAL (colormap); /* read only. */
-
- /*< private >*/
- gpointer GSEAL (windowing_data); /* read only. */
-};
-
-struct _GdkImageClass
-{
- GObjectClass parent_class;
-};
-
-GType gdk_image_get_type (void) G_GNUC_CONST;
-
-GdkImage* gdk_image_new (GdkImageType type,
- GdkVisual *visual,
- gint width,
- gint height);
-
-void gdk_image_put_pixel (GdkImage *image,
- gint x,
- gint y,
- guint32 pixel);
-guint32 gdk_image_get_pixel (GdkImage *image,
- gint x,
- gint y);
-
-void gdk_image_set_colormap (GdkImage *image,
- GdkColormap *colormap);
-GdkColormap* gdk_image_get_colormap (GdkImage *image);
-
-GdkImageType gdk_image_get_image_type (GdkImage *image);
-GdkVisual *gdk_image_get_visual (GdkImage *image);
-GdkByteOrder gdk_image_get_byte_order (GdkImage *image);
-gint gdk_image_get_width (GdkImage *image);
-gint gdk_image_get_height (GdkImage *image);
-guint16 gdk_image_get_depth (GdkImage *image);
-guint16 gdk_image_get_bytes_per_pixel(GdkImage *image);
-guint16 gdk_image_get_bytes_per_line (GdkImage *image);
-guint16 gdk_image_get_bits_per_pixel (GdkImage *image);
-gpointer gdk_image_get_pixels (GdkImage *image);
-
-
-G_END_DECLS
-
-#endif /* __GDK_IMAGE_H__ */
diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h
index f46edd9cf1..157f8a09b1 100644
--- a/gdk/gdkinternals.h
+++ b/gdk/gdkinternals.h
@@ -317,22 +317,6 @@ void gdk_synthesize_window_state (GdkWindow *window,
GdkDeviceManager * _gdk_device_manager_new (GdkDisplay *display);
-#define GDK_SCRATCH_IMAGE_WIDTH 256
-#define GDK_SCRATCH_IMAGE_HEIGHT 64
-
-GdkImage* _gdk_image_new_for_depth (GdkScreen *screen,
- GdkImageType type,
- GdkVisual *visual,
- gint width,
- gint height,
- gint depth);
-GdkImage *_gdk_image_get_scratch (GdkScreen *screen,
- gint width,
- gint height,
- gint depth,
- gint *x,
- gint *y);
-
cairo_surface_t *_gdk_drawable_ref_cairo_surface (GdkDrawable *drawable);
GdkDrawable *_gdk_drawable_get_source_drawable (GdkDrawable *drawable);
@@ -691,7 +675,6 @@ void _gdk_offscreen_window_new (GdkWindow *window,
* Initialization and exit routines *
************************************/
-void _gdk_image_exit (void);
void _gdk_windowing_exit (void);
G_END_DECLS
diff --git a/gdk/gdktypes.h b/gdk/gdktypes.h
index 16a4f91f84..aaba5898bf 100644
--- a/gdk/gdktypes.h
+++ b/gdk/gdktypes.h
@@ -104,7 +104,6 @@ typedef struct _GdkColor GdkColor;
typedef struct _GdkColormap GdkColormap;
typedef struct _GdkCursor GdkCursor;
typedef struct _GdkGC GdkGC;
-typedef struct _GdkImage GdkImage;
typedef struct _GdkVisual GdkVisual;
typedef struct _GdkDrawable GdkDrawable;
diff --git a/gdk/makefile.msc b/gdk/makefile.msc
index b137a4dcf9..717e2b9787 100644
--- a/gdk/makefile.msc
+++ b/gdk/makefile.msc
@@ -75,7 +75,6 @@ gdk_OBJECTS = \
gdkevents.obj \
gdkgc.obj \
gdkglobals.obj \
- gdkimage.obj \
gdkwindowimpl.obj \
gdkkeynames.obj \
gdkkeys.obj \
@@ -101,7 +100,6 @@ gdk_public_h_sources = \
gdkevents.h \
gdkgc.h \
gdkkeysyms.h \
- gdkimage.h \
gdkinput.h \
gdkkeys.h \
gdkpango.h \
diff --git a/gdk/quartz/Makefile.am b/gdk/quartz/Makefile.am
index 6a45b489ec..2681f6d835 100644
--- a/gdk/quartz/Makefile.am
+++ b/gdk/quartz/Makefile.am
@@ -36,7 +36,6 @@ libgdk_quartz_la_SOURCES = \
gdkgeometry-quartz.c \
gdkglobals-quartz.c \
gdkim-quartz.c \
- gdkimage-quartz.c \
gdkinput.c \
gdkinputprivate.h \
gdkkeys-quartz.c \
diff --git a/gdk/quartz/gdkimage-quartz.c b/gdk/quartz/gdkimage-quartz.c
deleted file mode 100644
index 3af2cecda6..0000000000
--- a/gdk/quartz/gdkimage-quartz.c
+++ /dev/null
@@ -1,152 +0,0 @@
-/* gdkimage-quartz.c
- *
- * Copyright (C) 2005 Imendio AB
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include "config.h"
-
-#include "gdk.h"
-#include "gdkimage.h"
-#include "gdkprivate-quartz.h"
-
-static GObjectClass *parent_class;
-
-static void
-gdk_image_finalize (GObject *object)
-{
- GdkImage *image = GDK_IMAGE (object);
-
- g_free (image->mem);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static void
-gdk_image_class_init (GdkImageClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- object_class->finalize = gdk_image_finalize;
-}
-
-GType
-gdk_image_get_type (void)
-{
- static GType object_type = 0;
-
- if (!object_type)
- {
- const GTypeInfo object_info =
- {
- sizeof (GdkImageClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) gdk_image_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GdkImage),
- 0, /* n_preallocs */
- (GInstanceInitFunc) NULL,
- };
-
- object_type = g_type_register_static (G_TYPE_OBJECT,
- "GdkImage",
- &object_info,
- 0);
- }
-
- return object_type;
-}
-
-GdkImage*
-_gdk_image_new_for_depth (GdkScreen *screen,
- GdkImageType type,
- GdkVisual *visual,
- gint width,
- gint height,
- gint depth)
-{
- GdkImage *image;
-
- if (visual)
- depth = visual->depth;
-
- g_assert (depth == 24 || depth == 32);
-
- image = g_object_new (gdk_image_get_type (), NULL);
- image->type = type;
- image->visual = visual;
- image->width = width;
- image->height = height;
- image->depth = depth;
-
- image->byte_order = (G_BYTE_ORDER == G_LITTLE_ENDIAN) ? GDK_LSB_FIRST : GDK_MSB_FIRST;
-
- /* We only support images with bpp 4 */
- image->bpp = 4;
- image->bpl = image->width * image->bpp;
- image->bits_per_pixel = image->bpp * 8;
-
- image->mem = g_malloc (image->bpl * image->height);
- memset (image->mem, 0x00, image->bpl * image->height);
-
- return image;
-}
-
-guint32
-gdk_image_get_pixel (GdkImage *image,
- gint x,
- gint y)
-{
- guchar *ptr;
-
- g_return_val_if_fail (image != NULL, 0);
- g_return_val_if_fail (x >= 0 && x < image->width, 0);
- g_return_val_if_fail (y >= 0 && y < image->height, 0);
-
- ptr = image->mem + y * image->bpl + x * image->bpp;
-
- return *(guint32 *)ptr;
-}
-
-void
-gdk_image_put_pixel (GdkImage *image,
- gint x,
- gint y,
- guint32 pixel)
-{
- guchar *ptr;
-
- ptr = image->mem + y * image->bpl + x * image->bpp;
-
- *(guint32 *)ptr = pixel;
-}
-
-gint
-_gdk_windowing_get_bits_for_depth (GdkDisplay *display,
- gint depth)
-{
- if (depth == 24 || depth == 32)
- return 32;
- else
- g_assert_not_reached ();
-
- return 0;
-}
diff --git a/gdk/win32/Makefile.am b/gdk/win32/Makefile.am
index 099247384a..c6b0f9a08c 100644
--- a/gdk/win32/Makefile.am
+++ b/gdk/win32/Makefile.am
@@ -44,7 +44,6 @@ libgdk_win32_la_SOURCES = \
gdkgeometry-win32.c \
gdkglobals-win32.c \
gdkim-win32.c \
- gdkimage-win32.c \
gdkinput.c \
gdkkeys-win32.c \
gdkmain-win32.c \
diff --git a/gdk/win32/gdkdisplay-win32.c b/gdk/win32/gdkdisplay-win32.c
index 340d243f33..3295353ec5 100644
--- a/gdk/win32/gdkdisplay-win32.c
+++ b/gdk/win32/gdkdisplay-win32.c
@@ -207,7 +207,6 @@ gdk_display_open (const gchar *display_name)
gdk_screen_set_default_colormap (_gdk_screen,
gdk_screen_get_system_colormap (_gdk_screen));
_gdk_windowing_window_init (_gdk_screen);
- _gdk_windowing_image_init ();
_gdk_events_init ();
_gdk_input_init (_gdk_display);
_gdk_dnd_init ();
diff --git a/gdk/win32/gdkdrawable-win32.c b/gdk/win32/gdkdrawable-win32.c
index b93432eb19..92fd843e19 100644
--- a/gdk/win32/gdkdrawable-win32.c
+++ b/gdk/win32/gdkdrawable-win32.c
@@ -1298,8 +1298,7 @@ blit_from_pixmap (gboolean use_fg_bg,
{
/* Destination is also pixmap, get fg and bg from
* its palette. Either use the foreground and
- * background pixel values in the GC (only in the
- * case of gdk_image_put(), cf. XPutImage()), or 0
+ * background pixel values in the GC, or 0
* and 1 to index the palette.
*/
if (!GDI_CALL (GetDIBColorTable, (hdc, bgix, 1, newtable)) ||
diff --git a/gdk/win32/gdkimage-win32.c b/gdk/win32/gdkimage-win32.c
deleted file mode 100644
index bcc336349e..0000000000
--- a/gdk/win32/gdkimage-win32.c
+++ /dev/null
@@ -1,363 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- * Copyright (C) 1998-2002 Tor Lillqvist
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#include "config.h"
-#include "gdkimage.h"
-#include "gdkpixmap.h"
-#include "gdkscreen.h" /* gdk_screen_get_default() */
-#include "gdkprivate-win32.h"
-
-static GList *image_list = NULL;
-static gpointer parent_class = NULL;
-
-static void gdk_win32_image_destroy (GdkImage *image);
-static void gdk_image_init (GdkImage *image);
-static void gdk_image_class_init (GdkImageClass *klass);
-static void gdk_image_finalize (GObject *object);
-
-GType
-gdk_image_get_type (void)
-{
- static GType object_type = 0;
-
- if (!object_type)
- {
- const GTypeInfo object_info =
- {
- sizeof (GdkImageClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) gdk_image_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (GdkImage),
- 0, /* n_preallocs */
- (GInstanceInitFunc) gdk_image_init,
- };
-
- object_type = g_type_register_static (G_TYPE_OBJECT,
- "GdkImage",
- &object_info, 0);
- }
-
- return object_type;
-}
-
-static void
-gdk_image_init (GdkImage *image)
-{
- image->windowing_data = NULL;
-}
-
-static void
-gdk_image_class_init (GdkImageClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- object_class->finalize = gdk_image_finalize;
-}
-
-static void
-gdk_image_finalize (GObject *object)
-{
- GdkImage *image = GDK_IMAGE (object);
-
- gdk_win32_image_destroy (image);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-void
-_gdk_image_exit (void)
-{
- GdkImage *image;
-
- while (image_list)
- {
- image = image_list->data;
- gdk_win32_image_destroy (image);
- }
-}
-
-/*
- * Create a GdkImage _without_ an associated GdkPixmap. The caller is
- * responsible for creating a GdkPixmap object and making the association.
- */
-
-static GdkImage *
-_gdk_win32_new_image (GdkVisual *visual,
- gint width,
- gint height,
- gint depth,
- guchar *bits)
-{
- GdkImage *image;
-
- image = g_object_new (gdk_image_get_type (), NULL);
- image->windowing_data = NULL;
- image->type = GDK_IMAGE_SHARED;
- image->visual = visual;
- image->byte_order = GDK_LSB_FIRST;
- image->width = width;
- image->height = height;
- image->depth = depth;
- image->bits_per_pixel = _gdk_windowing_get_bits_for_depth (gdk_display_get_default (), depth);
- switch (depth)
- {
- case 1:
- case 4:
- case 5:
- case 6:
- case 7:
- case 8:
- image->bpp = 1;
- break;
- case 15:
- case 16:
- image->bpp = 2;
- break;
- case 24:
- image->bpp = image->bits_per_pixel / 8;
- break;
- case 32:
- image->bpp = 4;
- break;
- default:
- g_warning ("_gdk_win32_new_image: depth=%d", image->depth);
- g_assert_not_reached ();
- }
- if (depth == 1)
- image->bpl = ((width - 1)/32 + 1)*4;
- else if (depth == 4)
- image->bpl = ((width - 1)/8 + 1)*4;
- else
- image->bpl = ((width*image->bpp - 1)/4 + 1)*4;
- image->mem = bits;
-
- return image;
-}
-
-void
-_gdk_windowing_image_init (void)
-{
- /* Nothing needed AFAIK */
-}
-
-GdkImage*
-_gdk_image_new_for_depth (GdkScreen *screen,
- GdkImageType type,
- GdkVisual *visual,
- gint width,
- gint height,
- gint depth)
-{
- GdkPixmap *pixmap;
- GdkImage *image;
- guchar *bits;
-
- g_return_val_if_fail (!visual || GDK_IS_VISUAL (visual), NULL);
- g_return_val_if_fail (visual || depth != -1, NULL);
- g_return_val_if_fail (screen == gdk_screen_get_default (), NULL);
-
- if (visual)
- depth = visual->depth;
-
- pixmap = gdk_pixmap_new (NULL, width, height, depth);
-
- if (pixmap == NULL)
- return NULL;
-
- GDK_NOTE (IMAGE, g_print ("_gdk_image_new_for_depth: %dx%dx%d=%p\n",
- width, height, depth, GDK_PIXMAP_HBITMAP (pixmap)));
-
- bits = GDK_PIXMAP_IMPL_WIN32 (GDK_PIXMAP_OBJECT (pixmap)->impl)->bits;
- image = _gdk_win32_new_image (visual, width, height, depth, bits);
- image->windowing_data = pixmap;
-
- return image;
-}
-
-guint32
-gdk_image_get_pixel (GdkImage *image,
- gint x,
- gint y)
-{
- guchar *pixelp;
-
- g_return_val_if_fail (image != NULL, 0);
- g_return_val_if_fail (x >= 0 && x < image->width, 0);
- g_return_val_if_fail (y >= 0 && y < image->height, 0);
-
- if (!(x >= 0 && x < image->width && y >= 0 && y < image->height))
- return 0;
-
- if (image->depth == 1)
- return (((guchar *) image->mem)[y * image->bpl + (x >> 3)] & (1 << (7 - (x & 0x7)))) != 0;
-
- if (image->depth == 4)
- {
- pixelp = (guchar *) image->mem + y * image->bpl + (x >> 1);
- if (x&1)
- return (*pixelp) & 0x0F;
-
- return (*pixelp) >> 4;
- }
-
- pixelp = (guchar *) image->mem + y * image->bpl + x * image->bpp;
-
- switch (image->bpp)
- {
- case 1:
- return *pixelp;
-
- /* Windows is always LSB, no need to check image->byte_order. */
- case 2:
- return pixelp[0] | (pixelp[1] << 8);
-
- case 3:
- return pixelp[0] | (pixelp[1] << 8) | (pixelp[2] << 16);
-
- case 4:
- return pixelp[0] | (pixelp[1] << 8) | (pixelp[2] << 16);
- }
- g_assert_not_reached ();
- return 0;
-}
-
-void
-gdk_image_put_pixel (GdkImage *image,
- gint x,
- gint y,
- guint32 pixel)
-{
- guchar *pixelp;
-
- g_return_if_fail (image != NULL);
- g_return_if_fail (x >= 0 && x < image->width);
- g_return_if_fail (y >= 0 && y < image->height);
-
- if (!(x >= 0 && x < image->width && y >= 0 && y < image->height))
- return;
-
- GdiFlush ();
- if (image->depth == 1)
- if (pixel & 1)
- ((guchar *) image->mem)[y * image->bpl + (x >> 3)] |= (1 << (7 - (x & 0x7)));
- else
- ((guchar *) image->mem)[y * image->bpl + (x >> 3)] &= ~(1 << (7 - (x & 0x7)));
- else if (image->depth == 4)
- {
- pixelp = (guchar *) image->mem + y * image->bpl + (x >> 1);
-
- if (x&1)
- {
- *pixelp &= 0xF0;
- *pixelp |= (pixel & 0x0F);
- }
- else
- {
- *pixelp &= 0x0F;
- *pixelp |= (pixel << 4);
- }
- }
- else
- {
- pixelp = (guchar *) image->mem + y * image->bpl + x * image->bpp;
-
- /* Windows is always LSB, no need to check image->byte_order. */
- switch (image->bpp)
- {
- case 4:
- pixelp[3] = 0;
- case 3:
- pixelp[2] = ((pixel >> 16) & 0xFF);
- case 2:
- pixelp[1] = ((pixel >> 8) & 0xFF);
- case 1:
- pixelp[0] = (pixel & 0xFF);
- }
- }
-}
-
-static void
-gdk_win32_image_destroy (GdkImage *image)
-{
- GdkPixmap *pixmap;
-
- g_return_if_fail (GDK_IS_IMAGE (image));
-
- pixmap = image->windowing_data;
-
- if (pixmap == NULL) /* This means that _gdk_image_exit()
- * destroyed the image already, and
- * now we're called a second time from
- * _finalize()
- */
- return;
-
- GDK_NOTE (IMAGE, g_print ("gdk_win32_image_destroy: %p\n",
- GDK_PIXMAP_HBITMAP (pixmap)));
-
- g_object_unref (pixmap);
- image->windowing_data = NULL;
-}
-
-gint
-_gdk_windowing_get_bits_for_depth (GdkDisplay *display,
- gint depth)
-{
- g_return_val_if_fail (display == gdk_display_get_default (), 0);
-
- switch (depth)
- {
- case 1:
- return 1;
-
- case 2:
- case 3:
- case 4:
- return 4;
-
- case 5:
- case 6:
- case 7:
- case 8:
- return 8;
-
- case 15:
- case 16:
- return 16;
-
- case 24:
- case 32:
- return 32;
- }
- g_assert_not_reached ();
- return 0;
-}
diff --git a/gdk/win32/gdkprivate-win32.h b/gdk/win32/gdkprivate-win32.h
index 043952220e..d026d8902e 100644
--- a/gdk/win32/gdkprivate-win32.h
+++ b/gdk/win32/gdkprivate-win32.h
@@ -236,12 +236,6 @@ GdkGC *_gdk_win32_gc_new (GdkDrawable *drawable,
GdkGCValues *values,
GdkGCValuesMask values_mask);
-GdkImage *_gdk_win32_get_image (GdkDrawable *drawable,
- gint x,
- gint y,
- gint width,
- gint height);
-
void _gdk_win32_blit (gboolean use_fg_bg,
GdkDrawableImplWin32 *drawable,
GdkGC *gc,
@@ -465,7 +459,6 @@ void _gdk_root_window_size_init (void);
void _gdk_monitor_init(void);
void _gdk_visual_init (void);
void _gdk_dnd_init (void);
-void _gdk_windowing_image_init (void);
void _gdk_events_init (void);
void _gdk_input_init (GdkDisplay *display);
diff --git a/gdk/win32/makefile.msc b/gdk/win32/makefile.msc
index 1b3a993f0c..45a335026e 100644
--- a/gdk/win32/makefile.msc
+++ b/gdk/win32/makefile.msc
@@ -42,7 +42,6 @@ gdk_win32_OBJECTS = \
gdkgeometry-win32.obj \
gdkglobals-win32.obj \
gdkim-win32.obj \
- gdkimage-win32.obj \
gdkinput.obj \
gdkinput-win32.obj \
gdkkeys-win32.obj \
diff --git a/gdk/x11/Makefile.am b/gdk/x11/Makefile.am
index 31d61a6792..080ccd101c 100644
--- a/gdk/x11/Makefile.am
+++ b/gdk/x11/Makefile.am
@@ -41,7 +41,6 @@ libgdk_x11_la_SOURCES = \
gdkgeometry-x11.c \
gdkglobals-x11.c \
gdkim-x11.c \
- gdkimage-x11.c \
gdkinput.c \
gdkkeys-x11.c \
gdkmain-x11.c \
diff --git a/gdk/x11/gdkcolor-x11.c b/gdk/x11/gdkcolor-x11.c
index 0889d32c7f..2d41214687 100644
--- a/gdk/x11/gdkcolor-x11.c
+++ b/gdk/x11/gdkcolor-x11.c
@@ -1019,9 +1019,7 @@ gdk_colormap_alloc_colors (GdkColormap *colormap,
* hardware pixel @pixel. @pixel must be a valid pixel in the
* colormap; it's a programmer error to call this function with a
* pixel which is not in the colormap. Hardware pixels are normally
- * obtained from gdk_colormap_alloc_colors(), or from a #GdkImage. (A
- * #GdkImage contains image data in hardware format, a #GdkPixbuf
- * contains image data in a canonical 24-bit RGB format.)
+ * obtained from gdk_colormap_alloc_colors().
*
* This function is rarely useful; it's used for example to
* implement the eyedropper feature in #GtkColorSelection.
diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c
index 7195c01185..9b61238aa4 100644
--- a/gdk/x11/gdkdisplay-x11.c
+++ b/gdk/x11/gdkdisplay-x11.c
@@ -1197,7 +1197,6 @@ gdk_display_open (const gchar *display_name)
display = g_object_new (GDK_TYPE_DISPLAY_X11, NULL);
display_x11 = GDK_DISPLAY_X11 (display);
- display_x11->use_xshm = TRUE;
display_x11->xdisplay = xdisplay;
#ifdef HAVE_X11R6
@@ -1427,7 +1426,6 @@ gdk_display_open (const gchar *display_name)
}
#endif
- _gdk_windowing_image_init (display);
_gdk_input_init (display);
_gdk_dnd_init (display);
diff --git a/gdk/x11/gdkdisplay-x11.h b/gdk/x11/gdkdisplay-x11.h
index f8a55d0103..697632b746 100644
--- a/gdk/x11/gdkdisplay-x11.h
+++ b/gdk/x11/gdkdisplay-x11.h
@@ -76,8 +76,6 @@ struct _GdkDisplayX11
GdkKeymap *keymap;
guint keymap_serial;
- gboolean use_xshm;
- gboolean have_shm_pixmaps;
GdkTristate have_render;
gboolean have_xfixes;
gint xfixes_event_base;
diff --git a/gdk/x11/gdkimage-x11.c b/gdk/x11/gdkimage-x11.c
deleted file mode 100644
index 70cb7152b7..0000000000
--- a/gdk/x11/gdkimage-x11.c
+++ /dev/null
@@ -1,564 +0,0 @@
-/* GDK - The GIMP Drawing Kit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-/*
- * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
- * file for a list of people on the GTK+ Team. See the ChangeLog
- * files for a list of changes. These files are distributed with
- * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
- */
-
-#include "config.h"
-
-#include <stdlib.h>
-#include <sys/types.h>
-
-#if defined (HAVE_IPC_H) && defined (HAVE_SHM_H) && defined (HAVE_XSHM_H)
-#define USE_SHM
-#endif
-
-#ifdef USE_SHM
-#include <sys/ipc.h>
-#include <sys/shm.h>
-#endif /* USE_SHM */
-
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-
-#ifdef USE_SHM
-#include <X11/extensions/XShm.h>
-#endif /* USE_SHM */
-
-#include <errno.h>
-
-#include "gdk.h" /* For gdk_error_trap_* / gdk_flush_* */
-#include "gdkx.h"
-#include "gdkimage.h"
-#include "gdkprivate.h"
-#include "gdkprivate-x11.h"
-#include "gdkdisplay-x11.h"
-#include "gdkscreen-x11.h"
-
-
-typedef struct _GdkImagePrivateX11 GdkImagePrivateX11;
-
-struct _GdkImagePrivateX11
-{
- XImage *ximage;
- GdkScreen *screen;
- gpointer x_shm_info;
- Pixmap shm_pixmap;
-};
-
-static GList *image_list = NULL;
-
-static void gdk_x11_image_destroy (GdkImage *image);
-static void gdk_image_finalize (GObject *object);
-
-#define PRIVATE_DATA(image) ((GdkImagePrivateX11 *) GDK_IMAGE (image)->windowing_data)
-
-G_DEFINE_TYPE (GdkImage, gdk_image, G_TYPE_OBJECT)
-
-static void
-gdk_image_init (GdkImage *image)
-{
- image->windowing_data = G_TYPE_INSTANCE_GET_PRIVATE (image,
- GDK_TYPE_IMAGE,
- GdkImagePrivateX11);
-}
-
-static void
-gdk_image_class_init (GdkImageClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->finalize = gdk_image_finalize;
-
- g_type_class_add_private (object_class, sizeof (GdkImagePrivateX11));
-}
-
-static void
-gdk_image_finalize (GObject *object)
-{
- GdkImage *image = GDK_IMAGE (object);
-
- gdk_x11_image_destroy (image);
-
- G_OBJECT_CLASS (gdk_image_parent_class)->finalize (object);
-}
-
-
-void
-_gdk_image_exit (void)
-{
- GdkImage *image;
-
- while (image_list)
- {
- image = image_list->data;
- gdk_x11_image_destroy (image);
- }
-}
-
-void
-_gdk_windowing_image_init (GdkDisplay *display)
-{
- GdkDisplayX11 *display_x11 = GDK_DISPLAY_X11 (display);
-
- if (display_x11->use_xshm)
- {
-#ifdef USE_SHM
- Display *xdisplay = display_x11->xdisplay;
- int major, minor, event_base;
- Bool pixmaps;
-
- if (XShmQueryExtension (xdisplay) &&
- XShmQueryVersion (xdisplay, &major, &minor, &pixmaps))
- {
- display_x11->have_shm_pixmaps = pixmaps;
- event_base = XShmGetEventBase (xdisplay);
-
- gdk_x11_register_standard_event_type (display,
- event_base, ShmNumberEvents);
- }
- else
-#endif /* USE_SHM */
- display_x11->use_xshm = FALSE;
- }
-}
-
-GdkImage*
-_gdk_image_new_for_depth (GdkScreen *screen,
- GdkImageType type,
- GdkVisual *visual,
- gint width,
- gint height,
- gint depth)
-{
- GdkImage *image;
- GdkImagePrivateX11 *private;
-#ifdef USE_SHM
- XShmSegmentInfo *x_shm_info;
-#endif /* USE_SHM */
- Visual *xvisual = NULL;
- GdkDisplayX11 *display_x11;
- GdkScreenX11 *screen_x11;
-
- g_return_val_if_fail (!visual || GDK_IS_VISUAL (visual), NULL);
- g_return_val_if_fail (visual || depth != -1, NULL);
- g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
-
- screen_x11 = GDK_SCREEN_X11 (screen);
- display_x11 = GDK_DISPLAY_X11 (screen_x11->display);
-
- if (visual)
- depth = visual->depth;
-
- switch (type)
- {
- case GDK_IMAGE_FASTEST:
- image = _gdk_image_new_for_depth (screen, GDK_IMAGE_SHARED,
- visual, width, height, depth);
- if (!image)
- image = _gdk_image_new_for_depth (screen, GDK_IMAGE_NORMAL,
- visual, width, height, depth);
- break;
-
- default:
- image = g_object_new (gdk_image_get_type (), NULL);
-
- private = PRIVATE_DATA (image);
-
- private->screen = screen;
-
- image->type = type;
- image->visual = visual;
- image->width = width;
- image->height = height;
- image->depth = depth;
-
- if (visual)
- xvisual = ((GdkVisualPrivate*) visual)->xvisual;
-
- switch (type)
- {
- case GDK_IMAGE_SHARED:
-#ifdef USE_SHM
- if (display_x11->use_xshm)
- {
- private->x_shm_info = g_new (XShmSegmentInfo, 1);
- x_shm_info = private->x_shm_info;
- x_shm_info->shmid = -1;
- x_shm_info->shmaddr = (char*) -1;
-
- private->ximage = XShmCreateImage (screen_x11->xdisplay, xvisual, depth,
- ZPixmap, NULL, x_shm_info, width, height);
- if (private->ximage == NULL)
- {
- g_warning ("XShmCreateImage failed");
- display_x11->use_xshm = FALSE;
-
- goto error;
- }
-
- x_shm_info->shmid = shmget (IPC_PRIVATE,
- private->ximage->bytes_per_line * private->ximage->height,
- IPC_CREAT | 0600);
-
- if (x_shm_info->shmid == -1)
- {
- /* EINVAL indicates, most likely, that the segment we asked for
- * is bigger than SHMMAX, so we don't treat it as a permanent
- * error. ENOSPC and ENOMEM may also indicate this, but
- * more likely are permanent errors.
- */
- if (errno != EINVAL)
- {
- g_warning ("shmget failed: error %d (%s)", errno, g_strerror (errno));
- display_x11->use_xshm = FALSE;
- }
-
- goto error;
- }
-
- x_shm_info->readOnly = False;
- x_shm_info->shmaddr = shmat (x_shm_info->shmid, NULL, 0);
- private->ximage->data = x_shm_info->shmaddr;
-
- if (x_shm_info->shmaddr == (char*) -1)
- {
- g_warning ("shmat failed: error %d (%s)", errno, g_strerror (errno));
- /* Failure in shmat is almost certainly permanent. Most likely error is
- * EMFILE, which would mean that we've exceeded the per-process
- * Shm segment limit.
- */
- display_x11->use_xshm = FALSE;
- goto error;
- }
-
- gdk_error_trap_push ();
-
- XShmAttach (screen_x11->xdisplay, x_shm_info);
- XSync (screen_x11->xdisplay, False);
-
- if (gdk_error_trap_pop ())
- {
- /* this is the common failure case so omit warning */
- display_x11->use_xshm = FALSE;
- goto error;
- }
-
- /* We mark the segment as destroyed so that when
- * the last process detaches, it will be deleted.
- * There is a small possibility of leaking if
- * we die in XShmAttach. In theory, a signal handler
- * could be set up.
- */
- shmctl (x_shm_info->shmid, IPC_RMID, NULL);
-
- if (image)
- image_list = g_list_prepend (image_list, image);
- }
- else
-#endif /* USE_SHM */
- goto error;
- break;
- case GDK_IMAGE_NORMAL:
- private->ximage = XCreateImage (screen_x11->xdisplay, xvisual, depth,
- ZPixmap, 0, NULL, width, height, 32, 0);
-
- /* Use malloc, not g_malloc here, because X will call free()
- * on this data
- */
- private->ximage->data = malloc (private->ximage->bytes_per_line *
- private->ximage->height);
- if (!private->ximage->data)
- goto error;
- break;
-
- case GDK_IMAGE_FASTEST:
- g_assert_not_reached ();
- }
-
- if (image)
- {
- image->byte_order = (private->ximage->byte_order == LSBFirst) ? GDK_LSB_FIRST : GDK_MSB_FIRST;
- image->mem = private->ximage->data;
- image->bpl = private->ximage->bytes_per_line;
- image->bpp = (private->ximage->bits_per_pixel + 7) / 8;
- image->bits_per_pixel = private->ximage->bits_per_pixel;
- }
- }
-
- return image;
-
- error:
- if (private->ximage)
- {
- XDestroyImage (private->ximage);
- private->ximage = NULL;
- }
-#ifdef USE_SHM
- if (private->x_shm_info)
- {
- x_shm_info = private->x_shm_info;
-
- if (x_shm_info->shmaddr != (char *)-1)
- shmdt (x_shm_info->shmaddr);
- if (x_shm_info->shmid != -1)
- shmctl (x_shm_info->shmid, IPC_RMID, NULL);
-
- g_free (x_shm_info);
- private->x_shm_info = NULL;
- }
-#endif /* USE_SHM */
- g_object_unref (image);
-
- return NULL;
-}
-
-Pixmap
-_gdk_x11_image_get_shm_pixmap (GdkImage *image)
-{
- GdkImagePrivateX11 *private = PRIVATE_DATA (image);
- GdkDisplay *display = GDK_SCREEN_DISPLAY (private->screen);
-
- if (display->closed)
- return None;
-
-#ifdef USE_SHM
- /* Future: do we need one of these per-screen per-image? ShmPixmaps
- * are the same for every screen, but can they be shared? Not a concern
- * right now since we tie images to a particular screen.
- */
- if (!private->shm_pixmap && image->type == GDK_IMAGE_SHARED &&
- GDK_DISPLAY_X11 (display)->have_shm_pixmaps)
- private->shm_pixmap = XShmCreatePixmap (GDK_SCREEN_XDISPLAY (private->screen),
- GDK_SCREEN_XROOTWIN (private->screen),
- image->mem, private->x_shm_info,
- image->width, image->height, image->depth);
-
- return private->shm_pixmap;
-#else
- return None;
-#endif
-}
-
-static GdkImage*
-get_full_image (GdkDrawable *drawable,
- gint src_x,
- gint src_y,
- gint width,
- gint height)
-{
- GdkImage *image;
- GdkImagePrivateX11 *private;
- GdkDrawableImplX11 *impl;
- XImage *ximage;
-
- impl = GDK_DRAWABLE_IMPL_X11 (drawable);
-
- ximage = XGetImage (GDK_SCREEN_XDISPLAY (impl->screen),
- impl->xid,
- src_x, src_y, width, height,
- AllPlanes, ZPixmap);
-
- if (!ximage)
- return NULL;
-
- image = g_object_new (gdk_image_get_type (), NULL);
-
- private = PRIVATE_DATA (image);
-
- private->screen = impl->screen;
- private->ximage = ximage;
-
- image->type = GDK_IMAGE_NORMAL;
- image->visual = gdk_drawable_get_visual (drawable); /* could be NULL */
- image->width = width;
- image->height = height;
- image->depth = gdk_drawable_get_depth (drawable);
-
- image->mem = private->ximage->data;
- image->bpl = private->ximage->bytes_per_line;
- image->bits_per_pixel = private->ximage->bits_per_pixel;
- image->bpp = (private->ximage->bits_per_pixel + 7) / 8;
- image->byte_order = (private->ximage->byte_order == LSBFirst) ? GDK_LSB_FIRST : GDK_MSB_FIRST;
-
- return image;
-}
-
-guint32
-gdk_image_get_pixel (GdkImage *image,
- gint x,
- gint y)
-{
- guint32 pixel;
- GdkImagePrivateX11 *private;
-
- g_return_val_if_fail (GDK_IS_IMAGE (image), 0);
- g_return_val_if_fail (x >= 0 && x < image->width, 0);
- g_return_val_if_fail (y >= 0 && y < image->height, 0);
-
- private = PRIVATE_DATA (image);
-
- if (!private->screen->closed)
- pixel = XGetPixel (private->ximage, x, y);
- else
- pixel = 0;
-
- return pixel;
-}
-
-void
-gdk_image_put_pixel (GdkImage *image,
- gint x,
- gint y,
- guint32 pixel)
-{
- GdkImagePrivateX11 *private;
-
- g_return_if_fail (GDK_IS_IMAGE (image));
- g_return_if_fail (x >= 0 && x < image->width);
- g_return_if_fail (y >= 0 && y < image->height);
-
- private = PRIVATE_DATA (image);
-
- if (!private->screen->closed)
- pixel = XPutPixel (private->ximage, x, y, pixel);
-}
-
-static void
-gdk_x11_image_destroy (GdkImage *image)
-{
- GdkImagePrivateX11 *private;
-#ifdef USE_SHM
- XShmSegmentInfo *x_shm_info;
-#endif /* USE_SHM */
-
- g_return_if_fail (GDK_IS_IMAGE (image));
-
- private = PRIVATE_DATA (image);
-
- if (private->ximage) /* Deal with failure of creation */
- {
- switch (image->type)
- {
- case GDK_IMAGE_NORMAL:
- if (!private->screen->closed)
- XDestroyImage (private->ximage);
- break;
-
- case GDK_IMAGE_SHARED:
-#ifdef USE_SHM
- if (!private->screen->closed)
- {
- gdk_display_sync (GDK_SCREEN_DISPLAY (private->screen));
-
- if (private->shm_pixmap)
- XFreePixmap (GDK_SCREEN_XDISPLAY (private->screen), private->shm_pixmap);
-
- XShmDetach (GDK_SCREEN_XDISPLAY (private->screen), private->x_shm_info);
- XDestroyImage (private->ximage);
- }
-
- image_list = g_list_remove (image_list, image);
-
- x_shm_info = private->x_shm_info;
- shmdt (x_shm_info->shmaddr);
-
- g_free (private->x_shm_info);
- private->x_shm_info = NULL;
-
-#else /* USE_SHM */
- g_error ("trying to destroy shared memory image when gdk was compiled without shared memory support");
-#endif /* USE_SHM */
- break;
-
- case GDK_IMAGE_FASTEST:
- g_assert_not_reached ();
- }
-
- private->ximage = NULL;
- }
-}
-
-/**
- * gdk_x11_image_get_xdisplay:
- * @image: a #GdkImage.
- *
- * Returns the display of a #GdkImage.
- *
- * Return value: an Xlib <type>Display*</type>.
- **/
-Display *
-gdk_x11_image_get_xdisplay (GdkImage *image)
-{
- GdkImagePrivateX11 *private;
-
- g_return_val_if_fail (GDK_IS_IMAGE (image), NULL);
-
- private = PRIVATE_DATA (image);
-
- return GDK_SCREEN_XDISPLAY (private->screen);
-}
-
-/**
- * gdk_x11_image_get_ximage:
- * @image: a #GdkImage.
- *
- * Returns the X image belonging to a #GdkImage.
- *
- * Return value: an <type>XImage*</type>.
- **/
-XImage *
-gdk_x11_image_get_ximage (GdkImage *image)
-{
- GdkImagePrivateX11 *private;
-
- g_return_val_if_fail (GDK_IS_IMAGE (image), NULL);
-
- private = PRIVATE_DATA (image);
-
- if (private->screen->closed)
- return NULL;
- else
- return private->ximage;
-}
-
-gint
-_gdk_windowing_get_bits_for_depth (GdkDisplay *display,
- gint depth)
-{
- XPixmapFormatValues *formats;
- gint count, i;
-
- formats = XListPixmapFormats (GDK_DISPLAY_XDISPLAY (display), &count);
-
- for (i = 0; i < count; i++)
- if (formats[i].depth == depth)
- {
- gint result = formats[i].bits_per_pixel;
- XFree (formats);
- return result;
- }
-
- g_assert_not_reached ();
- return -1;
-}
diff --git a/gdk/x11/gdkprivate-x11.h b/gdk/x11/gdkprivate-x11.h
index edc3914281..e536f867d7 100644
--- a/gdk/x11/gdkprivate-x11.h
+++ b/gdk/x11/gdkprivate-x11.h
@@ -106,8 +106,6 @@ GdkGC *_gdk_x11_gc_new (GdkDrawable *drawable,
GdkGCValues *values,
GdkGCValuesMask values_mask);
-Pixmap _gdk_x11_image_get_shm_pixmap (GdkImage *image);
-
/* Routines from gdkgeometry-x11.c */
void _gdk_window_move_resize_child (GdkWindow *window,
gint x,
@@ -175,7 +173,6 @@ void _gdk_events_uninit (GdkDisplay *display);
void _gdk_windowing_window_init (GdkScreen *screen);
void _gdk_visual_init (GdkScreen *screen);
void _gdk_dnd_init (GdkDisplay *display);
-void _gdk_windowing_image_init (GdkDisplay *display);
PangoRenderer *_gdk_x11_renderer_get (GdkDrawable *drawable,
GdkGC *gc);
diff --git a/gdk/x11/gdkx.h b/gdk/x11/gdkx.h
index d23f1fb58f..44b0ea668d 100644
--- a/gdk/x11/gdkx.h
+++ b/gdk/x11/gdkx.h
@@ -42,8 +42,6 @@ Display *gdk_x11_drawable_get_xdisplay (GdkDrawable *drawable);
XID gdk_x11_drawable_get_xid (GdkDrawable *drawable);
GdkDrawable *gdk_x11_window_get_drawable_impl (GdkWindow *window);
GdkDrawable *gdk_x11_pixmap_get_drawable_impl (GdkPixmap *pixmap);
-Display *gdk_x11_image_get_xdisplay (GdkImage *image);
-XImage *gdk_x11_image_get_ximage (GdkImage *image);
Display *gdk_x11_colormap_get_xdisplay (GdkColormap *colormap);
Colormap gdk_x11_colormap_get_xcolormap (GdkColormap *colormap);
Display *gdk_x11_cursor_get_xdisplay (GdkCursor *cursor);
@@ -70,8 +68,6 @@ gint gdk_x11_get_default_screen (void);
#define GDK_COLORMAP_XCOLORMAP(cmap) (gdk_x11_colormap_get_xcolormap (cmap))
#define GDK_CURSOR_XDISPLAY(cursor) (gdk_x11_cursor_get_xdisplay (cursor))
#define GDK_CURSOR_XCURSOR(cursor) (gdk_x11_cursor_get_xcursor (cursor))
-#define GDK_IMAGE_XDISPLAY(image) (gdk_x11_image_get_xdisplay (image))
-#define GDK_IMAGE_XIMAGE(image) (gdk_x11_image_get_ximage (image))
#ifndef GDK_MULTIHEAD_SAFE
#define GDK_DISPLAY() gdk_display