Use gdk_drawable_get_depth instead of gdk_drawable_get_visual. Add some

Sat Feb 19 12:01:53 2000  Owen Taylor  <otaylor@redhat.com>

	* gdk/x11/gdkdrawable-x11.c (gdk_x11_draw_drawable):
	Use gdk_drawable_get_depth instead of gdk_drawable_get_visual.
	Add some more detailed checking.

	* gdk/gdkdraw.c gdk/gdkdrawable.h (gdk_drawable_get_depth):
	New function to retrieve the depth of a drawable.

	* gdk/gdkprivate.h (struct _GdkDrawablePrivate): Add a depth
	field, reorder fields to save memory.
This commit is contained in:
Owen Taylor
2000-02-19 17:28:41 +00:00
committed by Owen Taylor
parent f1590246cc
commit eaddaab242
13 changed files with 120 additions and 12 deletions

View File

@@ -1,3 +1,15 @@
Sat Feb 19 12:01:53 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkdrawable-x11.c (gdk_x11_draw_drawable):
Use gdk_drawable_get_depth instead of gdk_drawable_get_visual.
Add some more detailed checking.
* gdk/gdkdraw.c gdk/gdkdrawable.h (gdk_drawable_get_depth):
New function to retrieve the depth of a drawable.
* gdk/gdkprivate.h (struct _GdkDrawablePrivate): Add a depth
field, reorder fields to save memory.
Mon Dec 13 14:06:03 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_draw_cursor_on_drawable): Draw a small portion

View File

@@ -1,3 +1,15 @@
Sat Feb 19 12:01:53 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkdrawable-x11.c (gdk_x11_draw_drawable):
Use gdk_drawable_get_depth instead of gdk_drawable_get_visual.
Add some more detailed checking.
* gdk/gdkdraw.c gdk/gdkdrawable.h (gdk_drawable_get_depth):
New function to retrieve the depth of a drawable.
* gdk/gdkprivate.h (struct _GdkDrawablePrivate): Add a depth
field, reorder fields to save memory.
Mon Dec 13 14:06:03 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_draw_cursor_on_drawable): Draw a small portion

View File

@@ -1,3 +1,15 @@
Sat Feb 19 12:01:53 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkdrawable-x11.c (gdk_x11_draw_drawable):
Use gdk_drawable_get_depth instead of gdk_drawable_get_visual.
Add some more detailed checking.
* gdk/gdkdraw.c gdk/gdkdrawable.h (gdk_drawable_get_depth):
New function to retrieve the depth of a drawable.
* gdk/gdkprivate.h (struct _GdkDrawablePrivate): Add a depth
field, reorder fields to save memory.
Mon Dec 13 14:06:03 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_draw_cursor_on_drawable): Draw a small portion

View File

@@ -1,3 +1,15 @@
Sat Feb 19 12:01:53 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkdrawable-x11.c (gdk_x11_draw_drawable):
Use gdk_drawable_get_depth instead of gdk_drawable_get_visual.
Add some more detailed checking.
* gdk/gdkdraw.c gdk/gdkdrawable.h (gdk_drawable_get_depth):
New function to retrieve the depth of a drawable.
* gdk/gdkprivate.h (struct _GdkDrawablePrivate): Add a depth
field, reorder fields to save memory.
Mon Dec 13 14:06:03 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_draw_cursor_on_drawable): Draw a small portion

View File

@@ -1,3 +1,15 @@
Sat Feb 19 12:01:53 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkdrawable-x11.c (gdk_x11_draw_drawable):
Use gdk_drawable_get_depth instead of gdk_drawable_get_visual.
Add some more detailed checking.
* gdk/gdkdraw.c gdk/gdkdrawable.h (gdk_drawable_get_depth):
New function to retrieve the depth of a drawable.
* gdk/gdkprivate.h (struct _GdkDrawablePrivate): Add a depth
field, reorder fields to save memory.
Mon Dec 13 14:06:03 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_draw_cursor_on_drawable): Draw a small portion

View File

@@ -1,3 +1,15 @@
Sat Feb 19 12:01:53 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkdrawable-x11.c (gdk_x11_draw_drawable):
Use gdk_drawable_get_depth instead of gdk_drawable_get_visual.
Add some more detailed checking.
* gdk/gdkdraw.c gdk/gdkdrawable.h (gdk_drawable_get_depth):
New function to retrieve the depth of a drawable.
* gdk/gdkprivate.h (struct _GdkDrawablePrivate): Add a depth
field, reorder fields to save memory.
Mon Dec 13 14:06:03 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_draw_cursor_on_drawable): Draw a small portion

View File

@@ -1,3 +1,15 @@
Sat Feb 19 12:01:53 2000 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkdrawable-x11.c (gdk_x11_draw_drawable):
Use gdk_drawable_get_depth instead of gdk_drawable_get_visual.
Add some more detailed checking.
* gdk/gdkdraw.c gdk/gdkdrawable.h (gdk_drawable_get_depth):
New function to retrieve the depth of a drawable.
* gdk/gdkprivate.h (struct _GdkDrawablePrivate): Add a depth
field, reorder fields to save memory.
Mon Dec 13 14:06:03 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.c (gtk_entry_draw_cursor_on_drawable): Draw a small portion

