From 08bd38e78324446e6e1775d97e198eef2b1b870f Mon Sep 17 00:00:00 2001 From: Scott Moynes Date: Sat, 1 Feb 2003 06:24:11 +0000 Subject: [PATCH] Fixed the image cache when dealing with borders. --- CHANGELOG | 3 +++ src/Image.hh | 5 +++-- src/ImageControl.cc | 18 ++++++++++++++---- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index c6b9629e..358f29c0 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,9 @@ Changelog for Openbox: 2.2.4: + * Fixed a bug in the image cache that would draw (Scott Moynes) + borders incorrectly in rare circumstances. + * Draw window titles in the titlebars and toolbar with (Ben Jansens) UTF encoding when they are set with the NETWM (UTF) hints. diff --git a/src/Image.hh b/src/Image.hh index 94cb3c60..b496b2aa 100644 --- a/src/Image.hh +++ b/src/Image.hh @@ -91,7 +91,7 @@ public: Pixmap pixmap; unsigned int count, width, height; - unsigned long pixel1, pixel2, texture; + unsigned long pixel1, pixel2, texture, borderColor; }; BImageControl(BaseDisplay *dpy, const ScreenInfo *scrn, @@ -160,7 +160,8 @@ private: Pixmap searchCache(const unsigned int width, const unsigned int height, const unsigned long texture, - const BColor &c1, const BColor &c2); + const BColor &c1, const BColor &c2, + const BColor &borderColor); }; diff --git a/src/ImageControl.cc b/src/ImageControl.cc index c93a40f9..59387b00 100644 --- a/src/ImageControl.cc +++ b/src/ImageControl.cc @@ -394,7 +394,8 @@ BImageControl::~BImageControl(void) { Pixmap BImageControl::searchCache(const unsigned int width, const unsigned int height, const unsigned long texture, - const BColor &c1, const BColor &c2) { + const BColor &c1, const BColor &c2, + const BColor &bc) { if (cache.empty()) return None; @@ -404,11 +405,14 @@ Pixmap BImageControl::searchCache(const unsigned int width, CachedImage& tmp = *it; if (tmp.width == width && tmp.height == height && tmp.texture == texture && tmp.pixel1 == c1.pixel()) - if (texture & BTexture::Gradient) { - if (tmp.pixel2 == c2.pixel()) { + if (texture & BTexture::Gradient && tmp.pixel2 == c2.pixel()) { + if(texture & BTexture::Border && tmp.borderColor == bc.pixel()){ tmp.count++; return tmp.pixmap; } + } else if(texture & BTexture::Border && tmp.borderColor == bc.pixel()){ + tmp.count++; + return tmp.pixmap; } else { tmp.count++; return tmp.pixmap; @@ -423,7 +427,8 @@ Pixmap BImageControl::renderImage(unsigned int width, unsigned int height, if (texture.texture() & BTexture::Parent_Relative) return ParentRelative; Pixmap pixmap = searchCache(width, height, texture.texture(), - texture.color(), texture.colorTo()); + texture.color(), texture.colorTo(), + texture.borderColor()); if (pixmap) return pixmap; BImage image(this, width, height); @@ -446,6 +451,11 @@ Pixmap BImageControl::renderImage(unsigned int width, unsigned int height, else tmp.pixel2 = 0l; + if (texture.texture() & BTexture::Border) + tmp.borderColor = texture.borderColor().pixel(); + else + tmp.borderColor = 0l; + cache.push_back(tmp); if (cache.size() > cache_max) { -- 2.34.1