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::string;
namespace {
inline unsigned char maxValue(unsigned short colval) {
return colval == 65535 ? 0xFF : static_cast<unsigned char>(colval/0xFF);
}
}
namespace FbTk {
Color::Color():
@ -96,9 +88,7 @@ bool Color::setFromString(const char *color_string, int screen) {
return false;
setPixel(color.pixel);
setRGB(maxValue(color.red),
maxValue(color.green),
maxValue(color.blue));
setRGB(color.red / 256, color.green / 256, color.blue / 256);
setAllocated(true);
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;
} else {
free();
setRGB(maxValue(color.red),
maxValue(color.green),
maxValue(color.blue));
setRGB(color.red / 256, color.green / 256, color.blue / 256);
setPixel(color.pixel);
setAllocated(true);
}

View file

@ -63,6 +63,7 @@ private:
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 long m_pixel;
bool m_allocated;