From 17be85312c6f99a4725fbd0da221a269d782aa36 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 3 Jun 2003 10:32:26 +0000 Subject: [PATCH] fixed wxPenRefData::operator==() (part of patch 742783) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20879 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/pen.cpp | 38 +++++++++++++++++++++++--------------- src/gtk1/pen.cpp | 38 +++++++++++++++++++++++--------------- 2 files changed, 46 insertions(+), 30 deletions(-) diff --git a/src/gtk/pen.cpp b/src/gtk/pen.cpp index 176463b69d..7fb6e0cd0d 100644 --- a/src/gtk/pen.cpp +++ b/src/gtk/pen.cpp @@ -43,25 +43,33 @@ public: m_capStyle = data.m_capStyle; m_colour = data.m_colour; m_countDashes = data.m_countDashes; -/* - if (data.m_dash) TODO - m_dash = new -*/ m_dash = data.m_dash; } bool operator == (const wxPenRefData& data) const { - // It is impossible to tell if the dashes have changed - // so the only thing to do is assume they have - if (m_countDashes != 0 || data.m_countDashes != 0) - return false; - - return (m_style == data.m_style && - m_width == data.m_width && - m_joinStyle == data.m_joinStyle && - m_capStyle == data.m_capStyle && - m_colour == data.m_colour); + if ( m_countDashes != data.m_countDashes ) + return FALSE; + + if ( m_dash ) + { + if ( !data.m_dash || + memcmp(m_dash, data.m_dash, m_countDashes*sizeof(wxGTKDash)) ) + { + return FALSE; + } + } + else if ( data.m_dash ) + { + return FALSE; + } + + + return m_style == data.m_style && + m_width == data.m_width && + m_joinStyle == data.m_joinStyle && + m_capStyle == data.m_capStyle && + m_colour == data.m_colour; } int m_width; @@ -123,7 +131,7 @@ void wxPen::SetDashes( int number_of_dashes, const wxDash *dash ) AllocExclusive(); M_PENDATA->m_countDashes = number_of_dashes; - M_PENDATA->m_dash = (wxGTKDash *)dash; /* TODO */ + M_PENDATA->m_dash = (wxGTKDash *)dash; } void wxPen::SetColour( int red, int green, int blue ) diff --git a/src/gtk1/pen.cpp b/src/gtk1/pen.cpp index 176463b69d..7fb6e0cd0d 100644 --- a/src/gtk1/pen.cpp +++ b/src/gtk1/pen.cpp @@ -43,25 +43,33 @@ public: m_capStyle = data.m_capStyle; m_colour = data.m_colour; m_countDashes = data.m_countDashes; -/* - if (data.m_dash) TODO - m_dash = new -*/ m_dash = data.m_dash; } bool operator == (const wxPenRefData& data) const { - // It is impossible to tell if the dashes have changed - // so the only thing to do is assume they have - if (m_countDashes != 0 || data.m_countDashes != 0) - return false; - - return (m_style == data.m_style && - m_width == data.m_width && - m_joinStyle == data.m_joinStyle && - m_capStyle == data.m_capStyle && - m_colour == data.m_colour); + if ( m_countDashes != data.m_countDashes ) + return FALSE; + + if ( m_dash ) + { + if ( !data.m_dash || + memcmp(m_dash, data.m_dash, m_countDashes*sizeof(wxGTKDash)) ) + { + return FALSE; + } + } + else if ( data.m_dash ) + { + return FALSE; + } + + + return m_style == data.m_style && + m_width == data.m_width && + m_joinStyle == data.m_joinStyle && + m_capStyle == data.m_capStyle && + m_colour == data.m_colour; } int m_width; @@ -123,7 +131,7 @@ void wxPen::SetDashes( int number_of_dashes, const wxDash *dash ) AllocExclusive(); M_PENDATA->m_countDashes = number_of_dashes; - M_PENDATA->m_dash = (wxGTKDash *)dash; /* TODO */ + M_PENDATA->m_dash = (wxGTKDash *)dash; } void wxPen::SetColour( int red, int green, int blue ) -- 2.45.2