Commit 6e5a269f authored by Owen Taylor's avatar Owen Taylor Committed by Owen Taylor

Add two virtualized functions gdk_drawable_get_clip_region - to get the

Thu Dec 14 20:22:31 2000  Owen Taylor  <otaylor@redhat.com>

        * gdk/{gdkdrawable.[ch],gdkpixmap.c,gdkwindow.c,x11/gdkwindow.c}:
	Add two virtualized functions gdk_drawable_get_clip_region - to
	get the clip region when drawing.

	* gdk/gdkwindow.c (gdk_window_invalidate_rect): Rewrite to simple
	use invalidate_region.

	* gdk/gdkwindow.c (gdk_window_invalidate_region): Clip to visible
	region.

	* acconfig.h configure.in: Check for Xft. For now, assume
	that if Xft is found, Pango was compiled with Xft support
	as well.

	* gdk/gdkcolor.h gdk/x11/gdkcolor-x11.c: Add
	gdk_colormap_query_color().

	* gdk/x11/gdkdrawable-x11.c (gdk_x11_draw_glyphs): Draw
	with Xft if appropriate.

	* gdk/x11/gdkpango-x11.c (gdk_pango_context_get): Create
	a pangoxft context if we have XFT and the environment
	variable GD_USE_XFT is set.

	* gdk/x11/gdkx.h (struct _GdkGCX11): Cache the fg_pixel
	and also possibly an XftDraw structure.

        * gtk/gtkfontsel.c: Handle the case where the font from the
	style doesn't match any of the fonts a bit better.

	* gtk/testgtk.c: Add tabs between directional segments for
	hebrew/arabic test. (Not really necessary, just a little
	prettier.)
