X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8a16d7370e3cdc7d583a6f14ab11b3a1d27b73df..a57ea0102f67075861696d97e784c1b68f12fc51:/src/common/rgncmn.cpp diff --git a/src/common/rgncmn.cpp b/src/common/rgncmn.cpp index cee89a91c2..93de0d48f8 100644 --- a/src/common/rgncmn.cpp +++ b/src/common/rgncmn.cpp @@ -38,13 +38,13 @@ bool wxRegionBase::IsEqual(const wxRegion& region) const { - if ( m_refData == region.m_refData ) + if ( m_refData == region.GetRefData() ) { // regions are identical, hence equal return true; } - if ( !m_refData || !region.m_refData ) + if ( !m_refData || !region.GetRefData() ) { // one, but not both, of the regions is invalid return false; @@ -60,12 +60,12 @@ bool wxRegionBase::IsEqual(const wxRegion& region) const wxBitmap wxRegionBase::ConvertToBitmap() const { wxRect box = GetBox(); - wxBitmap bmp(box.GetRight(), box.GetBottom()); + wxBitmap bmp(box.GetRight() + 1, box.GetBottom() + 1); wxMemoryDC dc; dc.SelectObject(bmp); dc.SetBackground(*wxBLACK_BRUSH); dc.Clear(); - dc.SetClippingRegion(*wx_static_cast(const wxRegion *, this)); + dc.SetDeviceClippingRegion(*static_cast(this)); dc.SetBackground(*wxWHITE_BRUSH); dc.Clear(); dc.SelectObject(wxNullBitmap); @@ -131,7 +131,7 @@ bool wxRegionBase::Union(const wxBitmap& bmp) if (bmp.GetMask()) { wxImage image = bmp.ConvertToImage(); - wxASSERT_MSG( image.HasMask(), _T("wxBitmap::ConvertToImage doesn't preserve mask?") ); + wxASSERT_MSG( image.HasMask(), wxT("wxBitmap::ConvertToImage doesn't preserve mask?") ); return DoRegionUnion(*this, image, image.GetMaskRed(), image.GetMaskGreen(), @@ -157,3 +157,36 @@ bool wxRegionBase::Union(const wxBitmap& bmp, } #endif // wxUSE_IMAGE + +#ifdef wxHAS_REGION_COMBINE +// ============================================================================ +// wxRegionWithCombine +// ============================================================================ + +// implement some wxRegionBase pure virtuals in terms of Combine() +bool wxRegionWithCombine::DoUnionWithRect(const wxRect& rect) +{ + return Combine(rect, wxRGN_OR); +} + +bool wxRegionWithCombine::DoUnionWithRegion(const wxRegion& region) +{ + return DoCombine(region, wxRGN_OR); +} + +bool wxRegionWithCombine::DoIntersect(const wxRegion& region) +{ + return DoCombine(region, wxRGN_AND); +} + +bool wxRegionWithCombine::DoSubtract(const wxRegion& region) +{ + return DoCombine(region, wxRGN_DIFF); +} + +bool wxRegionWithCombine::DoXor(const wxRegion& region) +{ + return DoCombine(region, wxRGN_XOR); +} + +#endif // wxHAS_REGION_COMBINE