From b7c2d6ffcb6225c445bf5f8c6ed126490345b821 Mon Sep 17 00:00:00 2001 From: Ove Kaaven Date: Wed, 19 Jul 2000 09:39:18 +0000 Subject: [PATCH] gtk+ 1.3.1's region transformation code no longer returns a new region, but rather seems to operate on the source region... added a bunch of ifdefs. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@7783 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/region.cpp | 40 ++++++++++++++++++++++++++++++++++++++++ src/gtk1/region.cpp | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) diff --git a/src/gtk/region.cpp b/src/gtk/region.cpp index 0332bd48b6..9cf22c23eb 100644 --- a/src/gtk/region.cpp +++ b/src/gtk/region.cpp @@ -64,8 +64,13 @@ wxRegion::wxRegion( wxCoord x, wxCoord y, wxCoord w, wxCoord h ) rect.y = y; rect.width = w; rect.height = h; +#ifdef __WXGTK20__ + gdk_region_union_with_rect( reg, &rect ); + M_REGIONDATA->m_region = reg; +#else M_REGIONDATA->m_region = gdk_region_union_with_rect( reg, &rect ); gdk_region_destroy( reg ); +#endif M_REGIONDATA->m_rects.Append( (wxObject*) new wxRect(x,y,w,h) ); } @@ -78,8 +83,13 @@ wxRegion::wxRegion( const wxPoint& topLeft, const wxPoint& bottomRight ) rect.y = topLeft.y; rect.width = bottomRight.x - rect.x; rect.height = bottomRight.y - rect.y; +#ifdef __WXGTK20__ + gdk_region_union_with_rect( reg, &rect ); + M_REGIONDATA->m_region = reg; +#else M_REGIONDATA->m_region = gdk_region_union_with_rect( reg, &rect ); gdk_region_destroy( reg ); +#endif M_REGIONDATA->m_rects.Append( (wxObject*) new wxRect(topLeft,bottomRight) ); } @@ -92,8 +102,13 @@ wxRegion::wxRegion( const wxRect& rect ) g_rect.y = rect.y; g_rect.width = rect.width; g_rect.height = rect.height; +#ifdef __WXGTK20__ + gdk_region_union_with_rect( reg, &g_rect ); + M_REGIONDATA->m_region = reg; +#else M_REGIONDATA->m_region = gdk_region_union_with_rect( reg, &g_rect ); gdk_region_destroy( reg ); +#endif M_REGIONDATA->m_rects.Append( (wxObject*) new wxRect(rect.x,rect.y,rect.width,rect.height) ); } @@ -131,14 +146,23 @@ bool wxRegion::Union( wxCoord x, wxCoord y, wxCoord width, wxCoord height ) { m_refData = new wxRegionRefData(); GdkRegion *reg = gdk_region_new(); +#ifdef __WXGTK20__ + gdk_region_union_with_rect( reg, &rect ); + M_REGIONDATA->m_region = reg; +#else M_REGIONDATA->m_region = gdk_region_union_with_rect( reg, &rect ); gdk_region_destroy( reg ); +#endif } else { +#ifdef __WXGTK20__ + gdk_region_union_with_rect( M_REGIONDATA->m_region, &rect ); +#else GdkRegion *reg = gdk_region_union_with_rect( M_REGIONDATA->m_region, &rect ); gdk_region_destroy( M_REGIONDATA->m_region ); M_REGIONDATA->m_region = reg; +#endif } M_REGIONDATA->m_rects.Append( (wxObject*) new wxRect(x,y,width,height) ); @@ -162,9 +186,13 @@ bool wxRegion::Union( const wxRegion& region ) M_REGIONDATA->m_region = gdk_region_new(); } +#ifdef __WXGTK20__ + gdk_region_union( M_REGIONDATA->m_region, region.GetRegion() ); +#else GdkRegion *reg = gdk_regions_union( M_REGIONDATA->m_region, region.GetRegion() ); gdk_region_destroy( M_REGIONDATA->m_region ); M_REGIONDATA->m_region = reg; +#endif wxNode *node = region.GetRectList()->First(); while (node) @@ -215,9 +243,13 @@ bool wxRegion::Intersect( const wxRegion& region ) return TRUE; } +#ifdef __WXGTK20__ + gdk_region_intersect( M_REGIONDATA->m_region, region.GetRegion() ); +#else GdkRegion *reg = gdk_regions_intersect( M_REGIONDATA->m_region, region.GetRegion() ); gdk_region_destroy( M_REGIONDATA->m_region ); M_REGIONDATA->m_region = reg; +#endif return TRUE; } @@ -258,9 +290,13 @@ bool wxRegion::Subtract( const wxRegion& region ) M_REGIONDATA->m_region = gdk_region_new(); } +#ifdef __WXGTK20__ + gdk_region_subtract( M_REGIONDATA->m_region, region.GetRegion() ); +#else GdkRegion *reg = gdk_regions_subtract( M_REGIONDATA->m_region, region.GetRegion() ); gdk_region_destroy( M_REGIONDATA->m_region ); M_REGIONDATA->m_region = reg; +#endif return TRUE; } @@ -301,9 +337,13 @@ bool wxRegion::Xor( const wxRegion& region ) M_REGIONDATA->m_region = gdk_region_new(); } +#ifdef __WXGTK20__ + gdk_region_xor( M_REGIONDATA->m_region, region.GetRegion() ); +#else GdkRegion *reg = gdk_regions_xor( M_REGIONDATA->m_region, region.GetRegion() ); gdk_region_destroy( M_REGIONDATA->m_region ); M_REGIONDATA->m_region = reg; +#endif wxNode *node = region.GetRectList()->First(); while (node) diff --git a/src/gtk1/region.cpp b/src/gtk1/region.cpp index 0332bd48b6..9cf22c23eb 100644 --- a/src/gtk1/region.cpp +++ b/src/gtk1/region.cpp @@ -64,8 +64,13 @@ wxRegion::wxRegion( wxCoord x, wxCoord y, wxCoord w, wxCoord h ) rect.y = y; rect.width = w; rect.height = h; +#ifdef __WXGTK20__ + gdk_region_union_with_rect( reg, &rect ); + M_REGIONDATA->m_region = reg; +#else M_REGIONDATA->m_region = gdk_region_union_with_rect( reg, &rect ); gdk_region_destroy( reg ); +#endif M_REGIONDATA->m_rects.Append( (wxObject*) new wxRect(x,y,w,h) ); } @@ -78,8 +83,13 @@ wxRegion::wxRegion( const wxPoint& topLeft, const wxPoint& bottomRight ) rect.y = topLeft.y; rect.width = bottomRight.x - rect.x; rect.height = bottomRight.y - rect.y; +#ifdef __WXGTK20__ + gdk_region_union_with_rect( reg, &rect ); + M_REGIONDATA->m_region = reg; +#else M_REGIONDATA->m_region = gdk_region_union_with_rect( reg, &rect ); gdk_region_destroy( reg ); +#endif M_REGIONDATA->m_rects.Append( (wxObject*) new wxRect(topLeft,bottomRight) ); } @@ -92,8 +102,13 @@ wxRegion::wxRegion( const wxRect& rect ) g_rect.y = rect.y; g_rect.width = rect.width; g_rect.height = rect.height; +#ifdef __WXGTK20__ + gdk_region_union_with_rect( reg, &g_rect ); + M_REGIONDATA->m_region = reg; +#else M_REGIONDATA->m_region = gdk_region_union_with_rect( reg, &g_rect ); gdk_region_destroy( reg ); +#endif M_REGIONDATA->m_rects.Append( (wxObject*) new wxRect(rect.x,rect.y,rect.width,rect.height) ); } @@ -131,14 +146,23 @@ bool wxRegion::Union( wxCoord x, wxCoord y, wxCoord width, wxCoord height ) { m_refData = new wxRegionRefData(); GdkRegion *reg = gdk_region_new(); +#ifdef __WXGTK20__ + gdk_region_union_with_rect( reg, &rect ); + M_REGIONDATA->m_region = reg; +#else M_REGIONDATA->m_region = gdk_region_union_with_rect( reg, &rect ); gdk_region_destroy( reg ); +#endif } else { +#ifdef __WXGTK20__ + gdk_region_union_with_rect( M_REGIONDATA->m_region, &rect ); +#else GdkRegion *reg = gdk_region_union_with_rect( M_REGIONDATA->m_region, &rect ); gdk_region_destroy( M_REGIONDATA->m_region ); M_REGIONDATA->m_region = reg; +#endif } M_REGIONDATA->m_rects.Append( (wxObject*) new wxRect(x,y,width,height) ); @@ -162,9 +186,13 @@ bool wxRegion::Union( const wxRegion& region ) M_REGIONDATA->m_region = gdk_region_new(); } +#ifdef __WXGTK20__ + gdk_region_union( M_REGIONDATA->m_region, region.GetRegion() ); +#else GdkRegion *reg = gdk_regions_union( M_REGIONDATA->m_region, region.GetRegion() ); gdk_region_destroy( M_REGIONDATA->m_region ); M_REGIONDATA->m_region = reg; +#endif wxNode *node = region.GetRectList()->First(); while (node) @@ -215,9 +243,13 @@ bool wxRegion::Intersect( const wxRegion& region ) return TRUE; } +#ifdef __WXGTK20__ + gdk_region_intersect( M_REGIONDATA->m_region, region.GetRegion() ); +#else GdkRegion *reg = gdk_regions_intersect( M_REGIONDATA->m_region, region.GetRegion() ); gdk_region_destroy( M_REGIONDATA->m_region ); M_REGIONDATA->m_region = reg; +#endif return TRUE; } @@ -258,9 +290,13 @@ bool wxRegion::Subtract( const wxRegion& region ) M_REGIONDATA->m_region = gdk_region_new(); } +#ifdef __WXGTK20__ + gdk_region_subtract( M_REGIONDATA->m_region, region.GetRegion() ); +#else GdkRegion *reg = gdk_regions_subtract( M_REGIONDATA->m_region, region.GetRegion() ); gdk_region_destroy( M_REGIONDATA->m_region ); M_REGIONDATA->m_region = reg; +#endif return TRUE; } @@ -301,9 +337,13 @@ bool wxRegion::Xor( const wxRegion& region ) M_REGIONDATA->m_region = gdk_region_new(); } +#ifdef __WXGTK20__ + gdk_region_xor( M_REGIONDATA->m_region, region.GetRegion() ); +#else GdkRegion *reg = gdk_regions_xor( M_REGIONDATA->m_region, region.GetRegion() ); gdk_region_destroy( M_REGIONDATA->m_region ); M_REGIONDATA->m_region = reg; +#endif wxNode *node = region.GetRectList()->First(); while (node) -- 2.45.2