From 60ec2e2177d893f4a62a176dc126652e1a814cf5 Mon Sep 17 00:00:00 2001 From: fluxgen Date: Sat, 28 Feb 2004 16:55:22 +0000 Subject: copy operator --- src/FbTk/Color.cc | 26 +++++++++++++------------- src/FbTk/Color.hh | 8 ++++---- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/FbTk/Color.cc b/src/FbTk/Color.cc index d969a43..8428954 100644 --- a/src/FbTk/Color.cc +++ b/src/FbTk/Color.cc @@ -19,7 +19,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Color.cc,v 1.8 2004/01/09 21:36:21 fluxgen Exp $ +// $Id: Color.cc,v 1.9 2004/02/28 16:55:22 fluxgen Exp $ #include "Color.hh" @@ -105,16 +105,16 @@ bool Color::setFromString(const char *color_string, int screen) { return true; } -/* - Color &Color::Color::operator = (const Color &col_copy) { - // check for aliasing - if (this == &col_copy) - return *this; - copy(col_copy); - return *this; - } -*/ +Color &Color::Color::operator = (const Color &col_copy) { + // check for aliasing + if (this == &col_copy) + return *this; + + copy(col_copy); + return *this; +} + void Color::free() { if (isAllocated()) { @@ -137,9 +137,9 @@ void Color::copy(const Color &col_copy) { free(); - allocate(col_copy.red(), - col_copy.green(), - col_copy.blue(), + allocate(col_copy.red()*0xFF, + col_copy.green()*0xFF, + col_copy.blue()*0xFF, col_copy.m_screen); } diff --git a/src/FbTk/Color.hh b/src/FbTk/Color.hh index 1ab926b..5206790 100644 --- a/src/FbTk/Color.hh +++ b/src/FbTk/Color.hh @@ -1,5 +1,5 @@ // Color.hh for Fluxbox Window Manager -// Copyright (c) 2002 Henrik Kinnunen (fluxgen@users.sourceforge.net) +// Copyright (c) 2002-2004 Henrik Kinnunen (fluxgen@users.sourceforge.net) // // from Image.hh for Blackbox - an X11 Window manager // Copyright (c) 1997 - 2000 Brad Hughes (bhughes@tcac.net) @@ -22,7 +22,7 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Color.hh,v 1.6 2003/12/16 17:06:49 fluxgen Exp $ +// $Id: Color.hh,v 1.7 2004/02/28 16:55:22 fluxgen Exp $ #ifndef FBTK_COLOR_HH #define FBTK_COLOR_HH @@ -46,8 +46,8 @@ public: bool setFromString(const char *color_string, int screen); /// TODO don't like this void setPixel(unsigned long pixel) { m_pixel = pixel; } - // TODO - //Color &operator = (const Color &col_copy); + + Color &operator = (const Color &col_copy); inline bool isAllocated() const { return m_allocated; } inline unsigned short red() const { return m_red; } -- cgit v0.11.2