64 bit fixes

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50211 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2007-11-24 09:41:14 +00:00
parent 18d52fedab
commit 1bd568fa44
8 changed files with 106 additions and 23 deletions

View File

@@ -39,6 +39,12 @@
typedef float CGFloat;
#endif
#ifdef __LP64__
#define wxMAC_USE_CORE_TEXT 1
#else
#define wxMAC_USE_ATSU_TEXT 1
#endif
#undef wxMAC_USE_CG_TEXT
//-----------------------------------------------------------------------------
// constants
//-----------------------------------------------------------------------------
@@ -66,8 +72,9 @@ OSStatus wxMacDrawCGImage(
#ifdef __LP64__
// todo flip
CGContextDrawImage(inContext, *inBounds, inImage );
return noErr;
#else
HIViewDrawCGImage( inContext, inBounds, inImage );
return HIViewDrawCGImage( inContext, inBounds, inImage );
#endif
}
@@ -708,6 +715,8 @@ wxMacCoreGraphicsFontData::wxMacCoreGraphicsFontData(wxGraphicsRenderer* rendere
{
m_macATSUIStyle = NULL;
#ifdef wxMAC_USE_CORE_TEXT
#elif defined(wxMAC_USE_ATSU_TEXT)
OSStatus status;
status = ATSUCreateAndCopyStyle( (ATSUStyle) font.MacGetATSUStyle() , &m_macATSUIStyle );
@@ -740,15 +749,21 @@ wxMacCoreGraphicsFontData::wxMacCoreGraphicsFontData(wxGraphicsRenderer* rendere
atsuTags, atsuSizes, atsuValues);
wxASSERT_MSG( status == noErr , wxT("couldn't modify ATSU style") );
#elif defined(WXMAC_USE_CG_TEXT)
#endif
}
wxMacCoreGraphicsFontData::~wxMacCoreGraphicsFontData()
{
#ifdef wxMAC_USE_CORE_TEXT
#elif defined(wxMAC_USE_ATSU_TEXT)
if ( m_macATSUIStyle )
{
::ATSUDisposeStyle((ATSUStyle)m_macATSUIStyle);
m_macATSUIStyle = NULL;
}
#elif defined(WXMAC_USE_CG_TEXT)
#endif
}
//
@@ -1320,9 +1335,12 @@ wxMacCoreGraphicsContext::wxMacCoreGraphicsContext( wxGraphicsRenderer* renderer
int originX , originY;
originX = originY = 0;
window->MacWindowToRootWindow( &originX , &originY );
Rect bounds;
GetWindowBounds( m_windowRef, kWindowContentRgn, &bounds );
Rect bounds = { 0,0,0,0 };
#ifdef __LP64__
#else
GetWindowBounds( m_windowRef, kWindowContentRgn, &bounds );
#endif
m_windowTransform = CGAffineTransformMakeTranslation( 0 , bounds.bottom - bounds.top );
m_windowTransform = CGAffineTransformScale( m_windowTransform , 1 , -1 );
m_windowTransform = CGAffineTransformTranslate( m_windowTransform, originX, originY ) ;
@@ -1711,7 +1729,17 @@ void wxMacCoreGraphicsContext::PopState()
void wxMacCoreGraphicsContext::DrawText( const wxString &str, wxDouble x, wxDouble y )
{
if ( m_font.IsNull() )
return;
EnsureIsValid();
#ifdef wxMAC_USE_CORE_TEXT
// TODO core text implementation here
#elif defined(wxMAC_USE_ATSU_TEXT)
DrawText(str, x, y, 0.0);
#elif defined(WXMAC_USE_CG_TEXT)
// TODO core graphics text implementation here
#endif
}
void wxMacCoreGraphicsContext::DrawText( const wxString &str, wxDouble x, wxDouble y, wxDouble angle )
@@ -1720,7 +1748,10 @@ void wxMacCoreGraphicsContext::DrawText( const wxString &str, wxDouble x, wxDoub
return;
EnsureIsValid();
#ifdef wxMAC_USE_CORE_TEXT
// default implementation takes care of rotation and calls non rotated DrawText afterwards
wxGraphicsContext::DrawText( str, x, y, angle );
#elif defined(wxMAC_USE_ATSU_TEXT)
OSStatus status = noErr;
ATSUTextLayout atsuLayout;
UniCharCount chars = str.length();
@@ -1826,6 +1857,10 @@ void wxMacCoreGraphicsContext::DrawText( const wxString &str, wxDouble x, wxDoub
#if SIZEOF_WCHAR_T == 4
free( ubuf );
#endif
#elif defined(WXMAC_USE_CG_TEXT)
// default implementation takes care of rotation and calls non rotated DrawText afterwards
wxGraphicsContext::DrawText( str, x, y, angle );
#endif
}
void wxMacCoreGraphicsContext::GetTextExtent( const wxString &str, wxDouble *width, wxDouble *height,
@@ -1845,6 +1880,9 @@ void wxMacCoreGraphicsContext::GetTextExtent( const wxString &str, wxDouble *wid
if (str.empty())
return;
#ifdef wxMAC_USE_CORE_TEXT
// TODO core text implementation here
#elif defined(wxMAC_USE_ATSU_TEXT)
OSStatus status = noErr;
ATSUTextLayout atsuLayout;
@@ -1899,6 +1937,9 @@ void wxMacCoreGraphicsContext::GetTextExtent( const wxString &str, wxDouble *wid
#if SIZEOF_WCHAR_T == 4
free( ubuf ) ;
#endif
#elif defined(WXMAC_USE_CG_TEXT)
// TODO core graphics text implementation here
#endif
}
void wxMacCoreGraphicsContext::GetPartialTextExtents(const wxString& text, wxArrayDouble& widths) const
@@ -1909,6 +1950,9 @@ void wxMacCoreGraphicsContext::GetPartialTextExtents(const wxString& text, wxArr
if (text.empty())
return;
#ifdef wxMAC_USE_CORE_TEXT
// TODO core text implementation here
#elif defined(wxMAC_USE_ATSU_TEXT)
ATSUTextLayout atsuLayout;
UniCharCount chars = text.length();
UniChar* ubuf = NULL;
@@ -1960,6 +2004,9 @@ void wxMacCoreGraphicsContext::GetPartialTextExtents(const wxString& text, wxArr
#if SIZEOF_WCHAR_T == 4
free( ubuf ) ;
#endif
#elif defined(WXMAC_USE_CG_TEXT)
// TODO core graphics text implementation here
#endif
}
void * wxMacCoreGraphicsContext::GetNativeContext()