void wxGDIPlusPathData::AddArc( wxDouble x, wxDouble y, wxDouble r, double startAngle, double endAngle, bool clockwise )
{
double sweepAngle = endAngle - startAngle ;
- if( abs(sweepAngle) >= 2*M_PI)
+ if( fabs(sweepAngle) >= 2*M_PI)
{
sweepAngle = 2 * M_PI;
}
helper->GetPixelFormat(),&data);
image = new Bitmap(data.Width, data.Height, data.Stride,
- PixelFormat32bppARGB , (BYTE*) data.Scan0);
+ PixelFormat32bppPARGB , (BYTE*) data.Scan0);
helper->UnlockBits(&data);
}
f->GetSize() / ffamily.GetEmHeight(FontStyleRegular);
if ( height )
- *height = rHeight * factorY + 0.5 ;
+ *height = rHeight * factorY;
if ( descent )
- *descent = rDescent * factorY + 0.5 ;
+ *descent = rDescent * factorY;
if ( externalLeading )
- *externalLeading = (rHeight - rAscent - rDescent) * factorY + 0.5 ;
+ *externalLeading = (rHeight - rAscent - rDescent) * factorY;
// measuring empty strings is not guaranteed, so do it by hand
if ( str.IsEmpty())
{
StringFormat strFormat;
CharacterRange strRange(0,wcslen(s));
strFormat.SetMeasurableCharacterRanges(1,&strRange);
+ strFormat.SetFormatFlags(StringFormatFlagsMeasureTrailingSpaces);
+
Region region ;
m_context->MeasureCharacterRanges(s, -1 , f,layoutRect, &strFormat,1,®ion) ;
RectF bbox ;
region.GetBounds(&bbox,m_context);
if ( width )
- *width = bbox.GetRight()-bbox.GetLeft()+0.5;
+ *width = bbox.GetRight()-bbox.GetLeft();
}
}
ranges[i].Length = 1 ;
}
strFormat.SetMeasurableCharacterRanges(len,ranges);
+ strFormat.SetFormatFlags(StringFormatFlagsMeasureTrailingSpaces);
m_context->MeasureCharacterRanges(ws, -1 , f,layoutRect, &strFormat,1,regions) ;
RectF bbox ;
void EnsureIsLoaded();
void Load();
void Unload();
+ friend class wxGDIPlusRendererModule;
private :
bool m_loaded;
void wxGDIPlusRenderer::Unload()
{
if ( m_gditoken )
+ {
GdiplusShutdown(m_gditoken);
+ m_gditoken = NULL;
+ }
+ m_loaded = false;
}
wxGraphicsContext * wxGDIPlusRenderer::CreateContext( const wxWindowDC& dc)
return wxNullGraphicsFont;
}
+// Shutdown GDI+ at app exit, before possible dll unload
+class wxGDIPlusRendererModule : public wxModule
+{
+public:
+ virtual bool OnInit() { return true; }
+ virtual void OnExit() { gs_GDIPlusRenderer.Unload(); }
+
+private:
+ DECLARE_DYNAMIC_CLASS(wxGDIPlusRendererModule)
+};
+
+IMPLEMENT_DYNAMIC_CLASS(wxGDIPlusRendererModule, wxModule)
+
#endif // wxUSE_GRAPHICS_CONTEXT