/*
* tkGC.c --
*
* This file maintains a database of read-only graphics contexts
* for the Tk toolkit, in order to allow GC's to be shared.
*
* Copyright (c) 1990-1994 The Regents of the University of California.
* Copyright (c) 1994 Sun Microsystems, Inc.
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* SCCS: @(#) tkGC.c 1.18 96/02/15 18:53:32
*/
#include "tkInt.h"
/*
* One of the following data structures exists for each GC that is
* currently active. The structure is indexed with two hash tables,
* one based on the values in the graphics context and the other
* based on the display and GC identifier.
*/
typedef struct {
* this structure). */
} TkGC;
/*
* Hash table to map from a GC's values to a TkGC structure describing
* a GC with those values (used by Tk_GetGC).
*/
typedef struct {
} ValueKey;
/*
* Hash table for <display + GC> -> TkGC mapping. This table is used by
* Tk_FreeGC.
*/
typedef struct {
} IdKey;
* initialized yet. */
/*
* Forward declarations for procedures defined in this file:
*/
static void GCInit _ANSI_ARGS_((void));
/*
*----------------------------------------------------------------------
*
* Tk_GetGC --
*
* Given a desired set of values for a graphics context, find
* a read-only graphics context with the desired values.
*
* Results:
* The return value is the X identifer for the desired graphics
* context. The caller should never modify this GC, and should
* call Tk_FreeGC when the GC is no longer needed.
*
* Side effects:
* The GC is added to an internal database with a reference count.
* For each call to this procedure, there should eventually be a call
* to Tk_FreeGC, so that the database can be cleaned up when GC's
* aren't needed anymore.
*
*----------------------------------------------------------------------
*/
register unsigned long valueMask;
/* 1 bits correspond to values specified
* in *valuesPtr; other values are set
* from defaults. */
/* Values are specified here for bits set
* in valueMask. */
{
int new;
if (!initialized) {
GCInit();
}
/*
* Must zero valueKey at start to clear out pad bytes that may be
* part of structure on some systems.
*/
/*
* First, check to see if there's already a GC that will work
* for this request (exact matches only, sorry).
*/
if (valueMask & GCFunction) {
} else {
}
if (valueMask & GCPlaneMask) {
} else {
}
if (valueMask & GCForeground) {
} else {
}
if (valueMask & GCBackground) {
} else {
}
if (valueMask & GCLineWidth) {
} else {
}
if (valueMask & GCLineStyle) {
} else {
}
if (valueMask & GCCapStyle) {
} else {
}
if (valueMask & GCJoinStyle) {
} else {
}
if (valueMask & GCFillStyle) {
} else {
}
if (valueMask & GCFillRule) {
} else {
}
} else {
}
} else {
}
} else {
}
if (valueMask & GCTileStipXOrigin) {
} else {
}
if (valueMask & GCTileStipYOrigin) {
} else {
}
} else {
}
if (valueMask & GCSubwindowMode) {
} else {
}
if (valueMask & GCGraphicsExposures) {
} else {
}
if (valueMask & GCClipXOrigin) {
} else {
}
if (valueMask & GCClipYOrigin) {
} else {
}
if (valueMask & GCClipMask) {
} else {
}
if (valueMask & GCDashOffset) {
} else {
}
if (valueMask & GCDashList) {
} else {
}
if (!new) {
}
/*
* No GC is currently available for this set of values. Allocate a
* new GC and add a new structure to the database.
*/
/*
* Find or make a drawable to use to specify the screen and depth
* of the GC. We may have to make a small pixmap, to avoid doing
* Tk_MakeWindowExist on the window.
*/
freeDrawable = None;
d = Tk_WindowId(tkwin);
} else {
freeDrawable = d;
}
if (!new) {
panic("GC already registered in Tk_GetGC");
}
if (freeDrawable != None) {
}
}
/*
*----------------------------------------------------------------------
*
* Tk_FreeGC --
*
* This procedure is called to release a graphics context allocated by
* Tk_GetGC.
*
* Results:
* None.
*
* Side effects:
* The reference count associated with gc is decremented, and
* gc is officially deallocated if no-one is using it anymore.
*
*----------------------------------------------------------------------
*/
void
{
if (!initialized) {
panic("Tk_FreeGC called before Tk_GetGC");
}
panic("Tk_FreeGC received unknown gc argument");
}
}
}
/*
*----------------------------------------------------------------------
*
* GCInit --
*
* Initialize the structures used for GC management.
*
* Results:
* None.
*
* Side effects:
* Read the code.
*
*----------------------------------------------------------------------
*/
static void
GCInit()
{
initialized = 1;
}