X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0cbff1201aa47e2b73ec90a97886f18e88270ea6..8f974c520a8733158591891458fda10fae4c3950:/src/mgl/dc.cpp?ds=sidebyside diff --git a/src/mgl/dc.cpp b/src/mgl/dc.cpp index e33904e99a..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); @@ -765,7 +788,7 @@ void wxDC::DrawAnyText(const wxString& text, wxCoord x, wxCoord y) if ( m_font.GetUnderlined() ) { int x1 = xx, y1 = yy; - int x2, y2; + int x2 = 0 , y2 = 0; int w = m_MGLDC->textWidth(c_text); m_MGLDC->underScoreLocation(x1, y1, c_text); switch (m_MGLDC->getTextDirection()) @@ -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 ) @@ -1397,7 +1419,7 @@ bool wxDC::DoBlit(wxCoord xdest, wxCoord ydest, xsrc = source->LogicalToDeviceX(xsrc); ysrc = source->LogicalToDeviceY(ysrc); - /* TODO: use the mask origin when drawing transparently */ + /* FIXME_MGL: use the mask origin when drawing transparently */ if (xsrcMask == -1 && ysrcMask == -1) { xsrcMask = xsrc; ysrcMask = ysrc;