View File

@@ -47,6 +47,8 @@ gdk_drawable_alloc (void)
private->width = 1;
private->height = 1;
private->depth = 0;
private->colormap = NULL;
return drawable;
@@ -104,6 +106,15 @@ gdk_drawable_get_visual (GdkDrawable *drawable)
return colormap ? gdk_colormap_get_visual (colormap) : NULL;
}
gint
gdk_drawable_get_depth (GdkDrawable *drawable)
{
GdkDrawablePrivate *private = (GdkDrawablePrivate *)drawable;
g_return_val_if_fail (drawable != NULL, NULL);
return private->depth;
}
GdkDrawable*
gdk_drawable_ref (GdkDrawable *drawable)
{

View File

@@ -130,6 +130,7 @@ void gdk_drawable_set_colormap (GdkDrawable *drawable,
GdkColormap *colormap);
GdkColormap* gdk_drawable_get_colormap (GdkDrawable *drawable);
GdkVisual* gdk_drawable_get_visual (GdkDrawable *drawable);
gint gdk_drawable_get_depth (GdkDrawable *drawable);
GdkDrawable* gdk_drawable_ref (GdkDrawable *drawable);
void gdk_drawable_unref (GdkDrawable *drawable);

View File

@@ -71,7 +71,6 @@ struct _GdkDrawablePrivate
GdkDrawableClass *klass;
gpointer klass_data;
guint8 window_type;
guint ref_count;
guint16 width;
@@ -79,6 +78,9 @@ struct _GdkDrawablePrivate
GdkColormap *colormap;
guint8 window_type;
guint8 depth;
guint destroyed : 2;
};

View File

@@ -319,8 +319,20 @@ gdk_x11_draw_drawable (GdkDrawable *drawable,
gint width,
gint height)
{
/* FIXME: this doesn't work because bitmaps don't have visuals */
if (gdk_drawable_get_visual (src)->depth == 1)
int src_depth = gdk_drawable_get_depth (src);
int dest_depth = gdk_drawable_get_depth (drawable);
if (src_depth == 1)
{
XCopyArea (GDK_DRAWABLE_XDISPLAY (drawable),
GDK_DRAWABLE_XID (src),
GDK_DRAWABLE_XID (drawable),
GDK_GC_XGC (gc),
xsrc, ysrc,
width, height,
xdest, ydest);
}
else if (dest_depth != 0 && src_depth == dest_depth)
{
XCopyArea (GDK_DRAWABLE_XDISPLAY (drawable),
GDK_DRAWABLE_XID (src),
@@ -331,15 +343,7 @@ gdk_x11_draw_drawable (GdkDrawable *drawable,
xdest, ydest);
}
else
{
XCopyArea (GDK_DRAWABLE_XDISPLAY (drawable),
GDK_DRAWABLE_XID (src),
GDK_DRAWABLE_XID (drawable),
GDK_GC_XGC (gc),
xsrc, ysrc,
width, height,
xdest, ydest);
}
g_warning ("Attempt to copy between drawables of mismatched depths!\n");
}
static void

View File

@@ -119,6 +119,7 @@ gdk_pixmap_new (GdkWindow *window,
width, height, depth);
private->width = width;
private->height = height;
private->depth = depth;
gdk_xid_table_insert (&GDK_DRAWABLE_XID (pixmap), pixmap);
@@ -149,6 +150,7 @@ gdk_bitmap_create_from_data (GdkWindow *window,
private->width = width;
private->height = height;
private->depth = 1;
GDK_DRAWABLE_XDATA (private)->xdisplay = GDK_DRAWABLE_XDISPLAY (window);
GDK_DRAWABLE_XDATA (private)->xid = XCreateBitmapFromData (GDK_DRAWABLE_XDISPLAY (window),
@@ -193,6 +195,7 @@ gdk_pixmap_create_from_data (GdkWindow *window,
private->width = width;
private->height = height;
private->depth = depth;
GDK_DRAWABLE_XDATA (private)->xdisplay = GDK_DRAWABLE_XDISPLAY (window);
GDK_DRAWABLE_XDATA (private)->xid = XCreatePixmapFromBitmapData (GDK_DRAWABLE_XDISPLAY (window),
@@ -802,6 +805,7 @@ gdk_pixmap_foreign_new (guint32 anid)
private->width = w_ret;
private->height = h_ret;
private->depth = depth_ret;
gdk_xid_table_insert(&GDK_DRAWABLE_XID (pixmap), pixmap);

View File

@@ -245,6 +245,8 @@ gdk_window_new (GdkWindow *parent,
{
class = InputOutput;
depth = visual->depth;
private->drawable.depth = depth;
if (attributes_mask & GDK_WA_COLORMAP)
private->drawable.colormap = attributes->colormap;