void wxGCDC::DestroyClippingRegion()
{
m_graphicContext->ResetClip();
+ // currently the clip eg of a window extends to the area between the scrollbars
+ // so we must explicitely make sure it only covers the area we want it to draw
+ int width, height ;
+ GetSize( &width , &height ) ;
+ m_graphicContext->Clip( DeviceToLogicalX(0) , DeviceToLogicalY(0) , width, height );
+
m_graphicContext->SetPen( m_pen );
m_graphicContext->SetBrush( m_brush );
if ( !m_logicalFunctionSupported )
return;
- bool fill = m_brush.GetStyle() != wxTRANSPARENT;
-
wxGraphicsPath path = m_graphicContext->CreatePath();
m_graphicContext->PushState();
- m_graphicContext->Translate(x+w/2,y+h/2);
+ m_graphicContext->Translate(x+w/2.0,y+h/2.0);
wxDouble factor = ((wxDouble) w) / h;
m_graphicContext->Scale( factor , 1.0);
- if ( fill && (sa!=ea) )
- path.MoveToPoint(0,0);
+
// since these angles (ea,sa) are measured counter-clockwise, we invert them to
// get clockwise angles
- path.AddArc( 0, 0, h/2 , DegToRad(-sa) , DegToRad(-ea), sa > ea );
- if ( fill && (sa!=ea) )
- path.AddLineToPoint(0,0);
+ path.AddArc( 0, 0, h/2.0 , DegToRad(-sa) , DegToRad(-ea), sa > ea );
m_graphicContext->DrawPath( path );
m_graphicContext->PopState();
}
if (w == 0 || h == 0)
return;
+ if ( m_graphicContext->ShouldOffset() )
+ {
+ // if we are offsetting the entire rectangle is moved 0.5, so the
+ // border line gets off by 1
+ w -= 1;
+ h -= 1;
+ }
m_graphicContext->DrawRoundedRectangle( x,y,w,h,radius);
}
if ( !m_logicalFunctionSupported )
return;
+ if ( m_graphicContext->ShouldOffset() )
+ {
+ // if we are offsetting the entire rectangle is moved 0.5, so the
+ // border line gets off by 1
+ w -= 1;
+ h -= 1;
+ }
m_graphicContext->DrawEllipse(x,y,w,h);
}
bool wxGCDC::DoBlit(
wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
- wxDC *source, wxCoord xsrc, wxCoord ysrc, int logical_func , bool WXUNUSED(useMask),
+ wxDC *source, wxCoord xsrc, wxCoord ysrc, int logical_func , bool useMask,
+ wxCoord xsrcMask, wxCoord ysrcMask )
+{
+ return DoStretchBlit( xdest, ydest, width, height,
+ source, xsrc, ysrc, width, height, logical_func, useMask,
+ xsrcMask,ysrcMask );
+}
+
+bool wxGCDC::DoStretchBlit(
+ wxCoord xdest, wxCoord ydest, wxCoord dstWidth, wxCoord dstHeight,
+ wxDC *source, wxCoord xsrc, wxCoord ysrc, wxCoord srcWidth, wxCoord srcHeight,
+ int logical_func , bool WXUNUSED(useMask),
wxCoord xsrcMask, wxCoord ysrcMask )
{
- wxCHECK_MSG( Ok(), false, wxT("wxGCDC(cg)::DoBlit - invalid DC") );
- wxCHECK_MSG( source->Ok(), false, wxT("wxGCDC(cg)::DoBlit - invalid source DC") );
+ wxCHECK_MSG( Ok(), false, wxT("wxGCDC(cg)::DoStretchBlit - invalid DC") );
+ wxCHECK_MSG( source->Ok(), false, wxT("wxGCDC(cg)::DoStretchBlit - invalid source DC") );
if ( logical_func == wxNO_OP )
return true;
wxRect subrect(source->LogicalToDeviceX(xsrc),
source->LogicalToDeviceY(ysrc),
- source->LogicalToDeviceXRel(width),
- source->LogicalToDeviceYRel(height));
+ source->LogicalToDeviceXRel(srcWidth),
+ source->LogicalToDeviceYRel(srcHeight));
// if needed clip the subrect down to the size of the source DC
wxCoord sw, sh;
if ( blit.Ok() )
{
m_graphicContext->DrawBitmap( blit, xdest, ydest,
- wxMin(width, blit.GetWidth()),
- wxMin(height, blit.GetHeight()));
+ dstWidth, dstHeight);
}
else
{
void wxGCDC::DoGetTextExtent( const wxString &str, wxCoord *width, wxCoord *height,
wxCoord *descent, wxCoord *externalLeading ,
- wxFont *theFont ) const
+ const wxFont *theFont ) const
{
wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoGetTextExtent - invalid DC") );