API: remove GdkGC

XXX: Some traces in the win32 code are left. I suppose they'd best be
replaced using Cairo.
This commit is contained in:
Benjamin Otte 2010-07-22 03:55:27 +02:00
parent 0fa7d810e7
commit 6a48a042c7
32 changed files with 1 additions and 5474 deletions

View File

@ -24,7 +24,6 @@
<xi:include href="xml/gdkscreen.xml" />
<xi:include href="xml/regions.xml" />
<xi:include href="xml/gcs.xml" />
<xi:include href="xml/drawing.xml" />
<xi:include href="xml/pixmaps.xml" />

View File

@ -71,18 +71,12 @@ gdk_drag_protocol_get_type
gdk_event_mask_get_type
gdk_event_type_get_type
gdk_extension_mode_get_type
gdk_fill_get_type
gdk_fill_rule_get_type
gdk_filter_return_get_type
gdk_function_get_type
gdk_gc_values_mask_get_type
gdk_grab_ownership_get_type
gdk_grab_status_get_type
gdk_gravity_get_type
gdk_input_mode_get_type
gdk_input_source_get_type
gdk_join_style_get_type
gdk_line_style_get_type
gdk_modifier_type_get_type
gdk_notify_type_get_type
gdk_overlap_type_get_type
@ -345,69 +339,6 @@ GDK_IS_DRAWABLE_CLASS
GdkDrawableClass
</SECTION>
<SECTION>
<TITLE>Graphics Contexts</TITLE>
<FILE>gcs</FILE>
GdkGC
GdkGCValues
GdkGCValuesMask
GdkFunction
gdk_gc_new
gdk_gc_new_with_values
gdk_gc_get_screen
gdk_gc_set_values
gdk_gc_get_values
gdk_gc_set_foreground
gdk_gc_set_background
gdk_gc_set_rgb_fg_color
gdk_gc_set_rgb_bg_color
gdk_gc_set_function
gdk_gc_set_fill
GdkFill
gdk_gc_set_tile
gdk_gc_set_stipple
gdk_gc_set_ts_origin
gdk_gc_set_clip_origin
gdk_gc_set_clip_mask
gdk_gc_set_clip_rectangle
gdk_gc_set_clip_region
gdk_gc_set_subwindow
GdkSubwindowMode
gdk_gc_set_exposures
gdk_gc_set_line_attributes
GdkLineStyle
GdkCapStyle
GdkJoinStyle
gdk_gc_set_dashes
gdk_gc_copy
gdk_gc_set_colormap
gdk_gc_get_colormap
gdk_gc_offset
<SUBSECTION Standard>
GDK_GC
GDK_TYPE_GC
GDK_IS_GC
GDK_GC_CLASS
GDK_GC_GET_CLASS
GDK_IS_GC_CLASS
GDK_TYPE_CAP_STYLE
GDK_TYPE_FILL
GDK_TYPE_FILL_RULE
GDK_TYPE_FUNCTION
GDK_TYPE_GC_VALUES_MASK
GDK_TYPE_JOIN_STYLE
GDK_TYPE_LINE_STYLE
GDK_TYPE_SUBWINDOW_MODE
<SUBSECTION Private>
GdkGCClass
gdk_gc_get_type
</SECTION>
<SECTION>
<TITLE>Visuals</TITLE>
<FILE>visuals</FILE>
@ -1137,8 +1068,6 @@ gdk_x11_display_set_cursor_theme
gdk_x11_register_standard_event_type
gdk_x11_drawable_get_xdisplay
gdk_x11_drawable_get_xid
gdk_x11_gc_get_xdisplay
gdk_x11_gc_get_xgc
gdk_x11_get_default_root_xwindow
gdk_x11_get_default_screen
gdk_x11_get_default_xdisplay

View File

@ -6,7 +6,6 @@ gdk_screen_get_type
gdk_drawable_get_type
gdk_window_object_get_type
gdk_pixmap_get_type
gdk_gc_get_type
gdk_keymap_get_type
gdk_device_get_type
gdk_device_manager_get_type

View File

@ -1,426 +0,0 @@
<!-- ##### SECTION Title ##### -->
Graphics Contexts
<!-- ##### SECTION Short_Description ##### -->
Objects to encapsulate drawing properties
<!-- ##### SECTION Long_Description ##### -->
<para>
All drawing operations in GDK take a
<firstterm>graphics context</firstterm> (GC) argument.
A graphics context encapsulates information about
the way things are drawn, such as the foreground
color or line width. By using graphics contexts,
the number of arguments to each drawing call is
greatly reduced, and communication overhead is
minimized, since identical arguments do not need
to be passed repeatedly.
</para>
<para>
Most values of a graphics context can be set at
creation time by using gdk_gc_new_with_values(),
or can be set one-by-one using functions such
as gdk_gc_set_foreground(). A few of the values
in the GC, such as the dash pattern, can only
be set by the latter method.
</para>
<!-- ##### SECTION See_Also ##### -->
<para>
</para>
<!-- ##### SECTION Stability_Level ##### -->
<!-- ##### SECTION Image ##### -->
<!-- ##### STRUCT GdkGC ##### -->
<para>
The #GdkGC structure represents a graphics context.
It is an opaque structure with no user-visible
elements.
</para>
<!-- ##### STRUCT GdkGCValues ##### -->
<para>
The #GdkGCValues structure holds a set of values used
to create or modify a graphics context.
</para>
@foreground: the foreground color. Note that gdk_gc_get_values()
only sets the pixel value.
@background: the background color. Note that gdk_gc_get_values()
only sets the pixel value.
@function: the bitwise operation used when drawing.
@fill: the fill style.
@tile: the tile pixmap.
@stipple: the stipple bitmap.
@clip_mask: the clip mask bitmap.
@subwindow_mode: the subwindow mode.
@ts_x_origin: the x origin of the tile or stipple.
@ts_y_origin: the y origin of the tile or stipple.
@clip_x_origin: the x origin of the clip mask.
@clip_y_origin: the y origin of the clip mask.
@graphics_exposures: whether graphics exposures are enabled.
@line_width: the line width.
@line_style: the way dashed lines are drawn.
@cap_style: the way the ends of lines are drawn.
@join_style: the way joins between lines are drawn.
<!-- ##### ENUM GdkGCValuesMask ##### -->
<para>
A set of bit flags used to indicate which fields
#GdkGCValues structure are set.
</para>
@GDK_GC_FOREGROUND: the @foreground is set.
@GDK_GC_BACKGROUND: the @background is set.
@GDK_GC_FUNCTION: the @function is set.
@GDK_GC_FILL: the @fill is set.
@GDK_GC_TILE: the @tile is set.
@GDK_GC_STIPPLE: the @stipple is set.
@GDK_GC_CLIP_MASK: the @clip_mask is set.
@GDK_GC_SUBWINDOW: the @subwindow_mode is set.
@GDK_GC_TS_X_ORIGIN: the @ts_x_origin is set.
@GDK_GC_TS_Y_ORIGIN: the @ts_y_origin is set.
@GDK_GC_CLIP_X_ORIGIN: the @clip_x_origin is set.
@GDK_GC_CLIP_Y_ORIGIN: the @clip_y_origin is set.
@GDK_GC_EXPOSURES: the @graphics_exposures is set.
@GDK_GC_LINE_WIDTH: the @line_width is set.
@GDK_GC_LINE_STYLE: the @line_style is set.
@GDK_GC_CAP_STYLE: the @cap_style is set.
@GDK_GC_JOIN_STYLE: the @join_style is set.
<!-- ##### ENUM GdkFunction ##### -->
<para>
Determines how the bit values for the source pixels are combined with
the bit values for destination pixels to produce the final result. The
sixteen values here correspond to the 16 different possible 2x2 truth
tables. Only a couple of these values are usually useful; for colored
images, only %GDK_COPY, %GDK_XOR and %GDK_INVERT are generally
useful. For bitmaps, %GDK_AND and %GDK_OR are also useful.
</para>
@GDK_COPY: <literal>dst = src</literal>
@GDK_INVERT: <literal>dst = NOT dst</literal>
@GDK_XOR: <literal>dst = src XOR dst</literal>
@GDK_CLEAR: <literal>dst = 0</literal>
@GDK_AND: <literal>dst = dst AND src</literal>
@GDK_AND_REVERSE: <literal>dst = src AND (NOT dst)</literal>
@GDK_AND_INVERT: <literal>dst = (NOT src) AND dst</literal>
@GDK_NOOP: <literal>dst = dst</literal>
@GDK_OR: <literal>dst = src OR dst</literal>
@GDK_EQUIV: <literal>dst = (NOT src) XOR dst</literal>
@GDK_OR_REVERSE: <literal>dst = src OR (NOT dst)</literal>
@GDK_COPY_INVERT: <literal>dst = NOT src</literal>
@GDK_OR_INVERT: <literal>dst = (NOT src) OR dst</literal>
@GDK_NAND: <literal>dst = (NOT src) OR (NOT dst)</literal>
@GDK_NOR: <literal>dst = (NOT src) AND (NOT dst)</literal>
@GDK_SET: <literal>dst = 1</literal>
<!-- ##### FUNCTION gdk_gc_new ##### -->
<para>
</para>
@drawable:
@Returns:
<!-- ##### FUNCTION gdk_gc_new_with_values ##### -->
<para>
</para>
@drawable:
@values:
@values_mask:
@Returns:
<!-- ##### FUNCTION gdk_gc_get_screen ##### -->
<para>
</para>
@gc:
@Returns:
<!-- ##### FUNCTION gdk_gc_set_values ##### -->
<para>
</para>
@gc:
@values:
@values_mask:
<!-- ##### FUNCTION gdk_gc_get_values ##### -->
<para>
</para>
@gc:
@values:
<!-- ##### FUNCTION gdk_gc_set_foreground ##### -->
<para>
</para>
@gc:
@color:
<!-- ##### FUNCTION gdk_gc_set_background ##### -->
<para>
</para>
@gc:
@color:
<!-- ##### FUNCTION gdk_gc_set_rgb_fg_color ##### -->
<para>
</para>
@gc:
@color:
<!-- ##### FUNCTION gdk_gc_set_rgb_bg_color ##### -->
<para>
</para>
@gc:
@color:
<!-- ##### FUNCTION gdk_gc_set_function ##### -->
<para>
</para>
@gc:
@function:
<!-- ##### FUNCTION gdk_gc_set_fill ##### -->
<para>
</para>
@gc:
@fill:
<!-- ##### ENUM GdkFill ##### -->
<para>
Determines how primitives are drawn.
</para>
@GDK_SOLID: draw with the foreground color.
@GDK_TILED: draw with a tiled pixmap.
@GDK_STIPPLED: draw using the stipple bitmap. Pixels corresponding
to bits in the stipple bitmap that are set will be drawn in the
foreground color; pixels corresponding to bits that are
not set will be left untouched.
@GDK_OPAQUE_STIPPLED: draw using the stipple bitmap. Pixels corresponding
to bits in the stipple bitmap that are set will be drawn in the
foreground color; pixels corresponding to bits that are
not set will be drawn with the background color.
<!-- ##### FUNCTION gdk_gc_set_tile ##### -->
<para>
</para>
@gc:
@tile:
<!-- ##### FUNCTION gdk_gc_set_stipple ##### -->
<para>
</para>
@gc:
@stipple:
<!-- ##### FUNCTION gdk_gc_set_ts_origin ##### -->
<para>
</para>
@gc:
@x:
@y:
<!-- ##### FUNCTION gdk_gc_set_clip_origin ##### -->
<para>
</para>
@gc:
@x:
@y:
<!-- ##### FUNCTION gdk_gc_set_clip_mask ##### -->
<para>
</para>
@gc:
@mask:
<!-- ##### FUNCTION gdk_gc_set_clip_rectangle ##### -->
<para>
</para>
@gc:
@rectangle:
<!-- ##### FUNCTION gdk_gc_set_clip_region ##### -->
<para>
</para>
@gc:
@region:
<!-- ##### FUNCTION gdk_gc_set_subwindow ##### -->
<para>
</para>
@gc:
@mode:
<!-- ##### ENUM GdkSubwindowMode ##### -->
<para>
Determines how drawing onto a window will affect child
windows of that window.
</para>
@GDK_CLIP_BY_CHILDREN: only draw onto the window itself.
@GDK_INCLUDE_INFERIORS: draw onto the window and child windows.
<!-- ##### FUNCTION gdk_gc_set_exposures ##### -->
<para>
</para>
@gc:
@exposures:
<!-- ##### FUNCTION gdk_gc_set_line_attributes ##### -->
<para>
</para>
@gc:
@line_width:
@line_style:
@cap_style:
@join_style:
<!-- ##### ENUM GdkLineStyle ##### -->
<para>
Determines how lines are drawn.
</para>
@GDK_LINE_SOLID: lines are drawn solid.
@GDK_LINE_ON_OFF_DASH: even segments are drawn; odd segments are not drawn.
@GDK_LINE_DOUBLE_DASH: even segments are normally. Odd segments are drawn
in the background color if the fill style is %GDK_SOLID, or in the background
color masked by the stipple if the fill style is %GDK_STIPPLED.
<!-- ##### ENUM GdkCapStyle ##### -->
<para>
Determines how the end of lines are drawn.
</para>
@GDK_CAP_NOT_LAST: the same as %GDK_CAP_BUTT for lines of non-zero width.
for zero width lines, the final point on the line will not be drawn.
@GDK_CAP_BUTT: the ends of the lines are drawn squared off and extending
to the coordinates of the end point.
@GDK_CAP_ROUND: the ends of the lines are drawn as semicircles with the
diameter equal to the line width and centered at the end point.
@GDK_CAP_PROJECTING: the ends of the lines are drawn squared off and extending
half the width of the line beyond the end point.
<!-- ##### ENUM GdkJoinStyle ##### -->
<para>
Determines how the joins between segments of a polygon are drawn.
</para>
@GDK_JOIN_MITER: the sides of each line are extended to meet at an angle.
@GDK_JOIN_ROUND: the sides of the two lines are joined by a circular arc.
@GDK_JOIN_BEVEL: the sides of the two lines are joined by a straight line which
makes an equal angle with each line.
<!-- ##### FUNCTION gdk_gc_set_dashes ##### -->
<para>
</para>
@gc:
@dash_offset:
@dash_list:
@n:
<!-- ##### FUNCTION gdk_gc_copy ##### -->
<para>
</para>
@dst_gc:
@src_gc:
<!-- ##### FUNCTION gdk_gc_set_colormap ##### -->
<para>
</para>
@gc:
@colormap:
<!-- ##### FUNCTION gdk_gc_get_colormap ##### -->
<para>
</para>
@gc:
@Returns:
<!-- ##### FUNCTION gdk_gc_offset ##### -->
<para>
</para>
@gc:
@x_offset:
@y_offset:

