projects
/
wxWidgets.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Put some life into GTK 2.0 drawing.
[wxWidgets.git]
/
src
/
mgl
/
region.cpp
diff --git
a/src/mgl/region.cpp
b/src/mgl/region.cpp
index ad4ace5b7f327073fbaadd497678856d528f773c..3ec5b7d7516e270754e6ba4a60abe1d5e78288b2 100644
(file)
--- a/
src/mgl/region.cpp
+++ b/
src/mgl/region.cpp
@@
-3,7
+3,7
@@
// Purpose: Region handling for wxWindows/MGL
// Author: Vaclav Slavik
// RCS-ID: $Id$
// Purpose: Region handling for wxWindows/MGL
// Author: Vaclav Slavik
// RCS-ID: $Id$
-// Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com)
+// Copyright: (c) 2001
-2002
SciTech Software, Inc. (www.scitechsoft.com)
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@@
-37,18
+37,14
@@
IMPLEMENT_DYNAMIC_CLASS(wxRegionIterator, wxObject)
class WXDLLEXPORT wxRegionRefData : public wxGDIRefData
{
public:
class WXDLLEXPORT wxRegionRefData : public wxGDIRefData
{
public:
- wxRegionRefData()
- {
- }
+ wxRegionRefData() {}
wxRegionRefData(const wxRegionRefData& data)
{
m_region = data.m_region;
}
wxRegionRefData(const wxRegionRefData& data)
{
m_region = data.m_region;
}
- ~wxRegionRefData()
- {
- }
+ ~wxRegionRefData() {}
MGLRegion m_region;
};
MGLRegion m_region;
};
@@
-60,12
+56,22
@@
public:
// wxRegion
//-----------------------------------------------------------------------------
// wxRegion
//-----------------------------------------------------------------------------
+wxObjectRefData *wxRegion::CreateRefData() const
+{
+ return new wxRegionRefData;
+}
+
+wxObjectRefData *wxRegion::CloneRefData(const wxObjectRefData *data) const
+{
+ return new wxRegionRefData(*(wxRegionRefData *)data);
+}
+
/*
* Create an empty region.
*/
wxRegion::wxRegion()
{
/*
* Create an empty region.
*/
wxRegion::wxRegion()
{
- m_refData =
(wxRegionRefData *)
NULL;
+ m_refData = NULL;
}
wxRegion::wxRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h)
}
wxRegion::wxRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h)
@@
-78,14
+84,14
@@
wxRegion::wxRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h)
wxRegion::wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight)
{
m_refData = new wxRegionRefData;
wxRegion::wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight)
{
m_refData = new wxRegionRefData;
- MGLRect rect(topLeft.x, topLeft.y, bottomRight.x
, bottomRight.y
);
+ MGLRect rect(topLeft.x, topLeft.y, bottomRight.x
+1, bottomRight.y+1
);
M_REGION = rect;
}
wxRegion::wxRegion(const wxRect& r)
{
m_refData = new wxRegionRefData;
M_REGION = rect;
}
wxRegion::wxRegion(const wxRect& r)
{
m_refData = new wxRegionRefData;
- MGLRect rect(r.GetLeft(), r.GetTop(), r.GetRight()
, r.GetBottom()
);
+ MGLRect rect(r.GetLeft(), r.GetTop(), r.GetRight()
+1, r.GetBottom()+1
);
M_REGION = rect;
}
M_REGION = rect;
}
@@
-156,17
+162,24
@@
bool wxRegion::Empty() const
// Modifications
//-----------------------------------------------------------------------------
// Modifications
//-----------------------------------------------------------------------------
+bool wxRegion::Offset(wxCoord x, wxCoord y)
+{
+ AllocExclusive();
+ M_REGION.offset(x, y);
+ return TRUE;
+}
+
// Union rectangle or region with this.
bool wxRegion::Union(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
{
// Union rectangle or region with this.
bool wxRegion::Union(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
{
-
Unshar
e();
+
AllocExclusiv
e();
M_REGION += MGLRect(x, y, x + width, y + height);
return TRUE;
}
bool wxRegion::Union(const wxRegion& region)
{
M_REGION += MGLRect(x, y, x + width, y + height);
return TRUE;
}
bool wxRegion::Union(const wxRegion& region)
{
-
Unshar
e();
+
AllocExclusiv
e();
M_REGION += M_REGION_OF(region);
return TRUE;
}
M_REGION += M_REGION_OF(region);
return TRUE;
}
@@
-174,14
+187,14
@@
bool wxRegion::Union(const wxRegion& region)
// Intersect rectangle or region with this.
bool wxRegion::Intersect(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
{
// Intersect rectangle or region with this.
bool wxRegion::Intersect(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
{
-
Unshar
e();
+
AllocExclusiv
e();
M_REGION &= MGLRect(x, y, x + width, y + height);
return TRUE;
}
bool wxRegion::Intersect(const wxRegion& region)
{
M_REGION &= MGLRect(x, y, x + width, y + height);
return TRUE;
}
bool wxRegion::Intersect(const wxRegion& region)
{
-
Unshar
e();
+
AllocExclusiv
e();
M_REGION &= M_REGION_OF(region);
return TRUE;
}
M_REGION &= M_REGION_OF(region);
return TRUE;
}
@@
-190,14
+203,14
@@
bool wxRegion::Intersect(const wxRegion& region)
// Combines the parts of 'this' that are not part of the second region.
bool wxRegion::Subtract(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
{
// Combines the parts of 'this' that are not part of the second region.
bool wxRegion::Subtract(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
{
-
Unshar
e();
+
AllocExclusiv
e();
M_REGION -= MGLRect(x, y, x + width, y + height);
return TRUE;
}
bool wxRegion::Subtract(const wxRegion& region)
{
M_REGION -= MGLRect(x, y, x + width, y + height);
return TRUE;
}
bool wxRegion::Subtract(const wxRegion& region)
{
-
Unshar
e();
+
AllocExclusiv
e();
M_REGION -= M_REGION_OF(region);
return TRUE;
}
M_REGION -= M_REGION_OF(region);
return TRUE;
}
@@
-205,7
+218,7
@@
bool wxRegion::Subtract(const wxRegion& region)
// XOR: the union of two combined regions except for any overlapping areas.
bool wxRegion::Xor(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
{
// XOR: the union of two combined regions except for any overlapping areas.
bool wxRegion::Xor(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
{
-
Unshar
e();
+
AllocExclusiv
e();
MGLRect rect(x, y, x + width, y + height);
MGLRegion rg1 = M_REGION + rect,
rg2 = M_REGION & rect;
MGLRect rect(x, y, x + width, y + height);
MGLRegion rg1 = M_REGION + rect,
rg2 = M_REGION & rect;
@@
-215,7
+228,7
@@
bool wxRegion::Xor(wxCoord x, wxCoord y, wxCoord width, wxCoord height)
bool wxRegion::Xor(const wxRegion& region)
{
bool wxRegion::Xor(const wxRegion& region)
{
-
Unshar
e();
+
AllocExclusiv
e();
MGLRegion rg1 = M_REGION + M_REGION_OF(region),
rg2 = M_REGION & M_REGION_OF(region);
M_REGION = rg1 - rg2;
MGLRegion rg1 = M_REGION + M_REGION_OF(region),
rg2 = M_REGION & M_REGION_OF(region);
M_REGION = rg1 - rg2;
@@
-273,25
+286,6
@@
wxRegionContain wxRegion::Contains(const wxRect& rect) const
}
}
-
-void wxRegion::Unshare()
-{
- if (!m_refData)
- {
- m_refData = new wxRegionRefData();
- }
- else
- {
- wxRegionRefData* ref = new wxRegionRefData(*(wxRegionRefData*)m_refData);
- UnRef();
- m_refData = ref;
- }
-}
-
-
-
-
-
///////////////////////////////////////////////////////////////////////////////
// wxRegionIterator //
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// wxRegionIterator //
///////////////////////////////////////////////////////////////////////////////
@@
-324,7
+318,7
@@
wxRegionIterator::wxRegionIterator(const wxRegion& region)
static wxRegionRectList *gs_rectList;
static wxRegionRectList *gs_rectList;
-static void wxMGL_region_callback(const rect_t *r)
+static void
MGLAPI
wxMGL_region_callback(const rect_t *r)
{
gs_rectList->Append(new wxRect(r->left, r->top,
r->right - r->left, r->bottom - r->top));
{
gs_rectList->Append(new wxRect(r->left, r->top,
r->right - r->left, r->bottom - r->top));
@@
-396,4
+390,3
@@
wxCoord wxRegionIterator::GetH() const
else
return 0;
}
else
return 0;
}
-