Corrected wxRegion::GetBox()
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4920 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -16,19 +16,17 @@
|
|||||||
#include <gdk/gdk.h>
|
#include <gdk/gdk.h>
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxRegion
|
// wxRegion
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
class wxRegionRefData: public wxObjectRefData
|
class wxRegionRefData: public wxObjectRefData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
wxRegionRefData();
|
wxRegionRefData();
|
||||||
~wxRegionRefData();
|
~wxRegionRefData();
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
GdkRegion *m_region;
|
GdkRegion *m_region;
|
||||||
wxList m_rects;
|
wxList m_rects;
|
||||||
};
|
};
|
||||||
@@ -259,40 +257,12 @@ void wxRegion::GetBox( long& x, long& y, long&w, long &h ) const
|
|||||||
y = 0;
|
y = 0;
|
||||||
w = -1;
|
w = -1;
|
||||||
h = -1;
|
h = -1;
|
||||||
wxNode *node = GetRectList()->First();
|
GdkRectangle rect;
|
||||||
while (node)
|
gdk_region_get_clipbox( M_REGIONDATA->m_region, &rect );
|
||||||
{
|
x = rect.x;
|
||||||
wxRect *r = (wxRect*)node->Data();
|
y = rect.y;
|
||||||
if (node == GetRectList()->First())
|
w = rect.width;
|
||||||
{
|
h = rect.height;
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxRect wxRegion::GetBox() const
|
wxRect wxRegion::GetBox() const
|
||||||
|
@@ -16,19 +16,17 @@
|
|||||||
#include <gdk/gdk.h>
|
#include <gdk/gdk.h>
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// wxRegion
|
// wxRegion
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
class wxRegionRefData: public wxObjectRefData
|
class wxRegionRefData: public wxObjectRefData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
wxRegionRefData();
|
wxRegionRefData();
|
||||||
~wxRegionRefData();
|
~wxRegionRefData();
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
GdkRegion *m_region;
|
GdkRegion *m_region;
|
||||||
wxList m_rects;
|
wxList m_rects;
|
||||||
};
|
};
|
||||||
@@ -259,40 +257,12 @@ void wxRegion::GetBox( long& x, long& y, long&w, long &h ) const
|
|||||||
y = 0;
|
y = 0;
|
||||||
w = -1;
|
w = -1;
|
||||||
h = -1;
|
h = -1;
|
||||||
wxNode *node = GetRectList()->First();
|
GdkRectangle rect;
|
||||||
while (node)
|
gdk_region_get_clipbox( M_REGIONDATA->m_region, &rect );
|
||||||
{
|
x = rect.x;
|
||||||
wxRect *r = (wxRect*)node->Data();
|
y = rect.y;
|
||||||
if (node == GetRectList()->First())
|
w = rect.width;
|
||||||
{
|
h = rect.height;
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxRect wxRegion::GetBox() const
|
wxRect wxRegion::GetBox() const
|
||||||
|
Reference in New Issue
Block a user