gtk2/gdk/linux-fb/gdkgc-fb.c

381 lines
9.7 KiB
C
Raw Normal View History

2005-07-12 04:38:51 +00:00
/* GDK - The GIMP Drawing Kit
* Copyright (C) 2000 Elliot Lee
*
* 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>
2000-08-07 03:26:05 +00:00
#include <string.h>
#include <stdlib.h>
2000-05-31 21:50:38 +00:00
#include "gdkprivate-fb.h"
#include "gdkgc.h"
#include "gdkfb.h"
#include "gdkregion-generic.h"
typedef enum {
GDK_GC_DIRTY_CLIP = 1 << 0,
GDK_GC_DIRTY_TS = 1 << 1
} GdkGCDirtyValues;
static void gdk_fb_gc_finalize (GObject *obj);
2000-05-31 21:50:38 +00:00
static void gdk_fb_gc_get_values (GdkGC *gc,
GdkGCValues *values);
2000-05-31 21:50:38 +00:00
static void gdk_fb_gc_set_values (GdkGC *gc,
GdkGCValues *values,
GdkGCValuesMask values_mask);
static void gdk_fb_gc_set_dashes (GdkGC *gc,
gint dash_offset,
gint8 dash_list[],
gint n);
2000-05-31 21:50:38 +00:00
static gpointer parent_class = NULL;
static void
gdk_gc_fb_class_init (GdkGCFBClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GdkGCClass *gc_class = GDK_GC_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
object_class->finalize = gdk_fb_gc_finalize;
gc_class->get_values = gdk_fb_gc_get_values;
gc_class->set_values = gdk_fb_gc_set_values;
gc_class->set_dashes = gdk_fb_gc_set_dashes;
}
GType
gdk_gc_fb_get_type (void)
{
static GType object_type = 0;
if (!object_type)
{
static const GTypeInfo object_info =
{
sizeof (GdkGCFBClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gdk_gc_fb_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GdkGCFBData),
0, /* n_preallocs */
(GInstanceInitFunc) NULL,
};
object_type = g_type_register_static (GDK_TYPE_GC,
"GdkGCFB",
&object_info,
0);
}
return object_type;
}
2000-05-31 21:50:38 +00:00
GdkGC *
_gdk_fb_gc_new (GdkDrawable *drawable,
GdkGCValues *values,
GdkGCValuesMask values_mask)
{
GdkGC *gc;
GdkGCFBData *private;
gc = g_object_new (gdk_gc_fb_get_type (), NULL);
2000-05-31 21:50:38 +00:00
Add a draw-border style property to allow themes to draw outside the 2005-04-28 Owen Taylor <otaylor@redhat.com> * gtk/gtkwidget.c: Add a draw-border style property to allow themes to draw outside the widget's allocation. * gdk/gdkwindow.c gtk/gtkstyle.c: Remove some save/restore pairs that were working around the clip-leakage bug in Cairo. * gtk/gtkstyle.c: Use cairo_fill_preserve() rathe than save/fill/restore. * gdk/gdkgc.c gdk/gdkinternals.h: Add _gdk_gc_update_context() That updates a Cairo context to match a GC. * gdk/gdkdraw.c: Use _gdk_gc_update_context() to add support for tiles/stipples/clipping to gdk_draw_glyphs(), gdk_draw_trapezoids(). * gdk/gdkpango.c: Use _gdk_gc_update_context() instead of internal implementation of stipples. Use one cairo_t across the entire drawing operation. Replace cairo_matrix_create() with stack-allocated matrices. * gdk/gdkgc.c gdk/gdkinternals.h gdk/x11/gdkgc-x11.c gdk/win32/gdkgc-win32.c: Save various aspects of the GC state (fill, tile, stipple, foreground, background, clip region) in instance-private-data for future use. Add getters. Get rid of _gdk_windowing_gc_get_foreground() function implemented by the backends. * gdk/gdkgc.c gdk/gdkinternals.h gdk/x11/gdkgc-x11.c gdk/win32/gdkgc-win32.c gdk/linux-fb/gdkgc-fb.c: Add _gdk_gc_init() to do initial setup of the GC from values; fixes some problems from drawable redirection. * gdk/gdkgc.c gdk/gdkinternals.h gdk/x11/gdkgc-x11.c gdk/win32/gdkgc-win32.c gdk/linux-fb/gdkgc-fb.c: Move gdk_gc_copy() and gdk_gc_set_clip_{region,rectangle}() into the generic code, add _gdk_windowing_gc_copy(), _gdk_windowing_gc_set_clip_region() to do backend specific stuff. * gdk/x11/{gdkprivate-x11.h,gdkgc-x11.c.c,gdkdrawable-x11.c} gdk/win32/{gdkprivate-win32.h,gdkgc-x11.c.c,gdkdrawable-x11.c} gdk/linux-fb/{gdkprivate-fb.h,gdkgc-fb.c.c,gdkdrawable-fb.c}: Don't duplicate state that now is stored by the generic code. * gdk/gdk.symbols Update
2005-05-02 23:29:24 +00:00
_gdk_gc_init (gc, drawable, values, values_mask);
private = (GdkGCFBData *)gc;
private->depth = GDK_DRAWABLE_FBDATA (drawable)->depth;
private->values.foreground.pixel = 255;
private->values.foreground.red =
private->values.foreground.green =
private->values.foreground.blue = 65535;
private->values.cap_style = GDK_CAP_BUTT;
_gdk_fb_gc_calc_state (gc, _GDK_FB_GC_DEPTH);
2000-05-31 21:50:38 +00:00
gdk_fb_gc_set_values (gc, values, values_mask);
2000-05-31 21:50:38 +00:00
return gc;
}
static void
gdk_fb_gc_finalize (GObject *obj)
2000-05-31 21:50:38 +00:00
{
GdkGC *gc = GDK_GC_P (obj);
GdkGCFBData *private;
private = GDK_GC_FBDATA (gc);
if (private->values.clip_mask)
gdk_pixmap_unref (private->values.clip_mask);
g_free (private->dash_list);
G_OBJECT_CLASS (parent_class)->finalize (obj);
2000-05-31 21:50:38 +00:00
}
static void
gdk_fb_gc_get_values (GdkGC *gc,
GdkGCValues *values)
{
*values = GDK_GC_FBDATA (gc)->values;
2000-05-31 21:50:38 +00:00
}
static void
gdk_fb_gc_set_values (GdkGC *gc,
GdkGCValues *values,
GdkGCValuesMask values_mask)
{
GdkPixmap *oldpm;
GdkFont *oldf;
GdkGCFBData *private;
2000-05-31 21:50:38 +00:00
private = GDK_GC_FBDATA (gc);
if (values_mask & GDK_GC_FOREGROUND)
2000-05-31 21:50:38 +00:00
{
private->values.foreground = values->foreground;
private->values_mask |= GDK_GC_FOREGROUND;
2000-05-31 21:50:38 +00:00
}
if (values_mask & GDK_GC_BACKGROUND)
2000-05-31 21:50:38 +00:00
{
private->values.background = values->background;
private->values_mask |= GDK_GC_BACKGROUND;
2000-05-31 21:50:38 +00:00
}
if (values_mask & GDK_GC_FONT)
2000-05-31 21:50:38 +00:00
{
oldf = private->values.font;
private->values.font = gdk_font_ref (values->font);
private->values_mask |= GDK_GC_FONT;
if (oldf)
2000-05-31 21:50:38 +00:00
gdk_font_unref(oldf);
}
if (values_mask & GDK_GC_FUNCTION)
2000-05-31 21:50:38 +00:00
{
private->values.function = values->function;
private->values_mask |= GDK_GC_FUNCTION;
2000-05-31 21:50:38 +00:00
}
if (values_mask & GDK_GC_FILL)
2000-05-31 21:50:38 +00:00
{
private->values.fill = values->fill;
private->values_mask |= GDK_GC_FILL;
2000-05-31 21:50:38 +00:00
}
if (values_mask & GDK_GC_TILE)
2000-05-31 21:50:38 +00:00
{
oldpm = private->values.tile;
if (values->tile)
g_assert (GDK_DRAWABLE_IMPL_FBDATA (values->tile)->depth >= 8);
Add a draw-border style property to allow themes to draw outside the 2005-04-28 Owen Taylor <otaylor@redhat.com> * gtk/gtkwidget.c: Add a draw-border style property to allow themes to draw outside the widget's allocation. * gdk/gdkwindow.c gtk/gtkstyle.c: Remove some save/restore pairs that were working around the clip-leakage bug in Cairo. * gtk/gtkstyle.c: Use cairo_fill_preserve() rathe than save/fill/restore. * gdk/gdkgc.c gdk/gdkinternals.h: Add _gdk_gc_update_context() That updates a Cairo context to match a GC. * gdk/gdkdraw.c: Use _gdk_gc_update_context() to add support for tiles/stipples/clipping to gdk_draw_glyphs(), gdk_draw_trapezoids(). * gdk/gdkpango.c: Use _gdk_gc_update_context() instead of internal implementation of stipples. Use one cairo_t across the entire drawing operation. Replace cairo_matrix_create() with stack-allocated matrices. * gdk/gdkgc.c gdk/gdkinternals.h gdk/x11/gdkgc-x11.c gdk/win32/gdkgc-win32.c: Save various aspects of the GC state (fill, tile, stipple, foreground, background, clip region) in instance-private-data for future use. Add getters. Get rid of _gdk_windowing_gc_get_foreground() function implemented by the backends. * gdk/gdkgc.c gdk/gdkinternals.h gdk/x11/gdkgc-x11.c gdk/win32/gdkgc-win32.c gdk/linux-fb/gdkgc-fb.c: Add _gdk_gc_init() to do initial setup of the GC from values; fixes some problems from drawable redirection. * gdk/gdkgc.c gdk/gdkinternals.h gdk/x11/gdkgc-x11.c gdk/win32/gdkgc-win32.c gdk/linux-fb/gdkgc-fb.c: Move gdk_gc_copy() and gdk_gc_set_clip_{region,rectangle}() into the generic code, add _gdk_windowing_gc_copy(), _gdk_windowing_gc_set_clip_region() to do backend specific stuff. * gdk/x11/{gdkprivate-x11.h,gdkgc-x11.c.c,gdkdrawable-x11.c} gdk/win32/{gdkprivate-win32.h,gdkgc-x11.c.c,gdkdrawable-x11.c} gdk/linux-fb/{gdkprivate-fb.h,gdkgc-fb.c.c,gdkdrawable-fb.c}: Don't duplicate state that now is stored by the generic code. * gdk/gdk.symbols Update
2005-05-02 23:29:24 +00:00
private->values.tile = values->tile;
private->values_mask |= GDK_GC_TILE;
if (oldpm)
gdk_pixmap_unref (oldpm);
2000-05-31 21:50:38 +00:00
}
if (values_mask & GDK_GC_STIPPLE)
2000-05-31 21:50:38 +00:00
{
oldpm = private->values.stipple;
if (values->stipple)
g_assert (GDK_DRAWABLE_IMPL_FBDATA (values->stipple)->depth == 1);
Add a draw-border style property to allow themes to draw outside the 2005-04-28 Owen Taylor <otaylor@redhat.com> * gtk/gtkwidget.c: Add a draw-border style property to allow themes to draw outside the widget's allocation. * gdk/gdkwindow.c gtk/gtkstyle.c: Remove some save/restore pairs that were working around the clip-leakage bug in Cairo. * gtk/gtkstyle.c: Use cairo_fill_preserve() rathe than save/fill/restore. * gdk/gdkgc.c gdk/gdkinternals.h: Add _gdk_gc_update_context() That updates a Cairo context to match a GC. * gdk/gdkdraw.c: Use _gdk_gc_update_context() to add support for tiles/stipples/clipping to gdk_draw_glyphs(), gdk_draw_trapezoids(). * gdk/gdkpango.c: Use _gdk_gc_update_context() instead of internal implementation of stipples. Use one cairo_t across the entire drawing operation. Replace cairo_matrix_create() with stack-allocated matrices. * gdk/gdkgc.c gdk/gdkinternals.h gdk/x11/gdkgc-x11.c gdk/win32/gdkgc-win32.c: Save various aspects of the GC state (fill, tile, stipple, foreground, background, clip region) in instance-private-data for future use. Add getters. Get rid of _gdk_windowing_gc_get_foreground() function implemented by the backends. * gdk/gdkgc.c gdk/gdkinternals.h gdk/x11/gdkgc-x11.c gdk/win32/gdkgc-win32.c gdk/linux-fb/gdkgc-fb.c: Add _gdk_gc_init() to do initial setup of the GC from values; fixes some problems from drawable redirection. * gdk/gdkgc.c gdk/gdkinternals.h gdk/x11/gdkgc-x11.c gdk/win32/gdkgc-win32.c gdk/linux-fb/gdkgc-fb.c: Move gdk_gc_copy() and gdk_gc_set_clip_{region,rectangle}() into the generic code, add _gdk_windowing_gc_copy(), _gdk_windowing_gc_set_clip_region() to do backend specific stuff. * gdk/x11/{gdkprivate-x11.h,gdkgc-x11.c.c,gdkdrawable-x11.c} gdk/win32/{gdkprivate-win32.h,gdkgc-x11.c.c,gdkdrawable-x11.c} gdk/linux-fb/{gdkprivate-fb.h,gdkgc-fb.c.c,gdkdrawable-fb.c}: Don't duplicate state that now is stored by the generic code. * gdk/gdk.symbols Update
2005-05-02 23:29:24 +00:00
private->values.stipple = values->stipple;
private->values_mask |= GDK_GC_STIPPLE;
if (oldpm)
gdk_pixmap_unref (oldpm);
2000-05-31 21:50:38 +00:00
}
if (values_mask & GDK_GC_CLIP_MASK)
2000-05-31 21:50:38 +00:00
{
oldpm = private->values.clip_mask;
2000-05-31 21:50:38 +00:00
private->values.clip_mask = values->clip_mask ? gdk_pixmap_ref (values->clip_mask) : NULL;
private->values_mask |= GDK_GC_CLIP_MASK;
if (oldpm)
gdk_pixmap_unref (oldpm);
2000-05-31 21:50:38 +00:00
}
if (values_mask & GDK_GC_SUBWINDOW)
2000-05-31 21:50:38 +00:00
{
private->values.subwindow_mode = values->subwindow_mode;
private->values_mask |= GDK_GC_SUBWINDOW;
2000-05-31 21:50:38 +00:00
}
if (values_mask & GDK_GC_TS_X_ORIGIN)
2000-05-31 21:50:38 +00:00
{
private->values.ts_x_origin = values->ts_x_origin;
private->values_mask |= GDK_GC_TS_X_ORIGIN;
2000-05-31 21:50:38 +00:00
}
if (values_mask & GDK_GC_TS_Y_ORIGIN)
2000-05-31 21:50:38 +00:00
{
private->values.ts_y_origin = values->ts_y_origin;
private->values_mask |= GDK_GC_TS_Y_ORIGIN;
2000-05-31 21:50:38 +00:00
}
if (values_mask & GDK_GC_CLIP_X_ORIGIN)
2000-05-31 21:50:38 +00:00
{
private->values.clip_x_origin = GDK_GC_P (gc)->clip_x_origin = values->clip_x_origin;
private->values_mask |= GDK_GC_CLIP_X_ORIGIN;
2000-05-31 21:50:38 +00:00
}
if (values_mask & GDK_GC_CLIP_Y_ORIGIN)
2000-05-31 21:50:38 +00:00
{
private->values.clip_y_origin = GDK_GC_P(gc)->clip_y_origin = values->clip_y_origin;
private->values_mask |= GDK_GC_CLIP_Y_ORIGIN;
2000-05-31 21:50:38 +00:00
}
if (values_mask & GDK_GC_EXPOSURES)
2000-05-31 21:50:38 +00:00
{
private->values.graphics_exposures = values->graphics_exposures;
private->values_mask |= GDK_GC_EXPOSURES;
2000-05-31 21:50:38 +00:00
}
if (values_mask & GDK_GC_LINE_WIDTH)
2000-05-31 21:50:38 +00:00
{
private->values.line_width = values->line_width;
private->values_mask |= GDK_GC_LINE_WIDTH;
2000-05-31 21:50:38 +00:00
}
if (values_mask & GDK_GC_LINE_STYLE)
2000-05-31 21:50:38 +00:00
{
private->values.line_style = values->line_style;
private->values_mask |= GDK_GC_LINE_STYLE;
2000-05-31 21:50:38 +00:00
}
if (values_mask & GDK_GC_CAP_STYLE)
2000-05-31 21:50:38 +00:00
{
private->values.cap_style = values->cap_style;
private->values_mask |= GDK_GC_CAP_STYLE;
2000-05-31 21:50:38 +00:00
}
if (values_mask & GDK_GC_JOIN_STYLE)
2000-05-31 21:50:38 +00:00
{
private->values.join_style = values->join_style;
private->values_mask |= GDK_GC_JOIN_STYLE;
2000-05-31 21:50:38 +00:00
}
_gdk_fb_gc_calc_state (gc, values_mask);
2000-05-31 21:50:38 +00:00
}
static void
gdk_fb_gc_set_dashes (GdkGC *gc,
gint dash_offset,
gint8 dash_list[],
2000-05-31 21:50:38 +00:00
gint n)
{
GdkGCFBData *private;
private = GDK_GC_FBDATA (gc);
private->dash_offset = dash_offset;
private->dash_list_len = n;
if (n)
2000-05-31 21:50:38 +00:00
{
private->dash_list = g_realloc (private->dash_list, n);
memcpy (private->dash_list, dash_list, n);
2000-05-31 21:50:38 +00:00
}
else
{
g_free (private->dash_list);
private->dash_list = NULL;
2000-05-31 21:50:38 +00:00
}
}
2000-06-20 20:20:38 +00:00
static void
gc_unset_cmask(GdkGC *gc)
{
GdkGCFBData *data;
data = GDK_GC_FBDATA (gc);
if (data->values.clip_mask)
2000-06-20 20:20:38 +00:00
{
gdk_pixmap_unref (data->values.clip_mask);
2000-06-20 20:20:38 +00:00
data->values.clip_mask = NULL;
data->values_mask &= ~ GDK_GC_CLIP_MASK;
}
_gdk_fb_gc_calc_state (gc, GDK_GC_CLIP_MASK);
2000-06-20 20:20:38 +00:00
}
2000-05-31 21:50:38 +00:00
void
Add a draw-border style property to allow themes to draw outside the 2005-04-28 Owen Taylor <otaylor@redhat.com> * gtk/gtkwidget.c: Add a draw-border style property to allow themes to draw outside the widget's allocation. * gdk/gdkwindow.c gtk/gtkstyle.c: Remove some save/restore pairs that were working around the clip-leakage bug in Cairo. * gtk/gtkstyle.c: Use cairo_fill_preserve() rathe than save/fill/restore. * gdk/gdkgc.c gdk/gdkinternals.h: Add _gdk_gc_update_context() That updates a Cairo context to match a GC. * gdk/gdkdraw.c: Use _gdk_gc_update_context() to add support for tiles/stipples/clipping to gdk_draw_glyphs(), gdk_draw_trapezoids(). * gdk/gdkpango.c: Use _gdk_gc_update_context() instead of internal implementation of stipples. Use one cairo_t across the entire drawing operation. Replace cairo_matrix_create() with stack-allocated matrices. * gdk/gdkgc.c gdk/gdkinternals.h gdk/x11/gdkgc-x11.c gdk/win32/gdkgc-win32.c: Save various aspects of the GC state (fill, tile, stipple, foreground, background, clip region) in instance-private-data for future use. Add getters. Get rid of _gdk_windowing_gc_get_foreground() function implemented by the backends. * gdk/gdkgc.c gdk/gdkinternals.h gdk/x11/gdkgc-x11.c gdk/win32/gdkgc-win32.c gdk/linux-fb/gdkgc-fb.c: Add _gdk_gc_init() to do initial setup of the GC from values; fixes some problems from drawable redirection. * gdk/gdkgc.c gdk/gdkinternals.h gdk/x11/gdkgc-x11.c gdk/win32/gdkgc-win32.c gdk/linux-fb/gdkgc-fb.c: Move gdk_gc_copy() and gdk_gc_set_clip_{region,rectangle}() into the generic code, add _gdk_windowing_gc_copy(), _gdk_windowing_gc_set_clip_region() to do backend specific stuff. * gdk/x11/{gdkprivate-x11.h,gdkgc-x11.c.c,gdkdrawable-x11.c} gdk/win32/{gdkprivate-win32.h,gdkgc-x11.c.c,gdkdrawable-x11.c} gdk/linux-fb/{gdkprivate-fb.h,gdkgc-fb.c.c,gdkdrawable-fb.c}: Don't duplicate state that now is stored by the generic code. * gdk/gdk.symbols Update
2005-05-02 23:29:24 +00:00
_gdk_windowing_gc_set_clip_region (GdkGC *gc,
GdkRegion *region)
2000-05-31 21:50:38 +00:00
{
Add a draw-border style property to allow themes to draw outside the 2005-04-28 Owen Taylor <otaylor@redhat.com> * gtk/gtkwidget.c: Add a draw-border style property to allow themes to draw outside the widget's allocation. * gdk/gdkwindow.c gtk/gtkstyle.c: Remove some save/restore pairs that were working around the clip-leakage bug in Cairo. * gtk/gtkstyle.c: Use cairo_fill_preserve() rathe than save/fill/restore. * gdk/gdkgc.c gdk/gdkinternals.h: Add _gdk_gc_update_context() That updates a Cairo context to match a GC. * gdk/gdkdraw.c: Use _gdk_gc_update_context() to add support for tiles/stipples/clipping to gdk_draw_glyphs(), gdk_draw_trapezoids(). * gdk/gdkpango.c: Use _gdk_gc_update_context() instead of internal implementation of stipples. Use one cairo_t across the entire drawing operation. Replace cairo_matrix_create() with stack-allocated matrices. * gdk/gdkgc.c gdk/gdkinternals.h gdk/x11/gdkgc-x11.c gdk/win32/gdkgc-win32.c: Save various aspects of the GC state (fill, tile, stipple, foreground, background, clip region) in instance-private-data for future use. Add getters. Get rid of _gdk_windowing_gc_get_foreground() function implemented by the backends. * gdk/gdkgc.c gdk/gdkinternals.h gdk/x11/gdkgc-x11.c gdk/win32/gdkgc-win32.c gdk/linux-fb/gdkgc-fb.c: Add _gdk_gc_init() to do initial setup of the GC from values; fixes some problems from drawable redirection. * gdk/gdkgc.c gdk/gdkinternals.h gdk/x11/gdkgc-x11.c gdk/win32/gdkgc-win32.c gdk/linux-fb/gdkgc-fb.c: Move gdk_gc_copy() and gdk_gc_set_clip_{region,rectangle}() into the generic code, add _gdk_windowing_gc_copy(), _gdk_windowing_gc_set_clip_region() to do backend specific stuff. * gdk/x11/{gdkprivate-x11.h,gdkgc-x11.c.c,gdkdrawable-x11.c} gdk/win32/{gdkprivate-win32.h,gdkgc-x11.c.c,gdkdrawable-x11.c} gdk/linux-fb/{gdkprivate-fb.h,gdkgc-fb.c.c,gdkdrawable-fb.c}: Don't duplicate state that now is stored by the generic code. * gdk/gdk.symbols Update
2005-05-02 23:29:24 +00:00
GdkGCFBData *data = GDK_GC_FBDATA (gc);
2000-05-31 21:50:38 +00:00
Add a draw-border style property to allow themes to draw outside the 2005-04-28 Owen Taylor <otaylor@redhat.com> * gtk/gtkwidget.c: Add a draw-border style property to allow themes to draw outside the widget's allocation. * gdk/gdkwindow.c gtk/gtkstyle.c: Remove some save/restore pairs that were working around the clip-leakage bug in Cairo. * gtk/gtkstyle.c: Use cairo_fill_preserve() rathe than save/fill/restore. * gdk/gdkgc.c gdk/gdkinternals.h: Add _gdk_gc_update_context() That updates a Cairo context to match a GC. * gdk/gdkdraw.c: Use _gdk_gc_update_context() to add support for tiles/stipples/clipping to gdk_draw_glyphs(), gdk_draw_trapezoids(). * gdk/gdkpango.c: Use _gdk_gc_update_context() instead of internal implementation of stipples. Use one cairo_t across the entire drawing operation. Replace cairo_matrix_create() with stack-allocated matrices. * gdk/gdkgc.c gdk/gdkinternals.h gdk/x11/gdkgc-x11.c gdk/win32/gdkgc-win32.c: Save various aspects of the GC state (fill, tile, stipple, foreground, background, clip region) in instance-private-data for future use. Add getters. Get rid of _gdk_windowing_gc_get_foreground() function implemented by the backends. * gdk/gdkgc.c gdk/gdkinternals.h gdk/x11/gdkgc-x11.c gdk/win32/gdkgc-win32.c gdk/linux-fb/gdkgc-fb.c: Add _gdk_gc_init() to do initial setup of the GC from values; fixes some problems from drawable redirection. * gdk/gdkgc.c gdk/gdkinternals.h gdk/x11/gdkgc-x11.c gdk/win32/gdkgc-win32.c gdk/linux-fb/gdkgc-fb.c: Move gdk_gc_copy() and gdk_gc_set_clip_{region,rectangle}() into the generic code, add _gdk_windowing_gc_copy(), _gdk_windowing_gc_set_clip_region() to do backend specific stuff. * gdk/x11/{gdkprivate-x11.h,gdkgc-x11.c.c,gdkdrawable-x11.c} gdk/win32/{gdkprivate-win32.h,gdkgc-x11.c.c,gdkdrawable-x11.c} gdk/linux-fb/{gdkprivate-fb.h,gdkgc-fb.c.c,gdkdrawable-fb.c}: Don't duplicate state that now is stored by the generic code. * gdk/gdk.symbols Update
2005-05-02 23:29:24 +00:00
gc->clip_x_origin = 0;
gc->clip_y_origin = 0;
2000-05-31 21:50:38 +00:00
data->values.clip_x_origin = 0;
data->values.clip_y_origin = 0;
2000-06-20 20:20:38 +00:00
gc_unset_cmask (gc);
_gdk_fb_gc_calc_state (gc, GDK_GC_CLIP_X_ORIGIN|GDK_GC_CLIP_Y_ORIGIN);
2000-05-31 21:50:38 +00:00
}
void
Add a draw-border style property to allow themes to draw outside the 2005-04-28 Owen Taylor <otaylor@redhat.com> * gtk/gtkwidget.c: Add a draw-border style property to allow themes to draw outside the widget's allocation. * gdk/gdkwindow.c gtk/gtkstyle.c: Remove some save/restore pairs that were working around the clip-leakage bug in Cairo. * gtk/gtkstyle.c: Use cairo_fill_preserve() rathe than save/fill/restore. * gdk/gdkgc.c gdk/gdkinternals.h: Add _gdk_gc_update_context() That updates a Cairo context to match a GC. * gdk/gdkdraw.c: Use _gdk_gc_update_context() to add support for tiles/stipples/clipping to gdk_draw_glyphs(), gdk_draw_trapezoids(). * gdk/gdkpango.c: Use _gdk_gc_update_context() instead of internal implementation of stipples. Use one cairo_t across the entire drawing operation. Replace cairo_matrix_create() with stack-allocated matrices. * gdk/gdkgc.c gdk/gdkinternals.h gdk/x11/gdkgc-x11.c gdk/win32/gdkgc-win32.c: Save various aspects of the GC state (fill, tile, stipple, foreground, background, clip region) in instance-private-data for future use. Add getters. Get rid of _gdk_windowing_gc_get_foreground() function implemented by the backends. * gdk/gdkgc.c gdk/gdkinternals.h gdk/x11/gdkgc-x11.c gdk/win32/gdkgc-win32.c gdk/linux-fb/gdkgc-fb.c: Add _gdk_gc_init() to do initial setup of the GC from values; fixes some problems from drawable redirection. * gdk/gdkgc.c gdk/gdkinternals.h gdk/x11/gdkgc-x11.c gdk/win32/gdkgc-win32.c gdk/linux-fb/gdkgc-fb.c: Move gdk_gc_copy() and gdk_gc_set_clip_{region,rectangle}() into the generic code, add _gdk_windowing_gc_copy(), _gdk_windowing_gc_set_clip_region() to do backend specific stuff. * gdk/x11/{gdkprivate-x11.h,gdkgc-x11.c.c,gdkdrawable-x11.c} gdk/win32/{gdkprivate-win32.h,gdkgc-x11.c.c,gdkdrawable-x11.c} gdk/linux-fb/{gdkprivate-fb.h,gdkgc-fb.c.c,gdkdrawable-fb.c}: Don't duplicate state that now is stored by the generic code. * gdk/gdk.symbols Update
2005-05-02 23:29:24 +00:00
_gdk_windowing_gc_copy (GdkGC *dst_gc,
GdkGC *src_gc)
2000-05-31 21:50:38 +00:00
{
Add a draw-border style property to allow themes to draw outside the 2005-04-28 Owen Taylor <otaylor@redhat.com> * gtk/gtkwidget.c: Add a draw-border style property to allow themes to draw outside the widget's allocation. * gdk/gdkwindow.c gtk/gtkstyle.c: Remove some save/restore pairs that were working around the clip-leakage bug in Cairo. * gtk/gtkstyle.c: Use cairo_fill_preserve() rathe than save/fill/restore. * gdk/gdkgc.c gdk/gdkinternals.h: Add _gdk_gc_update_context() That updates a Cairo context to match a GC. * gdk/gdkdraw.c: Use _gdk_gc_update_context() to add support for tiles/stipples/clipping to gdk_draw_glyphs(), gdk_draw_trapezoids(). * gdk/gdkpango.c: Use _gdk_gc_update_context() instead of internal implementation of stipples. Use one cairo_t across the entire drawing operation. Replace cairo_matrix_create() with stack-allocated matrices. * gdk/gdkgc.c gdk/gdkinternals.h gdk/x11/gdkgc-x11.c gdk/win32/gdkgc-win32.c: Save various aspects of the GC state (fill, tile, stipple, foreground, background, clip region) in instance-private-data for future use. Add getters. Get rid of _gdk_windowing_gc_get_foreground() function implemented by the backends. * gdk/gdkgc.c gdk/gdkinternals.h gdk/x11/gdkgc-x11.c gdk/win32/gdkgc-win32.c gdk/linux-fb/gdkgc-fb.c: Add _gdk_gc_init() to do initial setup of the GC from values; fixes some problems from drawable redirection. * gdk/gdkgc.c gdk/gdkinternals.h gdk/x11/gdkgc-x11.c gdk/win32/gdkgc-win32.c gdk/linux-fb/gdkgc-fb.c: Move gdk_gc_copy() and gdk_gc_set_clip_{region,rectangle}() into the generic code, add _gdk_windowing_gc_copy(), _gdk_windowing_gc_set_clip_region() to do backend specific stuff. * gdk/x11/{gdkprivate-x11.h,gdkgc-x11.c.c,gdkdrawable-x11.c} gdk/win32/{gdkprivate-win32.h,gdkgc-x11.c.c,gdkdrawable-x11.c} gdk/linux-fb/{gdkprivate-fb.h,gdkgc-fb.c.c,gdkdrawable-fb.c}: Don't duplicate state that now is stored by the generic code. * gdk/gdk.symbols Update
2005-05-02 23:29:24 +00:00
GdkGCFBData *dst_private = GDK_GC_FBDATA (dst_gc);
GdkGCFBData *src_private = GDK_GC_FBDATA (src_gc);
GdkGCValuesMask old_mask = dst_private->values_mask;
2000-05-31 21:50:38 +00:00
if (dst_private->values_mask & GDK_GC_FONT)
gdk_font_unref (dst_private->values.font);
if (dst_private->values_mask & GDK_GC_CLIP_MASK)
Add a draw-border style property to allow themes to draw outside the 2005-04-28 Owen Taylor <otaylor@redhat.com> * gtk/gtkwidget.c: Add a draw-border style property to allow themes to draw outside the widget's allocation. * gdk/gdkwindow.c gtk/gtkstyle.c: Remove some save/restore pairs that were working around the clip-leakage bug in Cairo. * gtk/gtkstyle.c: Use cairo_fill_preserve() rathe than save/fill/restore. * gdk/gdkgc.c gdk/gdkinternals.h: Add _gdk_gc_update_context() That updates a Cairo context to match a GC. * gdk/gdkdraw.c: Use _gdk_gc_update_context() to add support for tiles/stipples/clipping to gdk_draw_glyphs(), gdk_draw_trapezoids(). * gdk/gdkpango.c: Use _gdk_gc_update_context() instead of internal implementation of stipples. Use one cairo_t across the entire drawing operation. Replace cairo_matrix_create() with stack-allocated matrices. * gdk/gdkgc.c gdk/gdkinternals.h gdk/x11/gdkgc-x11.c gdk/win32/gdkgc-win32.c: Save various aspects of the GC state (fill, tile, stipple, foreground, background, clip region) in instance-private-data for future use. Add getters. Get rid of _gdk_windowing_gc_get_foreground() function implemented by the backends. * gdk/gdkgc.c gdk/gdkinternals.h gdk/x11/gdkgc-x11.c gdk/win32/gdkgc-win32.c gdk/linux-fb/gdkgc-fb.c: Add _gdk_gc_init() to do initial setup of the GC from values; fixes some problems from drawable redirection. * gdk/gdkgc.c gdk/gdkinternals.h gdk/x11/gdkgc-x11.c gdk/win32/gdkgc-win32.c gdk/linux-fb/gdkgc-fb.c: Move gdk_gc_copy() and gdk_gc_set_clip_{region,rectangle}() into the generic code, add _gdk_windowing_gc_copy(), _gdk_windowing_gc_set_clip_region() to do backend specific stuff. * gdk/x11/{gdkprivate-x11.h,gdkgc-x11.c.c,gdkdrawable-x11.c} gdk/win32/{gdkprivate-win32.h,gdkgc-x11.c.c,gdkdrawable-x11.c} gdk/linux-fb/{gdkprivate-fb.h,gdkgc-fb.c.c,gdkdrawable-fb.c}: Don't duplicate state that now is stored by the generic code. * gdk/gdk.symbols Update
2005-05-02 23:29:24 +00:00
g_object_unref (dst_private->values.clip_mask);
2000-05-31 21:50:38 +00:00
g_free (dst_private->dash_list);
Add a draw-border style property to allow themes to draw outside the 2005-04-28 Owen Taylor <otaylor@redhat.com> * gtk/gtkwidget.c: Add a draw-border style property to allow themes to draw outside the widget's allocation. * gdk/gdkwindow.c gtk/gtkstyle.c: Remove some save/restore pairs that were working around the clip-leakage bug in Cairo. * gtk/gtkstyle.c: Use cairo_fill_preserve() rathe than save/fill/restore. * gdk/gdkgc.c gdk/gdkinternals.h: Add _gdk_gc_update_context() That updates a Cairo context to match a GC. * gdk/gdkdraw.c: Use _gdk_gc_update_context() to add support for tiles/stipples/clipping to gdk_draw_glyphs(), gdk_draw_trapezoids(). * gdk/gdkpango.c: Use _gdk_gc_update_context() instead of internal implementation of stipples. Use one cairo_t across the entire drawing operation. Replace cairo_matrix_create() with stack-allocated matrices. * gdk/gdkgc.c gdk/gdkinternals.h gdk/x11/gdkgc-x11.c gdk/win32/gdkgc-win32.c: Save various aspects of the GC state (fill, tile, stipple, foreground, background, clip region) in instance-private-data for future use. Add getters. Get rid of _gdk_windowing_gc_get_foreground() function implemented by the backends. * gdk/gdkgc.c gdk/gdkinternals.h gdk/x11/gdkgc-x11.c gdk/win32/gdkgc-win32.c gdk/linux-fb/gdkgc-fb.c: Add _gdk_gc_init() to do initial setup of the GC from values; fixes some problems from drawable redirection. * gdk/gdkgc.c gdk/gdkinternals.h gdk/x11/gdkgc-x11.c gdk/win32/gdkgc-win32.c gdk/linux-fb/gdkgc-fb.c: Move gdk_gc_copy() and gdk_gc_set_clip_{region,rectangle}() into the generic code, add _gdk_windowing_gc_copy(), _gdk_windowing_gc_set_clip_region() to do backend specific stuff. * gdk/x11/{gdkprivate-x11.h,gdkgc-x11.c.c,gdkdrawable-x11.c} gdk/win32/{gdkprivate-win32.h,gdkgc-x11.c.c,gdkdrawable-x11.c} gdk/linux-fb/{gdkprivate-fb.h,gdkgc-fb.c.c,gdkdrawable-fb.c}: Don't duplicate state that now is stored by the generic code. * gdk/gdk.symbols Update
2005-05-02 23:29:24 +00:00
if (src_private->dash_list)
dst_private->dash_list = g_memdup (src_private->dash_list,
src_private->dash_list_len);
dst_private->values_mask = src_private->values_mask;
dst_private->values = src_private->values;
if (dst_private->values_mask & GDK_GC_FONT)
gdk_font_ref (dst_private->values.font);
if (dst_private->values_mask & GDK_GC_CLIP_MASK)
Add a draw-border style property to allow themes to draw outside the 2005-04-28 Owen Taylor <otaylor@redhat.com> * gtk/gtkwidget.c: Add a draw-border style property to allow themes to draw outside the widget's allocation. * gdk/gdkwindow.c gtk/gtkstyle.c: Remove some save/restore pairs that were working around the clip-leakage bug in Cairo. * gtk/gtkstyle.c: Use cairo_fill_preserve() rathe than save/fill/restore. * gdk/gdkgc.c gdk/gdkinternals.h: Add _gdk_gc_update_context() That updates a Cairo context to match a GC. * gdk/gdkdraw.c: Use _gdk_gc_update_context() to add support for tiles/stipples/clipping to gdk_draw_glyphs(), gdk_draw_trapezoids(). * gdk/gdkpango.c: Use _gdk_gc_update_context() instead of internal implementation of stipples. Use one cairo_t across the entire drawing operation. Replace cairo_matrix_create() with stack-allocated matrices. * gdk/gdkgc.c gdk/gdkinternals.h gdk/x11/gdkgc-x11.c gdk/win32/gdkgc-win32.c: Save various aspects of the GC state (fill, tile, stipple, foreground, background, clip region) in instance-private-data for future use. Add getters. Get rid of _gdk_windowing_gc_get_foreground() function implemented by the backends. * gdk/gdkgc.c gdk/gdkinternals.h gdk/x11/gdkgc-x11.c gdk/win32/gdkgc-win32.c gdk/linux-fb/gdkgc-fb.c: Add _gdk_gc_init() to do initial setup of the GC from values; fixes some problems from drawable redirection. * gdk/gdkgc.c gdk/gdkinternals.h gdk/x11/gdkgc-x11.c gdk/win32/gdkgc-win32.c gdk/linux-fb/gdkgc-fb.c: Move gdk_gc_copy() and gdk_gc_set_clip_{region,rectangle}() into the generic code, add _gdk_windowing_gc_copy(), _gdk_windowing_gc_set_clip_region() to do backend specific stuff. * gdk/x11/{gdkprivate-x11.h,gdkgc-x11.c.c,gdkdrawable-x11.c} gdk/win32/{gdkprivate-win32.h,gdkgc-x11.c.c,gdkdrawable-x11.c} gdk/linux-fb/{gdkprivate-fb.h,gdkgc-fb.c.c,gdkdrawable-fb.c}: Don't duplicate state that now is stored by the generic code. * gdk/gdk.symbols Update
2005-05-02 23:29:24 +00:00
g_object_ref (dst_private->values.clip_mask);
dst_private->dash_offset = src_private->dash_offset;
dst_private->alu = src_private->alu;
dst_private->set_pixel = src_private->set_pixel;
_gdk_fb_gc_calc_state (gc, old_mask | dst_private->values_mask);
2000-05-31 21:50:38 +00:00
}