parent 2142a98c
Thu Dec 14 20:22:31 2000 Owen Taylor <otaylor@redhat.com>
* gdk/{gdkdrawable.[ch],gdkpixmap.c,gdkwindow.c,x11/gdkwindow.c}:
Add two virtualized functions gdk_drawable_get_clip_region - to
get the clip region when drawing.
* gdk/gdkwindow.c (gdk_window_invalidate_rect): Rewrite to simple
use invalidate_region.
* gdk/gdkwindow.c (gdk_window_invalidate_region): Clip to visible
region.
* acconfig.h configure.in: Check for Xft. For now, assume
that if Xft is found, Pango was compiled with Xft support
as well.
* gdk/gdkcolor.h gdk/x11/gdkcolor-x11.c: Add
gdk_colormap_query_color().
* gdk/x11/gdkdrawable-x11.c (gdk_x11_draw_glyphs): Draw
with Xft if appropriate.
* gdk/x11/gdkpango-x11.c (gdk_pango_context_get): Create
a pangoxft context if we have XFT and the environment
variable GD_USE_XFT is set.
* gdk/x11/gdkx.h (struct _GdkGCX11): Cache the fg_pixel
and also possibly an XftDraw structure.
* gtk/gtkfontsel.c: Handle the case where the font from the
style doesn't match any of the fonts a bit better.
* gtk/testgtk.c: Add tabs between directional segments for
hebrew/arabic test. (Not really necessary, just a little
prettier.)
2000-12-14 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c (fill_file_buffer): fix unicode validation when
......
Thu Dec 14 20:22:31 2000 Owen Taylor <otaylor@redhat.com>
* gdk/{gdkdrawable.[ch],gdkpixmap.c,gdkwindow.c,x11/gdkwindow.c}:
Add two virtualized functions gdk_drawable_get_clip_region - to
get the clip region when drawing.
* gdk/gdkwindow.c (gdk_window_invalidate_rect): Rewrite to simple
use invalidate_region.
* gdk/gdkwindow.c (gdk_window_invalidate_region): Clip to visible
region.
* acconfig.h configure.in: Check for Xft. For now, assume
that if Xft is found, Pango was compiled with Xft support
as well.
* gdk/gdkcolor.h gdk/x11/gdkcolor-x11.c: Add
gdk_colormap_query_color().
* gdk/x11/gdkdrawable-x11.c (gdk_x11_draw_glyphs): Draw
with Xft if appropriate.
* gdk/x11/gdkpango-x11.c (gdk_pango_context_get): Create
a pangoxft context if we have XFT and the environment
variable GD_USE_XFT is set.
* gdk/x11/gdkx.h (struct _GdkGCX11): Cache the fg_pixel
and also possibly an XftDraw structure.
* gtk/gtkfontsel.c: Handle the case where the font from the
style doesn't match any of the fonts a bit better.
* gtk/testgtk.c: Add tabs between directional segments for
hebrew/arabic test. (Not really necessary, just a little
prettier.)
2000-12-14 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c (fill_file_buffer): fix unicode validation when
......
Thu Dec 14 20:22:31 2000 Owen Taylor <otaylor@redhat.com>
* gdk/{gdkdrawable.[ch],gdkpixmap.c,gdkwindow.c,x11/gdkwindow.c}:
Add two virtualized functions gdk_drawable_get_clip_region - to
get the clip region when drawing.
* gdk/gdkwindow.c (gdk_window_invalidate_rect): Rewrite to simple
use invalidate_region.
* gdk/gdkwindow.c (gdk_window_invalidate_region): Clip to visible
region.
* acconfig.h configure.in: Check for Xft. For now, assume
that if Xft is found, Pango was compiled with Xft support
as well.
* gdk/gdkcolor.h gdk/x11/gdkcolor-x11.c: Add
gdk_colormap_query_color().
* gdk/x11/gdkdrawable-x11.c (gdk_x11_draw_glyphs): Draw
with Xft if appropriate.
* gdk/x11/gdkpango-x11.c (gdk_pango_context_get): Create
a pangoxft context if we have XFT and the environment
variable GD_USE_XFT is set.
* gdk/x11/gdkx.h (struct _GdkGCX11): Cache the fg_pixel
and also possibly an XftDraw structure.
* gtk/gtkfontsel.c: Handle the case where the font from the
style doesn't match any of the fonts a bit better.
* gtk/testgtk.c: Add tabs between directional segments for
hebrew/arabic test. (Not really necessary, just a little
prettier.)
2000-12-14 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c (fill_file_buffer): fix unicode validation when
......
Thu Dec 14 20:22:31 2000 Owen Taylor <otaylor@redhat.com>
* gdk/{gdkdrawable.[ch],gdkpixmap.c,gdkwindow.c,x11/gdkwindow.c}:
Add two virtualized functions gdk_drawable_get_clip_region - to
get the clip region when drawing.
* gdk/gdkwindow.c (gdk_window_invalidate_rect): Rewrite to simple
use invalidate_region.
* gdk/gdkwindow.c (gdk_window_invalidate_region): Clip to visible
region.
* acconfig.h configure.in: Check for Xft. For now, assume
that if Xft is found, Pango was compiled with Xft support
as well.
* gdk/gdkcolor.h gdk/x11/gdkcolor-x11.c: Add
gdk_colormap_query_color().
* gdk/x11/gdkdrawable-x11.c (gdk_x11_draw_glyphs): Draw
with Xft if appropriate.
* gdk/x11/gdkpango-x11.c (gdk_pango_context_get): Create
a pangoxft context if we have XFT and the environment
variable GD_USE_XFT is set.
* gdk/x11/gdkx.h (struct _GdkGCX11): Cache the fg_pixel
and also possibly an XftDraw structure.
* gtk/gtkfontsel.c: Handle the case where the font from the
style doesn't match any of the fonts a bit better.
* gtk/testgtk.c: Add tabs between directional segments for
hebrew/arabic test. (Not really necessary, just a little
prettier.)
2000-12-14 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c (fill_file_buffer): fix unicode validation when
......
Thu Dec 14 20:22:31 2000 Owen Taylor <otaylor@redhat.com>
* gdk/{gdkdrawable.[ch],gdkpixmap.c,gdkwindow.c,x11/gdkwindow.c}:
Add two virtualized functions gdk_drawable_get_clip_region - to
get the clip region when drawing.
* gdk/gdkwindow.c (gdk_window_invalidate_rect): Rewrite to simple
use invalidate_region.
* gdk/gdkwindow.c (gdk_window_invalidate_region): Clip to visible
region.
* acconfig.h configure.in: Check for Xft. For now, assume
that if Xft is found, Pango was compiled with Xft support
as well.
* gdk/gdkcolor.h gdk/x11/gdkcolor-x11.c: Add
gdk_colormap_query_color().
* gdk/x11/gdkdrawable-x11.c (gdk_x11_draw_glyphs): Draw
with Xft if appropriate.
* gdk/x11/gdkpango-x11.c (gdk_pango_context_get): Create
a pangoxft context if we have XFT and the environment
variable GD_USE_XFT is set.
* gdk/x11/gdkx.h (struct _GdkGCX11): Cache the fg_pixel
and also possibly an XftDraw structure.
* gtk/gtkfontsel.c: Handle the case where the font from the
style doesn't match any of the fonts a bit better.
* gtk/testgtk.c: Add tabs between directional segments for
hebrew/arabic test. (Not really necessary, just a little
prettier.)
2000-12-14 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c (fill_file_buffer): fix unicode validation when
......
Thu Dec 14 20:22:31 2000 Owen Taylor <otaylor@redhat.com>
* gdk/{gdkdrawable.[ch],gdkpixmap.c,gdkwindow.c,x11/gdkwindow.c}:
Add two virtualized functions gdk_drawable_get_clip_region - to
get the clip region when drawing.
* gdk/gdkwindow.c (gdk_window_invalidate_rect): Rewrite to simple
use invalidate_region.
* gdk/gdkwindow.c (gdk_window_invalidate_region): Clip to visible
region.
* acconfig.h configure.in: Check for Xft. For now, assume
that if Xft is found, Pango was compiled with Xft support
as well.
* gdk/gdkcolor.h gdk/x11/gdkcolor-x11.c: Add
gdk_colormap_query_color().
* gdk/x11/gdkdrawable-x11.c (gdk_x11_draw_glyphs): Draw
with Xft if appropriate.
* gdk/x11/gdkpango-x11.c (gdk_pango_context_get): Create
a pangoxft context if we have XFT and the environment
variable GD_USE_XFT is set.
* gdk/x11/gdkx.h (struct _GdkGCX11): Cache the fg_pixel
and also possibly an XftDraw structure.
* gtk/gtkfontsel.c: Handle the case where the font from the
style doesn't match any of the fonts a bit better.
* gtk/testgtk.c: Add tabs between directional segments for
hebrew/arabic test. (Not really necessary, just a little
prettier.)
2000-12-14 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c (fill_file_buffer): fix unicode validation when
......
Thu Dec 14 20:22:31 2000 Owen Taylor <otaylor@redhat.com>
* gdk/{gdkdrawable.[ch],gdkpixmap.c,gdkwindow.c,x11/gdkwindow.c}:
Add two virtualized functions gdk_drawable_get_clip_region - to
get the clip region when drawing.
* gdk/gdkwindow.c (gdk_window_invalidate_rect): Rewrite to simple
use invalidate_region.
* gdk/gdkwindow.c (gdk_window_invalidate_region): Clip to visible
region.
* acconfig.h configure.in: Check for Xft. For now, assume
that if Xft is found, Pango was compiled with Xft support
as well.
* gdk/gdkcolor.h gdk/x11/gdkcolor-x11.c: Add
gdk_colormap_query_color().
* gdk/x11/gdkdrawable-x11.c (gdk_x11_draw_glyphs): Draw
with Xft if appropriate.
* gdk/x11/gdkpango-x11.c (gdk_pango_context_get): Create
a pangoxft context if we have XFT and the environment
variable GD_USE_XFT is set.
* gdk/x11/gdkx.h (struct _GdkGCX11): Cache the fg_pixel
and also possibly an XftDraw structure.
* gtk/gtkfontsel.c: Handle the case where the font from the
style doesn't match any of the fonts a bit better.
* gtk/testgtk.c: Add tabs between directional segments for
hebrew/arabic test. (Not really necessary, just a little
prettier.)
2000-12-14 Havoc Pennington <hp@redhat.com>
* gtk/testtext.c (fill_file_buffer): fix unicode validation when
......
......@@ -32,6 +32,7 @@
#undef HAVE_SYS_SELECT_H
#undef HAVE_SYS_TIME_H
#undef HAVE_XCONVERTCASE
#undef HAVE_XFT
#undef NO_FD_SET
......
......@@ -398,6 +398,22 @@ if test "x$gdktarget" = "xx11"; then
,
$x_libs)
#
# Checks for Xft/XRender
#
have_xft=false
XFT_LIBS=""
AC_CHECK_LIB(Xrender, XRenderFindFormat,
AC_CHECK_LIB(Xft, XftFontOpen, have_xft=true, :, -lXrender $X_LIBS)
,:,-lXext $X_LIBS)
if $have_xft = 'true' ; then
X_LIBS="-lXft -lXrender -lXext $X_LIBS"
fi
AC_DEFINE(HAVE_XFT)
AM_CONDITIONAL(HAVE_XFT, $have_xft)
# Check for XIM support.
AC_CHECK_LIB(X11, XUnregisterIMInstantiateCallback,
......@@ -562,6 +578,9 @@ fi
if test "x$gdktarget" = "xx11"; then
PANGO_CFLAGS="`$PANGO_CONFIG --cflags pangox`"
PANGO_LIBS="`$PANGO_CONFIG --libs pangox`"
if $have_xft = true ; then
PANGO_LIBS="$PANGO_LIBS -lpangoxft"
fi
else
PANGO_CFLAGS="`$PANGO_CONFIG --cflags pango`"
PANGO_LIBS="`$PANGO_CONFIG --libs pango`"
......
......@@ -82,6 +82,9 @@ gboolean gdk_colormap_alloc_color (GdkColormap *colormap,
void gdk_colormap_free_colors (GdkColormap *colormap,
GdkColor *colors,
gint ncolors);
void gdk_colormap_query_color (GdkColormap *colormap,
gulong pixel,
GdkColor *result);
GdkVisual *gdk_colormap_get_visual (GdkColormap *colormap);
......
......@@ -29,12 +29,13 @@
#include "gdkwindow.h"
static GdkDrawable* gdk_drawable_real_get_composite_drawable (GdkDrawable *drawable,
gint x,
gint y,
gint width,
gint height,
gint *composite_x_offset,
gint *composite_y_offset);
gint x,
gint y,
gint width,
gint height,
gint *composite_x_offset,
gint *composite_y_offset);
static GdkRegion * gdk_drawable_real_get_visible_region (GdkDrawable *drawable);
static void gdk_drawable_class_init (GdkDrawableClass *klass);
......@@ -70,6 +71,9 @@ static void
gdk_drawable_class_init (GdkDrawableClass *klass)
{
klass->get_composite_drawable = gdk_drawable_real_get_composite_drawable;
/* Default implementation for clip and visible region is the same */
klass->get_clip_region = gdk_drawable_real_get_visible_region;
klass->get_visible_region = gdk_drawable_real_get_visible_region;
}
/* Manipulation of drawables
......@@ -525,3 +529,58 @@ gdk_drawable_real_get_composite_drawable (GdkDrawable *drawable,
return GDK_DRAWABLE (g_object_ref (G_OBJECT (drawable)));
}
/**
* gdk_drawable_get_clip_region:
* @drawable: a #GdkDrawable
*
* Computes the region of a drawable that potentially can be written
* to by drawing primitives. This region will not take into account
* the clip region for the GC, and may also not take into account
* other factors such as if the window is obscured by other windows,
* but no area outside of this region will be affected by drawing
* primitives.
*
* Return value: a #GdkRegion. This must be freed with gdk_region_destroy()
* when you are done.
**/
GdkRegion *
gdk_drawable_get_clip_region (GdkDrawable *drawable)
{
g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), NULL);
return GDK_DRAWABLE_GET_CLASS (drawable)->get_clip_region (drawable);
}
/**
* gdk_drawable_get_visible_region:
* @drawable:
*
* Computes the region of a drawable that is potentially visible.
* This does not necessarily take into account if the window is
* obscured by other windows, but no area outside of this region
* is visible.
*
* Return value: a #GdkRegion. This must be freed with gdk_region_destroy()
* when you are done.
**/
GdkRegion *
gdk_drawable_get_visible_region (GdkDrawable *drawable)
{
g_return_val_if_fail (GDK_IS_DRAWABLE (drawable), NULL);
return GDK_DRAWABLE_GET_CLASS (drawable)->get_visible_region (drawable);
}
static GdkRegion *
gdk_drawable_real_get_visible_region (GdkDrawable *drawable)
{
GdkRectangle rect;
rect.x = 0;
rect.y = 0;
gdk_drawable_get_size (drawable, &rect.width, &rect.height);
return gdk_region_rectangle (&rect);
}
......@@ -120,6 +120,9 @@ struct _GdkDrawableClass
gint width,
gint height);
GdkRegion* (*get_clip_region) (GdkDrawable *drawable);
GdkRegion* (*get_visible_region) (GdkDrawable *drawable);
GdkDrawable* (*get_composite_drawable) (GdkDrawable *drawable,
gint x,
gint y,
......@@ -260,6 +263,9 @@ GdkImage* gdk_drawable_get_image (GdkDrawable *drawable,
gint width,
gint height);
GdkRegion *gdk_drawable_get_clip_region (GdkDrawable *drawable);
GdkRegion *gdk_drawable_get_visible_region (GdkDrawable *drawable);
#ifdef __cplusplus
}
#endif /* __cplusplus */
......
......@@ -107,12 +107,11 @@ static void gdk_pixmap_real_get_size (GdkDrawable *drawable,
gint *width,
gint *height);
static GdkImage* gdk_pixmap_get_image (GdkDrawable *drawable,
gint x,
gint y,
gint width,
gint height);
static GdkImage* gdk_pixmap_get_image (GdkDrawable *drawable,
gint x,
gint y,
gint width,
gint height);
static GdkVisual* gdk_pixmap_real_get_visual (GdkDrawable *drawable);
static gint gdk_pixmap_real_get_depth (GdkDrawable *drawable);
......
......@@ -136,12 +136,14 @@ static void gdk_window_real_set_colormap (GdkDrawable *drawable,
static GdkColormap* gdk_window_real_get_colormap (GdkDrawable *drawable);
static GdkDrawable* gdk_window_get_composite_drawable (GdkDrawable *drawable,
gint x,
gint y,
gint width,
gint height,
gint *composite_x_offset,
gint *composite_y_offset);
gint x,
gint y,
gint width,
gint height,
gint *composite_x_offset,
gint *composite_y_offset);
static GdkRegion* gdk_window_get_clip_region (GdkDrawable *drawable);
static GdkRegion* gdk_window_get_visible_region (GdkDrawable *drawable);
static void gdk_window_free_paint_stack (GdkWindow *window);
......@@ -217,6 +219,8 @@ gdk_window_class_init (GdkWindowObjectClass *klass)
drawable_class->get_colormap = gdk_window_real_get_colormap;
drawable_class->get_visual = gdk_window_real_get_visual;
drawable_class->get_image = gdk_window_get_image;
drawable_class->get_clip_region = gdk_window_get_clip_region;
drawable_class->get_visible_region = gdk_window_get_visible_region;
drawable_class->get_composite_drawable = gdk_window_get_composite_drawable;
}
......@@ -1207,6 +1211,41 @@ gdk_window_get_composite_drawable (GdkDrawable *window,
return tmp_pixmap;
}
static GdkRegion*
gdk_window_get_clip_region (GdkDrawable *drawable)
{
GdkWindowObject *private = (GdkWindowObject *)drawable;
GdkRegion *result;
result = gdk_drawable_get_clip_region (private->impl);
if (private->paint_stack)
{
GdkRegion *paint_region = gdk_region_new ();
GSList *tmp_list = private->paint_stack;
while (tmp_list)
{
GdkWindowPaint *paint = tmp_list->data;
gdk_region_union (paint_region, paint->region);
}
gdk_region_intersect (result, paint_region);
gdk_region_destroy (paint_region);
}
return result;
}
static GdkRegion*
gdk_window_get_visible_region (GdkDrawable *drawable)
{
GdkWindowObject *private = (GdkWindowObject*) drawable;
return gdk_drawable_get_visible_region (private->impl);
}
static void
gdk_window_draw_drawable (GdkDrawable *drawable,
GdkGC *gc,
......@@ -1710,6 +1749,7 @@ gdk_window_invalidate_rect (GdkWindow *window,
gboolean invalidate_children)
{
GdkRectangle window_rect;
GdkRegion *region;
GdkWindowObject *private = (GdkWindowObject *)window;
g_return_if_fail (window != NULL);
......@@ -1730,55 +1770,10 @@ gdk_window_invalidate_rect (GdkWindow *window,
&window_rect.height);
rect = &window_rect;
}
if (private->update_area)
{
gdk_region_union_with_rect (private->update_area, rect);
}
else
{
update_windows = g_slist_prepend (update_windows, window);
private->update_area = gdk_region_rectangle (rect);
if (!private->update_freeze_count && !update_idle)
update_idle = g_idle_add_full (GDK_PRIORITY_REDRAW,
gdk_window_update_idle, NULL, NULL);
}
if (invalidate_children)
{
GList *tmp_list;
GdkRectangle child_rect, new_rect;
tmp_list = private->children;
while (tmp_list)
{
GdkWindowObject *child = tmp_list->data;
tmp_list = tmp_list->next;
if (!child->input_only)
{
gint width, height;
gdk_drawable_get_size (GDK_DRAWABLE (child),
&width, &height);
child_rect.x = child->x;
child_rect.y = child->y;
child_rect.width = width;
child_rect.height = height;
if (gdk_rectangle_intersect (rect, &child_rect, &new_rect))
{
new_rect.x -= child_rect.x;
new_rect.y -= child_rect.y;
gdk_window_invalidate_rect ((GdkWindow *)child, &new_rect, TRUE);
}
}
}
}
region = gdk_region_rectangle (rect);
gdk_window_invalidate_region (window, region, invalidate_children);
gdk_region_destroy (region);
}
void
......@@ -1787,6 +1782,7 @@ gdk_window_invalidate_region (GdkWindow *window,
gboolean invalidate_children)
{
GdkWindowObject *private = (GdkWindowObject *)window;
GdkRegion *visible_region;
g_return_if_fail (window != NULL);
g_return_if_fail (GDK_IS_WINDOW (window));
......@@ -1796,55 +1792,51 @@ gdk_window_invalidate_region (GdkWindow *window,
if (private->input_only || !private->mapped)
return;
if (private->update_area)
{
gdk_region_union (private->update_area, region);
}
else
{
update_windows = g_slist_prepend (update_windows, window);
private->update_area = gdk_region_copy (region);
if (!private->update_freeze_count && !update_idle)
update_idle = g_idle_add_full (GDK_PRIORITY_REDRAW,
gdk_window_update_idle, NULL, NULL);
}
visible_region = gdk_drawable_get_visible_region (window);
gdk_region_intersect (visible_region, region);
if (invalidate_children)
if (!gdk_region_empty (region))
{
GList *tmp_list;
GdkRectangle child_rect;
GdkRegion *child_region;
tmp_list = private->children;
while (tmp_list)
if (private->update_area)
{
GdkWindowObject *child = tmp_list->data;
tmp_list = tmp_list->next;
if (!child->input_only)
gdk_region_union (private->update_area, region);
}
else
{
update_windows = g_slist_prepend (update_windows, window);
private->update_area = gdk_region_copy (region);
if (!private->update_freeze_count && !update_idle)
update_idle = g_idle_add_full (GDK_PRIORITY_REDRAW,
gdk_window_update_idle, NULL, NULL);
}
if (invalidate_children)
{
GList *tmp_list;
tmp_list = private->children;
while (tmp_list)
{
gint width, height;
gdk_drawable_get_size (GDK_DRAWABLE (child),
&width, &height);
child_rect.x = child->x;
child_rect.y = child->y;
child_rect.width = width;
child_rect.height = height;
child_region = gdk_region_rectangle (&child_rect);
gdk_region_intersect (child_region, region);
GdkWindowObject *child = tmp_list->data;
tmp_list = tmp_list->next;
if (!gdk_region_empty (child_region))
if (!child->input_only)
{
gdk_region_offset (child_region, - child_rect.x, - child_rect.y);
GdkRegion *child_region;
gint x, y;
gdk_window_get_position ((GdkWindow *)child, &x, &y);
/* This copy could be saved with a little more complexity */
child_region = gdk_region_copy (region);
gdk_region_offset (child_region, -x, -y);
gdk_window_invalidate_region ((GdkWindow *)child, child_region, TRUE);
gdk_region_destroy (child_region);
}
gdk_region_destroy (child_region);
}
}
}
......
......@@ -963,6 +963,47 @@ gdk_colormap_alloc_colors (GdkColormap *colormap,
return nremaining;
}
void
gdk_colormap_query_color (GdkColormap *colormap,
gulong pixel,
GdkColor *result)
{
XColor xcolor;
GdkVisual *visual;
g_return_if_fail (GDK_IS_COLORMAP (colormap));
visual = gdk_colormap_get_visual (colormap);
switch (visual->type) {
case GDK_VISUAL_DIRECT_COLOR:
case GDK_VISUAL_TRUE_COLOR:
result->red = 65535. * (double)((pixel & visual->red_mask) >> visual->red_shift) / ((1 << visual->red_prec) - 1);
result->green = 65535. * (double)((pixel & visual->green_mask) >> visual->green_shift) / ((1 << visual->green_prec) - 1);
result->blue = 65535. * (double)((pixel & visual->blue_mask) >> visual->blue_shift) / ((1 << visual->blue_prec) - 1);
break;
case GDK_VISUAL_STATIC_GRAY:
case GDK_VISUAL_GRAYSCALE:
result->red = result->green = result->blue = 65535. * (double)pixel/((1<<visual->depth) - 1);
break;
case GDK_VISUAL_STATIC_COLOR:
xcolor.pixel = pixel;
XQueryColor (GDK_DISPLAY (), GDK_COLORMAP_XCOLORMAP (colormap), &xcolor);
result->red = xcolor.red;
result->green = xcolor.green;
result->blue = xcolor.blue;
break;
case GDK_VISUAL_PSEUDO_COLOR:
result->red = colormap->colors[pixel].red;
result->green = colormap->colors[pixel].green;
result->blue = colormap->colors[pixel].blue;
break;
default:
g_assert_not_reached ();
break;
}
}
gboolean
gdk_color_change (GdkColormap *colormap,
GdkColor *color)
......
......@@ -25,9 +25,15 @@
*/
#include "gdkprivate-x11.h"
#include "gdkregion-generic.h"
#include <pango/pangox.h>
#include <config.h>
#if HAVE_XFT
#include <pango/pangoxft.h>