]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/graphics.cpp
use wxLocaltime_r() instead of localtime(): this is safer and localtime() isn't avail...
[wxWidgets.git] / src / mac / carbon / graphics.cpp
index a79c96bfc94fc2769c867dd06d99249c680b8b22..3778c0d47c876a06aebd48c77abcda425c77c56e 100755 (executable)
@@ -796,7 +796,7 @@ bool wxMacCoreGraphicsMatrixData::IsEqual( const wxGraphicsMatrixData* t) const
 {
     const CGAffineTransform* tm = (CGAffineTransform*) t->GetNativeMatrix();
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
-    if ( CGAffineTransformEqualToTransform )
+    if ( CGAffineTransformEqualToTransform!=NULL )
     {
         return CGAffineTransformEqualToTransform(m_matrix, *((CGAffineTransform*) t->GetNativeMatrix()));
     }
@@ -1050,7 +1050,7 @@ void wxMacCoreGraphicsPathData::GetBox(wxDouble *x, wxDouble *y, wxDouble *w, wx
 bool wxMacCoreGraphicsPathData::Contains( wxDouble x, wxDouble y, int fillStyle) const
 {
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
-    if ( CGPathContainsPoint )
+    if ( CGPathContainsPoint!=NULL )
     {
         return CGPathContainsPoint( m_path, NULL, CGPointMake(x,y), fillStyle == wxODDEVEN_RULE );
     }
@@ -1494,7 +1494,33 @@ void wxMacCoreGraphicsContext::DrawBitmap( const wxBitmap &bmp, wxDouble x, wxDo
 
     CGImageRef image = (CGImageRef)( bmp.CGImageCreate() );
     HIRect r = CGRectMake( x , y , w , h );
-    HIViewDrawCGImage( m_cgContext , &r , image );
+    if ( bmp.GetDepth() == 1 )
+    {
+        // is is a mask, the '1' in the mask tell where to draw the current brush
+        if (  !m_brush.IsNull() )
+        {
+            if ( ((wxMacCoreGraphicsBrushData*)m_brush.GetRefData())->IsShading() )
+            {
+                // TODO clip to mask
+            /*
+                CGContextSaveGState( m_cgContext );
+                CGContextAddPath( m_cgContext , (CGPathRef) path.GetNativePath() );
+                CGContextClip( m_cgContext );
+                CGContextDrawShading( m_cgContext, ((wxMacCoreGraphicsBrushData*)m_brush.GetRefData())->GetShading() );
+                CGContextRestoreGState( m_cgContext);
+            */
+            }
+            else
+            {
+                ((wxMacCoreGraphicsBrushData*)m_brush.GetRefData())->Apply(this);
+                HIViewDrawCGImage( m_cgContext , &r , image );
+            }
+        }
+    }
+    else
+    {
+        HIViewDrawCGImage( m_cgContext , &r , image );
+    }
     CGImageRelease( image );
 }
 
@@ -1843,6 +1869,8 @@ public :
     virtual wxGraphicsContext * CreateContextFromNativeWindow( void * window );
 
     virtual wxGraphicsContext * CreateContext( wxWindow* window );
+    
+    virtual wxGraphicsContext * CreateMeasuringContext();
 
     // Path
 
@@ -1908,6 +1936,11 @@ wxGraphicsContext * wxMacCoreGraphicsRenderer::CreateContext( wxWindow* window )
     return new wxMacCoreGraphicsContext(this, window );
 }
 
+wxGraphicsContext * wxMacCoreGraphicsRenderer::CreateMeasuringContext()
+{
+    return new wxMacCoreGraphicsContext(this);
+}
+
 // Path
 
 wxGraphicsPath wxMacCoreGraphicsRenderer::CreatePath()