]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/metafile.cpp
enter wxPendingEventLocker critical section in ProcessPendingEvents() (fixes 1720352)
[wxWidgets.git] / src / mac / carbon / metafile.cpp
index f25d2d061d09d26d5da2076db55adef2fe16a4ee..07a905760f481985f76e00efdd3f2a233c85085a 100644 (file)
@@ -25,6 +25,7 @@
 #include "wx/metafile.h"
 #include "wx/clipbrd.h"
 #include "wx/mac/private.h"
+#include "wx/graphics.h"
 
 #include <stdio.h>
 #include <string.h>
@@ -48,10 +49,6 @@ private:
 #endif
 };
 
-
-extern bool wxClipboardIsOpen;
-
-
 wxMetafileRefData::wxMetafileRefData()
 {
     m_metafile = NULL;
@@ -65,12 +62,14 @@ wxMetafileRefData::~wxMetafileRefData()
 {
     if (m_metafile)
     {
+#ifndef __LP64__
         KillPicture( (PicHandle)m_metafile );
         m_metafile = NULL;
 
 #if wxMAC_USE_CORE_GRAPHICS
         QDPictRelease( m_qdPictRef );
         m_qdPictRef = NULL;
+#endif
 #endif
     }
 }
@@ -92,7 +91,7 @@ wxMetaFile::~wxMetaFile()
 {
 }
 
-bool wxMetaFile::Ok() const
+bool wxMetaFile::IsOk() const
 {
     return (M_METAFILEDATA && (M_METAFILEDATA->m_metafile != NULL));
 }
@@ -146,12 +145,14 @@ void wxMetafile::SetHMETAFILE(WXHMETAFILE mf)
         membuf, data, sz, wxMacMemoryBufferReleaseProc );
     M_METAFILEDATA->m_qdPictRef = NULL;
 
+#ifndef __LP64__
     if (provider != NULL)
     {
         M_METAFILEDATA->m_qdPictRef = QDPictCreateWithProvider( provider );
         CGDataProviderRelease( provider );
     }
 #endif
+#endif
 }
 
 bool wxMetaFile::Play(wxDC *dc)
@@ -164,8 +165,9 @@ bool wxMetaFile::Play(wxDC *dc)
 
     {
 #if wxMAC_USE_CORE_GRAPHICS
+#ifndef __LP64__
         QDPictRef cgPictRef = M_METAFILEDATA->m_qdPictRef;
-        CGContextRef cg = ((wxMacCGContext*)(dc->GetGraphicContext()))->GetNativeContext();
+        CGContextRef cg = (CGContextRef) dc->GetGraphicsContext()->GetNativeContext();
         CGRect bounds = QDPictGetBounds( cgPictRef );
 
         CGContextSaveGState( cg );
@@ -173,6 +175,7 @@ bool wxMetaFile::Play(wxDC *dc)
         CGContextScaleCTM( cg, 1, -1 );
         QDPictDrawToCGContext( cg, bounds, cgPictRef );
         CGContextRestoreGState( cg );
+#endif
 #else
         PicHandle pict = (PicHandle)GetHMETAFILE();
         wxMacPortSetter helper( dc );
@@ -190,11 +193,13 @@ wxSize wxMetaFile::GetSize() const
 
     if (Ok())
     {
-        PicHandle pict = (PicHandle)GetHMETAFILE();
+#ifndef __LP64__
+       PicHandle pict = (PicHandle)GetHMETAFILE();
         Rect r;
         wxMacGetPictureBounds( pict, &r );
         dataSize.x = r.right - r.left;
         dataSize.y = r.bottom - r.top;
+#endif
     }
 
     return dataSize;
@@ -210,7 +215,7 @@ wxMetaFileDC::wxMetaFileDC(
     int width, int height,
     const wxString& WXUNUSED(description) )
 {
-    wxASSERT_MSG( width <= 0 || height <= 0, wxT("no arbitration of metafile size supported") );
+    wxASSERT_MSG( width != 0 || height != 0, wxT("no arbitration of metafile size supported") );
     wxASSERT_MSG( filename.empty(), wxT("no file based metafile support yet"));
 
     m_metaFile = new wxMetaFile( filename );
@@ -248,8 +253,9 @@ void wxMetaFileDC::DoGetSize(int *width, int *height) const
 
 wxMetaFile *wxMetaFileDC::Close()
 {
+#ifndef __LP64__
     ClosePicture();
-
+#endif
     return m_metaFile;
 }