#include "wx/dcmemory.h"
#include "wx/dcprint.h"
#include "wx/region.h"
+ #include "wx/image.h"
#endif
#include "wx/mac/uma.h"
-#include "wx/image.h"
#ifdef __MSL__
#if __MSL__ >= 0x6000
const short kEmulatedMode = -1 ;
const short kUnsupportedMode = -2 ;
-extern TECObjectRef s_TECNativeCToUnicode ;
-
-
wxMacPortSetter::wxMacPortSetter( const wxDC* dc ) :
m_ph( (GrafPtr) dc->m_macPort )
{
SetThemeDrawingState( m_themeDrawingState , true ) ;
}
-//-----------------------------------------------------------------------------
-// Local functions
-//-----------------------------------------------------------------------------
-static inline double dmin(double a, double b) { return a < b ? a : b; }
-static inline double dmax(double a, double b) { return a > b ? a : b; }
-static inline double DegToRad(double deg) { return (deg * M_PI) / 180.0; }
-
//-----------------------------------------------------------------------------
// wxDC
//-----------------------------------------------------------------------------
GetCPixel( XLOG2DEVMAC(x), YLOG2DEVMAC(y), &colour );
// convert from Mac colour to wx
- col->Set( colour.red >> 8, colour.green >> 8, colour.blue >> 8);
+ *col = colour;
return true ;
}
return true ;
}
-bool wxDC::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
+bool wxDC::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord dstWidth, wxCoord dstHeight,
wxDC *source, wxCoord xsrc, wxCoord ysrc, int logical_func , bool useMask,
wxCoord xsrcMask, wxCoord ysrcMask )
{
- wxCHECK_MSG(Ok(), false, wxT("wxDC::DoBlit - invalid DC"));
- wxCHECK_MSG(source->Ok(), false, wxT("wxDC::DoBlit - invalid source DC"));
+ return DoStretchBlit( xdest, ydest, dstWidth, dstHeight,
+ source, xsrc, ysrc, dstWidth, dstHeight,
+ logical_func, useMask,
+ xsrcMask, ysrcMask );
+}
+
+bool wxDC::DoStretchBlit(wxCoord xdest, wxCoord ydest,
+ wxCoord dstWidth, wxCoord dstHeight,
+ wxDC *source,
+ wxCoord xsrc, wxCoord ysrc,
+ wxCoord srcWidth, wxCoord srcHeight,
+ int logical_func, bool useMask,
+ wxCoord xsrcMask, wxCoord ysrcMask)
+{
+ wxCHECK_MSG(Ok(), false, wxT("wxDC::DoStretchBlit - invalid DC"));
+ wxCHECK_MSG(source->Ok(), false, wxT("wxDC::DoStretchBlit - invalid source DC"));
if ( logical_func == wxNO_OP )
return true ;
Rect srcrect , dstrect ;
srcrect.top = source->YLOG2DEVMAC(ysrc) ;
srcrect.left = source->XLOG2DEVMAC(xsrc) ;
- srcrect.right = source->XLOG2DEVMAC(xsrc + width ) ;
- srcrect.bottom = source->YLOG2DEVMAC(ysrc + height) ;
+ srcrect.right = source->XLOG2DEVMAC(xsrc + srcWidth ) ;
+ srcrect.bottom = source->YLOG2DEVMAC(ysrc + srcHeight) ;
dstrect.top = YLOG2DEVMAC(ydest) ;
dstrect.left = XLOG2DEVMAC(xdest) ;
- dstrect.bottom = YLOG2DEVMAC(ydest + height ) ;
- dstrect.right = XLOG2DEVMAC(xdest + width ) ;
+ dstrect.bottom = YLOG2DEVMAC(ydest + dstHeight ) ;
+ dstrect.right = XLOG2DEVMAC(xdest + dstWidth ) ;
short mode = kUnsupportedMode ;
bool invertDestinationFirst = false ;
wxMacUniCharBuffer unibuf( str ) ;
UniCharCount chars = unibuf.GetChars() ;
-
+
status = ::ATSUCreateTextLayoutWithTextPtr( unibuf.GetBuffer() , 0 , chars , chars , 1 ,
&chars , (ATSUStyle*) &m_macATSUIStyle , &atsuLayout ) ;
ATSUTextMeasurement ascent, descent ;
ATSLineLayoutOptions layoutOptions = kATSLineNoLayoutOptions ;
-
+
if (m_font.GetNoAntiAliasing())
{
layoutOptions |= kATSLineNoAntiAliasing ;
}
-
+
Fixed atsuAngle = IntToFixed( iAngle ) ;
ATSUAttributeTag atsuTags[] =
kATSULineLayoutOptionsTag ,
kATSULineRotationTag ,
} ;
-
+
ByteCount atsuSizes[sizeof(atsuTags)/sizeof(ATSUAttributeTag)] =
{
sizeof( ATSLineLayoutOptions ) ,
sizeof( Fixed ) ,
} ;
-
+
ATSUAttributeValuePtr atsuValues[sizeof(atsuTags)/sizeof(ATSUAttributeTag)] =
{
&layoutOptions ,
&atsuAngle ,
} ;
-
+
status = ::ATSUSetLayoutControls(atsuLayout , sizeof(atsuTags)/sizeof(ATSUAttributeTag) - ( abs(iAngle) > 0.001 ? 0 : 1),
atsuTags, atsuSizes, atsuValues ) ;
status = ::ATSUMeasureText( atsuLayout, kATSUFromTextBeginning, kATSUToTextEnd,
&textBefore , &textAfter, &ascent , &descent );
wxASSERT_MSG( status == noErr , wxT("couldn't measure the rotated text") );
-
+
if ( m_backgroundMode == wxSOLID )
- {
+ {
// background painting must be done by hand, cannot be done by ATSUI
wxCoord x2 , y2 ;
PolyHandle polygon = OpenPoly();
OSStatus status = noErr ;
ATSUTextLayout atsuLayout ;
-
+
wxMacUniCharBuffer unibuf( str ) ;
UniCharCount chars = unibuf.GetChars() ;
-
+
status = ::ATSUCreateTextLayoutWithTextPtr( unibuf.GetBuffer() , 0 , chars , chars , 1 ,
&chars , (ATSUStyle*) &m_macATSUIStyle , &atsuLayout ) ;
wxASSERT_MSG( status == noErr , wxT("couldn't setup transient font matching") );
ATSLineLayoutOptions layoutOptions = kATSLineNoLayoutOptions ;
-
+
if (m_font.GetNoAntiAliasing())
{
layoutOptions |= kATSLineNoAntiAliasing ;
}
-
+
ATSUAttributeTag atsuTags[] =
{
kATSULineLayoutOptionsTag ,
} ;
-
+
ByteCount atsuSizes[sizeof(atsuTags)/sizeof(ATSUAttributeTag)] =
{
sizeof( ATSLineLayoutOptions ) ,
} ;
-
+
ATSUAttributeValuePtr atsuValues[sizeof(atsuTags)/sizeof(ATSUAttributeTag)] =
{
&layoutOptions ,
} ;
-
+
status = ::ATSUSetLayoutControls(atsuLayout , sizeof(atsuTags)/sizeof(ATSUAttributeTag) ,
atsuTags, atsuSizes, atsuValues ) ;
-
+
ATSUTextMeasurement textBefore, textAfter ;
ATSUTextMeasurement textAscent, textDescent ;
OSStatus status = noErr ;
ATSUTextLayout atsuLayout ;
-
+
wxMacUniCharBuffer unibuf( text ) ;
UniCharCount chars = unibuf.GetChars() ;
-
+
status = ::ATSUCreateTextLayoutWithTextPtr( unibuf.GetBuffer() , 0 , chars , chars , 1 ,
&chars , (ATSUStyle*) &m_macATSUIStyle , &atsuLayout ) ;
wxASSERT_MSG( status == noErr , wxT("couldn't setup transient font matching") );
ATSLineLayoutOptions layoutOptions = kATSLineNoLayoutOptions ;
-
+
if (m_font.GetNoAntiAliasing())
{
layoutOptions |= kATSLineNoAntiAliasing ;
}
-
+
ATSUAttributeTag atsuTags[] =
{
kATSULineLayoutOptionsTag ,
} ;
-
+
ByteCount atsuSizes[sizeof(atsuTags)/sizeof(ATSUAttributeTag)] =
{
sizeof( ATSLineLayoutOptions ) ,
} ;
-
+
ATSUAttributeValuePtr atsuValues[sizeof(atsuTags)/sizeof(ATSUAttributeTag)] =
{
&layoutOptions ,
} ;
-
+
status = ::ATSUSetLayoutControls(atsuLayout , sizeof(atsuTags)/sizeof(ATSUAttributeTag) ,
atsuTags, atsuSizes, atsuValues ) ;
-
+
for ( int pos = 0; pos < (int)chars ; pos ++ )
{
unsigned long actualNumberOfBounds = 0;