X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/938156b25541ff200404018f8e6721686a046829..c0c05e79b20d6ca372ece6ac5995b0e3db18a29b:/src/cocoa/dc.mm diff --git a/src/cocoa/dc.mm b/src/cocoa/dc.mm index e371df92cd..db8e22406b 100644 --- a/src/cocoa/dc.mm +++ b/src/cocoa/dc.mm @@ -20,6 +20,7 @@ #include "wx/cocoa/autorelease.h" #include "wx/cocoa/string.h" +#include "wx/cocoa/ObjcRef.h" #import #import @@ -75,11 +76,16 @@ inline void CocoaSetPenForNSBezierPath(wxPen &pen, NSBezierPath *bezpath) void wxCocoaDCImpl::CocoaInitializeTextSystem() { + wxAutoNSAutoreleasePool pool; + wxASSERT_MSG(!sm_cocoaNSTextStorage && !sm_cocoaNSLayoutManager && !sm_cocoaNSTextContainer,wxT("Text system already initalized! BAD PROGRAMMER!")); - sm_cocoaNSTextStorage = [[NSTextStorage alloc] init]; + // FIXME: Never released + sm_cocoaNSTextStorage = wxGCSafeRetain([[[NSTextStorage alloc] init] autorelease]); + + // FIXME: Never released + sm_cocoaNSLayoutManager = wxGCSafeRetain([[[NSLayoutManager alloc] init] autorelease]); - sm_cocoaNSLayoutManager = [[NSLayoutManager alloc] init]; [sm_cocoaNSTextStorage addLayoutManager:sm_cocoaNSLayoutManager]; // NSTextStorage retains NSLayoutManager, but so do we // [sm_cocoaNSLayoutManager release]; [sm_cocoaNSLayoutManager retain]; @@ -87,7 +93,8 @@ void wxCocoaDCImpl::CocoaInitializeTextSystem() // NOTE: initWithContainerSize is the designated initializer, but the // Apple CircleView sample gets away with just calling init, which // is all we really need for our purposes. - sm_cocoaNSTextContainer = [[NSTextContainer alloc] init]; + // FIXME: Never released + sm_cocoaNSTextContainer = wxGCSafeRetain([[[NSTextContainer alloc] init] autorelease]); [sm_cocoaNSLayoutManager addTextContainer:sm_cocoaNSTextContainer]; // NSLayoutManager retains NSTextContainer, but so do we // [sm_cocoaNSTextContainer release]; [sm_cocoaNSTextContainer retain]; @@ -355,7 +362,7 @@ void wxCocoaDCImpl::DoDrawPoint( int x, int y ) { }; -void wxCocoaDCImpl::DoDrawPolygon( int, wxPoint *, int, int, int) +void wxCocoaDCImpl::DoDrawPolygon( int, wxPoint *, int, int, wxPolygonFillMode) { }; @@ -492,7 +499,7 @@ void wxCocoaDCImpl::DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y, bool [context restoreGraphicsState]; } -bool wxCocoaDCImpl::DoFloodFill(wxCoord x, wxCoord y, const wxColour& col, int style) +bool wxCocoaDCImpl::DoFloodFill(wxCoord x, wxCoord y, const wxColour& col, wxFloodFillStyle style) { return false; } @@ -502,7 +509,7 @@ void wxCocoaDCImpl::DoCrossHair(wxCoord x, wxCoord y) } -bool wxCocoaDCImpl::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, wxDC *source, wxCoord xsrc, wxCoord ysrc, int rop, bool useMask , wxCoord xsrcMask, wxCoord ysrcMask) +bool wxCocoaDCImpl::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, wxDC *source, wxCoord xsrc, wxCoord ysrc, wxRasterOperationMode rop, bool useMask , wxCoord xsrcMask, wxCoord ysrcMask) { if(!CocoaTakeFocus()) return false; if(!source) return false; @@ -572,12 +579,12 @@ void wxCocoaDCImpl::SetPalette(const wxPalette&) { } -void wxCocoaDCImpl::SetLogicalFunction(int) +void wxCocoaDCImpl::SetLogicalFunction(wxRasterOperationMode) { } -void wxCocoaDCImpl::SetMapMode( int mode ) +void wxCocoaDCImpl::SetMapMode( wxMappingMode mode ) { switch (mode) {