m_downloadedPatterns[0] = m_downloadedPatterns[1] = FALSE;
m_mglFont = NULL;
+ m_globalClippingRegion = NULL;
}
{
if (m_OwnsMGLDC)
delete m_MGLDC;
+ delete m_globalClippingRegion;
}
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();
}
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)
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)
{
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();
}
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;
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);
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())
wxCoord x, wxCoord y,
double angle)
{
- if ( m_pen.GetStyle() == wxTRANSPARENT ) return;
m_MGLDC->makeCurrent(); // will go away with MGL6.0
if ( angle == 0 )
bool wxDC::DoBlit(wxCoord xdest, wxCoord ydest,
wxCoord width, wxCoord height,
wxDC *source, wxCoord xsrc, wxCoord ysrc,
- int rop, bool useMask)
+ int rop, bool useMask,
+ wxCoord xsrcMask, wxCoord ysrcMask)
{
wxCHECK_MSG( Ok(), FALSE, wxT("invalid dc") );
wxCHECK_MSG( source, FALSE, wxT("invalid source dc") );
xsrc = source->LogicalToDeviceX(xsrc);
ysrc = source->LogicalToDeviceY(ysrc);
+ /* FIXME_MGL: use the mask origin when drawing transparently */
+ if (xsrcMask == -1 && ysrcMask == -1)
+ {
+ xsrcMask = xsrc; ysrcMask = ysrc;
+ }
+ else
+ {
+ xsrcMask = source->LogicalToDeviceX(xsrcMask);
+ ysrcMask = source->LogicalToDeviceY(ysrcMask);
+ }
+
CalcBoundingBox(xdest, ydest);
CalcBoundingBox(xdest + width, ydest + height);