View File

@ -97,15 +97,6 @@ Returns the X resource (window or pixmap) belonging to a #GdkDrawable.
@Returns: the ID of @win's X resource.
<!-- ##### MACRO GDK_GC_XDISPLAY ##### -->
<para>
Returns the display of a #GdkGC.
</para>
@gc: a #GdkGC.
@Returns: an Xlib <type>Display*</type>.
<!-- ##### MACRO GDK_COLORMAP_XDISPLAY ##### -->
<para>
Returns the display of a #GdkColormap.
@ -179,24 +170,6 @@ Returns the display of a #GdkCursor.
@Returns: an Xlib <type>Display*</type>.
<!-- ##### MACRO GDK_GC_XGC ##### -->
<para>
Returns the X GC of a #GdkGC.
</para>
@gc: a #GdkGC.
@Returns: an Xlib <type>GC</type>.
<!-- ##### MACRO GDK_GC_GET_XGC ##### -->
<para>
Returns the X GC of a #GdkGC.
</para>
@gc: a #GdkGC.
@Returns: an Xlib <type>GC</type>.
<!-- ##### MACRO GDK_WINDOW_XWINDOW ##### -->
<para>
Another name for GDK_DRAWABLE_XID().
@ -539,24 +512,6 @@ Another name for GDK_DRAWABLE_XID().
@Returns:
<!-- ##### FUNCTION gdk_x11_gc_get_xdisplay ##### -->
<para>
</para>
@gc:
@Returns:
<!-- ##### FUNCTION gdk_x11_gc_get_xgc ##### -->
<para>
</para>
@gc:
@Returns:
<!-- ##### FUNCTION gdk_x11_get_default_root_xwindow ##### -->
<para>

View File

@ -81,7 +81,6 @@ gdk_public_h_sources = \
gdkdnd.h \
gdkdrawable.h \
gdkevents.h \
gdkgc.h \
gdkinput.h \
gdkkeys.h \
gdkkeysyms.h \
@ -121,7 +120,6 @@ gdk_c_sources = \
gdkdnd.c \
gdkdraw.c \
gdkevents.c \
gdkgc.c \
gdkglobals.c \
gdkkeys.c \
gdkkeyuni.c \
@ -209,7 +207,6 @@ x11_introspection_files = \
x11/gdkdrawable-x11.c \
x11/gdkeventsource.c \
x11/gdkeventtranslator.c \
x11/gdkgc-x11.c \
x11/gdkgeometry-x11.c \
x11/gdkglobals-x11.c \
x11/gdkim-x11.c \

View File

@ -27,7 +27,6 @@ libgdk_directfb_la_SOURCES = \
gdkdisplay-directfb.h \
gdkdrawable-directfb.c \
gdkevents-directfb.c \
gdkgc-directfb.c \
gdkgeometry-directfb.c \
gdkglobals-directfb.c \
gdkim-directfb.c \

View File

@ -1,386 +0,0 @@
/* GDK - The GIMP Drawing Kit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* 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.
*/
/*
* GTK+ DirectFB backend
* Copyright (C) 2001-2002 convergence integrated media GmbH
* Copyright (C) 2002-2004 convergence GmbH
* Written by Denis Oliver Kropp <dok@convergence.de> and
* Sven Neumann <sven@convergence.de>
*/
#undef GDK_DISABLE_DEPRECATED
#include "config.h"
#include "gdk.h"
#include <string.h>
#include "gdkdirectfb.h"
#include "gdkprivate-directfb.h"
#include "gdkgc.h"
#include "gdkpixmap.h"
static void gdk_directfb_gc_get_values (GdkGC *gc,
GdkGCValues *values);
static void gdk_directfb_gc_set_values (GdkGC *gc,
GdkGCValues *values,
GdkGCValuesMask values_mask);
static void gdk_directfb_gc_set_dashes (GdkGC *gc,
gint dash_offset,
gint8 dash_list[],
gint n);
static void gdk_gc_directfb_finalize (GObject *object);
G_DEFINE_TYPE (GdkGCDirectFB, _gdk_gc_directfb, GDK_TYPE_GC)
static void
_gdk_gc_directfb_init (GdkGCDirectFB *directfb_gc)
{
}
static void
_gdk_gc_directfb_class_init (GdkGCDirectFBClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GdkGCClass *gc_class = GDK_GC_CLASS (klass);
object_class->finalize = gdk_gc_directfb_finalize;
gc_class->get_values = gdk_directfb_gc_get_values;
gc_class->set_values = gdk_directfb_gc_set_values;
gc_class->set_dashes = gdk_directfb_gc_set_dashes;
}
static void
gdk_gc_directfb_finalize (GObject *object)
{
GdkGCDirectFB *directfb_gc = GDK_GC_DIRECTFB (object);
if (directfb_gc->clip_region.numRects)
temp_region_deinit (&directfb_gc->clip_region);
if (directfb_gc->values.clip_mask)
g_object_unref (directfb_gc->values.clip_mask);
if (directfb_gc->values.stipple)
g_object_unref (directfb_gc->values.stipple);
if (directfb_gc->values.tile)
g_object_unref (directfb_gc->values.tile);
G_OBJECT_CLASS (_gdk_gc_directfb_parent_class)->finalize (object);
}
GdkGC *
_gdk_directfb_gc_new (GdkDrawable *drawable,
GdkGCValues *values,
GdkGCValuesMask values_mask)
{
GdkGC *gc;
GdkGCDirectFB *private;
/* NOTICE that the drawable here has to be the impl drawable, not the
publicly visible drawable. */
g_return_val_if_fail (GDK_IS_DRAWABLE_IMPL_DIRECTFB (drawable), NULL);
gc = GDK_GC (g_object_new (_gdk_gc_directfb_get_type (), NULL));
_gdk_gc_init (gc, drawable, values, values_mask);
private = GDK_GC_DIRECTFB (gc);
#if 0
private->values.background.pixel = 0;
private->values.background.red =
private->values.background.green =
private->values.background.blue = 0;
private->values.foreground.pixel = 0;
private->values.foreground.red =
private->values.foreground.green =
private->values.foreground.blue = 0;
#endif
private->values.cap_style = GDK_CAP_BUTT;
gdk_directfb_gc_set_values (gc, values, values_mask);
return gc;
}
static void
gdk_directfb_gc_get_values (GdkGC *gc,
GdkGCValues *values)
{
*values = GDK_GC_DIRECTFB (gc)->values;
}
#if 0
void
_gdk_windowing_gc_get_foreground (GdkGC *gc,
GdkColor *color)
{
GdkGCDirectFB *private;
private = GDK_GC_DIRECTFB (gc);
*color =private->values.foreground;
}
#endif
static void
gdk_directfb_gc_set_values (GdkGC *gc,
GdkGCValues *values,
GdkGCValuesMask values_mask)
{
GdkGCDirectFB *private = GDK_GC_DIRECTFB (gc);
if (values_mask & GDK_GC_FOREGROUND)
{
private->values.foreground = values->foreground;
private->values_mask |= GDK_GC_FOREGROUND;
}
if (values_mask & GDK_GC_BACKGROUND)
{
private->values.background = values->background;
private->values_mask |= GDK_GC_BACKGROUND;
}
if (values_mask & GDK_GC_FUNCTION)
{
private->values.function = values->function;
private->values_mask |= GDK_GC_FUNCTION;
}
if (values_mask & GDK_GC_FILL)
{
private->values.fill = values->fill;
private->values_mask |= GDK_GC_FILL;
}
if (values_mask & GDK_GC_TILE)
{
GdkPixmap *oldpm = private->values.tile;
if (values->tile)
g_assert (GDK_PIXMAP_OBJECT (values->tile)->depth > 1);
private->values.tile = values->tile ? g_object_ref (values->tile) : NULL;
private->values_mask |= GDK_GC_TILE;
if (oldpm)
g_object_unref (oldpm);
}
if (values_mask & GDK_GC_STIPPLE)
{
GdkPixmap *oldpm = private->values.stipple;
if (values->stipple)
g_assert (GDK_PIXMAP_OBJECT (values->stipple)->depth == 1);
private->values.stipple = (values->stipple ?
g_object_ref (values->stipple) : NULL);
private->values_mask |= GDK_GC_STIPPLE;
if (oldpm)
g_object_unref (oldpm);
}
if (values_mask & GDK_GC_CLIP_MASK)
{
GdkPixmap *oldpm = private->values.clip_mask;
private->values.clip_mask = (values->clip_mask ?
g_object_ref (values->clip_mask) : NULL);
private->values_mask |= GDK_GC_CLIP_MASK;
if (oldpm)
g_object_unref (oldpm);
temp_region_reset (&private->clip_region);
}
if (values_mask & GDK_GC_SUBWINDOW)
{
private->values.subwindow_mode = values->subwindow_mode;
private->values_mask |= GDK_GC_SUBWINDOW;
}
if (values_mask & GDK_GC_TS_X_ORIGIN)
{
private->values.ts_x_origin = values->ts_x_origin;
private->values_mask |= GDK_GC_TS_X_ORIGIN;
}
if (values_mask & GDK_GC_TS_Y_ORIGIN)
{
private->values.ts_y_origin = values->ts_y_origin;
private->values_mask |= GDK_GC_TS_Y_ORIGIN;
}
if (values_mask & GDK_GC_CLIP_X_ORIGIN)
{
private->values.clip_x_origin = GDK_GC (gc)->clip_x_origin = values->clip_x_origin;
private->values_mask |= GDK_GC_CLIP_X_ORIGIN;
}
if (values_mask & GDK_GC_CLIP_Y_ORIGIN)
{
private->values.clip_y_origin = GDK_GC (gc)->clip_y_origin = values->clip_y_origin;
private->values_mask |= GDK_GC_CLIP_Y_ORIGIN;
}
if (values_mask & GDK_GC_EXPOSURES)
{
private->values.graphics_exposures = values->graphics_exposures;
private->values_mask |= GDK_GC_EXPOSURES;
}
if (values_mask & GDK_GC_LINE_WIDTH)
{
private->values.line_width = values->line_width;
private->values_mask |= GDK_GC_LINE_WIDTH;
}
if (values_mask & GDK_GC_LINE_STYLE)
{
private->values.line_style = values->line_style;
private->values_mask |= GDK_GC_LINE_STYLE;
}
if (values_mask & GDK_GC_CAP_STYLE)
{
private->values.cap_style = values->cap_style;
private->values_mask |= GDK_GC_CAP_STYLE;
}
if (values_mask & GDK_GC_JOIN_STYLE)
{
private->values.join_style = values->join_style;
private->values_mask |= GDK_GC_JOIN_STYLE;
}
}
static void
gdk_directfb_gc_set_dashes (GdkGC *gc,
gint dash_offset,
gint8 dash_list[],
gint n)
{
g_warning ("gdk_directfb_gc_set_dashes not implemented");
}
static void
gc_unset_clip_mask (GdkGC *gc)
{
GdkGCDirectFB *data = GDK_GC_DIRECTFB (gc);
if (data->values.clip_mask)
{
g_object_unref (data->values.clip_mask);
data->values.clip_mask = NULL;
data->values_mask &= ~ GDK_GC_CLIP_MASK;
}
}
void
_gdk_windowing_gc_set_clip_region (GdkGC *gc,
const cairo_region_t *region,
gboolean reset_origin)
{
GdkGCDirectFB *data;
g_return_if_fail (gc != NULL);
data = GDK_GC_DIRECTFB (gc);
if (region == &data->clip_region)
return;
if (region)
temp_region_init_copy (&data->clip_region, region);
else
temp_region_reset (&data->clip_region);
if (reset_origin)
{
gc->clip_x_origin = 0;
gc->clip_y_origin = 0;
data->values.clip_x_origin = 0;
data->values.clip_y_origin = 0;
}
gc_unset_clip_mask (gc);
}
void
_gdk_windowing_gc_copy (GdkGC *dst_gc,
GdkGC *src_gc)
{
GdkGCDirectFB *dst_private;
g_return_if_fail (dst_gc != NULL);
g_return_if_fail (src_gc != NULL);
dst_private = GDK_GC_DIRECTFB (dst_gc);
temp_region_reset(&dst_private->clip_region);
if (dst_private->values_mask & GDK_GC_TILE)
g_object_unref (dst_private->values.tile);
if (dst_private->values_mask & GDK_GC_STIPPLE)
g_object_unref (dst_private->values.stipple);
if (dst_private->values_mask & GDK_GC_CLIP_MASK)
g_object_unref (dst_private->values.clip_mask);
*dst_gc = *src_gc;
if (dst_private->values_mask & GDK_GC_TILE)
g_object_ref (dst_private->values.tile);
if (dst_private->values_mask & GDK_GC_STIPPLE)
g_object_ref (dst_private->values.stipple);
if (dst_private->values_mask & GDK_GC_CLIP_MASK)
g_object_ref (dst_private->values.clip_mask);
}
/**
* gdk_gc_get_screen:
* @gc: a #GdkGC.
*
* Gets the #GdkScreen for which @gc was created
*
* Returns: the #GdkScreen for @gc.
*
* Since: 2.2
*/
GdkScreen *
gdk_gc_get_screen (GdkGC *gc)
{
g_return_val_if_fail (GDK_IS_GC_DIRECTFB (gc), NULL);
return _gdk_screen;
}

