X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/524c47aa3adf2af11a3069fd5da035a604f08f66..48e05747043db02c4e9d2e286eca4fdf5dee7881:/src/osx/carbon/metafile.cpp diff --git a/src/osx/carbon/metafile.cpp b/src/osx/carbon/metafile.cpp index a671b772b5..0d7607c6f7 100644 --- a/src/osx/carbon/metafile.cpp +++ b/src/osx/carbon/metafile.cpp @@ -26,7 +26,7 @@ #include "wx/clipbrd.h" #include "wx/osx/private.h" #include "wx/graphics.h" -#include "wx/osx/carbon/metafile.h" +#include "wx/osx/metafile.h" #include #include @@ -76,6 +76,11 @@ private: int m_width ; int m_height ; + + + // Our m_pdfDoc field can't be easily (deep) copied and so we don't define a + // copy ctor. + wxDECLARE_NO_COPY_CLASS(wxMetafileRefData); }; wxMetafileRefData::wxMetafileRefData(CFDataRef data) : @@ -156,8 +161,8 @@ void wxMetafileRefData::UpdateDocumentFromData() { CGPDFPageRef page = CGPDFDocumentGetPage( m_pdfDoc, 1 ); CGRect rect = CGPDFPageGetBoxRect ( page, kCGPDFMediaBox); - m_width = wx_static_cast(int, rect.size.width); - m_height = wx_static_cast(int, rect.size.height); + m_width = static_cast(rect.size.width); + m_height = static_cast(rect.size.height); } } @@ -175,9 +180,12 @@ wxGDIRefData *wxMetaFile::CreateGDIRefData() const return new wxMetafileRefData; } -wxGDIRefData *wxMetaFile::CloneGDIRefData(const wxGDIRefData *data) const +wxGDIRefData * +wxMetaFile::CloneGDIRefData(const wxGDIRefData * WXUNUSED(data)) const { - return new wxMetafileRefData(*wx_static_cast(const wxMetafileRefData *, data)); + wxFAIL_MSG( wxS("Cloning metafiles is not implemented in wxCarbon.") ); + + return new wxMetafileRefData; } WXHMETAFILE wxMetaFile::GetHMETAFILE() const @@ -216,26 +224,6 @@ void wxMetafile::SetHMETAFILE(WXHMETAFILE mf) m_refData = new wxMetafileRefData((CFDataRef)mf); } -#ifndef __LP64__ -void wxMetafile::SetPICT(void* pictHandle) -{ - UnRef(); - - Handle picHandle = (Handle) pictHandle; - HLock(picHandle); - CFDataRef data = CFDataCreateWithBytesNoCopy( kCFAllocatorDefault, (const UInt8*) *picHandle, GetHandleSize(picHandle), kCFAllocatorNull); - wxCFRef provider(wxMacCGDataProviderCreateWithCFData(data)); - QDPictRef pictRef = QDPictCreateWithProvider(provider); - CGRect rect = QDPictGetBounds(pictRef); - m_refData = new wxMetafileRefData(wx_static_cast(int, rect.size.width), - wx_static_cast(int, rect.size.height)); - QDPictDrawToCGContext( ((wxMetafileRefData*) m_refData)->GetContext(), rect, pictRef ); - CFRelease( data ); - QDPictRelease( pictRef ); - ((wxMetafileRefData*) m_refData)->Close(); -} -#endif - bool wxMetaFile::Play(wxDC *dc) { if (!m_refData) @@ -266,7 +254,7 @@ wxSize wxMetaFile::GetSize() const { wxSize dataSize = wxDefaultSize; - if (Ok()) + if (IsOk()) { dataSize.x = M_METAFILEDATA->GetWidth(); dataSize.y = M_METAFILEDATA->GetHeight(); @@ -318,8 +306,7 @@ void wxMetafileDCImpl::DoGetSize(int *width, int *height) const wxMetaFile *wxMetafileDCImpl::Close() { - delete m_graphicContext; - m_graphicContext = NULL; + wxDELETE(m_graphicContext); m_ok = false; M_METAFILEREFDATA(*m_metaFile)->Close();