Forward port of my recent changes in the 2.8 branch:

* Force use of floating point math in wxGCDC::DoDrawEllipticArc.

 * Check for 0.5 offset in wxGCDC::DoDrawRoundedRectangle and
   DoDrawEllipse.  Set wxGDIPlusContext to use the offset.

 * Avoid crash in wxStdDialogButtonSizer::Realize if there is no
   negative button.

 * Provide implementations for wxCairoPathData::AddPath,
   wxCairoContext::Clip, wxCairoContext::DrawBitmap,
   wxCairoContext::DrawIcon, and wxCairoContext::GetTextExtent.

 * Fix wxCairoContext::DrawText to draw the text using the upper-left
   corner for the x,y position, not the baseline.

 * Fix wxMacCoreGraphicsRenderer::CreateContext to be able to use a
   wxMemoryDC as the target.

 * Map wxTELETYPE font family on wxMac to a monospace font.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45077 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2007-03-26 20:08:41 +00:00
parent 28e88942bc
commit d9485f89b8
6 changed files with 211 additions and 30 deletions

View File

@@ -501,20 +501,15 @@ void wxGCDC::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord w, wxCoord h,
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();
}
@@ -698,6 +693,13 @@ void wxGCDC::DoDrawRoundedRectangle(wxCoord x, wxCoord y,
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);
}
@@ -708,6 +710,13 @@ void wxGCDC::DoDrawEllipse(wxCoord x, wxCoord y, wxCoord w, wxCoord h)
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);
}