]> git.saurik.com Git - wxWidgets.git/commit - src/osx/carbon/graphics.cpp
Fix discrepancy between different ways of measuring text extents under Mac.
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 10 Nov 2009 00:13:57 +0000 (00:13 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 10 Nov 2009 00:13:57 +0000 (00:13 +0000)
commit0738b901b17340f09766524b8d9d79e9ed1268e7
treeeace0ce69a47cf7a552658d71edb7365c34d1179
parentacaa833787f4e7ae6d19ac98da1f2b3f3969fedf
Fix discrepancy between different ways of measuring text extents under Mac.

wxGraphicsContext::GetTextExtent() didn't round the returned double result to
int but truncated it instead and so returned different extent than
GetPartialTextExtents() which did round it up.

Moreover, wxGraphicsContext::GetPartialTextExtents() didn't round it up
correctly: it wrongly added 0.5 to the value still stored as double and which
was hence rounded up (correctly, this time) when converted to int in
wxDC::GetPartialTextExtents().

These two errors combined to produce difference of up to 2 pixels between the
last offset returned by wxDC::GetPartialTextExtents() and the total string
extent returned by wxDC::GetTextExtent() which thoroughly confused the code in
wxControlBase::DoEllipsizeSingleLine() (and probably not only there).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62580 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
src/osx/carbon/graphics.cpp