wxDC *source,
wxCoord xsrc, wxCoord ysrc,
int logical_func,
- bool useMask )
+ bool useMask,
+ wxCoord xsrcMask, wxCoord ysrcMask )
{
/* this is the nth try to get this utterly useless function to
work. it now completely ignores the scaling or translation
bool use_bitmap_method = FALSE;
bool is_mono = FALSE;
+ /* TODO: use the mask origin when drawing transparently */
+ if (xsrcMask == -1 && ysrcMask == -1)
+ {
+ xsrcMask = xsrc; ysrcMask = ysrc;
+ }
+
if (srcDC->m_isMemDC)
{
if (!memDC->m_selected.Ok()) return FALSE;
#else
wxCoord width = gdk_string_width( font, text.mbc_str() );
wxCoord height = font->ascent + font->descent;
- /* CMB 21/5/98: draw text background if mode is wxSOLID */
- if (m_backgroundMode == wxSOLID)
+
+ if ( m_backgroundMode == wxSOLID )
{
gdk_gc_set_foreground( m_textGC, m_textBackgroundColour.GetColor() );
gdk_draw_rectangle( m_window, m_textGC, TRUE, x, y, width, height );
void wxWindowDC::SetFont( const wxFont &font )
{
+ wxCHECK_RET( font.Ok(), _T("invalid font in wxWindowDC::SetFont") );
+
m_font = font;
#ifdef __WXGTK20__
// fix fontdesc?
{
wxCHECK_RET( Ok(), wxT("invalid window dc") );
- if (m_textForegroundColour == col) return;
+ // don't set m_textForegroundColour to an invalid colour as we'd crash
+ // later then (we use m_textForegroundColour.GetColor() without checking
+ // in a few places)
+ if ( !col.Ok() || (m_textForegroundColour == col) )
+ return;
m_textForegroundColour = col;
- if (!m_textForegroundColour.Ok()) return;
- if (!m_window) return;
-
- m_textForegroundColour.CalcPixel( m_cmap );
- gdk_gc_set_foreground( m_textGC, m_textForegroundColour.GetColor() );
+ if ( m_window )
+ {
+ m_textForegroundColour.CalcPixel( m_cmap );
+ gdk_gc_set_foreground( m_textGC, m_textForegroundColour.GetColor() );
+ }
}
void wxWindowDC::SetTextBackground( const wxColour &col )
{
wxCHECK_RET( Ok(), wxT("invalid window dc") );
- if (m_textBackgroundColour == col) return;
+ // same as above
+ if ( !col.Ok() || (m_textBackgroundColour == col) )
+ return;
m_textBackgroundColour = col;
- if (!m_textBackgroundColour.Ok()) return;
-
- if (!m_window) return;
- m_textBackgroundColour.CalcPixel( m_cmap );
- gdk_gc_set_background( m_textGC, m_textBackgroundColour.GetColor() );
+ if ( m_window )
+ {
+ m_textBackgroundColour.CalcPixel( m_cmap );
+ gdk_gc_set_background( m_textGC, m_textBackgroundColour.GetColor() );
+ }
}
void wxWindowDC::SetBackgroundMode( int mode )
wxClientDC::wxClientDC( wxWindow *win )
: wxWindowDC( win )
{
+ wxCHECK_RET( win, _T("NULL window in wxClientDC::wxClientDC") );
+
#ifdef __WXUNIVERSAL__
wxPoint ptOrigin = win->GetClientAreaOrigin();
SetDeviceOrigin(ptOrigin.x, ptOrigin.y);
#endif // __WXUNIVERSAL__
}
+void wxClientDC::DoGetSize(int *width, int *height) const
+{
+ wxCHECK_RET( m_owner, _T("GetSize() doesn't work without window") );
+
+ m_owner->GetClientSize( width, height );
+}
+
// ----------------------------------------------------------------------------
// wxDCModule
// ----------------------------------------------------------------------------