[gtk+/rendering-cleanup: 125/140] API: Remove drawable getters for visual, screen and depth
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/rendering-cleanup: 125/140] API: Remove drawable getters for visual, screen and depth
- Date: Sun, 29 Aug 2010 16:13:57 +0000 (UTC)
commit 47290e95e6b0a29120a52766de0d29be46156558
Author: Benjamin Otte <otte redhat com>
Date: Sun Aug 29 01:49:30 2010 +0200
API: Remove drawable getters for visual, screen and depth
Removed and replaced are:
gdk_drawable_get_visual() => gdk_window_get_visual()
gdk_drawable_get_screen() => gdk_window_get_screen()
gdk_drawable_get_depth() => gdk_visual_get_depth
(gdk_window_get_visual())
docs/reference/gdk/gdk3-sections.txt | 3 --
gdk/gdk.symbols | 3 --
gdk/gdkdraw.c | 53 +---------------------------------
gdk/gdkdrawable.h | 6 ----
gdk/gdkoffscreenwindow.c | 27 -----------------
gdk/gdkwindow.c | 31 --------------------
gdk/quartz/gdkdrawable-quartz.c | 24 ---------------
gdk/win32/gdkdrawable-win32.c | 30 -------------------
gdk/x11/gdkdrawable-x11.c | 51 ++------------------------------
9 files changed, 5 insertions(+), 223 deletions(-)
---
diff --git a/docs/reference/gdk/gdk3-sections.txt b/docs/reference/gdk/gdk3-sections.txt
index b8454bf..d014f1a 100644
--- a/docs/reference/gdk/gdk3-sections.txt
+++ b/docs/reference/gdk/gdk3-sections.txt
@@ -285,10 +285,7 @@ gdk_color_get_type
<FILE>drawing</FILE>
GdkDrawable
gdk_drawable_get_display
-gdk_drawable_get_screen
-gdk_drawable_get_visual
gdk_drawable_get_colormap
-gdk_drawable_get_depth
gdk_drawable_get_size
gdk_drawable_get_clip_region
gdk_drawable_get_visible_region
diff --git a/gdk/gdk.symbols b/gdk/gdk.symbols
index c00a5e0..4f4e077 100644
--- a/gdk/gdk.symbols
+++ b/gdk/gdk.symbols
@@ -533,13 +533,10 @@ gdk_drag_get_protocol
#if IN_FILE(__GDK_DRAW_C__)
gdk_drawable_get_clip_region
gdk_drawable_get_colormap
-gdk_drawable_get_depth
gdk_drawable_get_display
-gdk_drawable_get_screen
gdk_drawable_get_size
gdk_drawable_get_type G_GNUC_CONST
gdk_drawable_get_visible_region
-gdk_drawable_get_visual
#endif
#endif
diff --git a/gdk/gdkdraw.c b/gdk/gdkdraw.c
index c3e2d4c..366ffab 100644
--- a/gdk/gdkdraw.c
+++ b/gdk/gdkdraw.c
@@ -82,57 +82,6 @@ gdk_drawable_get_size (GdkDrawable *drawable,
}
/**
- * gdk_drawable_get_visual:
- * @drawable: a #GdkDrawable
- *
- * Gets the #GdkVisual describing the pixel format of @drawable.
- *
- * Return value: a #GdkVisual
- **/
-GdkVisual*
-gdk_drawable_get_visual (GdkDrawable *drawable)
-{
- g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), NULL);
-
- return GDK_DRAWABLE_GET_CLASS (drawable)->get_visual (drawable);
-}
-
-/**
- * gdk_drawable_get_depth:
- * @drawable: a #GdkDrawable
- *
- * Obtains the bit depth of the drawable, that is, the number of bits
- * that make up a pixel in the drawable's visual. Examples are 8 bits
- * per pixel, 24 bits per pixel, etc.
- *
- * Return value: number of bits per pixel
- **/
-gint
-gdk_drawable_get_depth (GdkDrawable *drawable)
-{
- g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), 0);
-
- return GDK_DRAWABLE_GET_CLASS (drawable)->get_depth (drawable);
-}
-/**
- * gdk_drawable_get_screen:
- * @drawable: a #GdkDrawable
- *
- * Gets the #GdkScreen associated with a #GdkDrawable.
- *
- * Return value: the #GdkScreen associated with @drawable
- *
- * Since: 2.2
- **/
-GdkScreen*
-gdk_drawable_get_screen(GdkDrawable *drawable)
-{
- g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), NULL);
-
- return GDK_DRAWABLE_GET_CLASS (drawable)->get_screen (drawable);
-}
-
-/**
* gdk_drawable_get_display:
* @drawable: a #GdkDrawable
*
@@ -147,7 +96,7 @@ gdk_drawable_get_display (GdkDrawable *drawable)
{
g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), NULL);
- return gdk_screen_get_display (gdk_drawable_get_screen (drawable));
+ return gdk_screen_get_display (gdk_colormap_get_screen (gdk_drawable_get_colormap (drawable)));
}
/**
diff --git a/gdk/gdkdrawable.h b/gdk/gdkdrawable.h
index db146c3..b4f654d 100644
--- a/gdk/gdkdrawable.h
+++ b/gdk/gdkdrawable.h
@@ -56,14 +56,11 @@ struct _GdkDrawableClass
{
GObjectClass parent_class;
- gint (*get_depth) (GdkDrawable *drawable);
void (*get_size) (GdkDrawable *drawable,
gint *width,
gint *height);
GdkColormap* (*get_colormap) (GdkDrawable *drawable);
- GdkVisual* (*get_visual) (GdkDrawable *drawable);
- GdkScreen* (*get_screen) (GdkDrawable *drawable);
cairo_region_t* (*get_clip_region) (GdkDrawable *drawable);
cairo_region_t* (*get_visible_region) (GdkDrawable *drawable);
@@ -96,9 +93,6 @@ void gdk_drawable_get_size (GdkDrawable *drawable,
gint *width,
gint *height);
GdkColormap* gdk_drawable_get_colormap (GdkDrawable *drawable);
-GdkVisual* gdk_drawable_get_visual (GdkDrawable *drawable);
-gint gdk_drawable_get_depth (GdkDrawable *drawable);
-GdkScreen* gdk_drawable_get_screen (GdkDrawable *drawable);
GdkDisplay* gdk_drawable_get_display (GdkDrawable *drawable);
cairo_region_t *gdk_drawable_get_clip_region (GdkDrawable *drawable);
diff --git a/gdk/gdkoffscreenwindow.c b/gdk/gdkoffscreenwindow.c
index cf43dfa..9b3c3c1 100644
--- a/gdk/gdkoffscreenwindow.c
+++ b/gdk/gdkoffscreenwindow.c
@@ -148,30 +148,6 @@ gdk_offscreen_window_get_colormap (GdkDrawable *drawable)
return offscreen->colormap;
}
-static gint
-gdk_offscreen_window_get_depth (GdkDrawable *drawable)
-{
- GdkOffscreenWindow *offscreen = GDK_OFFSCREEN_WINDOW (drawable);
-
- return gdk_drawable_get_depth (offscreen->wrapper);
-}
-
-static GdkScreen*
-gdk_offscreen_window_get_screen (GdkDrawable *drawable)
-{
- GdkOffscreenWindow *offscreen = GDK_OFFSCREEN_WINDOW (drawable);
-
- return offscreen->screen;
-}
-
-static GdkVisual*
-gdk_offscreen_window_get_visual (GdkDrawable *drawable)
-{
- GdkOffscreenWindow *offscreen = GDK_OFFSCREEN_WINDOW (drawable);
-
- return gdk_drawable_get_visual (offscreen->wrapper);
-}
-
void
_gdk_offscreen_window_new (GdkWindow *window,
GdkScreen *screen,
@@ -770,9 +746,6 @@ gdk_offscreen_window_class_init (GdkOffscreenWindowClass *klass)
drawable_class->ref_cairo_surface = gdk_offscreen_window_ref_cairo_surface;
drawable_class->get_colormap = gdk_offscreen_window_get_colormap;
- drawable_class->get_depth = gdk_offscreen_window_get_depth;
- drawable_class->get_screen = gdk_offscreen_window_get_screen;
- drawable_class->get_visual = gdk_offscreen_window_get_visual;
}
static void
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index e492c25..e8d6170 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -227,9 +227,6 @@ static void gdk_window_real_get_size (GdkDrawable *drawable,
gint *width,
gint *height);
-static GdkVisual* gdk_window_real_get_visual (GdkDrawable *drawable);
-static gint gdk_window_real_get_depth (GdkDrawable *drawable);
-static GdkScreen* gdk_window_real_get_screen (GdkDrawable *drawable);
static GdkColormap* gdk_window_real_get_colormap (GdkDrawable *drawable);
static cairo_region_t* gdk_window_get_clip_region (GdkDrawable *drawable);
@@ -376,11 +373,8 @@ gdk_window_class_init (GdkWindowObjectClass *klass)
object_class->set_property = gdk_window_set_property;
object_class->get_property = gdk_window_get_property;
- drawable_class->get_depth = gdk_window_real_get_depth;
- drawable_class->get_screen = gdk_window_real_get_screen;
drawable_class->get_size = gdk_window_real_get_size;
drawable_class->get_colormap = gdk_window_real_get_colormap;
- drawable_class->get_visual = gdk_window_real_get_visual;
drawable_class->ref_cairo_surface = gdk_window_ref_cairo_surface;
drawable_class->create_cairo_surface = gdk_window_create_cairo_surface;
drawable_class->set_cairo_clip = gdk_window_set_cairo_clip;
@@ -3651,31 +3645,6 @@ gdk_window_real_get_size (GdkDrawable *drawable,
*height = private->height;
}
-static GdkVisual*
-gdk_window_real_get_visual (GdkDrawable *drawable)
-{
- GdkColormap *colormap;
-
- g_return_val_if_fail (GDK_IS_WINDOW (drawable), NULL);
-
- colormap = gdk_drawable_get_colormap (drawable);
- return colormap ? gdk_colormap_get_visual (colormap) : NULL;
-}
-
-static gint
-gdk_window_real_get_depth (GdkDrawable *drawable)
-{
- g_return_val_if_fail (GDK_IS_WINDOW (drawable), 0);
-
- return ((GdkWindowObject *)GDK_WINDOW (drawable))->depth;
-}
-
-static GdkScreen*
-gdk_window_real_get_screen (GdkDrawable *drawable)
-{
- return gdk_drawable_get_screen (GDK_WINDOW_OBJECT (drawable)->impl);
-}
-
static GdkColormap*
gdk_window_real_get_colormap (GdkDrawable *drawable)
{
diff --git a/gdk/quartz/gdkdrawable-quartz.c b/gdk/quartz/gdkdrawable-quartz.c
index 64845b9..ef3cb87 100644
--- a/gdk/quartz/gdkdrawable-quartz.c
+++ b/gdk/quartz/gdkdrawable-quartz.c
@@ -112,26 +112,6 @@ gdk_quartz_get_colormap (GdkDrawable *drawable)
return GDK_DRAWABLE_IMPL_QUARTZ (drawable)->colormap;
}
-static GdkScreen*
-gdk_quartz_get_screen (GdkDrawable *drawable)
-{
- return _gdk_screen;
-}
-
-static GdkVisual*
-gdk_quartz_get_visual (GdkDrawable *drawable)
-{
- return gdk_drawable_get_visual (GDK_DRAWABLE_IMPL_QUARTZ (drawable)->wrapper);
-}
-
-static int
-gdk_quartz_get_depth (GdkDrawable *drawable)
-{
- /* This is a bit bogus but I'm not sure the other way is better */
-
- return gdk_drawable_get_depth (GDK_DRAWABLE_IMPL_QUARTZ (drawable)->wrapper);
-}
-
static void
gdk_drawable_impl_quartz_finalize (GObject *object)
{
@@ -157,10 +137,6 @@ gdk_drawable_impl_quartz_class_init (GdkDrawableImplQuartzClass *klass)
drawable_class->create_cairo_surface = gdk_quartz_create_cairo_surface;
drawable_class->get_colormap = gdk_quartz_get_colormap;
-
- drawable_class->get_depth = gdk_quartz_get_depth;
- drawable_class->get_screen = gdk_quartz_get_screen;
- drawable_class->get_visual = gdk_quartz_get_visual;
}
GType
diff --git a/gdk/win32/gdkdrawable-win32.c b/gdk/win32/gdkdrawable-win32.c
index 2ad840e..849c901 100644
--- a/gdk/win32/gdkdrawable-win32.c
+++ b/gdk/win32/gdkdrawable-win32.c
@@ -55,12 +55,6 @@ static cairo_surface_t *gdk_win32_create_cairo_surface (GdkDrawable *drawable,
static GdkColormap* gdk_win32_get_colormap (GdkDrawable *drawable);
-static gint gdk_win32_get_depth (GdkDrawable *drawable);
-
-static GdkScreen * gdk_win32_get_screen (GdkDrawable *drawable);
-
-static GdkVisual* gdk_win32_get_visual (GdkDrawable *drawable);
-
static void gdk_drawable_impl_win32_finalize (GObject *object);
static const cairo_user_data_key_t gdk_win32_cairo_key;
@@ -80,10 +74,6 @@ _gdk_drawable_impl_win32_class_init (GdkDrawableImplWin32Class *klass)
drawable_class->create_cairo_surface = gdk_win32_create_cairo_surface;
drawable_class->get_colormap = gdk_win32_get_colormap;
-
- drawable_class->get_depth = gdk_win32_get_depth;
- drawable_class->get_screen = gdk_win32_get_screen;
- drawable_class->get_visual = gdk_win32_get_visual;
}
static void
@@ -257,26 +247,6 @@ _gdk_windowing_set_cairo_surface_size (cairo_surface_t *surface,
return FALSE;
}
-static gint
-gdk_win32_get_depth (GdkDrawable *drawable)
-{
- /* This is a bit bogus but I'm not sure the other way is better */
-
- return gdk_drawable_get_depth (GDK_DRAWABLE_IMPL_WIN32 (drawable)->wrapper);
-}
-
-static GdkScreen*
-gdk_win32_get_screen (GdkDrawable *drawable)
-{
- return gdk_screen_get_default ();
-}
-
-static GdkVisual*
-gdk_win32_get_visual (GdkDrawable *drawable)
-{
- return gdk_drawable_get_visual (GDK_DRAWABLE_IMPL_WIN32 (drawable)->wrapper);
-}
-
HGDIOBJ
gdk_win32_drawable_get_handle (GdkDrawable *drawable)
{
diff --git a/gdk/x11/gdkdrawable-x11.c b/gdk/x11/gdkdrawable-x11.c
index c080a22..b1634f8 100644
--- a/gdk/x11/gdkdrawable-x11.c
+++ b/gdk/x11/gdkdrawable-x11.c
@@ -45,9 +45,6 @@ static cairo_surface_t *gdk_x11_create_cairo_surface (GdkDrawable *drawable,
int height);
static GdkColormap* gdk_x11_get_colormap (GdkDrawable *drawable);
-static gint gdk_x11_get_depth (GdkDrawable *drawable);
-static GdkScreen * gdk_x11_get_screen (GdkDrawable *drawable);
-static GdkVisual* gdk_x11_get_visual (GdkDrawable *drawable);
static const cairo_user_data_key_t gdk_x11_cairo_key;
@@ -62,10 +59,6 @@ _gdk_drawable_impl_x11_class_init (GdkDrawableImplX11Class *klass)
drawable_class->create_cairo_surface = gdk_x11_create_cairo_surface;
drawable_class->get_colormap = gdk_x11_get_colormap;
-
- drawable_class->get_depth = gdk_x11_get_depth;
- drawable_class->get_screen = gdk_x11_get_screen;
- drawable_class->get_visual = gdk_x11_get_visual;
}
static void
@@ -127,14 +120,6 @@ gdk_x11_get_colormap (GdkDrawable *drawable)
return impl->colormap;
}
-static gint
-gdk_x11_get_depth (GdkDrawable *drawable)
-{
- /* This is a bit bogus but I'm not sure the other way is better */
-
- return gdk_drawable_get_depth (GDK_DRAWABLE_IMPL_X11 (drawable)->wrapper);
-}
-
static GdkDrawable *
get_impl_drawable (GdkDrawable *drawable)
{
@@ -147,21 +132,6 @@ get_impl_drawable (GdkDrawable *drawable)
}
}
-static GdkScreen*
-gdk_x11_get_screen (GdkDrawable *drawable)
-{
- if (GDK_IS_DRAWABLE_IMPL_X11 (drawable))
- return GDK_DRAWABLE_IMPL_X11 (drawable)->screen;
- else
- return GDK_DRAWABLE_IMPL_X11 (get_impl_drawable (drawable))->screen;
-}
-
-static GdkVisual*
-gdk_x11_get_visual (GdkDrawable *drawable)
-{
- return gdk_drawable_get_visual (GDK_DRAWABLE_IMPL_X11 (drawable)->wrapper);
-}
-
/**
* gdk_x11_drawable_get_xdisplay:
* @drawable: a #GdkDrawable.
@@ -257,23 +227,10 @@ gdk_x11_create_cairo_surface (GdkDrawable *drawable,
GdkVisual *visual;
visual = gdk_window_get_visual (impl->wrapper);
- if (visual)
- return cairo_xlib_surface_create (GDK_SCREEN_XDISPLAY (impl->screen),
- impl->xid,
- GDK_VISUAL_XVISUAL (visual),
- width, height);
- else if (gdk_drawable_get_depth (drawable) == 1)
- return cairo_xlib_surface_create_for_bitmap (GDK_SCREEN_XDISPLAY (impl->screen),
- impl->xid,
- GDK_SCREEN_XSCREEN (impl->screen),
- width, height);
- else
- {
- g_warning ("Using Cairo rendering requires the drawable argument to\n"
- "have a specified colormap. All windows have a colormap,\n"
- "so why is this code even reached?");
- return NULL;
- }
+ return cairo_xlib_surface_create (GDK_SCREEN_XDISPLAY (impl->screen),
+ impl->xid,
+ GDK_VISUAL_XVISUAL (visual),
+ width, height);
}
static cairo_surface_t *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]