AUI_ERRCODE c3_Icon::DrawThis( aui_Surface *surface, sint32 x, sint32 y ) { if ( IsHidden() ) return AUI_ERRCODE_OK; if ( !surface ) surface = m_window->TheSurface(); RECT rect = { 0, 0, m_width, m_height }; OffsetRect( &rect, m_x + x, m_y + y ); ToWindow( &rect ); if ( m_pattern ) m_pattern->Draw( surface, &rect ); DrawThisStateImage( 0, surface, &rect ); if (m_mapIcon != MAPICON_MAX) { if (m_color != COLOR_MAX) { POINT where; TileSet *tileSet = g_tiledMap->GetTileSet(); POINT iconDim = tileSet->GetMapIconDimensions( m_mapIcon ); where.x = ( m_width - iconDim.x ) / 2; if (where.x < 0) where.x = 0; where.y = ( m_height - iconDim.y ) / 2; if (where.y < 0) where.y = 0; where.x += rect.left; where.y += rect.top; Pixel16 *icon; icon = tileSet->GetMapIconData( m_mapIcon ); Assert(icon); if (!icon) return AUI_ERRCODE_OK; g_tiledMap->DrawColorizedOverlay( icon, surface, where.x, where.y, g_colorSet->GetColor(m_color) ); } } if (m_bevelWidth > 0) { primitives_BevelRect16( surface, &rect, m_bevelWidth, m_bevelType, 16, 16 ); } DrawThisText( surface, &rect ); if ( surface == m_window->TheSurface() ) m_window->AddDirtyRect( &rect ); return AUI_ERRCODE_OK; }