- wxCHECK_RET( Ok(), wxT("wxGCDC(cg)::DoDrawBitmap - invalid DC") );
- wxCHECK_RET( bmp.Ok(), wxT("wxGCDC(cg)::DoDrawBitmap - invalid bitmap") );
+ wxCHECK_RET( IsOk(), wxT("wxGCDC(cg)::DoDrawBitmap - invalid DC") );
+ wxCHECK_RET( bmp.IsOk(), wxT("wxGCDC(cg)::DoDrawBitmap - invalid bitmap") );
+
+ int w = bmp.GetScaledWidth();
+ int h = bmp.GetScaledHeight();
+ if ( bmp.GetDepth() == 1 )
+ {
+ m_graphicContext->SetPen(*wxTRANSPARENT_PEN);
+ m_graphicContext->SetBrush( wxBrush( m_textBackgroundColour , wxSOLID ) );
+ m_graphicContext->DrawRectangle( x, y, w, h );
+ m_graphicContext->SetBrush( wxBrush( m_textForegroundColour , wxSOLID ) );
+ m_graphicContext->DrawBitmap( bmp, x, y, w, h );
+ m_graphicContext->SetBrush( m_graphicContext->CreateBrush(m_brush));
+ m_graphicContext->SetPen( m_graphicContext->CreatePen(m_pen));
+ }
+ else // not a monochrome bitmap, handle it normally
+ {
+ // make a copy in case we need to remove its mask, if we don't modify
+ // it the copy is cheap as bitmaps are reference-counted
+ wxBitmap bmpCopy(bmp);
+ if ( !useMask && bmp.GetMask() )
+ bmpCopy.SetMask(NULL);