X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=otk%2Frendercolor.cc;h=5917b00732bba72a70ebb08c10946c3deaad1fba;hb=4ef15148365c223b8e810611a10dc27dc5fba355;hp=bfc8d46104356135af96b526528b72c985a12871;hpb=75e8fc2705d9c606a702eb7057e9e503be90618b;p=chaz%2Fopenbox diff --git a/otk/rendercolor.cc b/otk/rendercolor.cc index bfc8d461..5917b007 100644 --- a/otk/rendercolor.cc +++ b/otk/rendercolor.cc @@ -1,13 +1,13 @@ // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*- -#ifdef HAVE_CONFIG_H -# include "../config.h" -#endif // HAVE_CONFIG_H +#include "config.h" #include "rendercolor.hh" #include "display.hh" #include "screeninfo.hh" +#include + namespace otk { std::map *RenderColor::_cache = 0; @@ -52,6 +52,7 @@ void RenderColor::create() if (item) { _gc = item->gc; + _pixel = item->pixel; ++item->count; } else { XGCValues gcv; @@ -71,21 +72,24 @@ void RenderColor::create() xcol.pixel = 0; } - gcv.foreground = xcol.pixel; + _pixel = xcol.pixel; + gcv.foreground = _pixel; gcv.cap_style = CapProjecting; _gc = XCreateGC(**display, info->rootWindow(), GCForeground | GCCapStyle, &gcv); assert(_gc); // insert into the cache - _cache[_screen][color] = new CacheItem(_gc); + item = new CacheItem(_gc, _pixel); + _cache[_screen][color] = item; + ++item->count; } } RenderColor::~RenderColor() { unsigned long color = _blue | _green << 8 | _red << 16; - + CacheItem *item = _cache[_screen][color]; assert(item); // it better be in the cache ...