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;
|
|
|
|
|
2000-11-13 17:40:23 +00:00
|
|
|
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,
|
2000-11-13 17:40:23 +00:00
|
|
|
GdkGCValues *values);
|
2000-05-31 21:50:38 +00:00
|
|
|
static void gdk_fb_gc_set_values (GdkGC *gc,
|
2000-11-13 17:40:23 +00:00
|
|
|
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
|
|
|
|
2000-07-24 16:19:00 +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;
|
|
|
|
}
|
|
|
|
|
2000-11-13 17:40:23 +00:00
|
|
|
GType
|
|
|
|
gdk_gc_fb_get_type (void)
|
2000-07-24 16:19:00 +00:00
|
|
|
{
|
|
|
|
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",
|
2000-11-02 15:38:04 +00:00
|
|
|
&object_info,
|
|
|
|
0);
|
2000-07-24 16:19:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
2000-11-15 12:45:30 +00:00
|
|
|
GdkGCFBData *private;
|
2000-05-31 21:50:38 +00:00
|
|
|
|
2000-11-13 17:40:23 +00:00
|
|
|
gc = GDK_GC (g_object_new (gdk_gc_fb_get_type (), NULL));
|
2000-05-31 21:50:38 +00:00
|
|
|
|
2000-11-15 12:45:30 +00:00
|
|
|
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;
|
|
|
|
|
|
|
|
_gdk_fb_gc_calc_state (gc, _GDK_FB_GC_DEPTH);
|
2000-05-31 21:50:38 +00:00
|
|
|
|
2000-11-13 17:40:23 +00:00
|
|
|
gdk_fb_gc_set_values (gc, values, values_mask);
|
2000-05-31 21:50:38 +00:00
|
|
|
|
Huge GtkFB patch with lots of small bugfixes and initial selections implementation.
2000-11-23 Alexander Larsson <alexl@redhat.com>
* gdk/linux-fb/gdkselection-fb.c:
Initial selection implementation.
* gtk/gtkselection.c:
if GDK_WINDOWING_FB defined, include linux-fb/gdkfb.h and look up
requestor in gtk_selection_request.
* gdk/linux-fb/gdkfb.h, gdk/linux-fb/gdkglobals-fb.c:
Added gdk_selection_property atom.
* gdk/linux-fb/gdkprivate-fb.h:
Export _gdk_selection_window_destroyed.
Removed mask_off_x/y from GdkCursorPrivateFB.
Removed hbearing, added top, left to PangoFBGlyphInfo.
* gdk/linux-fb/gdkwindow-fb.c (_gdk_windowing_window_destroy):
Call _gdk_selection_window_destroyed
(_gdk_windowing_window_init): Don't call gdk_cursor_new() before
the root window has been created.
(static_dx_hack, static_dy_hack, compare_draw_rects,
gdk_fb_window_move_resize): Remove unnecessary sort of rectangles
in region. They are already sorted. Instead just traverse them in
reverse if draw_direction < 0.
* gdk/linux-fb/gdkinput-ps2.c (send_button_event):
Double-clicks must be sent after the normal button_press.
(gdk_fb_cursor_unhide): Remove usage of mask_off_x/y. Clean up.
* gdk/linux-fb/gdkgeometry-fb.c (gdk_window_scroll):
Pass _gdk_fb_screen_gc instead of NULL.
* gdk/linux-fb/gdkmain-fb.c (_gdk_windowing_init_check):
Initialize gdk_selection_property.
(gdk_event_make): Remove unused code.
* gdk/linux-fb/gdkcursor-fb.c:
Make the pixmap for the cursor the same size as the mask. Also remove
the mask_off_x/y fields in GdkCursorPrivateFB and combine
_gdk_cursor_new_from_pixmap() and gdk_cursor_new_from_pixmap()
Now the whole cursor is visible.
* gdk/linux-fb/gdkdrawable-fb2.c (gdk_fb_draw_drawable_3):
Fix bug where xdest+height instead of ydest+height was used
to calculate if the source and dest overlapped. This fixes the
redraw bug when the main window in testgtk was scrolled when
partially covered by a tall window.
Copy rectangles in region in order depending on draw_direction.
Also moved the draw_direction flipping of start_y and end_y into
the gc functions, as this might not be what all of them want.
(gdk_fb_draw_lines): Support dashed lines.
(gdk_fb_draw_glyphs): Clean up glyph placement. Also fix positioning
so that the text is positioned correctly (was 1 pixel high).
gdk/linux-fb/gdkgc-fb.c:
Initialize cap_style to GTK_CAP_BUTT. This fixes a problem where
all lines were drawn a pixel to short. Also checked the default of
the rest of the values, and they're the same as X now.
* gdk/linux-fb/gdkpango-fb.c (pango_fb_font_get_glyph_info):
Clean up pixel positioning of the glyphs. Just use bgy->top and
bgy->left. Also used PANGO_PIXEL where appropriate and added 0.5
to all divisions to get correct rounding behaviour.
* gdk/linux-fb/gdkrender-fb.c (gdk_fb_draw_drawable_generic,
gdk_fb_draw_drawable_memmove, gdk_fb_draw_drawable_aa_24):
Moved start_y/end_y flip into draw_drawable implementations.
Flip also x rendering when draw_direction < 0.
Remove unneccesary multiply with draw_direction.
2000-11-25 15:44:35 +00:00
|
|
|
private->values.cap_style = GDK_CAP_BUTT;
|
2000-05-31 21:50:38 +00:00
|
|
|
return gc;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2000-07-24 16:19:00 +00:00
|
|
|
gdk_fb_gc_finalize (GObject *obj)
|
2000-05-31 21:50:38 +00:00
|
|
|
{
|
2000-11-13 17:40:23 +00:00
|
|
|
GdkGC *gc = GDK_GC_P (obj);
|
|
|
|
GdkGCFBData *private;
|
2000-07-24 16:19:00 +00:00
|
|
|
|
2000-11-13 17:40:23 +00:00
|
|
|
private = GDK_GC_FBDATA (gc);
|
|
|
|
|
|
|
|
if (private->clip_region)
|
|
|
|
gdk_region_destroy (private->clip_region);
|
|
|
|
if (private->values.clip_mask)
|
|
|
|
gdk_pixmap_unref (private->values.clip_mask);
|
|
|
|
if (private->values.stipple)
|
|
|
|
gdk_pixmap_unref (private->values.stipple);
|
|
|
|
if (private->values.tile)
|
|
|
|
gdk_pixmap_unref (private->values.tile);
|
2000-08-07 23:00:38 +00:00
|
|
|
|
|
|
|
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)
|
|
|
|
{
|
2000-11-13 17:40:23 +00:00
|
|
|
*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;
|
2000-11-13 17:40:23 +00:00
|
|
|
GdkGCFBData *private;
|
2000-05-31 21:50:38 +00:00
|
|
|
|
2000-11-13 17:40:23 +00:00
|
|
|
private = GDK_GC_FBDATA (gc);
|
|
|
|
|
|
|
|
if (values_mask & GDK_GC_FOREGROUND)
|
2000-05-31 21:50:38 +00:00
|
|
|
{
|
2000-11-13 17:40:23 +00:00
|
|
|
private->values.foreground = values->foreground;
|
|
|
|
private->values_mask |= GDK_GC_FOREGROUND;
|
2000-05-31 21:50:38 +00:00
|
|
|
}
|
|
|
|
|
2000-11-13 17:40:23 +00:00
|
|
|
if (values_mask & GDK_GC_BACKGROUND)
|
2000-05-31 21:50:38 +00:00
|
|
|
{
|
2000-11-13 17:40:23 +00:00
|
|
|
private->values.background = values->background;
|
|
|
|
private->values_mask |= GDK_GC_BACKGROUND;
|
2000-05-31 21:50:38 +00:00
|
|
|
}
|
|
|
|
|
2000-11-13 17:40:23 +00:00
|
|
|
if (values_mask & GDK_GC_FONT)
|
2000-05-31 21:50:38 +00:00
|
|
|
{
|
2000-11-13 17:40:23 +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);
|
|
|
|
}
|
|
|
|
|
2000-11-13 17:40:23 +00:00
|
|
|
if (values_mask & GDK_GC_FUNCTION)
|
2000-05-31 21:50:38 +00:00
|
|
|
{
|
2000-11-13 17:40:23 +00:00
|
|
|
private->values.function = values->function;
|
|
|
|
private->values_mask |= GDK_GC_FUNCTION;
|
2000-05-31 21:50:38 +00:00
|
|
|
}
|
|
|
|
|
2000-11-13 17:40:23 +00:00
|
|
|
if (values_mask & GDK_GC_FILL)
|
2000-05-31 21:50:38 +00:00
|
|
|
{
|
2000-11-13 17:40:23 +00:00
|
|
|
private->values.fill = values->fill;
|
|
|
|
private->values_mask |= GDK_GC_FILL;
|
2000-05-31 21:50:38 +00:00
|
|
|
}
|
|
|
|
|
2000-11-13 17:40:23 +00:00
|
|
|
if (values_mask & GDK_GC_TILE)
|
2000-05-31 21:50:38 +00:00
|
|
|
{
|
2000-11-13 17:40:23 +00:00
|
|
|
oldpm = private->values.tile;
|
|
|
|
if (values->tile)
|
|
|
|
g_assert (GDK_DRAWABLE_IMPL_FBDATA (values->tile)->depth >= 8);
|
|
|
|
|
|
|
|
private->values.tile = values->tile ? gdk_pixmap_ref (values->tile) : NULL;
|
|
|
|
private->values_mask |= GDK_GC_TILE;
|
|
|
|
if (oldpm)
|
|
|
|
gdk_pixmap_unref (oldpm);
|
2000-05-31 21:50:38 +00:00
|
|
|
}
|
|
|
|
|
2000-11-13 17:40:23 +00:00
|
|
|
if (values_mask & GDK_GC_STIPPLE)
|
2000-05-31 21:50:38 +00:00
|
|
|
{
|
2000-11-13 17:40:23 +00:00
|
|
|
oldpm = private->values.stipple;
|
|
|
|
if (values->stipple)
|
|
|
|
g_assert (GDK_DRAWABLE_IMPL_FBDATA (values->stipple)->depth == 1);
|
|
|
|
private->values.stipple = values->stipple ? gdk_pixmap_ref (values->stipple) : NULL;
|
|
|
|
private->values_mask |= GDK_GC_STIPPLE;
|
|
|
|
if (oldpm)
|
|
|
|
gdk_pixmap_unref (oldpm);
|
2000-05-31 21:50:38 +00:00
|
|
|
}
|
|
|
|
|
2000-11-13 17:40:23 +00:00
|
|
|
if (values_mask & GDK_GC_CLIP_MASK)
|
2000-05-31 21:50:38 +00:00
|
|
|
{
|
2000-11-13 17:40:23 +00:00
|
|
|
oldpm = private->values.clip_mask;
|
2000-05-31 21:50:38 +00:00
|
|
|
|
2000-11-13 17:40:23 +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-06-20 20:20:38 +00:00
|
|
|
|
2000-11-13 17:40:23 +00:00
|
|
|
if (private->clip_region)
|
2000-06-20 20:20:38 +00:00
|
|
|
{
|
2000-11-13 17:40:23 +00:00
|
|
|
gdk_region_destroy (private->clip_region);
|
|
|
|
private->clip_region = NULL;
|
2000-06-20 20:20:38 +00:00
|
|
|
}
|
2000-05-31 21:50:38 +00:00
|
|
|
}
|
|
|
|
|
2000-11-13 17:40:23 +00:00
|
|
|
if (values_mask & GDK_GC_SUBWINDOW)
|
2000-05-31 21:50:38 +00:00
|
|
|
{
|
2000-11-13 17:40:23 +00:00
|
|
|
private->values.subwindow_mode = values->subwindow_mode;
|
|
|
|
private->values_mask |= GDK_GC_SUBWINDOW;
|
2000-05-31 21:50:38 +00:00
|
|
|
}
|
|
|
|
|
2000-11-13 17:40:23 +00:00
|
|
|
if (values_mask & GDK_GC_TS_X_ORIGIN)
|
2000-05-31 21:50:38 +00:00
|
|
|
{
|
2000-11-13 17:40:23 +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
|
|
|
}
|
|
|
|
|
2000-11-13 17:40:23 +00:00
|
|
|
if (values_mask & GDK_GC_TS_Y_ORIGIN)
|
2000-05-31 21:50:38 +00:00
|
|
|
{
|
2000-11-13 17:40:23 +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
|
|
|
}
|
|
|
|
|
2000-11-13 17:40:23 +00:00
|
|
|
if (values_mask & GDK_GC_CLIP_X_ORIGIN)
|
2000-05-31 21:50:38 +00:00
|
|
|
{
|
2000-11-13 17:40:23 +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
|
|
|
}
|
|
|
|
|
2000-11-13 17:40:23 +00:00
|
|
|
if (values_mask & GDK_GC_CLIP_Y_ORIGIN)
|
2000-05-31 21:50:38 +00:00
|
|
|
{
|
2000-11-13 17:40:23 +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
|
|
|
}
|
|
|
|
|
2000-11-13 17:40:23 +00:00
|
|
|
if (values_mask & GDK_GC_EXPOSURES)
|
2000-05-31 21:50:38 +00:00
|
|
|
{
|
2000-11-13 17:40:23 +00:00
|
|
|
private->values.graphics_exposures = values->graphics_exposures;
|
|
|
|
private->values_mask |= GDK_GC_EXPOSURES;
|
2000-05-31 21:50:38 +00:00
|
|
|
}
|
|
|
|
|
2000-11-13 17:40:23 +00:00
|
|
|
if (values_mask & GDK_GC_LINE_WIDTH)
|
2000-05-31 21:50:38 +00:00
|
|
|
{
|
2000-11-13 17:40:23 +00:00
|
|
|
private->values.line_width = values->line_width;
|
|
|
|
private->values_mask |= GDK_GC_LINE_WIDTH;
|
2000-05-31 21:50:38 +00:00
|
|
|
}
|
|
|
|
|
2000-11-13 17:40:23 +00:00
|
|
|
if (values_mask & GDK_GC_LINE_STYLE)
|
2000-05-31 21:50:38 +00:00
|
|
|
{
|
2000-11-13 17:40:23 +00:00
|
|
|
private->values.line_style = values->line_style;
|
|
|
|
private->values_mask |= GDK_GC_LINE_STYLE;
|
2000-05-31 21:50:38 +00:00
|
|
|
}
|
|
|
|
|
2000-11-13 17:40:23 +00:00
|
|
|
if (values_mask & GDK_GC_CAP_STYLE)
|
2000-05-31 21:50:38 +00:00
|
|
|
{
|
2000-11-13 17:40:23 +00:00
|
|
|
private->values.cap_style = values->cap_style;
|
|
|
|
private->values_mask |= GDK_GC_CAP_STYLE;
|
2000-05-31 21:50:38 +00:00
|
|
|
}
|
|
|
|
|
2000-11-13 17:40:23 +00:00
|
|
|
if (values_mask & GDK_GC_JOIN_STYLE)
|
2000-05-31 21:50:38 +00:00
|
|
|
{
|
2000-11-13 17:40:23 +00:00
|
|
|
private->values.join_style = values->join_style;
|
|
|
|
private->values_mask |= GDK_GC_JOIN_STYLE;
|
2000-05-31 21:50:38 +00:00
|
|
|
}
|
2000-11-15 12:45:30 +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,
|
2000-07-24 16:19:00 +00:00
|
|
|
gint8 dash_list[],
|
2000-05-31 21:50:38 +00:00
|
|
|
gint n)
|
|
|
|
{
|
2000-11-13 17:40:23 +00:00
|
|
|
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
|
|
|
{
|
2000-11-13 17:40:23 +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
|
|
|
|
{
|
2000-11-13 17:40:23 +00:00
|
|
|
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);
|
2000-11-13 17:40:23 +00:00
|
|
|
|
|
|
|
if (data->values.clip_mask)
|
2000-06-20 20:20:38 +00:00
|
|
|
{
|
2000-11-13 17:40:23 +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;
|
|
|
|
}
|
2000-11-15 12:45:30 +00:00
|
|
|
|
|
|
|
_gdk_fb_gc_calc_state (gc, GDK_GC_CLIP_MASK);
|
2000-06-20 20:20:38 +00:00
|
|
|
}
|
2000-11-13 17:40:23 +00:00
|
|
|
|
2000-05-31 21:50:38 +00:00
|
|
|
void
|
|
|
|
gdk_gc_set_clip_rectangle (GdkGC *gc,
|
|
|
|
GdkRectangle *rectangle)
|
|
|
|
{
|
2000-07-24 16:19:00 +00:00
|
|
|
GdkGC *private = (GdkGC *)gc;
|
2000-05-31 21:50:38 +00:00
|
|
|
GdkGCFBData *data;
|
|
|
|
|
|
|
|
g_return_if_fail (gc != NULL);
|
|
|
|
|
|
|
|
data = GDK_GC_FBDATA (gc);
|
|
|
|
|
|
|
|
if (data->clip_region)
|
|
|
|
{
|
|
|
|
gdk_region_destroy (data->clip_region);
|
|
|
|
data->clip_region = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (rectangle)
|
|
|
|
data->clip_region = gdk_region_rectangle (rectangle);
|
|
|
|
|
|
|
|
private->clip_x_origin = 0;
|
|
|
|
private->clip_y_origin = 0;
|
|
|
|
data->values.clip_x_origin = 0;
|
|
|
|
data->values.clip_y_origin = 0;
|
2000-06-20 20:20:38 +00:00
|
|
|
|
2000-11-13 17:40:23 +00:00
|
|
|
gc_unset_cmask (gc);
|
2000-11-15 12:45:30 +00:00
|
|
|
|
|
|
|
_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
|
|
|
|
gdk_gc_set_clip_region (GdkGC *gc,
|
|
|
|
GdkRegion *region)
|
|
|
|
{
|
2000-07-24 16:19:00 +00:00
|
|
|
GdkGC *private = (GdkGC *)gc;
|
2000-05-31 21:50:38 +00:00
|
|
|
GdkGCFBData *data;
|
|
|
|
|
|
|
|
g_return_if_fail (gc != NULL);
|
|
|
|
|
|
|
|
data = GDK_GC_FBDATA (gc);
|
|
|
|
|
2000-11-13 17:40:23 +00:00
|
|
|
if (region == data->clip_region)
|
2000-05-31 21:50:38 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
if (data->clip_region)
|
|
|
|
{
|
|
|
|
gdk_region_destroy (data->clip_region);
|
|
|
|
data->clip_region = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (region)
|
|
|
|
data->clip_region = gdk_region_copy (region);
|
|
|
|
|
|
|
|
private->clip_x_origin = 0;
|
|
|
|
private->clip_y_origin = 0;
|
|
|
|
data->values.clip_x_origin = 0;
|
|
|
|
data->values.clip_y_origin = 0;
|
2000-06-20 20:20:38 +00:00
|
|
|
|
2000-11-13 17:40:23 +00:00
|
|
|
gc_unset_cmask (gc);
|
2000-11-15 12:45:30 +00:00
|
|
|
|
|
|
|
_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
|
|
|
|
gdk_gc_copy (GdkGC *dst_gc, GdkGC *src_gc)
|
|
|
|
{
|
2000-11-13 17:40:23 +00:00
|
|
|
GdkGCFBData *dst_private;
|
|
|
|
|
|
|
|
dst_private = GDK_GC_FBDATA (dst_gc);
|
|
|
|
|
2000-05-31 21:50:38 +00:00
|
|
|
g_return_if_fail (dst_gc != NULL);
|
|
|
|
g_return_if_fail (src_gc != NULL);
|
|
|
|
|
2000-11-13 17:40:23 +00:00
|
|
|
if (dst_private->clip_region)
|
|
|
|
gdk_region_destroy(dst_private->clip_region);
|
2000-05-31 21:50:38 +00:00
|
|
|
|
2000-11-13 17:40:23 +00:00
|
|
|
if (dst_private->values_mask & GDK_GC_FONT)
|
|
|
|
gdk_font_unref(dst_private->values.font);
|
|
|
|
if (dst_private->values_mask & GDK_GC_TILE)
|
|
|
|
gdk_pixmap_unref(dst_private->values.tile);
|
|
|
|
if (dst_private->values_mask & GDK_GC_STIPPLE)
|
|
|
|
gdk_pixmap_unref(dst_private->values.stipple);
|
|
|
|
if (dst_private->values_mask & GDK_GC_CLIP_MASK)
|
|
|
|
gdk_pixmap_unref(dst_private->values.clip_mask);
|
2000-05-31 21:50:38 +00:00
|
|
|
|
|
|
|
*dst_gc = *src_gc;
|
2000-11-13 17:40:23 +00:00
|
|
|
if (dst_private->values_mask & GDK_GC_FONT)
|
|
|
|
gdk_font_ref(dst_private->values.font);
|
|
|
|
if (dst_private->values_mask & GDK_GC_TILE)
|
|
|
|
gdk_pixmap_ref(dst_private->values.tile);
|
|
|
|
if (dst_private->values_mask & GDK_GC_STIPPLE)
|
|
|
|
gdk_pixmap_ref(dst_private->values.stipple);
|
|
|
|
if (dst_private->values_mask & GDK_GC_CLIP_MASK)
|
|
|
|
gdk_pixmap_ref(dst_private->values.clip_mask);
|
|
|
|
if (dst_private->clip_region)
|
|
|
|
dst_private->clip_region = gdk_region_copy(dst_private->clip_region);
|
2000-05-31 21:50:38 +00:00
|
|
|
}
|