X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c94f845b1602d44ccd7c7542afffde666adbb2f0..0bd2681966523df88ad5cf8e505b532843e58d74:/src/msw/metafile.cpp diff --git a/src/msw/metafile.cpp b/src/msw/metafile.cpp index 5b3e574c4d..2186f3ef18 100644 --- a/src/msw/metafile.cpp +++ b/src/msw/metafile.cpp @@ -191,7 +191,7 @@ wxMetafileDC::wxMetafileDC(const wxString& file, int xext, int yext, int xorg, i m_maxY = -10000; if ( !file.empty() && wxFileExists(file) ) wxRemoveFile(file); - m_hDC = (WXHDC) CreateMetaFile(file.empty() ? NULL : file.c_str()); + m_hDC = (WXHDC) CreateMetaFile(file.empty() ? NULL : file.wx_str()); m_ok = true; @@ -209,23 +209,22 @@ wxMetafileDC::~wxMetafileDC() m_hDC = 0; } -void wxMetafileDC::GetTextExtent(const wxString& string, long *x, long *y, - long *descent, long *externalLeading, - const wxFont *theFont, - bool WXUNUSED(use16bit)) const +void wxMetafileDC::DoGetTextExtent(const wxString& string, + wxCoord *x, wxCoord *y, + wxCoord *descent, wxCoord *externalLeading, + const wxFont *theFont) const { const wxFont *fontToUse = theFont; if (!fontToUse) fontToUse = &m_font; - HDC dc = GetDC(NULL); + ScreenHDC dc; + SelectInHDC selFont(dc, GetHfontOf(*fontToUse)); SIZE sizeRect; TEXTMETRIC tm; ::GetTextExtentPoint32(dc, WXSTRINGCAST string, wxStrlen(WXSTRINGCAST string), &sizeRect); - GetTextMetrics(dc, &tm); - - ReleaseDC(NULL, dc); + ::GetTextMetrics(dc, &tm); if ( x ) *x = sizeRect.cx;