X11workbench Toolkit
1.0
|
internal wrapper struct for GC with local cache More...
#include <window_helper.h>
Data Fields | |
Display * | display |
the Display associated with the WBGC (NULL implies 'Default Display') | |
Drawable | dw |
the Drawable for which this WBGC was created (None implies default Window) | |
GC | gc |
the associated 'GC' | |
XGCValues | values |
cached XGCValues for the GC | |
WB_FONT | pFont |
cached default font | |
Region | clip_rgn |
clipping region (or None to use clip_image) - owned by the object | |
XImage * | clip_image |
cached XImage for the GC, for 'clip mask' | |
XImage * | tile_image |
cached XImage for the GC, for 'tile' | |
XImage * | stip_image |
cached XImage for the GC, for 'stipple' | |
internal wrapper struct for GC with local cache
The WBGC structure has been defined for a couple of reasons: First, it is a similar concept to using 'HDC' in Win32, so it can help to translate all of the GC-related operations in a 1:1 manner for Win32; Second, it enables the toolkit to cache locally EVERYTHING that might enhance performance for X11 implmentations. Win-Win.
The biggest single performance problem in X11 exists when you want to use a remote client and also want to enhance operations beyond the simple features that are natively supported by an X server, things like anti-aliasing and transparency [for example]. In order to simplify implementing these things in a way that does NOT impact performance is to cache everything locally that might otherwise result in an RPC-like call into the X Server. The single slowest operation in this case is obtaining an XImage from a Pixmap or Window, and so this is specifically cached in the toolkit. Additionally, functions that can perform operations on these resources locally (rather than remotely) can then leverage the cached information, often giving you a significant performance boost.
The only down side is the additional housekeeping needed to track all of this.
It is generally safe to query the 'values' member in order to get cached information about the WBGC. You should not change them, however.
The XOrg documentation defines the XGCValues structure as follows:
Additional information regarding the drawing of lines
The XOrg 'manual page' documentation for XGCValues also includes the following information (slightly edited):
To be fair, the use of a line width of zero in the X11Workbench Toolkit is NOT recommended. The XImage code will assume zero implies width=1.
Also, an algorithm that allows the 'touching' of the same point many times is not impractical with an XImage; that is, the amount of code needed to check if a point were touched or will be touched is more computationally expensive than 'just touching it anyway'. As such, the XImage code may 'touch' a point multiple times, depending. For video hardware, especially accelerated video hardware, this could be a performance hit. But when using an XImage as a backing store for the window contents, it makes more sense to simply draw it anyway.
Additional information can be found in the aforementioned manual page.
Definition at line 363 of file window_helper.h.