From 864e8bd0fc3d768153ecfae6ac65e4ddf5c21bed Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Mon, 13 Dec 1999 13:43:47 +0000 Subject: [PATCH] Corrected wxRegion::GetBox() git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4920 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/region.cpp | 46 ++++++++------------------------------------- src/gtk1/region.cpp | 46 ++++++++------------------------------------- 2 files changed, 16 insertions(+), 76 deletions(-) diff --git a/src/gtk/region.cpp b/src/gtk/region.cpp index a19730b0d0..5718597469 100644 --- a/src/gtk/region.cpp +++ b/src/gtk/region.cpp @@ -16,19 +16,17 @@ #include #include + //----------------------------------------------------------------------------- // wxRegion //----------------------------------------------------------------------------- class wxRegionRefData: public wxObjectRefData { - public: - +public: wxRegionRefData(); ~wxRegionRefData(); - public: - GdkRegion *m_region; wxList m_rects; }; @@ -259,40 +257,12 @@ void wxRegion::GetBox( long& x, long& y, long&w, long &h ) const y = 0; w = -1; h = -1; - wxNode *node = GetRectList()->First(); - while (node) - { - wxRect *r = (wxRect*)node->Data(); - if (node == GetRectList()->First()) - { - x = r->x; - y = r->y; - w = r->width; - h = r->height; - } - else - { - if (r->x < x) - { - x = r->x; - w += x - r->x; - } - if (r->y < y) - { - y = r->y; - h += y - r->y; - } - if (r->width+r->x > x+w) - { - w = r->x + r->width - x; - } - if (r->height+r->y > y+h) - { - h = r->y + r->height - y; - } - } - node = node->Next(); - } + GdkRectangle rect; + gdk_region_get_clipbox( M_REGIONDATA->m_region, &rect ); + x = rect.x; + y = rect.y; + w = rect.width; + h = rect.height; } wxRect wxRegion::GetBox() const diff --git a/src/gtk1/region.cpp b/src/gtk1/region.cpp index a19730b0d0..5718597469 100644 --- a/src/gtk1/region.cpp +++ b/src/gtk1/region.cpp @@ -16,19 +16,17 @@ #include #include + //----------------------------------------------------------------------------- // wxRegion //----------------------------------------------------------------------------- class wxRegionRefData: public wxObjectRefData { - public: - +public: wxRegionRefData(); ~wxRegionRefData(); - public: - GdkRegion *m_region; wxList m_rects; }; @@ -259,40 +257,12 @@ void wxRegion::GetBox( long& x, long& y, long&w, long &h ) const y = 0; w = -1; h = -1; - wxNode *node = GetRectList()->First(); - while (node) - { - wxRect *r = (wxRect*)node->Data(); - if (node == GetRectList()->First()) - { - x = r->x; - y = r->y; - w = r->width; - h = r->height; - } - else - { - if (r->x < x) - { - x = r->x; - w += x - r->x; - } - if (r->y < y) - { - y = r->y; - h += y - r->y; - } - if (r->width+r->x > x+w) - { - w = r->x + r->width - x; - } - if (r->height+r->y > y+h) - { - h = r->y + r->height - y; - } - } - node = node->Next(); - } + GdkRectangle rect; + gdk_region_get_clipbox( M_REGIONDATA->m_region, &rect ); + x = rect.x; + y = rect.y; + w = rect.width; + h = rect.height; } wxRect wxRegion::GetBox() const -- 2.45.2