X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6d7ee9e860187240a5f82ec4489c831f894065f2..750d64e653a18b75f1a2798133a377143a2ac59e:/src/mgl/region.cpp diff --git a/src/mgl/region.cpp b/src/mgl/region.cpp index a3f2b9b0c6..ad94b81123 100644 --- a/src/mgl/region.cpp +++ b/src/mgl/region.cpp @@ -1,13 +1,13 @@ ///////////////////////////////////////////////////////////////////////////// // Name: region.cpp -// Purpose: Region handling for wxWindows/MGL +// Purpose: Region handling for wxWidgets/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 ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "region.h" #endif @@ -21,6 +21,7 @@ #include "wx/region.h" #include "wx/gdicmn.h" #include "wx/thread.h" +#include "wx/module.h" #include @@ -290,6 +291,27 @@ wxRegionContain wxRegion::Contains(const wxRect& rect) const // wxRegionIterator // /////////////////////////////////////////////////////////////////////////////// +#if wxUSE_THREADS +static wxMutex *gs_mutexIterator; + +class wxMglRegionModule : public wxModule +{ +public: + virtual bool OnInit() + { + gs_mutexIterator = new wxMutex(); + return TRUE; + } + virtual void OnExit() + { + wxDELETE(gs_mutexIterator); + } + + DECLARE_DYNAMIC_CLASS(wxMglRegionModule) +}; +IMPLEMENT_DYNAMIC_CLASS(wxMglRegionModule, wxModule) +#endif + /* * Initialize empty iterator */ @@ -331,10 +353,11 @@ void wxRegionIterator::Reset(const wxRegion& region) if (!region.Empty()) { - wxMutexGuiEnter(); +#if wxUSE_THREADS + wxMutexLocker(*gs_mutexIterator); +#endif gs_rectList = &m_rects; M_REGION_OF(region).traverse(wxMGL_region_callback); - wxMutexGuiLeave(); m_currentNode = m_rects.GetFirst(); } }