X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a4bbc9f720cbd99d7092e8944e671a6291068b13..8f974c520a8733158591891458fda10fae4c3950:/src/mgl/dc.cpp?ds=sidebyside diff --git a/src/mgl/dc.cpp b/src/mgl/dc.cpp index bc91b0e75e..4b556de6b7 100644 --- a/src/mgl/dc.cpp +++ b/src/mgl/dc.cpp @@ -172,6 +172,7 @@ wxDC::wxDC() m_downloadedPatterns[0] = m_downloadedPatterns[1] = FALSE; m_mglFont = NULL; + m_globalClippingRegion = NULL; } @@ -179,6 +180,7 @@ wxDC::~wxDC() { if (m_OwnsMGLDC) delete m_MGLDC; + delete m_globalClippingRegion; } void wxDC::SetMGLDC(MGLDevCtx *mgldc, bool OwnsMGLDC) @@ -188,6 +190,15 @@ void wxDC::SetMGLDC(MGLDevCtx *mgldc, bool OwnsMGLDC) m_MGLDC = mgldc; m_OwnsMGLDC = OwnsMGLDC; m_ok = TRUE; + + if ( mgldc->getDC()->a.clipRegion ) + { + m_globalClippingRegion = new MGLRegion; + mgldc->getClipRegion(*m_globalClippingRegion); + } + else + m_globalClippingRegion = NULL; + InitializeMGLDC(); } @@ -226,7 +237,13 @@ void wxDC::DoSetClippingRegion(wxCoord cx, wxCoord cy, wxCoord cw, wxCoord ch) else m_currentClippingRegion.Union(rect); - m_MGLDC->setClipRegion(m_currentClippingRegion.GetMGLRegion()); + if ( m_globalClippingRegion ) + { + m_MGLDC->setClipRegion(m_currentClippingRegion.GetMGLRegion() + & *m_globalClippingRegion); + } + else + m_MGLDC->setClipRegion(m_currentClippingRegion.GetMGLRegion()); m_clipping = TRUE; DO_SET_CLIPPING_BOX(m_currentClippingRegion) @@ -265,7 +282,13 @@ void wxDC::DoSetClippingRegionAsRegion(const wxRegion& region) else m_currentClippingRegion.Union(rg); - m_MGLDC->setClipRegion(m_currentClippingRegion.GetMGLRegion()); + if ( m_globalClippingRegion ) + { + m_MGLDC->setClipRegion(m_currentClippingRegion.GetMGLRegion() + & *m_globalClippingRegion); + } + else + m_MGLDC->setClipRegion(m_currentClippingRegion.GetMGLRegion()); m_clipping = TRUE; DO_SET_CLIPPING_BOX(m_currentClippingRegion) @@ -275,7 +298,10 @@ void wxDC::DestroyClippingRegion() { wxCHECK_RET( Ok(), wxT("invalid dc") ); - m_MGLDC->setClipRect(MGLRect(0, 0, m_MGLDC->sizex(), m_MGLDC->sizey())); + if ( m_globalClippingRegion ) + m_MGLDC->setClipRegion(*m_globalClippingRegion); + else + m_MGLDC->setClipRect(MGLRect(0, 0, m_MGLDC->sizex(), m_MGLDC->sizey())); m_clipping = FALSE; m_currentClippingRegion.Clear(); } @@ -308,9 +334,7 @@ void wxDC::Clear() wxCHECK_RET( Ok(), wxT("invalid dc") ); m_MGLDC->makeCurrent(); // will go away with MGL6.0 - m_MGLDC->clearDevice(); - if ( m_backgroundBrush.GetStyle() != wxSOLID && - m_backgroundBrush.GetStyle() != wxTRANSPARENT ) + if ( m_backgroundBrush.GetStyle() != wxTRANSPARENT ) { int w, h; wxBrush oldb = m_brush; @@ -691,7 +715,6 @@ void wxDC::DoDrawEllipticArc(wxCoord x,wxCoord y,wxCoord w,wxCoord h,double sa,d void wxDC::DoDrawText(const wxString& text, wxCoord x, wxCoord y) { - if ( m_pen.GetStyle() == wxTRANSPARENT ) return; m_MGLDC->makeCurrent(); // will go away with MGL6.0 DrawAnyText(text, x, y); @@ -785,7 +808,6 @@ void wxDC::DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, double angle) { - if ( m_pen.GetStyle() == wxTRANSPARENT ) return; m_MGLDC->makeCurrent(); // will go away with MGL6.0 if ( angle == 0 )