]>
Dogcows Code - chaz/openbox/blob - otk_c/gccache.h
1 // -*- mode: C; indent-tabs-mode: nil; c-basic-offset: 2; -*-
10 struct OtkGCCacheItem
;
12 typedef struct OtkGCCacheContext
{
23 OtkGCCacheContext
*OtkGCCacheContext_New();
24 void OtkGCCacheContext_Destroy(OtkGCCacheContext
*self
);
26 void OtkGCCacheContext_Set(OtkGCCacheContext
*self
,
27 OtkColor
*color
, XFontStruct
*font
,
28 int function
, int subwindow
, int linewidth
);
29 void OtkGCCacheContext_SetFont(OtkGCCacheContext
*self
,
33 typedef struct OtkGCCacheItem
{
34 OtkGCCacheContext
*ctx
;
40 OtkGCCacheItem
*OtkGCCacheItem_New();
43 typedef struct OtkGCCache
{
44 // this is closely modelled after the Qt GC cache, but with some of the
45 // complexity stripped out
46 unsigned int context_count
;
47 unsigned int cache_size
;
48 unsigned int cache_buckets
;
49 unsigned int cache_total_size
;
50 OtkGCCacheContext
**contexts
;
51 OtkGCCacheItem
**cache
;
54 void OtkGCCache_Initialize();
55 //void OtkGCCache_Destroy();
57 // cleans up the cache
58 void OtkGCCache_Purge();
60 OtkGCCacheItem
*OtkGCCache_Find(OtkColor
*color
,
61 XFontStruct
*font
, int function
,
62 int subwindow
, int linewidth
);
63 void OtkGCCache_Release(OtkGCCacheItem
*item
);
71 inline BPen(const BColor &_color, const XFontStruct * const _font = 0,
72 int _linewidth = 0, int _function = GXcopy,
73 int _subwindow = ClipByChildren)
74 : color(_color), font(_font), linewidth(_linewidth), function(_function),
75 subwindow(_subwindow), cache(OBDisplay::gcCache()), item(0) { }
77 inline ~BPen(void) { if (item) cache->release(item); }
79 inline const GC &gc(void) const {
80 if (! item) item = cache->find(color, font, function, subwindow,
87 const XFontStruct *font;
92 mutable BGCCache *cache;
93 mutable BGCCacheItem *item;
This page took 0.03733 seconds and 4 git commands to generate.