removed assignment operator
This commit is contained in:
parent
14d355e658
commit
3e0d0de6d9
2 changed files with 20 additions and 7 deletions
19
src/Color.cc
19
src/Color.cc
|
@ -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.2 2002/09/14 13:49:51 fluxgen Exp $
|
// $Id: Color.cc,v 1.3 2002/09/20 13:02:39 fluxgen Exp $
|
||||||
|
|
||||||
#include "Color.hh"
|
#include "Color.hh"
|
||||||
|
|
||||||
|
@ -57,7 +57,8 @@ m_screen(screen) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Color::Color(const char *color_string, int screen):
|
Color::Color(const char *color_string, int screen):
|
||||||
m_allocated(false) {
|
m_allocated(false),
|
||||||
|
m_screen(screen) {
|
||||||
setFromString(color_string, screen);
|
setFromString(color_string, screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,10 +95,16 @@ bool Color::setFromString(const char *color_string, int screen) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
Color &Color::Color::operator = (const Color &col_copy) {
|
Color &Color::Color::operator = (const Color &col_copy) {
|
||||||
|
// check for aliasing
|
||||||
|
if (this == &col_copy)
|
||||||
|
return *this;
|
||||||
|
|
||||||
copy(col_copy);
|
copy(col_copy);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
void Color::free() {
|
void Color::free() {
|
||||||
if (isAllocated()) {
|
if (isAllocated()) {
|
||||||
|
@ -113,6 +120,8 @@ void Color::free() {
|
||||||
void Color::copy(const Color &col_copy) {
|
void Color::copy(const Color &col_copy) {
|
||||||
if (!col_copy.isAllocated()) {
|
if (!col_copy.isAllocated()) {
|
||||||
free();
|
free();
|
||||||
|
setRGB(col_copy.red(), col_copy.green(), col_copy.blue());
|
||||||
|
setPixel(col_copy.pixel());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,8 +140,9 @@ void Color::allocate(unsigned char red, unsigned char green, unsigned char blue,
|
||||||
XColor color;
|
XColor color;
|
||||||
// fill xcolor structure
|
// fill xcolor structure
|
||||||
color.red = red;
|
color.red = red;
|
||||||
color.blue = blue;
|
|
||||||
color.green = green;
|
color.green = green;
|
||||||
|
color.blue = blue;
|
||||||
|
|
||||||
|
|
||||||
if (!XAllocColor(disp, DefaultColormap(disp, screen), &color)) {
|
if (!XAllocColor(disp, DefaultColormap(disp, screen), &color)) {
|
||||||
cerr<<"FbTk::Color: Allocation error."<<endl;
|
cerr<<"FbTk::Color: Allocation error."<<endl;
|
||||||
|
@ -143,6 +153,8 @@ void Color::allocate(unsigned char red, unsigned char green, unsigned char blue,
|
||||||
setPixel(color.pixel);
|
setPixel(color.pixel);
|
||||||
setAllocated(true);
|
setAllocated(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_screen = screen;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Color::setRGB(unsigned char red, unsigned char green, unsigned char blue) {
|
void Color::setRGB(unsigned char red, unsigned char green, unsigned char blue) {
|
||||||
|
@ -150,4 +162,5 @@ void Color::setRGB(unsigned char red, unsigned char green, unsigned char blue) {
|
||||||
m_green = green;
|
m_green = green;
|
||||||
m_blue = blue;
|
m_blue = blue;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -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/09/14 13:49:09 fluxgen Exp $
|
// $Id: Color.hh,v 1.3 2002/09/20 13:02:40 fluxgen Exp $
|
||||||
|
|
||||||
#ifndef FBTK_COLOR_HH
|
#ifndef FBTK_COLOR_HH
|
||||||
#define FBTK_COLOR_HH
|
#define FBTK_COLOR_HH
|
||||||
|
@ -45,8 +45,8 @@ public:
|
||||||
bool setFromString(const char *color_string, int screen);
|
bool setFromString(const char *color_string, int screen);
|
||||||
/// TODO don't like this
|
/// TODO don't like this
|
||||||
void setPixel(unsigned long pixel) { m_pixel = pixel; }
|
void setPixel(unsigned long pixel) { m_pixel = pixel; }
|
||||||
|
// TODO
|
||||||
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 char red() const { return m_red; }
|
||||||
|
|
Loading…
Reference in a new issue