- wxASSERT_MSG( blit.Ok() , wxT("Invalid bitmap for blitting") );
-
- wxCoord bmpwidth = blit.GetWidth();
- wxCoord bmpheight = blit.GetHeight();
-
- if ( xxsrc != 0 || yysrc != 0 || bmpwidth != wwsrc || bmpheight != hhsrc )
- {
- wwsrc = wxMin( wwsrc , bmpwidth - xxsrc );
- hhsrc = wxMin( hhsrc , bmpheight - yysrc );
- if ( wwsrc > 0 && hhsrc > 0 )
- {
- if ( xxsrc >= 0 && yysrc >= 0 )
- {
- wxRect subrect( xxsrc, yysrc, wwsrc , hhsrc );
- // TODO we perhaps could add a DrawSubBitmap call to dc for performance reasons
- blit = blit.GetSubBitmap( subrect );
- }
- else
- {
- // in this case we'd probably have to adjust the different coordinates, but
- // we have to find out proper contract first
- blit = wxNullBitmap;
- }
- }
- else
- {
- blit = wxNullBitmap;
- }
- }
-
- if ( blit.Ok() )
- {
- m_graphicContext->DrawBitmap( blit, xxdest , yydest , wwdest , hhdest );
- }
+ if ( blit.Ok() )
+ {
+ m_graphicContext->DrawBitmap( blit, xdest, ydest,
+ wxMin(width, blit.GetWidth()),
+ wxMin(height, blit.GetHeight()));