]> git.saurik.com Git - wxWidgets.git/blobdiff - src/cocoa/dcmemory.mm
Added wxToggleBitmapButton (it compiles).
[wxWidgets.git] / src / cocoa / dcmemory.mm
index 10b01be3b3d9b4d160816a5c48a791d95340a77c..dc526fba9c8d8702efbb43cbfea5a3a561ad01dd 100644 (file)
@@ -9,8 +9,11 @@
 // Licence:    wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-#include "wx/dcmemory.h"
-#include "wx/log.h"
+#include "wx/wxprec.h"
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+    #include "wx/dcmemory.h"
+#endif //WX_PRECOMP
 
 #import <AppKit/NSImage.h>
 #import <AppKit/NSAffineTransform.h>
@@ -86,14 +89,13 @@ void wxMemoryDC::SelectObject( const wxBitmap& bitmap )
                     m_selectedBitmap.GetHeight())];
 
         // Now copy the data
-        NSImage *nsimage = [[NSImage alloc]
-                initWithSize:NSMakeSize(m_selectedBitmap.GetWidth(),
-                    m_selectedBitmap.GetHeight())];
-        [nsimage addRepresentation: const_cast<wxBitmap&>(m_selectedBitmap).GetNSBitmapImageRep()];
+        NSImage *nsimage = [m_selectedBitmap.GetNSImage(false) retain];
+        [m_cocoaNSImage lockFocus];
         [nsimage drawAtPoint: NSMakePoint(0,0)
             fromRect: NSMakeRect(0.0,0.0,m_selectedBitmap.GetWidth(),m_selectedBitmap.GetHeight())
             operation: NSCompositeCopy
             fraction: 1.0];
+        [m_cocoaNSImage unlockFocus];
         
         [nsimage release];
     }
@@ -133,7 +135,7 @@ bool wxMemoryDC::CocoaDoBlitOnFocusedDC(wxCoord xdest, wxCoord ydest,
     [transform concat];
     [flipTransform concat];
 
-    wxLogDebug("[m_cocoaNSImage isFlipped]=%d", [m_cocoaNSImage isFlipped]);
+    wxLogTrace(wxTRACE_COCOA,wxT("[m_cocoaNSImage isFlipped]=%d"), [m_cocoaNSImage isFlipped]);
     [m_cocoaNSImage drawAtPoint: NSMakePoint(0,0)
         fromRect: NSMakeRect(xsrc,
             m_selectedBitmap.GetHeight()-height-ysrc,