more cleanup
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36563 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -36,6 +36,11 @@
|
||||
#include <TextEncodingConverter.h>
|
||||
#endif
|
||||
|
||||
|
||||
// set to 0 if problems arise
|
||||
#define wxMAC_EXPERIMENTAL_DC 1
|
||||
|
||||
|
||||
IMPLEMENT_ABSTRACT_CLASS(wxDC, wxObject)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -48,8 +53,6 @@ const short kUnsupportedMode = -2 ;
|
||||
|
||||
extern TECObjectRef s_TECNativeCToUnicode ;
|
||||
|
||||
// set to 0 if problems arise
|
||||
#define wxMAC_EXPERIMENTAL_DC 1
|
||||
|
||||
wxMacPortSetter::wxMacPortSetter( const wxDC* dc ) :
|
||||
m_ph( (GrafPtr) dc->m_macPort )
|
||||
@@ -749,9 +752,7 @@ bool wxDC::DoGetPixel( wxCoord x, wxCoord y, wxColour *col ) const
|
||||
GetCPixel( XLOG2DEVMAC(x), YLOG2DEVMAC(y), &colour );
|
||||
|
||||
// convert from Mac colour to wx
|
||||
col->Set( colour.red >> 8,
|
||||
colour.green >> 8,
|
||||
colour.blue >> 8);
|
||||
col->Set( colour.red >> 8, colour.green >> 8, colour.blue >> 8);
|
||||
|
||||
return true ;
|
||||
}
|
||||
@@ -985,6 +986,7 @@ void wxDC::DoDrawLines(int n, wxPoint points[],
|
||||
MacInstallPen() ;
|
||||
wxCoord offset = ( (m_pen.GetWidth() == 0 ? 1 :
|
||||
m_pen.GetWidth() ) * (wxCoord)m_scaleX - 1) / 2 ;
|
||||
|
||||
wxCoord x1, x2 , y1 , y2 ;
|
||||
x1 = XLOG2DEVMAC(points[0].x + xoffset);
|
||||
y1 = YLOG2DEVMAC(points[0].y + yoffset);
|
||||
@@ -1564,6 +1566,7 @@ void wxDC::DoDrawRotatedText(const wxString& str, wxCoord x, wxCoord y,
|
||||
status = ::ATSUMeasureTextImage( atsuLayout, kATSUFromTextBeginning, kATSUToTextEnd,
|
||||
IntToFixed(drawX) , IntToFixed(drawY) , &rect );
|
||||
wxASSERT_MSG( status == noErr , wxT("couldn't measure the rotated text") );
|
||||
|
||||
OffsetRect( &rect , -m_macLocalOrigin.x , -m_macLocalOrigin.y ) ;
|
||||
CalcBoundingBox(XDEV2LOG(rect.left), YDEV2LOG(rect.top) );
|
||||
CalcBoundingBox(XDEV2LOG(rect.right), YDEV2LOG(rect.bottom) );
|
||||
@@ -1749,7 +1752,7 @@ bool wxDC::DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) con
|
||||
// If anybody knows how to do this more efficiently yet still handle
|
||||
// the fractional glyph widths that may be present when using AA
|
||||
// fonts, please change it. Currently it is measuring from the
|
||||
// begining of the string for each succeding substring, which is much
|
||||
// beginning of the string for each succeeding substring, which is much
|
||||
// slower than this should be.
|
||||
for (size_t i=0; i<text.Length(); i++)
|
||||
{
|
||||
@@ -1777,7 +1780,7 @@ bool wxDC::DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) con
|
||||
|
||||
// Copy to widths, starting at measurements[1]
|
||||
// NOTE: this doesn't take into account any multi-byte characters
|
||||
// in buff, it probabkly should...
|
||||
// in buff, it probably should...
|
||||
for (size_t i=0; i<text.Length(); i++)
|
||||
widths[i] = XDEV2LOGREL(measurements[i + 1]);
|
||||
|
||||
@@ -1858,6 +1861,7 @@ void wxDC::MacInstallFont() const
|
||||
|
||||
// if ( m_macFontInstalled )
|
||||
// return ;
|
||||
|
||||
Pattern blackColor ;
|
||||
MacSetupBackgroundForCurrentPort(m_backgroundBrush) ;
|
||||
if ( m_backgroundMode != wxTRANSPARENT )
|
||||
@@ -1941,18 +1945,15 @@ void wxDC::MacInstallFont() const
|
||||
{
|
||||
sizeof( Fixed ) ,
|
||||
} ;
|
||||
// Boolean kTrue = true ;
|
||||
// Boolean kFalse = false ;
|
||||
|
||||
// ATSUVerticalCharacterType kHorizontal = kATSUStronglyHorizontal;
|
||||
ATSUAttributeValuePtr atsuValues[sizeof(atsuTags)/sizeof(ATSUAttributeTag)] =
|
||||
{
|
||||
&atsuSize ,
|
||||
} ;
|
||||
|
||||
status = ::ATSUSetAttributes((ATSUStyle)m_macATSUIStyle, sizeof(atsuTags)/sizeof(ATSUAttributeTag) ,
|
||||
atsuTags, atsuSizes, atsuValues);
|
||||
|
||||
wxASSERT_MSG( status == noErr , wxT("couldn't Modify ATSU style") ) ;
|
||||
wxASSERT_MSG( status == noErr , wxT("couldn't modify ATSU style") ) ;
|
||||
}
|
||||
|
||||
Pattern gPatterns[] =
|
||||
@@ -2006,19 +2007,21 @@ void wxDC::MacInstallPen() const
|
||||
//Pattern blackColor;
|
||||
// if ( m_macPenInstalled )
|
||||
// return ;
|
||||
|
||||
RGBColor forecolor = MAC_WXCOLORREF( m_pen.GetColour().GetPixel());
|
||||
RGBColor backcolor = MAC_WXCOLORREF( m_backgroundBrush.GetColour().GetPixel());
|
||||
::RGBForeColor( &forecolor );
|
||||
::RGBBackColor( &backcolor );
|
||||
::PenNormal() ;
|
||||
int penWidth = (int) (m_pen.GetWidth() * m_scaleX) ; ;
|
||||
|
||||
// null means only one pixel, at whatever resolution
|
||||
int penWidth = (int) (m_pen.GetWidth() * m_scaleX) ;
|
||||
if ( penWidth == 0 )
|
||||
penWidth = 1 ;
|
||||
::PenSize(penWidth, penWidth);
|
||||
|
||||
int penStyle = m_pen.GetStyle();
|
||||
Pattern pat;
|
||||
int penStyle = m_pen.GetStyle();
|
||||
if (penStyle == wxUSER_DASH)
|
||||
{
|
||||
// FIXME: there should be exactly 8 items in the dash
|
||||
@@ -2095,6 +2098,7 @@ void wxDC::MacInstallPen() const
|
||||
void wxDC::MacSetupBackgroundForCurrentPort(const wxBrush& background )
|
||||
{
|
||||
Pattern whiteColor ;
|
||||
|
||||
if ( background.Ok() )
|
||||
{
|
||||
switch ( background.MacGetBrushKind() )
|
||||
@@ -2139,10 +2143,11 @@ void wxDC::MacSetupBackgroundForCurrentPort(const wxBrush& background )
|
||||
void wxDC::MacInstallBrush() const
|
||||
{
|
||||
wxCHECK_RET(Ok(), wxT("Invalid DC"));
|
||||
Pattern blackColor ;
|
||||
|
||||
// if ( m_macBrushInstalled )
|
||||
// return ;
|
||||
// foreground
|
||||
|
||||
Pattern blackColor ;
|
||||
bool backgroundTransparent = (GetBackgroundMode() == wxTRANSPARENT) ;
|
||||
::RGBForeColor( &MAC_WXCOLORREF( m_brush.GetColour().GetPixel()) );
|
||||
::RGBBackColor( &MAC_WXCOLORREF( m_backgroundBrush.GetColour().GetPixel()) );
|
||||
|
Reference in New Issue
Block a user