/*!

*/
void
TeamGraphicPainter::draw( QPainter & painter )
{
    const Options & opt = Options::instance();

    if ( opt.anonymousMode()
         || ! opt.showTeamGraphic() )
    {
        return;
    }

    // update left team pixmap
    if ( M_team_graphic_left_set.size()
         != M_main_data.viewHolder().teamGraphicLeft().tiles().size() )
    {
        if ( M_main_data.viewHolder().teamGraphicLeft().tiles().empty() )
        {
            M_team_graphic_left_set.clear();
            M_team_graphic_pixmap_left = QPixmap();
        }
        else
        {
            copyTeamGraphic( M_team_graphic_pixmap_left,
                             M_team_graphic_left_set,
                             M_main_data.viewHolder().teamGraphicLeft() );
        }
    }

    // update right team pixmap
    if ( M_team_graphic_right_set.size()
         != M_main_data.viewHolder().teamGraphicRight().tiles().size() )
    {
        if ( M_main_data.viewHolder().teamGraphicRight().tiles().empty() )
        {
            M_team_graphic_right_set.clear();
            M_team_graphic_pixmap_right = QPixmap();
        }
        else
        {
            copyTeamGraphic( M_team_graphic_pixmap_right,
                             M_team_graphic_right_set,
                             M_main_data.viewHolder().teamGraphicRight() );
        }
    }

    if ( ! M_team_graphic_pixmap_left.isNull() )
    {
        int left_x = 0;
        if ( opt.reverseSide() )
        {
            left_x = opt.canvasWidth() - M_team_graphic_pixmap_left.width();
        }
        painter.drawPixmap( QPoint( left_x, opt.scoreBoardHeight() ),
                            M_team_graphic_pixmap_left );
    }

    if ( ! M_team_graphic_pixmap_right.isNull() )
    {
        int left_x = opt.canvasWidth() - M_team_graphic_pixmap_right.width();
        if ( opt.reverseSide() )
        {
            left_x = 0;
        }
        painter.drawPixmap( QPoint( left_x, opt.scoreBoardHeight() ),
                            M_team_graphic_pixmap_right );
    }
}
/*!

*/
void
TeamGraphicPainter::draw( QPainter & painter )
{
    const Options & opt = Options::instance();

    if ( ! opt.showTeamGraphic() )
    {
        return;
    }

    // update left team pixmap
    if ( M_team_graphic_left_set.size() != M_disp_holder.teamGraphicLeft().tiles().size() )
    {
        if ( M_disp_holder.teamGraphicLeft().tiles().empty() )
        {
            M_team_graphic_left_set.clear();
            M_team_graphic_pixmap_left = QPixmap();
        }
        else
        {
            copyTeamGraphic( M_team_graphic_pixmap_left,
                             M_team_graphic_left_set,
                             M_disp_holder.teamGraphicLeft() );
        }
    }

    // update right team pixmap
    if ( M_team_graphic_right_set.size() != M_disp_holder.teamGraphicRight().tiles().size() )
    {
        if ( M_disp_holder.teamGraphicRight().tiles().empty() )
        {
            M_team_graphic_right_set.clear();
            M_team_graphic_pixmap_right = QPixmap();
        }
        else
        {
            copyTeamGraphic( M_team_graphic_pixmap_right,
                             M_team_graphic_right_set,
                             M_disp_holder.teamGraphicRight() );
        }
    }

    if ( ! M_team_graphic_pixmap_left.isNull() )
    {
        int x = 0;
        int y = 0;
        //int x = ( 256 - M_team_graphic_pixmap_left.width() ) / 2;
        //int y = ( 64 -  M_team_graphic_pixmap_left.height() ) / 2;
        painter.drawPixmap( x, y, M_team_graphic_pixmap_left );
    }

    if ( ! M_team_graphic_pixmap_right.isNull() )
    {
        int x = painter.window().width() - M_team_graphic_pixmap_right.width() - 1;
        int y = 0;
        //int x = painter.window().width() - 256
        //    + ( 256 - M_team_graphic_pixmap_right.width() ) / 2;
        //int y = ( 64 -  M_team_graphic_pixmap_right.height() ) / 2;
        painter.drawPixmap( x, y, M_team_graphic_pixmap_right );
    }
}