View File

@ -198,31 +198,6 @@ typedef struct
DFBSurfacePixelFormat format;
} GdkVisualDirectFB;
#define GDK_TYPE_GC_DIRECTFB (_gdk_gc_directfb_get_type ())
#define GDK_GC_DIRECTFB(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_GC_DIRECTFB, GdkGCDirectFB))
#define GDK_IS_GC_DIRECTFB(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_GC_DIRECTFB))
typedef struct
{
GdkGC parent_instance;
cairo_region_t clip_region;
GdkGCValuesMask values_mask;
GdkGCValues values;
} GdkGCDirectFB;
typedef struct
{
GdkGCClass parent_class;
} GdkGCDirectFBClass;
GType _gdk_gc_directfb_get_type (void);
GdkGC * _gdk_directfb_gc_new (GdkDrawable *drawable,
GdkGCValues *values,
GdkGCValuesMask values_mask);
void gdk_directfb_event_windows_add (GdkWindow *window);
void gdk_directfb_event_windows_remove (GdkWindow *window);

View File

@ -41,7 +41,6 @@
#include <gdk/gdkdrawable.h>
#include <gdk/gdkenumtypes.h>
#include <gdk/gdkevents.h>
#include <gdk/gdkgc.h>
#include <gdk/gdkinput.h>
#include <gdk/gdkkeys.h>
#include <gdk/gdkpango.h>

View File

@ -250,20 +250,16 @@ gdk_input_source_get_type G_GNUC_CONST
gdk_input_mode_get_type G_GNUC_CONST
gdk_axis_use_get_type G_GNUC_CONST
gdk_byte_order_get_type G_GNUC_CONST
gdk_cap_style_get_type G_GNUC_CONST
gdk_crossing_mode_get_type G_GNUC_CONST
gdk_device_type_get_type G_GNUC_CONST
gdk_extension_mode_get_type G_GNUC_CONST
gdk_event_mask_get_type G_GNUC_CONST
gdk_event_type_get_type G_GNUC_CONST
gdk_fill_get_type G_GNUC_CONST
gdk_filter_return_get_type G_GNUC_CONST
gdk_function_get_type G_GNUC_CONST
gdk_grab_ownership_get_type G_GNUC_CONST
gdk_grab_status_get_type G_GNUC_CONST
gdk_gravity_get_type G_GNUC_CONST
gdk_join_style_get_type G_GNUC_CONST
gdk_line_style_get_type G_GNUC_CONST
gdk_modifier_type_get_type G_GNUC_CONST
gdk_notify_type_get_type G_GNUC_CONST
gdk_owner_change_get_type G_GNUC_CONST
@ -278,7 +274,6 @@ gdk_wm_decoration_get_type G_GNUC_CONST
gdk_wm_function_get_type G_GNUC_CONST
gdk_cursor_type_get_type G_GNUC_CONST
gdk_drag_action_get_type G_GNUC_CONST
gdk_gc_values_mask_get_type G_GNUC_CONST
gdk_window_attributes_type_get_type G_GNUC_CONST
gdk_window_class_get_type G_GNUC_CONST
gdk_window_edge_get_type G_GNUC_CONST
@ -552,43 +547,6 @@ gdk_drawable_set_colormap
#endif
#endif
#if IN_HEADER(__GDK_GC_H__)
#if IN_FILE(__GDK_GC_C__)
gdk_gc_new
gdk_gc_get_type G_GNUC_CONST
gdk_gc_new_with_values
gdk_gc_get_values
gdk_gc_set_values
gdk_gc_set_foreground
gdk_gc_set_background
gdk_gc_set_function
gdk_gc_set_fill
gdk_gc_set_tile
gdk_gc_set_stipple
gdk_gc_set_ts_origin
gdk_gc_set_clip_origin
gdk_gc_set_clip_mask
gdk_gc_set_clip_rectangle
gdk_gc_set_clip_region
gdk_gc_set_subwindow
gdk_gc_set_exposures
gdk_gc_set_line_attributes
gdk_gc_set_dashes
gdk_gc_offset
gdk_gc_copy
gdk_gc_get_colormap
gdk_gc_set_colormap
gdk_gc_set_rgb_bg_color
gdk_gc_set_rgb_fg_color
#endif
#endif
#if IN_HEADER(__GDK_GC_H__)
#if IN_FILE(__GDK_GC_X11_C__)
gdk_gc_get_screen
#endif
#endif
#if IN_HEADER(__GDK_PIXMAP_X11_H__)
#if IN_FILE(__GDK_PIXMAP_X11_C__)
#ifdef GDK_WINDOWING_X11

View File

