aboutsummaryrefslogtreecommitdiff
path: root/src/FbTk
diff options
context:
space:
mode:
authorMathias Gumz <akira at fluxbox dot org>2013-01-13 11:25:00 (GMT)
committerMathias Gumz <akira at fluxbox dot org>2013-01-13 11:25:00 (GMT)
commit8143b86fece2d9be45113db8a1781231ac67c2a2 (patch)
tree231fa2fc64e1ba1ebb2d8ca6982428a8a088cf8f /src/FbTk
parent13b9ee09ee1a8d2423baa0f4f84f5509e389023a (diff)
downloadfluxbox-8143b86fece2d9be45113db8a1781231ac67c2a2.zip
fluxbox-8143b86fece2d9be45113db8a1781231ac67c2a2.tar.bz2
improved code documentation
Diffstat (limited to 'src/FbTk')
-rw-r--r--src/FbTk/Color.cc16
-rw-r--r--src/FbTk/Color.hh1
2 files changed, 3 insertions, 14 deletions
diff --git a/src/FbTk/Color.cc b/src/FbTk/Color.cc
index b2d61ec..ea3f04e 100644
--- a/src/FbTk/Color.cc
+++ b/src/FbTk/Color.cc
@@ -31,14 +31,6 @@ using std::cerr;
31using std::endl; 31using std::endl;
32using std::string; 32using std::string;
33 33
34namespace {
35
36inline unsigned char maxValue(unsigned short colval) {
37 return colval == 65535 ? 0xFF : static_cast<unsigned char>(colval/0xFF);
38}
39
40}
41
42namespace FbTk { 34namespace FbTk {
43 35
44Color::Color(): 36Color::Color():
@@ -96,9 +88,7 @@ bool Color::setFromString(const char *color_string, int screen) {
96 return false; 88 return false;
97 89
98 setPixel(color.pixel); 90 setPixel(color.pixel);
99 setRGB(maxValue(color.red), 91 setRGB(color.red / 256, color.green / 256, color.blue / 256);
100 maxValue(color.green),
101 maxValue(color.blue));
102 setAllocated(true); 92 setAllocated(true);
103 m_screen = screen; 93 m_screen = screen;
104 94
@@ -168,9 +158,7 @@ void Color::allocate(unsigned short red, unsigned short green, unsigned short bl
168 cerr<<"FbTk::Color: "<<_FBTK_CONSOLETEXT(Error, ColorAllocation, "Allocation error.", "XAllocColor failed...")<<endl; 158 cerr<<"FbTk::Color: "<<_FBTK_CONSOLETEXT(Error, ColorAllocation, "Allocation error.", "XAllocColor failed...")<<endl;
169 } else { 159 } else {
170 free(); 160 free();
171 setRGB(maxValue(color.red), 161 setRGB(color.red / 256, color.green / 256, color.blue / 256);
172 maxValue(color.green),
173 maxValue(color.blue));
174 setPixel(color.pixel); 162 setPixel(color.pixel);
175 setAllocated(true); 163 setAllocated(true);
176 } 164 }
diff --git a/src/FbTk/Color.hh b/src/FbTk/Color.hh
index 588fcc1..151390e 100644
--- a/src/FbTk/Color.hh
+++ b/src/FbTk/Color.hh
@@ -63,6 +63,7 @@ private:
63 void setRGB(unsigned short red, unsigned short green, unsigned short blue); 63 void setRGB(unsigned short red, unsigned short green, unsigned short blue);
64 64
65 65
66 // stored in [0 - 255] range
66 unsigned short m_red, m_green, m_blue; 67 unsigned short m_red, m_green, m_blue;
67 unsigned long m_pixel; 68 unsigned long m_pixel;
68 bool m_allocated; 69 bool m_allocated;