using short instead of char

This commit is contained in:
fluxgen 2003-02-23 01:09:20 +00:00
parent 748467ac49
commit 344bd1d00a
2 changed files with 13 additions and 12 deletions

View file

@ -19,7 +19,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// $Id: Color.cc,v 1.3 2002/12/01 13:42:14 rathnor Exp $ // $Id: Color.cc,v 1.4 2003/02/23 01:09:20 fluxgen Exp $
#include "Color.hh" #include "Color.hh"
@ -50,7 +50,7 @@ Color::Color(const Color &col_copy) {
copy(col_copy); copy(col_copy);
} }
Color::Color(unsigned char red, unsigned char green, unsigned char blue, int screen): Color::Color(unsigned short red, unsigned short green, unsigned short blue, int screen):
m_red(red), m_green(green), m_blue(blue), m_red(red), m_green(green), m_blue(blue),
m_pixel(0), m_allocated(false), m_pixel(0), m_allocated(false),
m_screen(screen) { m_screen(screen) {
@ -138,7 +138,7 @@ void Color::copy(const Color &col_copy) {
} }
void Color::allocate(unsigned char red, unsigned char green, unsigned char blue, int screen) { void Color::allocate(unsigned short red, unsigned short green, unsigned short blue, int screen) {
Display *disp = App::instance()->display(); Display *disp = App::instance()->display();
XColor color; XColor color;
@ -161,7 +161,7 @@ void Color::allocate(unsigned char red, unsigned char green, unsigned char blue,
m_screen = screen; m_screen = screen;
} }
void Color::setRGB(unsigned char red, unsigned char green, unsigned char blue) { void Color::setRGB(unsigned short red, unsigned short green, unsigned short blue) {
m_red = red; m_red = red;
m_green = green; m_green = green;
m_blue = blue; m_blue = blue;

View file

@ -22,7 +22,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
// $Id: Color.hh,v 1.2 2002/12/01 13:42:14 rathnor Exp $ // $Id: Color.hh,v 1.3 2003/02/23 01:09:02 fluxgen Exp $
#ifndef FBTK_COLOR_HH #ifndef FBTK_COLOR_HH
#define FBTK_COLOR_HH #define FBTK_COLOR_HH
@ -38,7 +38,7 @@ public:
Color(); Color();
explicit Color(unsigned long pixel); explicit Color(unsigned long pixel);
Color(const Color &col_copy); Color(const Color &col_copy);
Color(unsigned char red, unsigned char green, unsigned char blue, int screen); Color(unsigned short red, unsigned short green, unsigned short blue, int screen);
Color(const char *color_string, int screen); Color(const char *color_string, int screen);
~Color(); ~Color();
@ -49,20 +49,21 @@ public:
//Color &operator = (const Color &col_copy); //Color &operator = (const Color &col_copy);
bool isAllocated() const { return m_allocated; } bool isAllocated() const { return m_allocated; }
unsigned char red() const { return m_red; } unsigned short red() const { return m_red; }
unsigned char green() const { return m_green; } unsigned short green() const { return m_green; }
unsigned char blue() const { return m_blue; } unsigned short blue() const { return m_blue; }
unsigned long pixel() const { return m_pixel; } unsigned long pixel() const { return m_pixel; }
private: private:
void free(); void free();
void copy(const Color &col); void copy(const Color &col);
void allocate(unsigned char red, unsigned char green, unsigned char blue, int screen); void allocate(unsigned short red, unsigned short green,
unsigned short blue, int screen);
inline void setAllocated(bool a) { m_allocated = a; } inline void setAllocated(bool a) { m_allocated = a; }
void setRGB(unsigned char red, unsigned char green, unsigned char blue); void setRGB(unsigned short red, unsigned short green, unsigned short blue);
unsigned char 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;
int m_screen; int m_screen;