@ -160,10 +160,7 @@ gdk_drawable_get_display (GdkDrawable *drawable)
* use this function if the drawable-creating function did not have a
* way to determine the colormap, and you then use drawable operations
* that require a colormap. The colormap for all drawables and
* graphics contexts you intend to use together should match. i.e.
* when using a #GdkGC to draw to a drawable, or copying one drawable
* to another, the colormaps should match.
*
* graphics contexts you intend to use together should match.
**/
void
gdk_drawable_set_colormap (GdkDrawable *drawable,

View File

@ -32,7 +32,6 @@
#define __GDK_DRAWABLE_H__
#include <gdk/gdktypes.h>
#include <gdk/gdkgc.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <cairo.h>
@ -57,10 +56,6 @@ struct _GdkDrawableClass
{
GObjectClass parent_class;
GdkGC *(*create_gc) (GdkDrawable *drawable,
GdkGCValues *values,
GdkGCValuesMask mask);
gint (*get_depth) (GdkDrawable *drawable);
void (*get_size) (GdkDrawable *drawable,
gint *width,

File diff suppressed because it is too large Load Diff

View File

@ -1,288 +0,0 @@
/* GDK - The GIMP Drawing Kit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* 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/.
*/
#if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
#error "Only <gdk/gdk.h> can be included directly."
#endif
#ifndef __GDK_GC_H__
#define __GDK_GC_H__
#include <gdk/gdkcolor.h>
#include <gdk/gdktypes.h>
G_BEGIN_DECLS
typedef struct _GdkGCValues GdkGCValues;
typedef struct _GdkGCClass GdkGCClass;
/* GC cap styles
* CapNotLast:
* CapButt:
* CapRound:
* CapProjecting:
*/
typedef enum
{
GDK_CAP_NOT_LAST,
GDK_CAP_BUTT,
GDK_CAP_ROUND,
GDK_CAP_PROJECTING
} GdkCapStyle;
/* GC fill types.
* Solid:
* Tiled:
* Stippled:
* OpaqueStippled:
*/
typedef enum
{
GDK_SOLID,
GDK_TILED,
GDK_STIPPLED,
GDK_OPAQUE_STIPPLED
} GdkFill;
/* GC function types.
* Copy: Overwrites destination pixels with the source pixels.
* Invert: Inverts the destination pixels.
* Xor: Xor's the destination pixels with the source pixels.
* Clear: set pixels to 0
* And: source AND destination
* And Reverse: source AND (NOT destination)
* And Invert: (NOT source) AND destination
* Noop: destination
* Or: source OR destination
* Nor: (NOT source) AND (NOT destination)
* Equiv: (NOT source) XOR destination
* Xor Reverse: source OR (NOT destination)
* Copy Inverted: NOT source
* Xor Inverted: (NOT source) OR destination
* Nand: (NOT source) OR (NOT destination)
* Set: set pixels to 1
*/
typedef enum
{
GDK_COPY,
GDK_INVERT,
GDK_XOR,
GDK_CLEAR,
GDK_AND,
GDK_AND_REVERSE,
GDK_AND_INVERT,
GDK_NOOP,
GDK_OR,
GDK_EQUIV,
GDK_OR_REVERSE,
GDK_COPY_INVERT,
GDK_OR_INVERT,
GDK_NAND,
GDK_NOR,
GDK_SET
} GdkFunction;
/* GC join styles
* JoinMiter:
* JoinRound:
* JoinBevel:
*/
typedef enum
{
GDK_JOIN_MITER,
GDK_JOIN_ROUND,
GDK_JOIN_BEVEL
} GdkJoinStyle;
/* GC line styles
* Solid:
* OnOffDash:
* DoubleDash:
*/
typedef enum
{
GDK_LINE_SOLID,
GDK_LINE_ON_OFF_DASH,
GDK_LINE_DOUBLE_DASH
} GdkLineStyle;
typedef enum
{
GDK_CLIP_BY_CHILDREN = 0,
GDK_INCLUDE_INFERIORS = 1
} GdkSubwindowMode;
typedef enum
{
GDK_GC_FOREGROUND = 1 << 0,
GDK_GC_BACKGROUND = 1 << 1,
GDK_GC_FUNCTION = 1 << 2,
GDK_GC_FILL = 1 << 3,
GDK_GC_TILE = 1 << 4,
GDK_GC_STIPPLE = 1 << 5,
GDK_GC_CLIP_MASK = 1 << 6,
GDK_GC_SUBWINDOW = 1 << 7,
GDK_GC_TS_X_ORIGIN = 1 << 8,
GDK_GC_TS_Y_ORIGIN = 1 << 9,
GDK_GC_CLIP_X_ORIGIN = 1 << 10,
GDK_GC_CLIP_Y_ORIGIN = 1 << 11,
GDK_GC_EXPOSURES = 1 << 12,
GDK_GC_LINE_WIDTH = 1 << 13,
GDK_GC_LINE_STYLE = 1 << 14,
GDK_GC_CAP_STYLE = 1 << 15,
GDK_GC_JOIN_STYLE = 1 << 16
} GdkGCValuesMask;
struct _GdkGCValues
{
GdkColor foreground;
GdkColor background;
GdkFunction function;
GdkFill fill;
GdkPixmap *tile;
GdkPixmap *stipple;
GdkPixmap *clip_mask;
GdkSubwindowMode subwindow_mode;
gint ts_x_origin;
gint ts_y_origin;
gint clip_x_origin;
gint clip_y_origin;
gint graphics_exposures;
gint line_width;
GdkLineStyle line_style;
GdkCapStyle cap_style;
GdkJoinStyle join_style;
};
#define GDK_TYPE_GC (gdk_gc_get_type ())
#define GDK_GC(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_GC, GdkGC))
#define GDK_GC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_GC, GdkGCClass))
#define GDK_IS_GC(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_GC))
#define GDK_IS_GC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_GC))
#define GDK_GC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_GC, GdkGCClass))
struct _GdkGC
{
GObject parent_instance;
gint GSEAL (clip_x_origin);
gint GSEAL (clip_y_origin);
gint GSEAL (ts_x_origin);
gint GSEAL (ts_y_origin);
GdkColormap *GSEAL (colormap);
};
struct _GdkGCClass
{
GObjectClass parent_class;
void (*get_values) (GdkGC *gc,
GdkGCValues *values);
void (*set_values) (GdkGC *gc,
GdkGCValues *values,
GdkGCValuesMask mask);
void (*set_dashes) (GdkGC *gc,
gint dash_offset,
gint8 dash_list[],
gint n);
/* Padding for future expansion */
void (*_gdk_reserved1) (void);
void (*_gdk_reserved2) (void);
void (*_gdk_reserved3) (void);
void (*_gdk_reserved4) (void);
};
GType gdk_gc_get_type (void) G_GNUC_CONST;
GdkGC *gdk_gc_new (GdkDrawable *drawable);
GdkGC *gdk_gc_new_with_values (GdkDrawable *drawable,
GdkGCValues *values,
GdkGCValuesMask values_mask);
void gdk_gc_get_values (GdkGC *gc,
GdkGCValues *values);
void gdk_gc_set_values (GdkGC *gc,
GdkGCValues *values,
GdkGCValuesMask values_mask);
void gdk_gc_set_foreground (GdkGC *gc,
const GdkColor *color);
void gdk_gc_set_background (GdkGC *gc,
const GdkColor *color);
void gdk_gc_set_function (GdkGC *gc,
GdkFunction function);
void gdk_gc_set_fill (GdkGC *gc,
GdkFill fill);
void gdk_gc_set_tile (GdkGC *gc,
GdkPixmap *tile);
void gdk_gc_set_stipple (GdkGC *gc,
GdkPixmap *stipple);
void gdk_gc_set_ts_origin (GdkGC *gc,
gint x,
gint y);
void gdk_gc_set_clip_origin (GdkGC *gc,
gint x,
gint y);
void gdk_gc_set_clip_mask (GdkGC *gc,
GdkBitmap *mask);
void gdk_gc_set_clip_rectangle (GdkGC *gc,
const GdkRectangle *rectangle);
void gdk_gc_set_clip_region (GdkGC *gc,
const cairo_region_t *region);
void gdk_gc_set_subwindow (GdkGC *gc,
GdkSubwindowMode mode);
void gdk_gc_set_exposures (GdkGC *gc,
gboolean exposures);
void gdk_gc_set_line_attributes (GdkGC *gc,
gint line_width,
GdkLineStyle line_style,
GdkCapStyle cap_style,
GdkJoinStyle join_style);
void gdk_gc_set_dashes (GdkGC *gc,
gint dash_offset,
gint8 dash_list[],
gint n);
void gdk_gc_offset (GdkGC *gc,
gint x_offset,
gint y_offset);
void gdk_gc_copy (GdkGC *dst_gc,
GdkGC *src_gc);
void gdk_gc_set_colormap (GdkGC *gc,
GdkColormap *colormap);
GdkColormap *gdk_gc_get_colormap (GdkGC *gc);
void gdk_gc_set_rgb_fg_color (GdkGC *gc,
const GdkColor *color);
void gdk_gc_set_rgb_bg_color (GdkGC *gc,
const GdkColor *color);
GdkScreen * gdk_gc_get_screen (GdkGC *gc);
G_END_DECLS
#endif /* __GDK_DRAWABLE_H__ */

View File

@ -364,31 +364,6 @@ void _gdk_screen_close (GdkScreen *screen);
const char *_gdk_get_sm_client_id (void);
void _gdk_gc_init (GdkGC *gc,
GdkDrawable *drawable,
GdkGCValues *values,
GdkGCValuesMask values_mask);
cairo_region_t *_gdk_gc_get_clip_region (GdkGC *gc);
GdkBitmap *_gdk_gc_get_clip_mask (GdkGC *gc);
gboolean _gdk_gc_get_exposures (GdkGC *gc);
GdkFill _gdk_gc_get_fill (GdkGC *gc);
GdkPixmap *_gdk_gc_get_tile (GdkGC *gc);
GdkBitmap *_gdk_gc_get_stipple (GdkGC *gc);
guint32 _gdk_gc_get_fg_pixel (GdkGC *gc);
guint32 _gdk_gc_get_bg_pixel (GdkGC *gc);
void _gdk_gc_add_drawable_clip (GdkGC *gc,
guint32 region_tag,
cairo_region_t *region,
int offset_x,
int offset_y);
void _gdk_gc_remove_drawable_clip (GdkGC *gc);
void _gdk_gc_set_clip_region_internal (GdkGC *gc,
cairo_region_t *region,
gboolean reset_origin);
GdkSubwindowMode _gdk_gc_get_subwindow (GdkGC *gc);
/*****************************************
* Interfaces provided by windowing code *
*****************************************/
@ -492,45 +467,6 @@ GType _gdk_paintable_get_type (void) G_GNUC_CONST;
GType _gdk_window_impl_get_type (void) G_GNUC_CONST;
GType _gdk_pixmap_impl_get_type (void) G_GNUC_CONST;
/**
* _gdk_windowing_gc_set_clip_region:
* @gc: a #GdkGC
* @region: the new clip region
* @reset_origin: if TRUE, reset the clip_x/y_origin values to 0
*
* Do any window-system specific processing necessary
* for a change in clip region. Since the clip origin
* will likely change before the GC is used with the
* new clip, frequently this function will only set a flag and
* do the real processing later.
*
* When this function is called, _gdk_gc_get_clip_region
* will already return the new region.
**/
void _gdk_windowing_gc_set_clip_region (GdkGC *gc,
const cairo_region_t *region,
gboolean reset_origin);
/**
* _gdk_windowing_gc_copy:
* @dst_gc: a #GdkGC from the GDK backend
* @src_gc: a #GdkGC from the GDK backend
*
* Copies backend specific state from @src_gc to @dst_gc.
* This is called before the generic state is copied, so
* the old generic state is still available from @dst_gc
**/
void _gdk_windowing_gc_copy (GdkGC *dst_gc,
GdkGC *src_gc);
/* Queries the current foreground color of a GdkGC */
void _gdk_windowing_gc_get_foreground (GdkGC *gc,
GdkColor *color);
/* Queries the current background color of a GdkGC */
void _gdk_windowing_gc_get_background (GdkGC *gc,
GdkColor *color);
struct GdkAppLaunchContextPrivate
{
GdkDisplay *display;

View File

@ -34,7 +34,6 @@
#include "gdkdrawable.h"
#include "gdktypes.h"
#include "gdkscreen.h"
#include "gdkgc.h"
#include "gdkcolor.h"
#include "gdkcursor.h"
@ -141,16 +140,6 @@ is_parent_of (GdkWindow *parent,
return FALSE;
}
static GdkGC *
gdk_offscreen_window_create_gc (GdkDrawable *drawable,
GdkGCValues *values,
GdkGCValuesMask values_mask)
{
GdkOffscreenWindow *offscreen = GDK_OFFSCREEN_WINDOW (drawable);
return gdk_gc_new_with_values (offscreen->pixmap, values, values_mask);
}
static cairo_surface_t *
gdk_offscreen_window_ref_cairo_surface (GdkDrawable *drawable)
{
@ -542,7 +531,6 @@ gdk_offscreen_window_move_resize_internal (GdkWindow *window,
GdkWindowObject *private = (GdkWindowObject *)window;
GdkOffscreenWindow *offscreen;
gint dx, dy, dw, dh;
GdkGC *gc;
GdkPixmap *old_pixmap;
offscreen = GDK_OFFSCREEN_WINDOW (private->impl);
@ -899,7 +887,6 @@ gdk_offscreen_window_class_init (GdkOffscreenWindowClass *klass)
object_class->finalize = gdk_offscreen_window_finalize;
drawable_class->create_gc = gdk_offscreen_window_create_gc;
drawable_class->ref_cairo_surface = gdk_offscreen_window_ref_cairo_surface;
drawable_class->set_colormap = gdk_offscreen_window_set_colormap;
drawable_class->get_colormap = gdk_offscreen_window_get_colormap;

View File

@ -31,10 +31,6 @@
#include "gdkscreen.h"
static GdkGC *gdk_pixmap_create_gc (GdkDrawable *drawable,
GdkGCValues *values,
GdkGCValuesMask mask);
static void gdk_pixmap_real_get_size (GdkDrawable *drawable,
gint *width,
gint *height);
@ -91,7 +87,6 @@ gdk_pixmap_class_init (GdkPixmapObjectClass *klass)
object_class->finalize = gdk_pixmap_finalize;
drawable_class->create_gc = gdk_pixmap_create_gc;
drawable_class->get_depth = gdk_pixmap_real_get_depth;
drawable_class->get_screen = gdk_pixmap_real_get_screen;
drawable_class->get_size = gdk_pixmap_real_get_size;
@ -160,16 +155,6 @@ gdk_pixmap_create_from_data (GdkDrawable *drawable,
depth, fg,bg);
}
static GdkGC *
gdk_pixmap_create_gc (GdkDrawable *drawable,
GdkGCValues *values,
GdkGCValuesMask mask)
{
return gdk_gc_new_with_values (((GdkPixmapObject *) drawable)->impl,
values, mask);
}
static void
gdk_pixmap_real_get_size (GdkDrawable *drawable,
gint *width,

View File

@ -102,7 +102,6 @@ typedef guint32 GdkNativeWindow;
typedef struct _GdkColor GdkColor;
typedef struct _GdkColormap GdkColormap;
typedef struct _GdkCursor GdkCursor;
typedef struct _GdkGC GdkGC;
typedef struct _GdkVisual GdkVisual;
typedef struct _GdkDrawable GdkDrawable;

View File

@ -175,13 +175,6 @@
* we reuse the pixmap from the implicit paint. During repaint we create and at the
* end flush an implicit paint, which means we can collect all the paints on
* multiple client side windows in the same backing store pixmap.
*
* All drawing to windows are wrapped with macros that set up the GC such that
* the offsets and clip region is right for drawing to the paint object or
* directly to the emulated window. It also automatically handles any flushing
* needed when drawing directly to a window. Adding window/paint clipping is
* done using _gdk_gc_add_drawable_clip which lets us efficiently add and then
* remove a custom clip region.
*/
#define USE_BACKING_STORE /* Appears to work on Win32, too, now. */
@ -226,10 +219,6 @@ typedef struct {
/* Global info */
static GdkGC *gdk_window_create_gc (GdkDrawable *drawable,
GdkGCValues *values,
GdkGCValuesMask mask);
static cairo_surface_t *gdk_window_ref_cairo_surface (GdkDrawable *drawable);
static cairo_surface_t *gdk_window_create_cairo_surface (GdkDrawable *drawable,
int width,
@ -406,7 +395,6 @@ gdk_window_class_init (GdkWindowObjectClass *klass)
object_class->set_property = gdk_window_set_property;
object_class->get_property = gdk_window_get_property;
drawable_class->create_gc = gdk_window_create_gc;
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;
@ -3608,110 +3596,6 @@ gdk_window_get_internal_paint_info (GdkWindow *window,
*y_offset = y_off;
}
static GdkDrawable *
start_draw_helper (GdkDrawable *drawable,
GdkGC *gc,
gint *x_offset_out,
gint *y_offset_out)
{
GdkWindowObject *private = (GdkWindowObject *)drawable;
gint x_offset, y_offset;
GdkDrawable *impl;
gint old_clip_x = gc->clip_x_origin;
gint old_clip_y = gc->clip_y_origin;
cairo_region_t *clip;
guint32 clip_region_tag;
GdkWindowPaint *paint;
paint = NULL;
if (private->paint_stack)
paint = private->paint_stack->data;
if (paint)
{
x_offset = paint->x_offset;
y_offset = paint->y_offset;
}
else
{
x_offset = -private->abs_x;
y_offset = -private->abs_y;
}
if (x_offset != 0 || y_offset != 0)
{
gdk_gc_set_clip_origin (gc,
old_clip_x - x_offset,
old_clip_y - y_offset);
gdk_gc_set_ts_origin (gc,
gc->ts_x_origin - x_offset,
gc->ts_y_origin - y_offset);
}
*x_offset_out = x_offset;
*y_offset_out = y_offset;
/* Add client side window clip region to gc */
clip = NULL;
if (paint)
{
/* Only need clipping if using implicit paint, otherwise
the pixmap is clipped when copying to the window in end_paint */
if (paint->uses_implicit)
{
/* This includes the window clip */
clip = paint->region;
}
clip_region_tag = paint->region_tag;
/* After having set up the drawable clip rect on a GC we need to make sure
* that we draw to th the impl, otherwise the pixmap code will reset the
* drawable clip. */
impl = ((GdkPixmapObject *)(paint->pixmap))->impl;
}
else
{
/* Drawing directly to the window, flush anything outstanding to
guarantee ordering. */
gdk_window_flush ((GdkWindow *)drawable);
/* Don't clip when drawing to root or all native */
if (!_gdk_native_windows && private->window_type != GDK_WINDOW_ROOT)
{
if (_gdk_gc_get_subwindow (gc) == GDK_CLIP_BY_CHILDREN)
clip = private->clip_region_with_children;
else
clip = private->clip_region;
}
clip_region_tag = private->clip_tag;
impl = private->impl;
}
if (clip)
_gdk_gc_add_drawable_clip (gc,
clip_region_tag, clip,
/* If there was a clip origin set appart from the
* window offset, need to take that into
* consideration */
-old_clip_x, -old_clip_y);
return impl;
}
static GdkGC *
gdk_window_create_gc (GdkDrawable *drawable,
GdkGCValues *values,
GdkGCValuesMask mask)
{
g_return_val_if_fail (GDK_IS_WINDOW (drawable), NULL);
if (GDK_WINDOW_DESTROYED (drawable))
return NULL;
return gdk_gc_new_with_values (((GdkWindowObject *) drawable)->impl,
values, mask);
}
static GdkDrawable *
gdk_window_get_source_drawable (GdkDrawable *drawable)
{

View File

@ -32,7 +32,6 @@ libgdk_quartz_la_SOURCES = \
gdkdrawable-quartz.h \
gdkevents-quartz.c \
gdkeventloop-quartz.c \
gdkgc-quartz.c \
gdkgeometry-quartz.c \
gdkglobals-quartz.c \
gdkim-quartz.c \

View File

@ -1,686 +0,0 @@
/* gdkgc-quartz.c
*
* Copyright (C) 2005 Imendio AB
*
* 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.
*/
#include "config.h"
#include "gdkgc.h"
#include "gdkprivate-quartz.h"
static gpointer parent_class = NULL;
static void
gdk_quartz_gc_get_values (GdkGC *gc,
GdkGCValues *values)
{
GdkGCQuartz *private;
private = GDK_GC_QUARTZ (gc);
values->foreground.pixel = _gdk_gc_get_fg_pixel (gc);
values->background.pixel = _gdk_gc_get_bg_pixel (gc);
values->function = private->function;
values->fill = _gdk_gc_get_fill (gc);
values->tile = _gdk_gc_get_tile (gc);
values->stipple = _gdk_gc_get_stipple (gc);
/* The X11 backend always returns a NULL clip_mask. */
values->clip_mask = NULL;
values->ts_x_origin = gc->ts_x_origin;
values->ts_y_origin = gc->ts_y_origin;
values->clip_x_origin = gc->clip_x_origin;
values->clip_y_origin = gc->clip_y_origin;
values->graphics_exposures = private->graphics_exposures;
values->line_width = private->line_width;
values->line_style = private->line_style;
values->cap_style = private->cap_style;
values->join_style = private->join_style;
}
static void
data_provider_release (void *info, const void *data, size_t size)
{
g_free (info);
}
static CGImageRef
create_clip_mask (GdkPixmap *source_pixmap)
{
int width, height, bytes_per_row, bits_per_pixel;
void *data;
CGImageRef source;
CGImageRef clip_mask;
CGContextRef cg_context;
CGDataProviderRef data_provider;
/* We need to flip the clip mask here, because this cannot be done during
* the drawing process when this mask will be used to do clipping. We
* quickly create a new CGImage, set up a CGContext, draw the source
* image while flipping, and done. If this appears too slow in the
* future, we would look into doing this by hand on the actual raw
* data.
*/
source = GDK_PIXMAP_IMPL_QUARTZ (GDK_PIXMAP_OBJECT (source_pixmap)->impl)->image;
width = CGImageGetWidth (source);
height = CGImageGetHeight (source);
bytes_per_row = CGImageGetBytesPerRow (source);
bits_per_pixel = CGImageGetBitsPerPixel (source);
data = g_malloc (height * bytes_per_row);
data_provider = CGDataProviderCreateWithData (data, data,
height * bytes_per_row,
data_provider_release);
clip_mask = CGImageCreate (width, height, 8,
bits_per_pixel,
bytes_per_row,
CGImageGetColorSpace (source),
CGImageGetAlphaInfo (source),
data_provider, NULL, FALSE,
kCGRenderingIntentDefault);
CGDataProviderRelease (data_provider);
cg_context = CGBitmapContextCreate (data,
width, height,
CGImageGetBitsPerComponent (source),
bytes_per_row,
CGImageGetColorSpace (source),
CGImageGetBitmapInfo (source));
CGContextTranslateCTM (cg_context, 0, height);
CGContextScaleCTM (cg_context, 1.0, -1.0);
CGContextDrawImage (cg_context,
CGRectMake (0, 0, width, height), source);
CGContextRelease (cg_context);
return clip_mask;
}
static void
gdk_quartz_gc_set_values (GdkGC *gc,
GdkGCValues *values,
GdkGCValuesMask mask)
{
GdkGCQuartz *private = GDK_GC_QUARTZ (gc);
if (mask & GDK_GC_FUNCTION)
private->function = values->function;
if (mask & GDK_GC_SUBWINDOW)
private->subwindow_mode = values->subwindow_mode;
if (mask & GDK_GC_EXPOSURES)
private->graphics_exposures = values->graphics_exposures;
if (mask & GDK_GC_CLIP_MASK)
{
private->have_clip_region = FALSE;
private->have_clip_mask = values->clip_mask != NULL;
if (private->clip_mask)
CGImageRelease (private->clip_mask);
if (values->clip_mask)
private->clip_mask = create_clip_mask (values->clip_mask);
else
private->clip_mask = NULL;
}
if (mask & GDK_GC_LINE_WIDTH)
private->line_width = values->line_width;
if (mask & GDK_GC_LINE_STYLE)
private->line_style = values->line_style;
if (mask & GDK_GC_CAP_STYLE)
private->cap_style = values->cap_style;
if (mask & GDK_GC_JOIN_STYLE)
private->join_style = values->join_style;
}
static void
gdk_quartz_gc_set_dashes (GdkGC *gc,
gint dash_offset,
gint8 dash_list[],
gint n)
{
GdkGCQuartz *private = GDK_GC_QUARTZ (gc);
gint i;
private->dash_count = n;
g_free (private->dash_lengths);
private->dash_lengths = g_new (CGFloat, n);
for (i = 0; i < n; i++)
private->dash_lengths[i] = (CGFloat) dash_list[i];
private->dash_phase = (CGFloat) dash_offset;
}
static void
gdk_gc_quartz_finalize (GObject *object)
{
GdkGCQuartz *private = GDK_GC_QUARTZ (object);
if (private->clip_mask)
CGImageRelease (private->clip_mask);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
gdk_gc_quartz_class_init (GdkGCQuartzClass *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_gc_quartz_finalize;
gc_class->get_values = gdk_quartz_gc_get_values;
gc_class->set_values = gdk_quartz_gc_set_values;
gc_class->set_dashes = gdk_quartz_gc_set_dashes;
}
static void
gdk_gc_quartz_init (GdkGCQuartz *gc_quartz)
{
gc_quartz->function = GDK_COPY;
gc_quartz->subwindow_mode = GDK_CLIP_BY_CHILDREN;
gc_quartz->graphics_exposures = TRUE;
gc_quartz->line_width = 0;
gc_quartz->line_style = GDK_LINE_SOLID;
gc_quartz->cap_style = GDK_CAP_BUTT;
gc_quartz->join_style = GDK_JOIN_MITER;
}
GType
_gdk_gc_quartz_get_type (void)
{
static GType object_type = 0;
if (!object_type)
{
const GTypeInfo object_info =
{
sizeof (GdkGCQuartzClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gdk_gc_quartz_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GdkGCQuartz),
0, /* n_preallocs */
(GInstanceInitFunc) gdk_gc_quartz_init,
};
object_type = g_type_register_static (GDK_TYPE_GC,
"GdkGCQuartz",
&object_info, 0);
}
return object_type;
}
GdkGC *
_gdk_quartz_gc_new (GdkDrawable *drawable,
GdkGCValues *values,
GdkGCValuesMask values_mask)
{
GdkGC *gc;
gc = g_object_new (GDK_TYPE_GC_QUARTZ, NULL);
_gdk_gc_init (gc, drawable, values, values_mask);
gdk_quartz_gc_set_values (gc, values, values_mask);
return gc;
}
void
_gdk_windowing_gc_set_clip_region (GdkGC *gc,
const cairo_region_t *region,
gboolean reset_origin)
{
GdkGCQuartz *private = GDK_GC_QUARTZ (gc);
if ((private->have_clip_region && ! region) || private->have_clip_mask)
{
if (private->clip_mask)
{
CGImageRelease (private->clip_mask);
private->clip_mask = NULL;
}
private->have_clip_mask = FALSE;
}
private->have_clip_region = region != NULL;
if (reset_origin)
{
gc->clip_x_origin = 0;
gc->clip_y_origin = 0;
}
}
void
_gdk_windowing_gc_copy (GdkGC *dst_gc,
GdkGC *src_gc)
{
GdkGCQuartz *dst_quartz_gc = GDK_GC_QUARTZ (dst_gc);
GdkGCQuartz *src_quartz_gc = GDK_GC_QUARTZ (src_gc);
dst_quartz_gc->function = src_quartz_gc->function;
dst_quartz_gc->subwindow_mode = src_quartz_gc->subwindow_mode;
dst_quartz_gc->graphics_exposures = src_quartz_gc->graphics_exposures;
dst_quartz_gc->have_clip_region = src_quartz_gc->have_clip_region;
dst_quartz_gc->have_clip_mask = src_quartz_gc->have_clip_mask;
if (dst_quartz_gc->clip_mask)
{
CGImageRelease (dst_quartz_gc->clip_mask);
dst_quartz_gc->clip_mask = NULL;
}
if (src_quartz_gc->clip_mask)
dst_quartz_gc->clip_mask =
CGImageCreateCopy (GDK_PIXMAP_IMPL_QUARTZ (GDK_PIXMAP_OBJECT (src_quartz_gc->clip_mask)->impl)->image);
dst_quartz_gc->line_width = src_quartz_gc->line_width;
dst_quartz_gc->line_style = src_quartz_gc->line_style;
dst_quartz_gc->cap_style = src_quartz_gc->cap_style;
dst_quartz_gc->join_style = src_quartz_gc->join_style;
g_free (dst_quartz_gc->dash_lengths);
dst_quartz_gc->dash_lengths = g_memdup (src_quartz_gc->dash_lengths,
sizeof (CGFloat) * src_quartz_gc->dash_count);
dst_quartz_gc->dash_count = src_quartz_gc->dash_count;
dst_quartz_gc->dash_phase = src_quartz_gc->dash_phase;
}
GdkScreen *
gdk_gc_get_screen (GdkGC *gc)
{
return _gdk_screen;
}
struct PatternCallbackInfo
{
GdkGCQuartz *private_gc;
GdkDrawable *drawable;
};
static void
pattern_callback_info_release (void *info)
{
g_free (info);
}
static void
gdk_quartz_draw_tiled_pattern (void *info,
CGContextRef context)
{
struct PatternCallbackInfo *pinfo = info;
GdkGC *gc = GDK_GC (pinfo->private_gc);
CGImageRef pattern_image;
size_t width, height;
pattern_image = GDK_PIXMAP_IMPL_QUARTZ (GDK_PIXMAP_OBJECT (_gdk_gc_get_tile (gc))->impl)->image;
width = CGImageGetWidth (pattern_image);
height = CGImageGetHeight (pattern_image);
CGContextDrawImage (context,
CGRectMake (0, 0, width, height),
pattern_image);
}
static void
gdk_quartz_draw_stippled_pattern (void *info,
CGContextRef context)
{
struct PatternCallbackInfo *pinfo = info;
GdkGC *gc = GDK_GC (pinfo->private_gc);
CGImageRef pattern_image;
CGRect rect;
CGColorRef color;
pattern_image = GDK_PIXMAP_IMPL_QUARTZ (GDK_PIXMAP_OBJECT (_gdk_gc_get_stipple (gc))->impl)->image;
rect = CGRectMake (0, 0,
CGImageGetWidth (pattern_image),
CGImageGetHeight (pattern_image));
CGContextClipToMask (context, rect, pattern_image);
color = _gdk_quartz_colormap_get_cgcolor_from_pixel (pinfo->drawable,
_gdk_gc_get_fg_pixel (gc));
CGContextSetFillColorWithColor (context, color);
CGColorRelease (color);
CGContextFillRect (context, rect);
}
static void
gdk_quartz_draw_opaque_stippled_pattern (void *info,
CGContextRef context)
{
struct PatternCallbackInfo *pinfo = info;
GdkGC *gc = GDK_GC (pinfo->private_gc);
CGImageRef pattern_image;
CGRect rect;
CGColorRef color;
pattern_image = GDK_PIXMAP_IMPL_QUARTZ (GDK_PIXMAP_OBJECT (_gdk_gc_get_stipple (gc))->impl)->image;
rect = CGRectMake (0, 0,
CGImageGetWidth (pattern_image),
CGImageGetHeight (pattern_image));
color = _gdk_quartz_colormap_get_cgcolor_from_pixel (pinfo->drawable,
_gdk_gc_get_bg_pixel (gc));
CGContextSetFillColorWithColor (context, color);
CGColorRelease (color);
CGContextFillRect (context, rect);
CGContextClipToMask (context, rect, pattern_image);
color = _gdk_quartz_colormap_get_cgcolor_from_pixel (info,
_gdk_gc_get_fg_pixel (gc));
CGContextSetFillColorWithColor (context, color);
CGColorRelease (color);
CGContextFillRect (context, rect);
}
void
_gdk_quartz_gc_update_cg_context (GdkGC *gc,
GdkDrawable *drawable,
CGContextRef context,
GdkQuartzContextValuesMask mask)
{
GdkGCQuartz *private;
guint32 fg_pixel;
guint32 bg_pixel;
g_return_if_fail (gc == NULL || GDK_IS_GC (gc));
if (!gc)
return;
private = GDK_GC_QUARTZ (gc);
if (private->have_clip_region)
{
CGRect rect;
CGRect *cg_rects;
cairo_region_t *region;
gint n_rects, i;
region = _gdk_gc_get_clip_region (gc);
n_rects = cairo_region_num_rectangles (region);
if (n_rects == 1)
cg_rects = &rect;
else
cg_rects = g_new (CGRect, n_rects);
for (i = 0; i < n_rects; i++)
{
cairo_rectangle_int_t cairo_rect;
cairo_region_get_rectangle (region, i, &cairo_rect);
cg_rects[i].origin.x = cairo_rect.x + gc->clip_x_origin;
cg_rects[i].origin.y = cairo_rect.y + gc->clip_y_origin;
cg_rects[i].size.width = cairo_rect.width;
cg_rects[i].size.height = cairo_rect.height;
}
CGContextClipToRects (context, cg_rects, n_rects);
if (cg_rects != &rect)
g_free (cg_rects);
}
else if (private->have_clip_mask && private->clip_mask)
{
/* Note: This is 10.4 only. For lower versions, we need to transform the
* mask into a region.
*/
CGContextClipToMask (context,
CGRectMake (gc->clip_x_origin, gc->clip_y_origin,
CGImageGetWidth (private->clip_mask),
CGImageGetHeight (private->clip_mask)),
private->clip_mask);
}
fg_pixel = _gdk_gc_get_fg_pixel (gc);
bg_pixel = _gdk_gc_get_bg_pixel (gc);
{
CGBlendMode blend_mode = kCGBlendModeNormal;
switch (private->function)
{
case GDK_COPY:
blend_mode = kCGBlendModeNormal;
break;
case GDK_INVERT:
case GDK_XOR:
blend_mode = kCGBlendModeExclusion;
fg_pixel = 0xffffffff;
bg_pixel = 0xffffffff;
break;
case GDK_CLEAR:
case GDK_AND:
case GDK_AND_REVERSE:
case GDK_AND_INVERT:
case GDK_NOOP:
case GDK_OR:
case GDK_EQUIV:
case GDK_OR_REVERSE:
case GDK_COPY_INVERT:
case GDK_OR_INVERT:
case GDK_NAND:
case GDK_NOR:
case GDK_SET:
blend_mode = kCGBlendModeNormal; /* FIXME */
break;
}
CGContextSetBlendMode (context, blend_mode);
}
/* FIXME: implement subwindow mode */
/* FIXME: implement graphics exposures */
if (mask & GDK_QUARTZ_CONTEXT_STROKE)
{
CGLineCap line_cap = kCGLineCapButt;
CGLineJoin line_join = kCGLineJoinMiter;
CGColorRef color;
color = _gdk_quartz_colormap_get_cgcolor_from_pixel (drawable,
fg_pixel);
CGContextSetStrokeColorWithColor (context, color);
CGColorRelease (color);
CGContextSetLineWidth (context, MAX (G_MINFLOAT, private->line_width));
switch (private->line_style)
{
case GDK_LINE_SOLID:
CGContextSetLineDash (context, 0.0, NULL, 0);
break;
case GDK_LINE_DOUBLE_DASH:
/* FIXME: Implement; for now, fall back to GDK_LINE_ON_OFF_DASH */
case GDK_LINE_ON_OFF_DASH:
CGContextSetLineDash (context, private->dash_phase,
private->dash_lengths, private->dash_count);
break;
}
switch (private->cap_style)
{
case GDK_CAP_NOT_LAST:
/* FIXME: Implement; for now, fall back to GDK_CAP_BUTT */
case GDK_CAP_BUTT:
line_cap = kCGLineCapButt;
break;
case GDK_CAP_ROUND:
line_cap = kCGLineCapRound;
break;
case GDK_CAP_PROJECTING:
line_cap = kCGLineCapSquare;
break;
}
CGContextSetLineCap (context, line_cap);
switch (private->join_style)
{
case GDK_JOIN_MITER:
line_join = kCGLineJoinMiter;
break;
case GDK_JOIN_ROUND:
line_join = kCGLineJoinRound;
break;
case GDK_JOIN_BEVEL:
line_join = kCGLineJoinBevel;
break;
}
CGContextSetLineJoin (context, line_join);
}
if (mask & GDK_QUARTZ_CONTEXT_FILL)
{
GdkFill fill = _gdk_gc_get_fill (gc);
CGColorSpaceRef baseSpace;
CGColorSpaceRef patternSpace;
CGFloat alpha = 1.0;
if (fill == GDK_SOLID)
{
CGColorRef color;
color = _gdk_quartz_colormap_get_cgcolor_from_pixel (drawable,
fg_pixel);
CGContextSetFillColorWithColor (context, color);
CGColorRelease (color);
}
else
{
if (!private->ts_pattern)
{
CGImageRef pattern_image = NULL;
gfloat width, height;
gboolean is_colored = FALSE;
CGPatternCallbacks callbacks = { 0, NULL, NULL };
struct PatternCallbackInfo *info;
CGPoint phase;
info = g_new (struct PatternCallbackInfo, 1);
/* Won't ref to avoid circular dependencies */
info->drawable = drawable;
info->private_gc = private;
callbacks.releaseInfo = pattern_callback_info_release;
switch (fill)
{
case GDK_TILED:
pattern_image = GDK_PIXMAP_IMPL_QUARTZ (GDK_PIXMAP_OBJECT (_gdk_gc_get_tile (gc))->impl)->image;
is_colored = TRUE;
callbacks.drawPattern = gdk_quartz_draw_tiled_pattern;
break;
case GDK_STIPPLED:
pattern_image = GDK_PIXMAP_IMPL_QUARTZ (GDK_PIXMAP_OBJECT (_gdk_gc_get_stipple (gc))->impl)->image;
is_colored = FALSE;
callbacks.drawPattern = gdk_quartz_draw_stippled_pattern;
break;
case GDK_OPAQUE_STIPPLED:
pattern_image = GDK_PIXMAP_IMPL_QUARTZ (GDK_PIXMAP_OBJECT (_gdk_gc_get_stipple (gc))->impl)->image;
is_colored = TRUE;
callbacks.drawPattern = gdk_quartz_draw_opaque_stippled_pattern;
break;
default:
break;
}
width = CGImageGetWidth (pattern_image);
height = CGImageGetHeight (pattern_image);
phase = CGPointApplyAffineTransform (CGPointMake (gc->ts_x_origin, gc->ts_y_origin), CGContextGetCTM (context));
CGContextSetPatternPhase (context, CGSizeMake (phase.x, phase.y));
private->ts_pattern = CGPatternCreate (info,
CGRectMake (0, 0, width, height),
CGAffineTransformIdentity,
width, height,
kCGPatternTilingConstantSpacing,
is_colored,
&callbacks);
}
baseSpace = (fill == GDK_STIPPLED) ? CGColorSpaceCreateWithName (kCGColorSpaceGenericRGB) : NULL;
patternSpace = CGColorSpaceCreatePattern (baseSpace);
CGContextSetFillColorSpace (context, patternSpace);
CGColorSpaceRelease (patternSpace);
CGColorSpaceRelease (baseSpace);
if (fill == GDK_STIPPLED)
{
CGColorRef color;
const CGFloat *components;
color = _gdk_quartz_colormap_get_cgcolor_from_pixel (drawable,
fg_pixel);
components = CGColorGetComponents (color);
CGContextSetFillPattern (context, private->ts_pattern,
components);
CGColorRelease (color);
}
else
CGContextSetFillPattern (context, private->ts_pattern, &alpha);
}
}
if (mask & GDK_QUARTZ_CONTEXT_TEXT)
{
/* FIXME: implement text */
}
if (GDK_IS_WINDOW_IMPL_QUARTZ (drawable))
private->is_window = TRUE;
else
private->is_window = FALSE;
}

View File

@ -35,51 +35,11 @@
#include "config.h"
#define GDK_TYPE_GC_QUARTZ (_gdk_gc_quartz_get_type ())
#define GDK_GC_QUARTZ(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_GC_QUARTZ, GdkGCQuartz))
#define GDK_GC_QUARTZ_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_GC_QUARTZ, GdkGCQuartzClass))
#define GDK_IS_GC_QUARTZ(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_GC_QUARTZ))
#define GDK_IS_GC_QUARTZ_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_GC_QUARTZ))
#define GDK_GC_QUARTZ_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_GC_QUARTZ, GdkGCQuartzClass))
#define GDK_DRAG_CONTEXT_PRIVATE(context) ((GdkDragContextPrivate *) GDK_DRAG_CONTEXT (context)->windowing_data)
typedef struct _GdkCursorPrivate GdkCursorPrivate;
typedef struct _GdkGCQuartz GdkGCQuartz;
typedef struct _GdkGCQuartzClass GdkGCQuartzClass;
typedef struct _GdkDragContextPrivate GdkDragContextPrivate;
struct _GdkGCQuartz
{
GdkGC parent_instance;
GdkFunction function;
GdkSubwindowMode subwindow_mode;
gboolean graphics_exposures;
gboolean have_clip_region;
gboolean have_clip_mask;
CGImageRef clip_mask;
gint line_width;
GdkLineStyle line_style;
GdkCapStyle cap_style;
GdkJoinStyle join_style;
CGFloat *dash_lengths;
gint dash_count;
CGFloat dash_phase;
CGPatternRef ts_pattern;
guint is_window : 1;
};
struct _GdkGCQuartzClass
{
GdkGCClass parent_class;
};
struct _GdkVisualClass
{
GObjectClass parent_class;
@ -120,15 +80,6 @@ typedef enum {
GDK_QUARTZ_CONTEXT_TEXT = 1 << 2
} GdkQuartzContextValuesMask;
GType _gdk_gc_quartz_get_type (void);
GdkGC *_gdk_quartz_gc_new (GdkDrawable *drawable,
GdkGCValues *values,
GdkGCValuesMask values_mask);
void _gdk_quartz_gc_update_cg_context (GdkGC *gc,
GdkDrawable *drawable,
CGContextRef context,
GdkQuartzContextValuesMask mask);
/* Colormap */
CGColorRef _gdk_quartz_colormap_get_cgcolor_from_pixel (GdkDrawable *drawable,
guint32 pixel);

View File

@ -40,7 +40,6 @@ libgdk_win32_la_SOURCES = \
gdkdrawable-win32.c \
gdkdrawable-win32.h \
gdkevents-win32.c \
gdkgc-win32.c \
gdkgeometry-win32.c \
gdkglobals-win32.c \
gdkim-win32.c \

View File

@ -317,93 +317,6 @@ render_line_vertical (GdkGCWin32 *gcwin32,
return TRUE;
}
static void
draw_tiles_lowlevel (HDC dest,
HDC tile,
int rop3,
gint dest_x,
gint dest_y,
gint tile_x_origin,
gint tile_y_origin,
gint width,
gint height,
gint tile_width,
gint tile_height)
{
gint x, y;
GDK_NOTE (DRAW, g_print ("draw_tiles_lowlevel: %p %+d%+d tile=%p:%dx%d@%+d%+d %dx%d\n",
dest,
dest_x, dest_y,
tile, tile_width, tile_height,
tile_x_origin, tile_y_origin,
width, height));
y = tile_y_origin % tile_height;
if (y > 0)
y -= tile_height;
while (y < dest_y + height)
{
if (y + tile_height >= dest_y)
{
x = tile_x_origin % tile_width;
if (x > 0)
x -= tile_width;
while (x < dest_x + width)
{
if (x + tile_width >= dest_x)
{
gint src_x = MAX (0, dest_x - x);
gint src_y = MAX (0, dest_y - y);
if (!GDI_CALL (BitBlt, (dest, x + src_x, y + src_y,
MIN (tile_width, dest_x + width - (x + src_x)),
MIN (tile_height, dest_y + height - (y + src_y)),
tile,
src_x, src_y,
rop3)))
return;
}
x += tile_width;
}
}
y += tile_height;
}
}
static void
draw_tiles (GdkDrawable *drawable,
GdkGC *gc,
int rop3,
GdkPixmap *tile,
gint dest_x,
gint dest_y,
gint tile_x_origin,
gint tile_y_origin,
gint width,
gint height)
{
const GdkGCValuesMask mask = GDK_GC_FOREGROUND;
gint tile_width, tile_height;
GdkGC *gc_copy;
HDC dest_hdc, tile_hdc;
gc_copy = gdk_gc_new (tile);
gdk_gc_copy (gc_copy, gc);
dest_hdc = gdk_win32_hdc_get (drawable, gc, mask);
tile_hdc = gdk_win32_hdc_get (tile, gc_copy, mask);
gdk_drawable_get_size (tile, &tile_width, &tile_height);
draw_tiles_lowlevel (dest_hdc, tile_hdc, rop3,
dest_x, dest_y, tile_x_origin, tile_y_origin,
width, height, tile_width, tile_height);
gdk_win32_hdc_release (drawable, gc, mask);
gdk_win32_hdc_release (tile, gc_copy, mask);
g_object_unref (gc_copy);
}
static cairo_region_t *
widen_bounds (GdkRectangle *bounds,
gint pen_width)

File diff suppressed because it is too large Load Diff

View File

@ -105,13 +105,6 @@
#define GDK_DEBUG_MISC_OR_COLORMAP (GDK_DEBUG_MISC|GDK_DEBUG_COLORMAP)
#define GDK_DEBUG_MISC_OR_EVENTS (GDK_DEBUG_MISC|GDK_DEBUG_EVENTS)
#define GDK_TYPE_GC_WIN32 (_gdk_gc_win32_get_type ())
#define GDK_GC_WIN32(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_GC_WIN32, GdkGCWin32))
#define GDK_GC_WIN32_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_GC_WIN32, GdkGCWin32Class))
#define GDK_IS_GC_WIN32(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_GC_WIN32))
#define GDK_IS_GC_WIN32_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_GC_WIN32))
#define GDK_GC_WIN32_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_GC_WIN32, GdkGCWin32Class))
//#define GDK_WINDOW_SCREEN(win) (_gdk_screen)
GdkScreen *GDK_WINDOW_SCREEN(GObject *win);
@ -120,8 +113,6 @@ GdkScreen *GDK_WINDOW_SCREEN(GObject *win);
typedef struct _GdkColormapPrivateWin32 GdkColormapPrivateWin32;
typedef struct _GdkCursorPrivate GdkCursorPrivate;
typedef struct _GdkWin32SingleFont GdkWin32SingleFont;
typedef struct _GdkGCWin32 GdkGCWin32;
typedef struct _GdkGCWin32Class GdkGCWin32Class;
struct _GdkCursorPrivate
{
@ -159,48 +150,6 @@ struct _GdkColormapPrivateWin32
GdkColorInfo *info;
};
struct _GdkGCWin32
{
GdkGC parent_instance;
/* A Windows Device Context (DC) is not equivalent to an X11
* GC. We can use a DC only in the window for which it was
* allocated, or (in the case of a memory DC) with the bitmap that
* has been selected into it. Thus, we have to release and
* reallocate a DC each time the GdkGC is used to paint into a new
* window or pixmap. We thus keep all the necessary values in the
* GdkGCWin32 object.
*/
HRGN hcliprgn;
GdkGCValuesMask values_mask;
gint rop2;
GdkSubwindowMode subwindow_mode;
gint graphics_exposures;
gint pen_width;
DWORD pen_style;
GdkLineStyle line_style;
GdkCapStyle cap_style;
GdkJoinStyle join_style;
DWORD *pen_dashes; /* use for PS_USERSTYLE or step-by-step rendering */
gint pen_num_dashes;
gint pen_dash_offset;
HBRUSH pen_hbrbg;
/* Following fields are valid while the GC exists as a Windows DC */
HDC hdc;
int saved_dc;
HPALETTE holdpal;
};
struct _GdkGCWin32Class
{
GdkGCClass parent_class;
};
GType _gdk_gc_win32_get_type (void);
gulong _gdk_win32_get_next_tick (gulong suggested_tick);
@ -232,10 +181,6 @@ void gdk_win32_handle_table_insert (HANDLE *handle,
gpointer data);
void gdk_win32_handle_table_remove (HANDLE handle);
GdkGC *_gdk_win32_gc_new (GdkDrawable *drawable,
GdkGCValues *values,
GdkGCValuesMask values_mask);
void _gdk_win32_blit (gboolean use_fg_bg,
GdkDrawableImplWin32 *drawable,
GdkGC *gc,

View File

@ -37,7 +37,6 @@ libgdk_x11_la_SOURCES = \
gdkeventsource.h \
gdkeventtranslator.c \
gdkeventtranslator.h \
gdkgc-x11.c \
gdkgeometry-x11.c \
gdkglobals-x11.c \
gdkim-x11.c \

View File

@ -72,8 +72,6 @@ _gdk_drawable_impl_x11_class_init (GdkDrawableImplX11Class *klass)
object_class->finalize = gdk_drawable_impl_x11_finalize;
drawable_class->create_gc = _gdk_x11_gc_new;
drawable_class->ref_cairo_surface = gdk_x11_ref_cairo_surface;
drawable_class->set_colormap = gdk_x11_set_colormap;

View File

@ -1,697 +0,0 @@
/* GDK - The GIMP Drawing Kit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* 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"
#include "gdkgc.h"
#include "gdkprivate-x11.h"
#include "gdkx.h"
#include <string.h>
typedef enum {
GDK_GC_DIRTY_CLIP = 1 << 0,
GDK_GC_DIRTY_TS = 1 << 1
} GdkGCDirtyValues;
static void gdk_x11_gc_values_to_xvalues (GdkGCValues *values,
GdkGCValuesMask mask,
XGCValues *xvalues,
unsigned long *xvalues_mask);
static void gdk_x11_gc_get_values (GdkGC *gc,
GdkGCValues *values);
static void gdk_x11_gc_set_values (GdkGC *gc,
GdkGCValues *values,
GdkGCValuesMask values_mask);
static void gdk_x11_gc_set_dashes (GdkGC *gc,
gint dash_offset,
gint8 dash_list[],
gint n);
static void gdk_gc_x11_finalize (GObject *object);
G_DEFINE_TYPE (GdkGCX11, _gdk_gc_x11, GDK_TYPE_GC)
static void
_gdk_gc_x11_class_init (GdkGCX11Class *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GdkGCClass *gc_class = GDK_GC_CLASS (klass);
object_class->finalize = gdk_gc_x11_finalize;
gc_class->get_values = gdk_x11_gc_get_values;
gc_class->set_values = gdk_x11_gc_set_values;
gc_class->set_dashes = gdk_x11_gc_set_dashes;
}
static void
_gdk_gc_x11_init (GdkGCX11 *gc)
{
}
static void
gdk_gc_x11_finalize (GObject *object)
{
GdkGCX11 *x11_gc = GDK_GC_X11 (object);
XFreeGC (GDK_GC_XDISPLAY (x11_gc), GDK_GC_XGC (x11_gc));
G_OBJECT_CLASS (_gdk_gc_x11_parent_class)->finalize (object);
}
GdkGC *
_gdk_x11_gc_new (GdkDrawable *drawable,
GdkGCValues *values,
GdkGCValuesMask values_mask)
{
GdkGC *gc;
GdkGCX11 *private;
XGCValues xvalues;
unsigned long xvalues_mask;
/* NOTICE that the drawable here has to be the impl drawable,
* not the publically-visible drawables.
*/
g_return_val_if_fail (GDK_IS_DRAWABLE_IMPL_X11 (drawable), NULL);
gc = g_object_new (_gdk_gc_x11_get_type (), NULL);
private = GDK_GC_X11 (gc);
_gdk_gc_init (gc, drawable, values, values_mask);
private->dirty_mask = 0;
private->have_clip_mask = FALSE;
private->screen = GDK_DRAWABLE_IMPL_X11 (drawable)->screen;
private->depth = gdk_drawable_get_depth (drawable);
if (values_mask & (GDK_GC_CLIP_X_ORIGIN | GDK_GC_CLIP_Y_ORIGIN))
{
values_mask &= ~(GDK_GC_CLIP_X_ORIGIN | GDK_GC_CLIP_Y_ORIGIN);
private->dirty_mask |= GDK_GC_DIRTY_CLIP;
}
if (values_mask & (GDK_GC_TS_X_ORIGIN | GDK_GC_TS_Y_ORIGIN))
{
values_mask &= ~(GDK_GC_TS_X_ORIGIN | GDK_GC_TS_Y_ORIGIN);
private->dirty_mask |= GDK_GC_DIRTY_TS;
}
if ((values_mask & GDK_GC_CLIP_MASK) && values->clip_mask)
private->have_clip_mask = TRUE;
xvalues.function = GXcopy;
xvalues.fill_style = FillSolid;
xvalues.arc_mode = ArcPieSlice;
xvalues.subwindow_mode = ClipByChildren;
xvalues.graphics_exposures = False;
xvalues_mask = GCFunction | GCFillStyle | GCArcMode | GCSubwindowMode | GCGraphicsExposures;
gdk_x11_gc_values_to_xvalues (values, values_mask, &xvalues, &xvalues_mask);
private->xgc = XCreateGC (GDK_GC_XDISPLAY (gc),
GDK_DRAWABLE_IMPL_X11 (drawable)->xid,
xvalues_mask, &xvalues);
return gc;
}
GC
_gdk_x11_gc_flush (GdkGC *gc)
{
Display *xdisplay = GDK_GC_XDISPLAY (gc);
GdkGCX11 *private = GDK_GC_X11 (gc);
GC xgc = private->xgc;
if (private->dirty_mask & GDK_GC_DIRTY_CLIP)
{
cairo_region_t *clip_region = _gdk_gc_get_clip_region (gc);
if (!clip_region)
XSetClipOrigin (xdisplay, xgc,
gc->clip_x_origin, gc->clip_y_origin);
else
{
XRectangle *rectangles;
gint n_rects;
_gdk_region_get_xrectangles (clip_region,
gc->clip_x_origin,
gc->clip_y_origin,
&rectangles,
&n_rects);
XSetClipRectangles (xdisplay, xgc, 0, 0,
rectangles,
n_rects, YXBanded);
g_free (rectangles);
}
}
if (private->dirty_mask & GDK_GC_DIRTY_TS)
{
XSetTSOrigin (xdisplay, xgc,
gc->ts_x_origin, gc->ts_y_origin);
}
private->dirty_mask = 0;
return xgc;
}
static void
gdk_x11_gc_get_values (GdkGC *gc,
GdkGCValues *values)
{
XGCValues xvalues;
if (XGetGCValues (GDK_GC_XDISPLAY (gc), GDK_GC_XGC (gc),
GCForeground | GCBackground | GCFont |
GCFunction | GCTile | GCStipple | /* GCClipMask | */
GCSubwindowMode | GCGraphicsExposures |
GCTileStipXOrigin | GCTileStipYOrigin |
GCClipXOrigin | GCClipYOrigin |
GCLineWidth | GCLineStyle | GCCapStyle |
GCFillStyle | GCJoinStyle, &xvalues))
{
values->foreground.pixel = xvalues.foreground;
values->background.pixel = xvalues.background;
switch (xvalues.function)
{
case GXcopy:
values->function = GDK_COPY;
break;
case GXinvert:
values->function = GDK_INVERT;
break;
case GXxor:
values->function = GDK_XOR;
break;
case GXclear:
values->function = GDK_CLEAR;
break;
case GXand:
values->function = GDK_AND;
break;
case GXandReverse:
values->function = GDK_AND_REVERSE;
break;
case GXandInverted:
values->function = GDK_AND_INVERT;
break;
case GXnoop:
values->function = GDK_NOOP;
break;
case GXor:
values->function = GDK_OR;
break;
case GXequiv:
values->function = GDK_EQUIV;
break;
case GXorReverse:
values->function = GDK_OR_REVERSE;
break;
case GXcopyInverted:
values->function =GDK_COPY_INVERT;
break;
case GXorInverted:
values->function = GDK_OR_INVERT;
break;
case GXnand:
values->function = GDK_NAND;
break;
case GXset:
values->function = GDK_SET;
break;
case GXnor:
values->function = GDK_NOR;
break;
}
switch (xvalues.fill_style)
{
case FillSolid:
values->fill = GDK_SOLID;
break;
case FillTiled:
values->fill = GDK_TILED;
break;
case FillStippled:
values->fill = GDK_STIPPLED;
break;
case FillOpaqueStippled:
values->fill = GDK_OPAQUE_STIPPLED;
break;
}
values->tile = gdk_pixmap_lookup_for_display (GDK_GC_DISPLAY (gc),
xvalues.tile);
values->stipple = gdk_pixmap_lookup_for_display (GDK_GC_DISPLAY (gc),
xvalues.stipple);
values->clip_mask = NULL;
values->subwindow_mode = xvalues.subwindow_mode;
values->ts_x_origin = xvalues.ts_x_origin;
values->ts_y_origin = xvalues.ts_y_origin;
values->clip_x_origin = xvalues.clip_x_origin;
values->clip_y_origin = xvalues.clip_y_origin;
values->graphics_exposures = xvalues.graphics_exposures;
values->line_width = xvalues.line_width;
switch (xvalues.line_style)
{
case LineSolid:
values->line_style = GDK_LINE_SOLID;
break;
case LineOnOffDash:
values->line_style = GDK_LINE_ON_OFF_DASH;
break;
case LineDoubleDash:
values->line_style = GDK_LINE_DOUBLE_DASH;
break;
}
switch (xvalues.cap_style)
{
case CapNotLast:
values->cap_style = GDK_CAP_NOT_LAST;
break;
case CapButt:
values->cap_style = GDK_CAP_BUTT;
break;
case CapRound:
values->cap_style = GDK_CAP_ROUND;
break;
case CapProjecting:
values->cap_style = GDK_CAP_PROJECTING;
break;
}
switch (xvalues.join_style)
{
case JoinMiter:
values->join_style = GDK_JOIN_MITER;
break;
case JoinRound:
values->join_style = GDK_JOIN_ROUND;
break;
case JoinBevel:
values->join_style = GDK_JOIN_BEVEL;
break;
}
}
else
{
memset (values, 0, sizeof (GdkGCValues));
}
}
static void
gdk_x11_gc_set_values (GdkGC *gc,
GdkGCValues *values,
GdkGCValuesMask values_mask)
{
GdkGCX11 *x11_gc;
XGCValues xvalues;
unsigned long xvalues_mask = 0;
x11_gc = GDK_GC_X11 (gc);
if (values_mask & (GDK_GC_CLIP_X_ORIGIN | GDK_GC_CLIP_Y_ORIGIN))
{
values_mask &= ~(GDK_GC_CLIP_X_ORIGIN | GDK_GC_CLIP_Y_ORIGIN);
x11_gc->dirty_mask |= GDK_GC_DIRTY_CLIP;
}
if (values_mask & (GDK_GC_TS_X_ORIGIN | GDK_GC_TS_Y_ORIGIN))
{
values_mask &= ~(GDK_GC_TS_X_ORIGIN | GDK_GC_TS_Y_ORIGIN);
x11_gc->dirty_mask |= GDK_GC_DIRTY_TS;
}
if (values_mask & GDK_GC_CLIP_MASK)
{
x11_gc->have_clip_region = FALSE;
x11_gc->have_clip_mask = values->clip_mask != NULL;
}
gdk_x11_gc_values_to_xvalues (values, values_mask, &xvalues, &xvalues_mask);
XChangeGC (GDK_GC_XDISPLAY (gc),
GDK_GC_XGC (gc),
xvalues_mask,
&xvalues);
}
static void
gdk_x11_gc_set_dashes (GdkGC *gc,
gint dash_offset,
gint8 dash_list[],
gint n)
{
g_return_if_fail (GDK_IS_GC (gc));
g_return_if_fail (dash_list != NULL);
XSetDashes (GDK_GC_XDISPLAY (gc), GDK_GC_XGC (gc),
dash_offset, (char *)dash_list, n);
}
static void
gdk_x11_gc_values_to_xvalues (GdkGCValues *values,
GdkGCValuesMask mask,
XGCValues *xvalues,
unsigned long *xvalues_mask)
{
/* Optimization for the common case (gdk_gc_new()) */
if (values == NULL || mask == 0)
return;
if (mask & GDK_GC_FOREGROUND)
{
xvalues->foreground = values->foreground.pixel;
*xvalues_mask |= GCForeground;
}
if (mask & GDK_GC_BACKGROUND)
{
xvalues->background = values->background.pixel;
*xvalues_mask |= GCBackground;
}
if (mask & GDK_GC_FUNCTION)
{
switch (values->function)
{
case GDK_COPY:
xvalues->function = GXcopy;
break;
case GDK_INVERT:
xvalues->function = GXinvert;
break;
case GDK_XOR:
xvalues->function = GXxor;
break;
case GDK_CLEAR:
xvalues->function = GXclear;
break;
case GDK_AND:
xvalues->function = GXand;
break;
case GDK_AND_REVERSE:
xvalues->function = GXandReverse;
break;
case GDK_AND_INVERT:
xvalues->function = GXandInverted;
break;
case GDK_NOOP:
xvalues->function = GXnoop;
break;
case GDK_OR:
xvalues->function = GXor;
break;
case GDK_EQUIV:
xvalues->function = GXequiv;
break;
case GDK_OR_REVERSE:
xvalues->function = GXorReverse;
break;
case GDK_COPY_INVERT:
xvalues->function = GXcopyInverted;
break;
case GDK_OR_INVERT:
xvalues->function = GXorInverted;
break;
case GDK_NAND:
xvalues->function = GXnand;
break;
case GDK_SET:
xvalues->function = GXset;
break;
case GDK_NOR:
xvalues->function = GXnor;
break;
}
*xvalues_mask |= GCFunction;
}
if (mask & GDK_GC_FILL)
{
switch (values->fill)
{
case GDK_SOLID:
xvalues->fill_style = FillSolid;
break;
case GDK_TILED:
xvalues->fill_style = FillTiled;
break;
case GDK_STIPPLED:
xvalues->fill_style = FillStippled;
break;
case GDK_OPAQUE_STIPPLED:
xvalues->fill_style = FillOpaqueStippled;
break;
}
*xvalues_mask |= GCFillStyle;
}
if (mask & GDK_GC_TILE)
{
if (values->tile)
xvalues->tile = GDK_DRAWABLE_XID (values->tile);
else
xvalues->tile = None;
*xvalues_mask |= GCTile;
}
if (mask & GDK_GC_STIPPLE)
{
if (values->stipple)
xvalues->stipple = GDK_DRAWABLE_XID (values->stipple);
else
xvalues->stipple = None;
*xvalues_mask |= GCStipple;
}
if (mask & GDK_GC_CLIP_MASK)
{
if (values->clip_mask)
xvalues->clip_mask = GDK_DRAWABLE_XID (values->clip_mask);
else
xvalues->clip_mask = None;
*xvalues_mask |= GCClipMask;
}
if (mask & GDK_GC_SUBWINDOW)
{
xvalues->subwindow_mode = values->subwindow_mode;
*xvalues_mask |= GCSubwindowMode;
}
if (mask & GDK_GC_TS_X_ORIGIN)
{
xvalues->ts_x_origin = values->ts_x_origin;
*xvalues_mask |= GCTileStipXOrigin;
}
if (mask & GDK_GC_TS_Y_ORIGIN)
{
xvalues->ts_y_origin = values->ts_y_origin;
*xvalues_mask |= GCTileStipYOrigin;
}
if (mask & GDK_GC_CLIP_X_ORIGIN)
{
xvalues->clip_x_origin = values->clip_x_origin;
*xvalues_mask |= GCClipXOrigin;
}
if (mask & GDK_GC_CLIP_Y_ORIGIN)
{
xvalues->clip_y_origin = values->clip_y_origin;
*xvalues_mask |= GCClipYOrigin;
}
if (mask & GDK_GC_EXPOSURES)
{
xvalues->graphics_exposures = values->graphics_exposures;
*xvalues_mask |= GCGraphicsExposures;
}
if (mask & GDK_GC_LINE_WIDTH)
{
xvalues->line_width = values->line_width;
*xvalues_mask |= GCLineWidth;
}
if (mask & GDK_GC_LINE_STYLE)
{
switch (values->line_style)
{
case GDK_LINE_SOLID:
xvalues->line_style = LineSolid;
break;
case GDK_LINE_ON_OFF_DASH:
xvalues->line_style = LineOnOffDash;
break;
case GDK_LINE_DOUBLE_DASH:
xvalues->line_style = LineDoubleDash;
break;
}
*xvalues_mask |= GCLineStyle;
}
if (mask & GDK_GC_CAP_STYLE)
{
switch (values->cap_style)
{
case GDK_CAP_NOT_LAST:
xvalues->cap_style = CapNotLast;
break;
case GDK_CAP_BUTT:
xvalues->cap_style = CapButt;
break;
case GDK_CAP_ROUND:
xvalues->cap_style = CapRound;
break;
case GDK_CAP_PROJECTING:
xvalues->cap_style = CapProjecting;
break;
}
*xvalues_mask |= GCCapStyle;
}
if (mask & GDK_GC_JOIN_STYLE)
{
switch (values->join_style)
{
case GDK_JOIN_MITER:
xvalues->join_style = JoinMiter;
break;
case GDK_JOIN_ROUND:
xvalues->join_style = JoinRound;
break;
case GDK_JOIN_BEVEL:
xvalues->join_style = JoinBevel;
break;
}
*xvalues_mask |= GCJoinStyle;
}
}
void
_gdk_windowing_gc_set_clip_region (GdkGC *gc,
const cairo_region_t *region,
gboolean reset_origin)
{
GdkGCX11 *x11_gc = GDK_GC_X11 (gc);
/* Unset immediately, to make sure Xlib doesn't keep the
* XID of an old clip mask cached
*/
if ((x11_gc->have_clip_region && !region) || x11_gc->have_clip_mask)
{
XSetClipMask (GDK_GC_XDISPLAY (gc), GDK_GC_XGC (gc), None);
x11_gc->have_clip_mask = FALSE;
}
x11_gc->have_clip_region = region != NULL;
if (reset_origin)
{
gc->clip_x_origin = 0;
gc->clip_y_origin = 0;
}
x11_gc->dirty_mask |= GDK_GC_DIRTY_CLIP;
}
void
_gdk_windowing_gc_copy (GdkGC *dst_gc,
GdkGC *src_gc)
{
GdkGCX11 *x11_src_gc = GDK_GC_X11 (src_gc);
GdkGCX11 *x11_dst_gc = GDK_GC_X11 (dst_gc);
XCopyGC (GDK_GC_XDISPLAY (src_gc), GDK_GC_XGC (src_gc), ~((~1) << GCLastBit),
GDK_GC_XGC (dst_gc));
x11_dst_gc->dirty_mask = x11_src_gc->dirty_mask;
x11_dst_gc->have_clip_region = x11_src_gc->have_clip_region;
x11_dst_gc->have_clip_mask = x11_src_gc->have_clip_mask;
}
/**
* gdk_gc_get_screen:
* @gc: a #GdkGC.
*
* Gets the #GdkScreen for which @gc was created
*
* Returns: the #GdkScreen for @gc.
*
* Since: 2.2
*/
GdkScreen *
gdk_gc_get_screen (GdkGC *gc)
{
g_return_val_if_fail (GDK_IS_GC_X11 (gc), NULL);
return GDK_GC_X11 (gc)->screen;
}
/**
* gdk_x11_gc_get_xdisplay:
* @gc: a #GdkGC.
*
* Returns the display of a #GdkGC.
*
* Return value: an Xlib <type>Display*</type>.
**/
Display *
gdk_x11_gc_get_xdisplay (GdkGC *gc)
{
g_return_val_if_fail (GDK_IS_GC_X11 (gc), NULL);
return GDK_SCREEN_XDISPLAY (gdk_gc_get_screen (gc));
}
/**
* gdk_x11_gc_get_xgc:
* @gc: a #GdkGC.
*
* Returns the X GC of a #GdkGC.
*
* Return value: an Xlib <type>GC</type>.
**/
GC
gdk_x11_gc_get_xgc (GdkGC *gc)
{
GdkGCX11 *gc_x11;
g_return_val_if_fail (GDK_IS_GC_X11 (gc), NULL);
gc_x11 = GDK_GC_X11 (gc);
if (gc_x11->dirty_mask)
_gdk_x11_gc_flush (gc);
return gc_x11->xgc;
}

View File

@ -41,34 +41,8 @@
#include "config.h"
#define GDK_TYPE_GC_X11 (_gdk_gc_x11_get_type ())
#define GDK_GC_X11(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_GC_X11, GdkGCX11))
#define GDK_GC_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_GC_X11, GdkGCX11Class))
#define GDK_IS_GC_X11(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_GC_X11))
#define GDK_IS_GC_X11_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_GC_X11))
#define GDK_GC_X11_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_GC_X11, GdkGCX11Class))
typedef struct _GdkCursorPrivate GdkCursorPrivate;
typedef struct _GdkVisualPrivate GdkVisualPrivate;
typedef struct _GdkGCX11 GdkGCX11;
typedef struct _GdkGCX11Class GdkGCX11Class;
struct _GdkGCX11
{
GdkGC parent_instance;
GC xgc;
GdkScreen *screen;
guint16 dirty_mask;
guint have_clip_region : 1;
guint have_clip_mask : 1;
guint depth : 8;
};
struct _GdkGCX11Class
{
GdkGCClass parent_class;
};
struct _GdkCursorPrivate
{
@ -98,14 +72,8 @@ gint _gdk_send_xevent (GdkDisplay *display,
glong event_mask,
XEvent *event_send);
GType _gdk_gc_x11_get_type (void);
gboolean _gdk_x11_have_render (GdkDisplay *display);
GdkGC *_gdk_x11_gc_new (GdkDrawable *drawable,
GdkGCValues *values,
GdkGCValuesMask values_mask);
/* Routines from gdkgeometry-x11.c */
void _gdk_window_move_resize_child (GdkWindow *window,
gint x,
@ -150,8 +118,6 @@ void _gdk_keymap_add_virtual_modifiers_compat (GdkKeymap *keymap,
gboolean _gdk_keymap_key_is_modifier (GdkKeymap *keymap,
guint keycode);
GC _gdk_x11_gc_flush (GdkGC *gc);
void _gdk_x11_initialize_locale (void);
void _gdk_xgrab_check_unmap (GdkWindow *window,

View File

@ -48,8 +48,6 @@ Display *gdk_x11_cursor_get_xdisplay (GdkCursor *cursor);
Cursor gdk_x11_cursor_get_xcursor (GdkCursor *cursor);
Display *gdk_x11_display_get_xdisplay (GdkDisplay *display);
Visual * gdk_x11_visual_get_xvisual (GdkVisual *visual);
Display *gdk_x11_gc_get_xdisplay (GdkGC *gc);
GC gdk_x11_gc_get_xgc (GdkGC *gc);
Screen * gdk_x11_screen_get_xscreen (GdkScreen *screen);
int gdk_x11_screen_get_screen_number (GdkScreen *screen);
void gdk_x11_window_set_user_time (GdkWindow *window,
@ -86,13 +84,10 @@ gint gdk_x11_get_default_screen (void);
#define GDK_PIXMAP_XID(pix) (GDK_DRAWABLE_IMPL_X11(((GdkPixmapObject *)pix)->impl)->xid)
#define GDK_DRAWABLE_XDISPLAY(win) (GDK_IS_WINDOW (win) ? GDK_WINDOW_XDISPLAY (win) : GDK_PIXMAP_XDISPLAY (win))
#define GDK_DRAWABLE_XID(win) (GDK_IS_WINDOW (win) ? GDK_WINDOW_XID (win) : GDK_PIXMAP_XID (win))
#define GDK_GC_XDISPLAY(gc) (GDK_SCREEN_XDISPLAY(GDK_GC_X11(gc)->screen))
#define GDK_GC_XGC(gc) (GDK_GC_X11(gc)->xgc)
#define GDK_SCREEN_XDISPLAY(screen) (GDK_SCREEN_X11 (screen)->xdisplay)
#define GDK_SCREEN_XSCREEN(screen) (GDK_SCREEN_X11 (screen)->xscreen)
#define GDK_SCREEN_XNUMBER(screen) (GDK_SCREEN_X11 (screen)->screen_num)
#define GDK_VISUAL_XVISUAL(vis) (((GdkVisualPrivate *) vis)->xvisual)
#define GDK_GC_GET_XGC(gc) (GDK_GC_X11(gc)->dirty_mask ? _gdk_x11_gc_flush (gc) : ((GdkGCX11 *)(gc))->xgc)
#define GDK_WINDOW_XWINDOW GDK_DRAWABLE_XID
#else /* GDK_COMPILATION */
@ -110,8 +105,6 @@ gint gdk_x11_get_default_screen (void);
#define GDK_PIXMAP_XID(win) (gdk_x11_drawable_get_xid (win))
#define GDK_DRAWABLE_XDISPLAY(win) (gdk_x11_drawable_get_xdisplay (win))
#define GDK_DRAWABLE_XID(win) (gdk_x11_drawable_get_xid (win))
#define GDK_GC_XDISPLAY(gc) (gdk_x11_gc_get_xdisplay (gc))
#define GDK_GC_XGC(gc) (gdk_x11_gc_get_xgc (gc))
#define GDK_SCREEN_XDISPLAY(screen) (gdk_x11_display_get_xdisplay (gdk_screen_get_display (screen)))
#define GDK_SCREEN_XSCREEN(screen) (gdk_x11_screen_get_xscreen (screen))
#define GDK_SCREEN_XNUMBER(screen) (gdk_x11_screen_get_screen_number (screen))