X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/df83b840bbf6441a0166848d49a093557e562926..97152f7856a81388163e883e340fa260f2719698:/src/common/gdicmn.cpp diff --git a/src/common/gdicmn.cpp b/src/common/gdicmn.cpp index a2c7cb5a8c..0f73fff839 100644 --- a/src/common/gdicmn.cpp +++ b/src/common/gdicmn.cpp @@ -138,8 +138,13 @@ wxRect wxRect::operator+(const wxRect& rect) const wxRect& wxRect::Union(const wxRect& rect) { - // ignore empty rectangles - if ( rect.width && rect.height ) + // ignore empty rectangles: union with an empty rectangle shouldn't extend + // this one to (0, 0) + if ( !width || !height ) + { + *this = rect; + } + else if ( rect.width && rect.height ) { int x1 = wxMin(x, rect.x); int y1 = wxMin(y, rect.y); @@ -151,6 +156,7 @@ wxRect& wxRect::Union(const wxRect& rect) width = x2 - x1; height = y2 - y1; } + //else: we're not empty and rect is empty return *this; } @@ -388,7 +394,7 @@ void wxColourDatabase::AddColour(const wxString& name, const wxColour& colour) } else // new colour { - (*m_map)[name] = new wxColour(colour); + (*m_map)[colName] = new wxColour(colour); } }