improved code documentation

This commit is contained in:
Mathias Gumz 2013-01-13 12:25:00 +01:00
parent 13b9ee09ee
commit 8143b86fec
2 changed files with 3 additions and 14 deletions

View file

@ -31,14 +31,6 @@ using std::cerr;
using std::endl; using std::endl;
using std::string; using std::string;
namespace {
inline unsigned char maxValue(unsigned short colval) {
return colval == 65535 ? 0xFF : static_cast<unsigned char>(colval/0xFF);
}
}
namespace FbTk { namespace FbTk {
Color::Color(): Color::Color():
@ -96,9 +88,7 @@ bool Color::setFromString(const char *color_string, int screen) {
return false; return false;
setPixel(color.pixel); setPixel(color.pixel);
setRGB(maxValue(color.red), setRGB(color.red / 256, color.green / 256, color.blue / 256);
maxValue(color.green),
maxValue(color.blue));
setAllocated(true); setAllocated(true);
m_screen = screen; m_screen = screen;
@ -168,9 +158,7 @@ void Color::allocate(unsigned short red, unsigned short green, unsigned short bl
cerr<<"FbTk::Color: "<<_FBTK_CONSOLETEXT(Error, ColorAllocation, "Allocation error.", "XAllocColor failed...")<<endl; cerr<<"FbTk::Color: "<<_FBTK_CONSOLETEXT(Error, ColorAllocation, "Allocation error.", "XAllocColor failed...")<<endl;
} else { } else {
free(); free();
setRGB(maxValue(color.red), setRGB(color.red / 256, color.green / 256, color.blue / 256);
maxValue(color.green),
maxValue(color.blue));
setPixel(color.pixel); setPixel(color.pixel);
setAllocated(true); setAllocated(true);
} }

View file

@ -63,6 +63,7 @@ private:
void setRGB(unsigned short red, unsigned short green, unsigned short blue); void setRGB(unsigned short red, unsigned short green, unsigned short blue);
// stored in [0 - 255] range
unsigned short m_red, m_green, m_blue; unsigned short m_red, m_green, m_blue;
unsigned long m_pixel; unsigned long m_pixel;
bool m_allocated; bool m_allocated;