X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5767e836997b965b9d936f1d65244bb886c39025..8919bc42e491ba94f685a42b2330ced15136af18:/src/common/gdicmn.cpp diff --git a/src/common/gdicmn.cpp b/src/common/gdicmn.cpp index 6cbe1a5d9e..5de95ee422 100644 --- a/src/common/gdicmn.cpp +++ b/src/common/gdicmn.cpp @@ -42,7 +42,7 @@ #include "wx/log.h" #include -#if defined(__WXMSW__) && !defined(__PALMOS__) +#if defined(__WXMSW__) #include "wx/msw/wrapwin.h" #endif @@ -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; }