]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/dccg.cpp
Made wxStreamBase::IsOk() virtual;
[wxWidgets.git] / src / mac / carbon / dccg.cpp
index 364809af1b011fa200847830790362fee8cb869b..845f0bf88ef711dd567b49ec1970248b6b0ccb1b 100755 (executable)
 
 #ifndef WX_PRECOMP
     #include "wx/log.h"
-    #include "wx/app.h"
     #include "wx/dcmemory.h"
-    #include "wx/dcprint.h"
     #include "wx/region.h"
-    #include "wx/image.h"
 #endif
 
 #include "wx/mac/uma.h"
 
-
 #ifdef __MSL__
     #if __MSL__ >= 0x6000
         #include "math.h"
@@ -58,12 +54,9 @@ const double M_PI = 3.14159265358979 ;
 #endif
 #endif
 
-const double RAD2DEG = 180.0 / M_PI;
-const short kEmulatedMode = -1 ;
-const short kUnsupportedMode = -2 ;
-
-extern TECObjectRef s_TECNativeCToUnicode ;
+static const double RAD2DEG = 180.0 / M_PI;
 
+#ifndef __LP64__
 
 // TODO: update
 // The textctrl implementation still needs that (needs what?) for the non-HIView implementation
@@ -131,13 +124,12 @@ wxMacPortSetter::~wxMacPortSetter()
 {
 //    m_dc->MacCleanupPort(&m_ph) ;
 }
+#endif
 
 //-----------------------------------------------------------------------------
 // Local functions
 //-----------------------------------------------------------------------------
 
-static inline double dmin(double a, double b) { return a < b ? a : b; }
-static inline double dmax(double a, double b) { return a > b ? a : b; }
 static inline double DegToRad(double deg) { return (deg * M_PI) / 180.0; }
 
 //-----------------------------------------------------------------------------
@@ -252,9 +244,10 @@ wxMacCGContext::~wxMacCGContext()
         CGContextRestoreGState( m_cgContext ) ;
         CGContextRestoreGState( m_cgContext ) ;
     }
-
+#ifndef __LP64__
     if ( m_qdPort )
         QDEndCGContext( m_qdPort, &m_cgContext ) ;
+#endif
 }
 
 
@@ -353,8 +346,11 @@ CGContextRef wxMacCGContext::GetNativeContext()
     if ( m_cgContext == NULL )
     {
         Rect bounds ;
+        OSStatus status = noErr;
+#ifndef __LP64__
         GetPortBounds( (CGrafPtr) m_qdPort , &bounds ) ;
-        OSStatus status = QDBeginCGContext((CGrafPtr) m_qdPort , &m_cgContext) ;
+        status = QDBeginCGContext((CGrafPtr) m_qdPort , &m_cgContext) ;
+#endif
         CGContextSaveGState( m_cgContext ) ;
 
         wxASSERT_MSG( status == noErr , wxT("Cannot nest wxDCs on the same window") ) ;
@@ -479,7 +475,7 @@ const CGPatternCallbacks wxMacCGPattern::ms_Callbacks = { 0, &wxMacCGPattern::_R
 class ImagePattern : public wxMacCGPattern
 {
 public :
-    ImagePattern( const wxBitmap* bmp , CGAffineTransform transform )
+    ImagePattern( const wxBitmap* bmp , const CGAffineTransform& transform )
     {
         wxASSERT( bmp && bmp->Ok() ) ;
 
@@ -487,7 +483,7 @@ public :
     }
 
     // ImagePattern takes ownership of CGImageRef passed in
-    ImagePattern( CGImageRef image , CGAffineTransform transform )
+    ImagePattern( CGImageRef image , const CGAffineTransform& transform )
     {
         if ( image )
             CFRetain( image ) ;
@@ -502,7 +498,7 @@ public :
     }
 
 protected :
-    void Init( CGImageRef image, CGAffineTransform transform )
+    void Init( CGImageRef image, const CGAffineTransform& transform )
     {
         m_image = image ;
         if ( m_image )
@@ -528,7 +524,7 @@ protected :
 class HatchPattern : public wxMacCGPattern
 {
 public :
-    HatchPattern( int hatchstyle, CGAffineTransform transform )
+    HatchPattern( int hatchstyle, const CGAffineTransform& transform )
     {
         m_hatch = hatchstyle ;
         m_imageBounds = CGRectMake( 0.0, 0.0, 8.0 , 8.0 ) ;
@@ -652,7 +648,7 @@ void wxMacCGContext::SetPen( const wxPen &pen )
     CGContextSetShouldAntialias( m_cgContext , false ) ;
 #endif
 
-    if ( fill | stroke )
+    if ( fill || stroke )
     {
         // set up brushes
         m_mode = kCGPathFill ; // just a default
@@ -829,7 +825,7 @@ void wxMacCGContext::SetBrush( const wxBrush &brush )
     CGContextSetShouldAntialias( m_cgContext , false ) ;
 #endif
 
-    if ( fill | stroke )
+    if ( fill || stroke )
     {
         // setup brushes
         m_mode = kCGPathFill ; // just a default
@@ -1096,8 +1092,7 @@ void wxMacCGContext::GetPartialTextExtents(const wxString& text, wxArrayInt& wid
 #endif
 #endif
 
-    OSStatus status;
-    status = ::ATSUCreateTextLayoutWithTextPtr( (UniCharArrayPtr) ubuf , 0 , chars , chars , 1 ,
+    ::ATSUCreateTextLayoutWithTextPtr( (UniCharArrayPtr) ubuf , 0 , chars , chars , 1 ,
         &chars , (ATSUStyle*) &m_macATSUIStyle , &atsuLayout ) ;
 
     for ( int pos = 0; pos < (int)chars; pos ++ )
@@ -1591,14 +1586,14 @@ bool wxDC::DoGetPixel( wxCoord x, wxCoord y, wxColour *col ) const
 {
     wxCHECK_MSG( Ok(), false, wxT("wxDC(cg)::DoGetPixel - invalid DC") );
 
-    wxMacPortSaver helper((CGrafPtr)m_macPort) ;
     RGBColor colour;
-
+#ifndef __LP64__
+    wxMacPortSaver helper((CGrafPtr)m_macPort) ;
     // NB: GetCPixel is a deprecated QD call, and a slow one at that
     GetCPixel(
         XLOG2DEVMAC(x) + m_macLocalOriginInPort.x - m_macLocalOrigin.x,
         YLOG2DEVMAC(y) + m_macLocalOriginInPort.y - m_macLocalOrigin.y, &colour );
-
+#endif
     // convert from Mac colour to wx
     col->Set( colour.red >> 8, colour.green >> 8, colour.blue >> 8 );
 
@@ -2136,7 +2131,6 @@ void wxDC::DoGetTextExtent( const wxString &str, wxCoord *width, wxCoord *height
 {
     wxCHECK_RET( Ok(), wxT("wxDC(cg)::DoGetTextExtent - invalid DC") );
 
-    wxFont formerFont = m_font ;
     if ( theFont )
     {
         m_graphicContext->SetFont( *theFont ) ;