X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/891d0563f7f43b640c4e0e78c30f038b2127fffb..f77e1e5d0d0eb7515425c2ad4daa1205674cb180:/src/cocoa/dc.mm?ds=inline diff --git a/src/cocoa/dc.mm b/src/cocoa/dc.mm index 79c10e0555..7b54beb590 100644 --- a/src/cocoa/dc.mm +++ b/src/cocoa/dc.mm @@ -107,7 +107,11 @@ void wxDC::DoDrawText(const wxString& text, wxCoord x, wxCoord y) NSRange glyphRange = [sm_cocoaNSLayoutManager glyphRangeForTextContainer:sm_cocoaNSTextContainer]; NSRect usedRect = [sm_cocoaNSLayoutManager usedRectForTextContainer:sm_cocoaNSTextContainer]; - + // NOTE: We'll crash trying to get the location of glyphAtIndex:0 if + // there is no length or we don't start at zero + if(!glyphRange.length) + return; + wxASSERT_MSG(glyphRange.location==0,"glyphRange must begin at zero"); NSAffineTransform *transform = [NSAffineTransform transform]; [transform translateXBy:x yBy:y]; @@ -145,6 +149,27 @@ void wxDC::DoDrawText(const wxString& text, wxCoord x, wxCoord y) [context restoreGraphicsState]; } +// wxDCBase functions +int wxDCBase::DeviceToLogicalX(int x) const +{ + return x; +} + +int wxDCBase::DeviceToLogicalY(int y) const +{ + return y; +} + +int wxDCBase::LogicalToDeviceX(int x) const +{ + return x; +} + +int wxDCBase::LogicalToDeviceY(int y) const +{ + return y; +} + /////////////////////////////////////////////////////////////////////////// // cut here, the rest is stubs /////////////////////////////////////////////////////////////////////////// @@ -394,13 +419,3 @@ void wxDC::ComputeScaleAndOrigin(void) } }; -int wxDCBase::DeviceToLogicalX(int x) const -{ - return x; -} - -int wxDCBase::DeviceToLogicalY(int y) const -{ - return y; -} -