all repos — fluxbox @ a5be2ef67d91f2cba7551e3a52a6b989c87e8611

custom fork of the fluxbox windowmanager

textured pixmap cache fix
fluxgen fluxgen
commit

a5be2ef67d91f2cba7551e3a52a6b989c87e8611

parent

b9049cefad82bd62a663e4ae4048d7574563bdfc

2 files changed, 29 insertions(+), 20 deletions(-)

jump to
M src/FbTk/ImageControl.ccsrc/FbTk/ImageControl.cc

@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: ImageControl.cc,v 1.7 2004/01/02 13:28:00 fluxgen Exp $ +// $Id: ImageControl.cc,v 1.8 2004/01/02 22:19:39 fluxgen Exp $ #include "ImageControl.hh"

@@ -150,15 +150,27 @@ }

Pixmap ImageControl::searchCache(unsigned int width, unsigned int height, - unsigned long texture_type, - const FbTk::Color &color, const FbTk::Color &color_to) const { + const Texture &text) const { + if (text.pixmap().drawable() != None) { + // do comparsion with width/height and texture_pixmap + CacheList::iterator it = cache.begin(); + CacheList::iterator it_end = cache.end(); + for (; it != it_end; ++it) { + if ((*it)->texture_pixmap = text.pixmap().drawable() && + (*it)->width == width && (*it)->height == height) + return (*it)->pixmap; + } + return None; + } + Cache tmp; + tmp.texture_pixmap = text.pixmap().drawable(); tmp.width = width; tmp.height = height; - tmp.texture = texture_type; - tmp.pixel1 = color.pixel(); - tmp.pixel2 = color_to.pixel(); + tmp.texture = text.type(); + tmp.pixel1 = text.color().pixel(); + tmp.pixel2 = text.colorTo().pixel(); CacheList::iterator it = cache.find(&tmp); if (it == cache.end()) { return None;

@@ -179,10 +191,10 @@ if (texture.type() & FbTk::Texture::PARENTRELATIVE)

return ParentRelative; // search cache first - Pixmap pixmap = searchCache(width, height, texture.type(), - texture.color(), texture.colorTo()); - if (pixmap) + Pixmap pixmap = searchCache(width, height, texture); + if (pixmap) { return pixmap; // return cache item + } // render new image TextureRender image(*this, width, height, m_colors, m_num_colors);

@@ -194,6 +206,7 @@

Cache *tmp = new Cache; tmp->pixmap = pixmap; + tmp->texture_pixmap = texture.pixmap().drawable(); tmp->width = width; tmp->height = height; tmp->count = 1;
M src/FbTk/ImageControl.hhsrc/FbTk/ImageControl.hh

@@ -22,7 +22,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: ImageControl.hh,v 1.7 2004/01/02 13:27:29 fluxgen Exp $ +// $Id: ImageControl.hh,v 1.8 2004/01/02 22:19:39 fluxgen Exp $ #ifndef FBTK_IMAGECONTROL_HH #define FBTK_IMAGECONTROL_HH

@@ -79,8 +79,7 @@ /**

Search cache for a specific pixmap @return None if no cache was found */ - Pixmap searchCache(unsigned int width, unsigned int height, unsigned long texture_type, - const FbTk::Color &color, const FbTk::Color &color_to) const; + Pixmap searchCache(unsigned int width, unsigned int height, const Texture &text) const; void createColorTable(); bool m_dither;

@@ -109,24 +108,21 @@ static unsigned long *sqrt_table; /// sqrt lookup table

typedef struct Cache { Pixmap pixmap; - + Pixmap texture_pixmap; unsigned int count, width, height; unsigned long pixel1, pixel2, texture; } Cache; - struct ltCacheEntry - { - bool operator()(const Cache* s1, const Cache* s2) const - { - return - (s1->width < s2->width || s1->width == s2->width && + struct ltCacheEntry { + bool operator()(const Cache* s1, const Cache* s2) const { + return (s1->width < s2->width || s1->width == s2->width && (s1->height < s2->height || s1->height == s2->height && (s1->texture < s2->texture || s1->texture == s2->texture && s1->pixel1 < s2->pixel1 || s1->pixel1 == s2->pixel1 && (s1->texture & FbTk::Texture::GRADIENT) && s1->pixel2 < s2->pixel2) )); - } + } };