aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk/ImageControl.hh
diff options
context:
space:
mode:
authorMathias Gumz <akira at fluxbox dot org>2010-09-17 13:34:12 (GMT)
committerMathias Gumz <akira at fluxbox dot org>2010-09-17 13:34:12 (GMT)
commite84c64f7be701e04ec2a2e0fbf980aa4fc9685ad (patch)
treec290b1e8e86e655e3b37e92477d9cab080243b1f /src/FbTk/ImageControl.hh
parent603b36a2ccfb6f825dff7259c4d5397c896cc08e (diff)
downloadfluxbox_pavel-e84c64f7be701e04ec2a2e0fbf980aa4fc9685ad.zip
fluxbox_pavel-e84c64f7be701e04ec2a2e0fbf980aa4fc9685ad.tar.bz2
lots of code cleanup, reordering, trimming public API, bugfixes
## FbTk/ImageControl.hh: * moved 'getSqrt()' over to TextureRender.cc because it is used only there * removed unused members m_root_window * use std::vector<> for colors and for the gradient buffers. ## FbTk/ImageControl.cc: * fixed memory leak in '~ImageControl', 'pixels' where not deleted[] at all. switched to std::vector, non-issue anymore. * moved identical code into functions 'allocateUnallocatedColors', 'initColortables' ## FbTk/TextureRenderer: * removed 'from', 'to', 'interlaced' from class, only used in 'renderGradient()' and are actually part of the given texture. * removed 'xtable', 'ytable' from class, only used in 'renderGradient()' * removed 'colors' from the class, is part of 'control' * moved render actions (invert, bevel1, bevel2, *gradient), they need more love but for now this is sufficient
Diffstat (limited to 'src/FbTk/ImageControl.hh')
-rw-r--r--src/FbTk/ImageControl.hh19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/FbTk/ImageControl.hh b/src/FbTk/ImageControl.hh
index b7b90f7..747525b 100644
--- a/src/FbTk/ImageControl.hh
+++ b/src/FbTk/ImageControl.hh
@@ -30,7 +30,9 @@
30#include "NotCopyable.hh" 30#include "NotCopyable.hh"
31 31
32#include <X11/Xlib.h> // for Visual* etc 32#include <X11/Xlib.h> // for Visual* etc
33
33#include <list> 34#include <list>
35#include <vector>
34 36
35namespace FbTk { 37namespace FbTk {
36 38
@@ -45,9 +47,10 @@ public:
45 47
46 int depth() const { return m_screen_depth; } 48 int depth() const { return m_screen_depth; }
47 int colorsPerChannel() const { return m_colors_per_channel; } 49 int colorsPerChannel() const { return m_colors_per_channel; }
50 size_t nrColors() const { return m_colors.size(); }
51 const XColor* colors() const { return &m_colors[0]; }
48 int screenNumber() const { return m_screen_num; } 52 int screenNumber() const { return m_screen_num; }
49 Visual *visual() const { return m_visual; } 53 Visual *visual() const { return m_visual; }
50 unsigned long getSqrt(unsigned int val) const;
51 54
52 /** 55 /**
53 Render to pixmap 56 Render to pixmap
@@ -84,24 +87,24 @@ private:
84 87
85 Colormap m_colormap; 88 Colormap m_colormap;
86 89
87 Window m_root_window; 90 std::vector<XColor> m_colors; ///< color table
88
89 XColor *m_colors; ///< color table
90 unsigned int m_num_colors; ///< number of colors in color table
91 91
92 Visual *m_visual; 92 Visual *m_visual;
93 93
94 int bits_per_pixel, red_offset, green_offset, blue_offset, 94 int bits_per_pixel;
95 int red_offset, green_offset, blue_offset,
95 red_bits, green_bits, blue_bits; 96 red_bits, green_bits, blue_bits;
96 int m_colors_per_channel; ///< number of colors per channel 97 int m_colors_per_channel; ///< number of colors per channel
97 int m_screen_depth; ///< bit depth of screen 98 int m_screen_depth; ///< bit depth of screen
98 int m_screen_num; ///< screen number 99 int m_screen_num; ///< screen number
100
99 unsigned char red_color_table[256]; 101 unsigned char red_color_table[256];
100 unsigned char green_color_table[256]; 102 unsigned char green_color_table[256];
101 unsigned char blue_color_table[256]; 103 unsigned char blue_color_table[256];
102 104
103 unsigned int *grad_xbuffer, *grad_ybuffer, grad_buffer_width, 105 // TextureRenderer uses these buffers
104 grad_buffer_height; 106 std::vector<unsigned int> grad_xbuffer;
107 std::vector<unsigned int> grad_ybuffer;
105 108
106 struct Cache; 109 struct Cache;
107 typedef std::list<Cache *> CacheList; 110 typedef std::list<Cache *> CacheList;