appearance brush support
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13213 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -24,6 +24,8 @@ IMPLEMENT_DYNAMIC_CLASS(wxBrush, wxGDIObject)
|
|||||||
wxBrushRefData::wxBrushRefData()
|
wxBrushRefData::wxBrushRefData()
|
||||||
{
|
{
|
||||||
m_style = wxSOLID;
|
m_style = wxSOLID;
|
||||||
|
m_isMacTheme = false ;
|
||||||
|
m_isMacThemeBackground = false ;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxBrushRefData::wxBrushRefData(const wxBrushRefData& data)
|
wxBrushRefData::wxBrushRefData(const wxBrushRefData& data)
|
||||||
@@ -31,6 +33,8 @@ wxBrushRefData::wxBrushRefData(const wxBrushRefData& data)
|
|||||||
m_style = data.m_style;
|
m_style = data.m_style;
|
||||||
m_stipple = data.m_stipple;
|
m_stipple = data.m_stipple;
|
||||||
m_colour = data.m_colour;
|
m_colour = data.m_colour;
|
||||||
|
m_isMacTheme = data.m_isMacTheme ;
|
||||||
|
m_macThemeBrush = data.m_macThemeBrush ;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxBrushRefData::~wxBrushRefData()
|
wxBrushRefData::~wxBrushRefData()
|
||||||
@@ -66,6 +70,15 @@ wxBrush::wxBrush(const wxBitmap& stipple)
|
|||||||
RealizeResource();
|
RealizeResource();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxBrush::wxBrush(ThemeBrush macThemeBrush )
|
||||||
|
{
|
||||||
|
m_refData = new wxBrushRefData;
|
||||||
|
|
||||||
|
M_BRUSHDATA->m_isMacTheme = true;
|
||||||
|
M_BRUSHDATA->m_macThemeBrush = macThemeBrush;
|
||||||
|
|
||||||
|
RealizeResource();
|
||||||
|
}
|
||||||
void wxBrush::Unshare()
|
void wxBrush::Unshare()
|
||||||
{
|
{
|
||||||
// Don't change shared data
|
// Don't change shared data
|
||||||
@@ -84,7 +97,8 @@ void wxBrush::Unshare()
|
|||||||
void wxBrush::SetColour(const wxColour& col)
|
void wxBrush::SetColour(const wxColour& col)
|
||||||
{
|
{
|
||||||
Unshare();
|
Unshare();
|
||||||
|
M_BRUSHDATA->m_isMacTheme = false;
|
||||||
|
M_BRUSHDATA->m_isMacThemeBackground = false ;
|
||||||
M_BRUSHDATA->m_colour = col;
|
M_BRUSHDATA->m_colour = col;
|
||||||
|
|
||||||
RealizeResource();
|
RealizeResource();
|
||||||
@@ -94,6 +108,8 @@ void wxBrush::SetColour(unsigned char r, unsigned char g, unsigned char b)
|
|||||||
{
|
{
|
||||||
Unshare();
|
Unshare();
|
||||||
|
|
||||||
|
M_BRUSHDATA->m_isMacTheme = false;
|
||||||
|
M_BRUSHDATA->m_isMacThemeBackground = false ;
|
||||||
M_BRUSHDATA->m_colour.Set(r, g, b);
|
M_BRUSHDATA->m_colour.Set(r, g, b);
|
||||||
|
|
||||||
RealizeResource();
|
RealizeResource();
|
||||||
@@ -103,6 +119,8 @@ void wxBrush::SetStyle(int Style)
|
|||||||
{
|
{
|
||||||
Unshare();
|
Unshare();
|
||||||
|
|
||||||
|
M_BRUSHDATA->m_isMacTheme = false;
|
||||||
|
M_BRUSHDATA->m_isMacThemeBackground = false ;
|
||||||
M_BRUSHDATA->m_style = Style;
|
M_BRUSHDATA->m_style = Style;
|
||||||
|
|
||||||
RealizeResource();
|
RealizeResource();
|
||||||
@@ -117,6 +135,28 @@ void wxBrush::SetStipple(const wxBitmap& Stipple)
|
|||||||
RealizeResource();
|
RealizeResource();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxBrush::SetMacTheme(ThemeBrush macThemeBrush)
|
||||||
|
{
|
||||||
|
Unshare();
|
||||||
|
|
||||||
|
M_BRUSHDATA->m_isMacTheme = true;
|
||||||
|
M_BRUSHDATA->m_isMacThemeBackground = false ;
|
||||||
|
M_BRUSHDATA->m_macThemeBrush = macThemeBrush;
|
||||||
|
|
||||||
|
RealizeResource();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxBrush::SetMacThemeBackground(ThemeBackgroundKind macThemeBackground)
|
||||||
|
{
|
||||||
|
Unshare();
|
||||||
|
|
||||||
|
M_BRUSHDATA->m_isMacTheme = false;
|
||||||
|
M_BRUSHDATA->m_isMacThemeBackground = true ;
|
||||||
|
M_BRUSHDATA->m_macThemeBackground = macThemeBackground;
|
||||||
|
|
||||||
|
RealizeResource();
|
||||||
|
}
|
||||||
|
|
||||||
bool wxBrush::RealizeResource()
|
bool wxBrush::RealizeResource()
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@@ -24,6 +24,8 @@ IMPLEMENT_DYNAMIC_CLASS(wxBrush, wxGDIObject)
|
|||||||
wxBrushRefData::wxBrushRefData()
|
wxBrushRefData::wxBrushRefData()
|
||||||
{
|
{
|
||||||
m_style = wxSOLID;
|
m_style = wxSOLID;
|
||||||
|
m_isMacTheme = false ;
|
||||||
|
m_isMacThemeBackground = false ;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxBrushRefData::wxBrushRefData(const wxBrushRefData& data)
|
wxBrushRefData::wxBrushRefData(const wxBrushRefData& data)
|
||||||
@@ -31,6 +33,8 @@ wxBrushRefData::wxBrushRefData(const wxBrushRefData& data)
|
|||||||
m_style = data.m_style;
|
m_style = data.m_style;
|
||||||
m_stipple = data.m_stipple;
|
m_stipple = data.m_stipple;
|
||||||
m_colour = data.m_colour;
|
m_colour = data.m_colour;
|
||||||
|
m_isMacTheme = data.m_isMacTheme ;
|
||||||
|
m_macThemeBrush = data.m_macThemeBrush ;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxBrushRefData::~wxBrushRefData()
|
wxBrushRefData::~wxBrushRefData()
|
||||||
@@ -66,6 +70,15 @@ wxBrush::wxBrush(const wxBitmap& stipple)
|
|||||||
RealizeResource();
|
RealizeResource();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxBrush::wxBrush(ThemeBrush macThemeBrush )
|
||||||
|
{
|
||||||
|
m_refData = new wxBrushRefData;
|
||||||
|
|
||||||
|
M_BRUSHDATA->m_isMacTheme = true;
|
||||||
|
M_BRUSHDATA->m_macThemeBrush = macThemeBrush;
|
||||||
|
|
||||||
|
RealizeResource();
|
||||||
|
}
|
||||||
void wxBrush::Unshare()
|
void wxBrush::Unshare()
|
||||||
{
|
{
|
||||||
// Don't change shared data
|
// Don't change shared data
|
||||||
@@ -84,7 +97,8 @@ void wxBrush::Unshare()
|
|||||||
void wxBrush::SetColour(const wxColour& col)
|
void wxBrush::SetColour(const wxColour& col)
|
||||||
{
|
{
|
||||||
Unshare();
|
Unshare();
|
||||||
|
M_BRUSHDATA->m_isMacTheme = false;
|
||||||
|
M_BRUSHDATA->m_isMacThemeBackground = false ;
|
||||||
M_BRUSHDATA->m_colour = col;
|
M_BRUSHDATA->m_colour = col;
|
||||||
|
|
||||||
RealizeResource();
|
RealizeResource();
|
||||||
@@ -94,6 +108,8 @@ void wxBrush::SetColour(unsigned char r, unsigned char g, unsigned char b)
|
|||||||
{
|
{
|
||||||
Unshare();
|
Unshare();
|
||||||
|
|
||||||
|
M_BRUSHDATA->m_isMacTheme = false;
|
||||||
|
M_BRUSHDATA->m_isMacThemeBackground = false ;
|
||||||
M_BRUSHDATA->m_colour.Set(r, g, b);
|
M_BRUSHDATA->m_colour.Set(r, g, b);
|
||||||
|
|
||||||
RealizeResource();
|
RealizeResource();
|
||||||
@@ -103,6 +119,8 @@ void wxBrush::SetStyle(int Style)
|
|||||||
{
|
{
|
||||||
Unshare();
|
Unshare();
|
||||||
|
|
||||||
|
M_BRUSHDATA->m_isMacTheme = false;
|
||||||
|
M_BRUSHDATA->m_isMacThemeBackground = false ;
|
||||||
M_BRUSHDATA->m_style = Style;
|
M_BRUSHDATA->m_style = Style;
|
||||||
|
|
||||||
RealizeResource();
|
RealizeResource();
|
||||||
@@ -117,6 +135,28 @@ void wxBrush::SetStipple(const wxBitmap& Stipple)
|
|||||||
RealizeResource();
|
RealizeResource();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void wxBrush::SetMacTheme(ThemeBrush macThemeBrush)
|
||||||
|
{
|
||||||
|
Unshare();
|
||||||
|
|
||||||
|
M_BRUSHDATA->m_isMacTheme = true;
|
||||||
|
M_BRUSHDATA->m_isMacThemeBackground = false ;
|
||||||
|
M_BRUSHDATA->m_macThemeBrush = macThemeBrush;
|
||||||
|
|
||||||
|
RealizeResource();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxBrush::SetMacThemeBackground(ThemeBackgroundKind macThemeBackground)
|
||||||
|
{
|
||||||
|
Unshare();
|
||||||
|
|
||||||
|
M_BRUSHDATA->m_isMacTheme = false;
|
||||||
|
M_BRUSHDATA->m_isMacThemeBackground = true ;
|
||||||
|
M_BRUSHDATA->m_macThemeBackground = macThemeBackground;
|
||||||
|
|
||||||
|
RealizeResource();
|
||||||
|
}
|
||||||
|
|
||||||
bool wxBrush::RealizeResource()
|
bool wxBrush::RealizeResource()
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@@ -473,16 +473,12 @@ void wxDC::SetBackgroundMode( int mode )
|
|||||||
|
|
||||||
void wxDC::SetFont( const wxFont &font )
|
void wxDC::SetFont( const wxFont &font )
|
||||||
{
|
{
|
||||||
wxCHECK_RET(Ok(), wxT("Invalid DC"));
|
|
||||||
|
|
||||||
m_font = font;
|
m_font = font;
|
||||||
m_macFontInstalled = false ;
|
m_macFontInstalled = false ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDC::SetPen( const wxPen &pen )
|
void wxDC::SetPen( const wxPen &pen )
|
||||||
{
|
{
|
||||||
wxCHECK_RET(Ok(), wxT("Invalid DC"));
|
|
||||||
|
|
||||||
if ( m_pen == pen )
|
if ( m_pen == pen )
|
||||||
return ;
|
return ;
|
||||||
|
|
||||||
@@ -493,8 +489,6 @@ void wxDC::SetPen( const wxPen &pen )
|
|||||||
|
|
||||||
void wxDC::SetBrush( const wxBrush &brush )
|
void wxDC::SetBrush( const wxBrush &brush )
|
||||||
{
|
{
|
||||||
wxCHECK_RET(Ok(), wxT("Invalid DC"));
|
|
||||||
|
|
||||||
if (m_brush == brush)
|
if (m_brush == brush)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -504,8 +498,6 @@ void wxDC::SetBrush( const wxBrush &brush )
|
|||||||
|
|
||||||
void wxDC::SetBackground( const wxBrush &brush )
|
void wxDC::SetBackground( const wxBrush &brush )
|
||||||
{
|
{
|
||||||
wxCHECK_RET(Ok(), wxT("Invalid DC"));
|
|
||||||
|
|
||||||
if (m_backgroundBrush == brush)
|
if (m_backgroundBrush == brush)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -1003,10 +995,10 @@ bool wxDC::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
|
|||||||
if ( LockPixels(bmappixels) )
|
if ( LockPixels(bmappixels) )
|
||||||
{
|
{
|
||||||
Rect srcrect , dstrect ;
|
Rect srcrect , dstrect ;
|
||||||
srcrect.top = source->YLOG2DEV(ysrc) ;
|
srcrect.top = source->YLOG2DEV(ysrc) + source->m_macLocalOrigin.v ;
|
||||||
srcrect.left = source->XLOG2DEV(xsrc) ;
|
srcrect.left = source->XLOG2DEV(xsrc) + source->m_macLocalOrigin.h ;
|
||||||
srcrect.right = source->XLOG2DEV(xsrc + width ) ;
|
srcrect.right = source->XLOG2DEV(xsrc + width ) + source->m_macLocalOrigin.v;
|
||||||
srcrect.bottom = source->YLOG2DEV(ysrc + height) ;
|
srcrect.bottom = source->YLOG2DEV(ysrc + height) + source->m_macLocalOrigin.h;
|
||||||
dstrect.top = YLOG2DEV(ydest) ;
|
dstrect.top = YLOG2DEV(ydest) ;
|
||||||
dstrect.left = XLOG2DEV(xdest) ;
|
dstrect.left = XLOG2DEV(xdest) ;
|
||||||
dstrect.bottom = YLOG2DEV(ydest + height ) ;
|
dstrect.bottom = YLOG2DEV(ydest + height ) ;
|
||||||
@@ -1028,15 +1020,31 @@ bool wxDC::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
|
|||||||
|
|
||||||
if ( useMask && source->m_macMask )
|
if ( useMask && source->m_macMask )
|
||||||
{
|
{
|
||||||
wxASSERT( mode == srcCopy ) ;
|
if ( mode == srcCopy )
|
||||||
if ( LockPixels( GetGWorldPixMap( source->m_macMask ) ) )
|
{
|
||||||
{
|
if ( LockPixels( GetGWorldPixMap( source->m_macMask ) ) )
|
||||||
CopyMask( GetPortBitMapForCopyBits( sourcePort ) ,
|
{
|
||||||
GetPortBitMapForCopyBits( source->m_macMask ) ,
|
CopyMask( GetPortBitMapForCopyBits( sourcePort ) ,
|
||||||
GetPortBitMapForCopyBits( m_macPort ) ,
|
GetPortBitMapForCopyBits( source->m_macMask ) ,
|
||||||
&srcrect, &srcrect , &dstrect ) ;
|
GetPortBitMapForCopyBits( m_macPort ) ,
|
||||||
UnlockPixels( GetGWorldPixMap( source->m_macMask ) ) ;
|
&srcrect, &srcrect , &dstrect ) ;
|
||||||
}
|
UnlockPixels( GetGWorldPixMap( source->m_macMask ) ) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RgnHandle clipRgn = NewRgn() ;
|
||||||
|
|
||||||
|
LockPixels( GetGWorldPixMap( source->m_macMask ) ) ;
|
||||||
|
BitMapToRegion( clipRgn , (BitMap*) *GetGWorldPixMap( source->m_macMask ) ) ;
|
||||||
|
UnlockPixels( GetGWorldPixMap( source->m_macMask ) ) ;
|
||||||
|
//OffsetRgn( clipRgn , -source->m_macMask->portRect.left , -source->m_macMask->portRect.top ) ;
|
||||||
|
OffsetRgn( clipRgn , -srcrect.left + dstrect.left, -srcrect.top + dstrect.top ) ;
|
||||||
|
CopyBits( GetPortBitMapForCopyBits( sourcePort ) ,
|
||||||
|
GetPortBitMapForCopyBits( m_macPort ) ,
|
||||||
|
&srcrect, &dstrect, mode, clipRgn ) ;
|
||||||
|
DisposeRgn( clipRgn ) ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1553,20 +1561,50 @@ void wxDC::MacInstallPen() const
|
|||||||
m_macFontInstalled = false ;
|
m_macFontInstalled = false ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int wxDC::MacSetupBackgroundForCurrentPort(const wxBrush& background )
|
||||||
|
{
|
||||||
|
Pattern whiteColor ;
|
||||||
|
if ( background.IsMacTheme() )
|
||||||
|
{
|
||||||
|
SetThemeBackground( background.GetMacTheme() , wxDisplayDepth() , true ) ;
|
||||||
|
}
|
||||||
|
else if ( background.IsMacThemeBackground() )
|
||||||
|
{
|
||||||
|
Rect originBox = { 0,0,1,1 } ;
|
||||||
|
::ApplyThemeBackground( background.GetMacThemeBackground() , &originBox ,kThemeStateActive ,
|
||||||
|
wxDisplayDepth() , true ) ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
::RGBBackColor( &background.GetColour().GetPixel() );
|
||||||
|
int brushStyle = background.GetStyle();
|
||||||
|
if (brushStyle == wxSOLID)
|
||||||
|
::BackPat(GetQDGlobalsWhite(&whiteColor));
|
||||||
|
else if (IS_HATCH(brushStyle))
|
||||||
|
{
|
||||||
|
Pattern pat ;
|
||||||
|
wxMacGetHatchPattern(brushStyle, &pat);
|
||||||
|
::BackPat(&pat);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
::BackPat(GetQDGlobalsWhite(&whiteColor));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0 ;
|
||||||
|
}
|
||||||
|
|
||||||
void wxDC::MacInstallBrush() const
|
void wxDC::MacInstallBrush() const
|
||||||
{
|
{
|
||||||
wxCHECK_RET(Ok(), wxT("Invalid DC"));
|
wxCHECK_RET(Ok(), wxT("Invalid DC"));
|
||||||
|
|
||||||
Pattern blackColor, whiteColor ;
|
Pattern blackColor ;
|
||||||
// if ( m_macBrushInstalled )
|
// if ( m_macBrushInstalled )
|
||||||
// return ;
|
// return ;
|
||||||
|
|
||||||
// foreground
|
// foreground
|
||||||
|
|
||||||
RGBColor forecolor = m_brush.GetColour().GetPixel();
|
::RGBForeColor( &m_brush.GetColour().GetPixel() );
|
||||||
RGBColor backcolor = m_backgroundBrush.GetColour().GetPixel();
|
|
||||||
::RGBForeColor( &forecolor );
|
|
||||||
::RGBBackColor( &backcolor );
|
|
||||||
|
|
||||||
int brushStyle = m_brush.GetStyle();
|
int brushStyle = m_brush.GetStyle();
|
||||||
if (brushStyle == wxSOLID)
|
if (brushStyle == wxSOLID)
|
||||||
@@ -1585,24 +1623,12 @@ void wxDC::MacInstallBrush() const
|
|||||||
|
|
||||||
// background
|
// background
|
||||||
|
|
||||||
brushStyle = m_backgroundBrush.GetStyle();
|
MacSetupBackgroundForCurrentPort( m_backgroundBrush ) ;
|
||||||
if (brushStyle == wxSOLID)
|
|
||||||
::BackPat(GetQDGlobalsWhite(&whiteColor));
|
|
||||||
else if (IS_HATCH(brushStyle))
|
|
||||||
{
|
|
||||||
Pattern pat ;
|
|
||||||
wxMacGetHatchPattern(brushStyle, &pat);
|
|
||||||
::BackPat(&pat);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
::BackPat(GetQDGlobalsWhite(&whiteColor));
|
|
||||||
}
|
|
||||||
|
|
||||||
short mode = patCopy ;
|
|
||||||
|
|
||||||
// todo :
|
// todo :
|
||||||
|
|
||||||
|
short mode = patCopy ;
|
||||||
switch( m_logicalFunction )
|
switch( m_logicalFunction )
|
||||||
{
|
{
|
||||||
case wxCOPY: // src
|
case wxCOPY: // src
|
||||||
|
106
src/mac/dc.cpp
106
src/mac/dc.cpp
@@ -473,16 +473,12 @@ void wxDC::SetBackgroundMode( int mode )
|
|||||||
|
|
||||||
void wxDC::SetFont( const wxFont &font )
|
void wxDC::SetFont( const wxFont &font )
|
||||||
{
|
{
|
||||||
wxCHECK_RET(Ok(), wxT("Invalid DC"));
|
|
||||||
|
|
||||||
m_font = font;
|
m_font = font;
|
||||||
m_macFontInstalled = false ;
|
m_macFontInstalled = false ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDC::SetPen( const wxPen &pen )
|
void wxDC::SetPen( const wxPen &pen )
|
||||||
{
|
{
|
||||||
wxCHECK_RET(Ok(), wxT("Invalid DC"));
|
|
||||||
|
|
||||||
if ( m_pen == pen )
|
if ( m_pen == pen )
|
||||||
return ;
|
return ;
|
||||||
|
|
||||||
@@ -493,8 +489,6 @@ void wxDC::SetPen( const wxPen &pen )
|
|||||||
|
|
||||||
void wxDC::SetBrush( const wxBrush &brush )
|
void wxDC::SetBrush( const wxBrush &brush )
|
||||||
{
|
{
|
||||||
wxCHECK_RET(Ok(), wxT("Invalid DC"));
|
|
||||||
|
|
||||||
if (m_brush == brush)
|
if (m_brush == brush)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -504,8 +498,6 @@ void wxDC::SetBrush( const wxBrush &brush )
|
|||||||
|
|
||||||
void wxDC::SetBackground( const wxBrush &brush )
|
void wxDC::SetBackground( const wxBrush &brush )
|
||||||
{
|
{
|
||||||
wxCHECK_RET(Ok(), wxT("Invalid DC"));
|
|
||||||
|
|
||||||
if (m_backgroundBrush == brush)
|
if (m_backgroundBrush == brush)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -1003,10 +995,10 @@ bool wxDC::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
|
|||||||
if ( LockPixels(bmappixels) )
|
if ( LockPixels(bmappixels) )
|
||||||
{
|
{
|
||||||
Rect srcrect , dstrect ;
|
Rect srcrect , dstrect ;
|
||||||
srcrect.top = source->YLOG2DEV(ysrc) ;
|
srcrect.top = source->YLOG2DEV(ysrc) + source->m_macLocalOrigin.v ;
|
||||||
srcrect.left = source->XLOG2DEV(xsrc) ;
|
srcrect.left = source->XLOG2DEV(xsrc) + source->m_macLocalOrigin.h ;
|
||||||
srcrect.right = source->XLOG2DEV(xsrc + width ) ;
|
srcrect.right = source->XLOG2DEV(xsrc + width ) + source->m_macLocalOrigin.v;
|
||||||
srcrect.bottom = source->YLOG2DEV(ysrc + height) ;
|
srcrect.bottom = source->YLOG2DEV(ysrc + height) + source->m_macLocalOrigin.h;
|
||||||
dstrect.top = YLOG2DEV(ydest) ;
|
dstrect.top = YLOG2DEV(ydest) ;
|
||||||
dstrect.left = XLOG2DEV(xdest) ;
|
dstrect.left = XLOG2DEV(xdest) ;
|
||||||
dstrect.bottom = YLOG2DEV(ydest + height ) ;
|
dstrect.bottom = YLOG2DEV(ydest + height ) ;
|
||||||
@@ -1028,15 +1020,31 @@ bool wxDC::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
|
|||||||
|
|
||||||
if ( useMask && source->m_macMask )
|
if ( useMask && source->m_macMask )
|
||||||
{
|
{
|
||||||
wxASSERT( mode == srcCopy ) ;
|
if ( mode == srcCopy )
|
||||||
if ( LockPixels( GetGWorldPixMap( source->m_macMask ) ) )
|
{
|
||||||
{
|
if ( LockPixels( GetGWorldPixMap( source->m_macMask ) ) )
|
||||||
CopyMask( GetPortBitMapForCopyBits( sourcePort ) ,
|
{
|
||||||
GetPortBitMapForCopyBits( source->m_macMask ) ,
|
CopyMask( GetPortBitMapForCopyBits( sourcePort ) ,
|
||||||
GetPortBitMapForCopyBits( m_macPort ) ,
|
GetPortBitMapForCopyBits( source->m_macMask ) ,
|
||||||
&srcrect, &srcrect , &dstrect ) ;
|
GetPortBitMapForCopyBits( m_macPort ) ,
|
||||||
UnlockPixels( GetGWorldPixMap( source->m_macMask ) ) ;
|
&srcrect, &srcrect , &dstrect ) ;
|
||||||
}
|
UnlockPixels( GetGWorldPixMap( source->m_macMask ) ) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RgnHandle clipRgn = NewRgn() ;
|
||||||
|
|
||||||
|
LockPixels( GetGWorldPixMap( source->m_macMask ) ) ;
|
||||||
|
BitMapToRegion( clipRgn , (BitMap*) *GetGWorldPixMap( source->m_macMask ) ) ;
|
||||||
|
UnlockPixels( GetGWorldPixMap( source->m_macMask ) ) ;
|
||||||
|
//OffsetRgn( clipRgn , -source->m_macMask->portRect.left , -source->m_macMask->portRect.top ) ;
|
||||||
|
OffsetRgn( clipRgn , -srcrect.left + dstrect.left, -srcrect.top + dstrect.top ) ;
|
||||||
|
CopyBits( GetPortBitMapForCopyBits( sourcePort ) ,
|
||||||
|
GetPortBitMapForCopyBits( m_macPort ) ,
|
||||||
|
&srcrect, &dstrect, mode, clipRgn ) ;
|
||||||
|
DisposeRgn( clipRgn ) ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1553,20 +1561,50 @@ void wxDC::MacInstallPen() const
|
|||||||
m_macFontInstalled = false ;
|
m_macFontInstalled = false ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int wxDC::MacSetupBackgroundForCurrentPort(const wxBrush& background )
|
||||||
|
{
|
||||||
|
Pattern whiteColor ;
|
||||||
|
if ( background.IsMacTheme() )
|
||||||
|
{
|
||||||
|
SetThemeBackground( background.GetMacTheme() , wxDisplayDepth() , true ) ;
|
||||||
|
}
|
||||||
|
else if ( background.IsMacThemeBackground() )
|
||||||
|
{
|
||||||
|
Rect originBox = { 0,0,1,1 } ;
|
||||||
|
::ApplyThemeBackground( background.GetMacThemeBackground() , &originBox ,kThemeStateActive ,
|
||||||
|
wxDisplayDepth() , true ) ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
::RGBBackColor( &background.GetColour().GetPixel() );
|
||||||
|
int brushStyle = background.GetStyle();
|
||||||
|
if (brushStyle == wxSOLID)
|
||||||
|
::BackPat(GetQDGlobalsWhite(&whiteColor));
|
||||||
|
else if (IS_HATCH(brushStyle))
|
||||||
|
{
|
||||||
|
Pattern pat ;
|
||||||
|
wxMacGetHatchPattern(brushStyle, &pat);
|
||||||
|
::BackPat(&pat);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
::BackPat(GetQDGlobalsWhite(&whiteColor));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0 ;
|
||||||
|
}
|
||||||
|
|
||||||
void wxDC::MacInstallBrush() const
|
void wxDC::MacInstallBrush() const
|
||||||
{
|
{
|
||||||
wxCHECK_RET(Ok(), wxT("Invalid DC"));
|
wxCHECK_RET(Ok(), wxT("Invalid DC"));
|
||||||
|
|
||||||
Pattern blackColor, whiteColor ;
|
Pattern blackColor ;
|
||||||
// if ( m_macBrushInstalled )
|
// if ( m_macBrushInstalled )
|
||||||
// return ;
|
// return ;
|
||||||
|
|
||||||
// foreground
|
// foreground
|
||||||
|
|
||||||
RGBColor forecolor = m_brush.GetColour().GetPixel();
|
::RGBForeColor( &m_brush.GetColour().GetPixel() );
|
||||||
RGBColor backcolor = m_backgroundBrush.GetColour().GetPixel();
|
|
||||||
::RGBForeColor( &forecolor );
|
|
||||||
::RGBBackColor( &backcolor );
|
|
||||||
|
|
||||||
int brushStyle = m_brush.GetStyle();
|
int brushStyle = m_brush.GetStyle();
|
||||||
if (brushStyle == wxSOLID)
|
if (brushStyle == wxSOLID)
|
||||||
@@ -1585,24 +1623,12 @@ void wxDC::MacInstallBrush() const
|
|||||||
|
|
||||||
// background
|
// background
|
||||||
|
|
||||||
brushStyle = m_backgroundBrush.GetStyle();
|
MacSetupBackgroundForCurrentPort( m_backgroundBrush ) ;
|
||||||
if (brushStyle == wxSOLID)
|
|
||||||
::BackPat(GetQDGlobalsWhite(&whiteColor));
|
|
||||||
else if (IS_HATCH(brushStyle))
|
|
||||||
{
|
|
||||||
Pattern pat ;
|
|
||||||
wxMacGetHatchPattern(brushStyle, &pat);
|
|
||||||
::BackPat(&pat);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
::BackPat(GetQDGlobalsWhite(&whiteColor));
|
|
||||||
}
|
|
||||||
|
|
||||||
short mode = patCopy ;
|
|
||||||
|
|
||||||
// todo :
|
// todo :
|
||||||
|
|
||||||
|
short mode = patCopy ;
|
||||||
switch( m_logicalFunction )
|
switch( m_logicalFunction )
|
||||||
{
|
{
|
||||||
case wxCOPY: // src
|
case wxCOPY: // src
|
||||||
|
Reference in New Issue
Block a user