aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/ImageControl.cc
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2004-01-02 22:19:39 (GMT)
committerfluxgen <fluxgen>2004-01-02 22:19:39 (GMT)
commita5be2ef67d91f2cba7551e3a52a6b989c87e8611 (patch)
treef51caab62bb1b3994f649dafbd79848bd23d7f9c /src/FbTk/ImageControl.cc
parentb9049cefad82bd62a663e4ae4048d7574563bdfc (diff)
downloadfluxbox_pavel-a5be2ef67d91f2cba7551e3a52a6b989c87e8611.zip
fluxbox_pavel-a5be2ef67d91f2cba7551e3a52a6b989c87e8611.tar.bz2
textured pixmap cache fix
Diffstat (limited to 'src/FbTk/ImageControl.cc')
-rw-r--r--src/FbTk/ImageControl.cc31
1 files changed, 22 insertions, 9 deletions
diff --git a/src/FbTk/ImageControl.cc b/src/FbTk/ImageControl.cc
index 783f7a7..977d899 100644
--- a/src/FbTk/ImageControl.cc
+++ b/src/FbTk/ImageControl.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: ImageControl.cc,v 1.7 2004/01/02 13:28:00 fluxgen Exp $ 25// $Id: ImageControl.cc,v 1.8 2004/01/02 22:19:39 fluxgen Exp $
26 26
27#include "ImageControl.hh" 27#include "ImageControl.hh"
28 28
@@ -150,15 +150,27 @@ ImageControl::~ImageControl() {
150 150
151 151
152Pixmap ImageControl::searchCache(unsigned int width, unsigned int height, 152Pixmap ImageControl::searchCache(unsigned int width, unsigned int height,
153 unsigned long texture_type, 153 const Texture &text) const {
154 const FbTk::Color &color, const FbTk::Color &color_to) const {
155 154
155 if (text.pixmap().drawable() != None) {
156 // do comparsion with width/height and texture_pixmap
157 CacheList::iterator it = cache.begin();
158 CacheList::iterator it_end = cache.end();
159 for (; it != it_end; ++it) {
160 if ((*it)->texture_pixmap = text.pixmap().drawable() &&
161 (*it)->width == width && (*it)->height == height)
162 return (*it)->pixmap;
163 }
164 return None;
165 }
166
156 Cache tmp; 167 Cache tmp;
168 tmp.texture_pixmap = text.pixmap().drawable();
157 tmp.width = width; 169 tmp.width = width;
158 tmp.height = height; 170 tmp.height = height;
159 tmp.texture = texture_type; 171 tmp.texture = text.type();
160 tmp.pixel1 = color.pixel(); 172 tmp.pixel1 = text.color().pixel();
161 tmp.pixel2 = color_to.pixel(); 173 tmp.pixel2 = text.colorTo().pixel();
162 CacheList::iterator it = cache.find(&tmp); 174 CacheList::iterator it = cache.find(&tmp);
163 if (it == cache.end()) { 175 if (it == cache.end()) {
164 return None; 176 return None;
@@ -179,10 +191,10 @@ Pixmap ImageControl::renderImage(unsigned int width, unsigned int height,
179 return ParentRelative; 191 return ParentRelative;
180 192
181 // search cache first 193 // search cache first
182 Pixmap pixmap = searchCache(width, height, texture.type(), 194 Pixmap pixmap = searchCache(width, height, texture);
183 texture.color(), texture.colorTo()); 195 if (pixmap) {
184 if (pixmap)
185 return pixmap; // return cache item 196 return pixmap; // return cache item
197 }
186 198
187 // render new image 199 // render new image
188 TextureRender image(*this, width, height, m_colors, m_num_colors); 200 TextureRender image(*this, width, height, m_colors, m_num_colors);
@@ -194,6 +206,7 @@ Pixmap ImageControl::renderImage(unsigned int width, unsigned int height,
194 Cache *tmp = new Cache; 206 Cache *tmp = new Cache;
195 207
196 tmp->pixmap = pixmap; 208 tmp->pixmap = pixmap;
209 tmp->texture_pixmap = texture.pixmap().drawable();
197 tmp->width = width; 210 tmp->width = width;
198 tmp->height = height; 211 tmp->height = height;
199 tmp->count = 1; 212 tmp->count = 1;