aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/ImageControl.hh
diff options
context:
space:
mode:
authorMathias Gumz <akira at fluxbox dot org>2008-01-14 22:27:00 (GMT)
committerMathias Gumz <akira at fluxbox dot org>2008-01-14 22:27:00 (GMT)
commite1db89e2d7d56afca5335550ee1c9ff87fd54ba4 (patch)
tree779b52814dedd08eb56d1875cb2f97bbcdd39e8b /src/FbTk/ImageControl.hh
parentc6099d777d844699fb8a4243921159898bc4f45c (diff)
downloadfluxbox_pavel-e1db89e2d7d56afca5335550ee1c9ff87fd54ba4.zip
fluxbox_pavel-e1db89e2d7d56afca5335550ee1c9ff87fd54ba4.tar.bz2
moved code a bit around, cleaned up some classes
Diffstat (limited to 'src/FbTk/ImageControl.hh')
-rw-r--r--src/FbTk/ImageControl.hh42
1 files changed, 11 insertions, 31 deletions
diff --git a/src/FbTk/ImageControl.hh b/src/FbTk/ImageControl.hh
index d754a07..3c3cbb1 100644
--- a/src/FbTk/ImageControl.hh
+++ b/src/FbTk/ImageControl.hh
@@ -25,16 +25,17 @@
25#ifndef FBTK_IMAGECONTROL_HH 25#ifndef FBTK_IMAGECONTROL_HH
26#define FBTK_IMAGECONTROL_HH 26#define FBTK_IMAGECONTROL_HH
27 27
28// actually, Text is rather tool like, that's where orientation comes from 28#include "Text.hh" // actually, Text is rather tool like, that's where orientation comes from
29#include "Text.hh"
30#include "Texture.hh"
31#include "Timer.hh" 29#include "Timer.hh"
32#include "NotCopyable.hh" 30#include "NotCopyable.hh"
33 31
32#include <X11/Xlib.h> // for Visual* etc
34#include <list> 33#include <list>
35 34
36namespace FbTk { 35namespace FbTk {
37 36
37class Texture;
38
38/// Holds screen info, color tables and caches textures 39/// Holds screen info, color tables and caches textures
39class ImageControl: private NotCopyable { 40class ImageControl: private NotCopyable {
40public: 41public:
@@ -47,7 +48,7 @@ public:
47 int bitsPerPixel() const { return bits_per_pixel; } 48 int bitsPerPixel() const { return bits_per_pixel; }
48#endif 49#endif
49 int depth() const { return m_screen_depth; } 50 int depth() const { return m_screen_depth; }
50 int colorsPerChannel() const { return m_colors_per_channel; } 51 int colorsPerChannel() const { return m_colors_per_channel; }
51 int screenNumber() const { return m_screen_num; } 52 int screenNumber() const { return m_screen_num; }
52 Visual *visual() const { return m_visual; } 53 Visual *visual() const { return m_visual; }
53 unsigned long getSqrt(unsigned int val) const; 54 unsigned long getSqrt(unsigned int val) const;
@@ -103,39 +104,18 @@ private:
103 int m_colors_per_channel; ///< number of colors per channel 104 int m_colors_per_channel; ///< number of colors per channel
104 int m_screen_depth; ///< bit depth of screen 105 int m_screen_depth; ///< bit depth of screen
105 int m_screen_num; ///< screen number 106 int m_screen_num; ///< screen number
106 unsigned char red_color_table[256], green_color_table[256], 107 unsigned char red_color_table[256];
107 blue_color_table[256]; 108 unsigned char green_color_table[256];
109 unsigned char blue_color_table[256];
110
108 unsigned int *grad_xbuffer, *grad_ybuffer, grad_buffer_width, 111 unsigned int *grad_xbuffer, *grad_ybuffer, grad_buffer_width,
109 grad_buffer_height; 112 grad_buffer_height;
110 113
111 static unsigned long *sqrt_table; /// sqrt lookup table 114 struct Cache;
112
113 typedef struct Cache {
114 Pixmap pixmap;
115 Pixmap texture_pixmap;
116 Orientation orient;
117 unsigned int count, width, height;
118 unsigned long pixel1, pixel2, texture;
119 } Cache;
120
121 struct ltCacheEntry {
122 bool operator()(const Cache* s1, const Cache* s2) const {
123 return (s1->orient < s2->orient || s1->orient == s2->orient
124 && (s1->width < s2->width || s1->width == s2->width
125 && (s1->height < s2->height || s1->height == s2->height
126 && (s1->texture < s2->texture || s1->texture == s2->texture
127 && (s1->pixel1 < s2->pixel1 || s1->pixel1 == s2->pixel1
128 && ((s1->texture & FbTk::Texture::GRADIENT) && s1->pixel2 < s2->pixel2)
129 )))));
130 }
131 };
132
133
134 unsigned long cache_max;
135 typedef std::list<Cache *> CacheList; 115 typedef std::list<Cache *> CacheList;
136 116
137 mutable CacheList cache; 117 mutable CacheList cache;
138 static bool s_timed_cache; 118 unsigned long cache_max;
139}; 119};
140 120
141} // end namespace FbTk 121} // end namespace FbTk