//////////////////////////////////////////////////////////////////////////////////////////////////// // PaintAll() // Paint this panes surface, then paint any children. // Note: the function ::Paint(), is overloaded by any class derived from Pane. // Added: pass the clip rect round, as with the others, pass by copy, as this can then be modified // and passed to child panes. //////////////////////////////////////////////////////////////////////////////////////////////////// void Pane::PaintAll( Surface * psurface ) { // Clipping test - TBD: reinstate. /* if( ( rectClip.XMax() <= rectClip.XMin() ) || ( rectClip.YMax() <= rectClip.YMin() ) || ( rectClip.XMax() < 0 ) || ( rectClip.YMax() < 0 ) ) { return; }*/ if( !m_bHidden ) { Paint( psurface ); for(Pane* ppane = m_pchild; ppane != NULL; ppane = ppane->m_pnext) { WinRect rectClipOld = psurface->GetClipRect(); psurface->Offset(ppane->m_offset); psurface->SetClipRect(WinRect(WinPoint(0, 0), ppane->GetSize())); D3DVIEWPORT9 newViewport, oldViewport; CD3DDevice9::Get()->GetViewport( &oldViewport ); WinRect surfClip = psurface->GetClipRect(); WinPoint surfOffset = psurface->GetOffset(); newViewport.X = surfClip.XMin() + surfOffset.X(); newViewport.Y = surfClip.YMin() + surfOffset.Y(); newViewport.Width = surfClip.XMax() - surfClip.XMin(); newViewport.Height = surfClip.YMax() - surfClip.YMin(); newViewport.MinZ = oldViewport.MinZ; newViewport.MaxZ = oldViewport.MaxZ; newViewport.X = (int) newViewport.X < 0 ? 0 : newViewport.X; newViewport.Y = (int) newViewport.Y < 0 ? 0 : newViewport.Y; newViewport.Width = (int) newViewport.Width < 0 ? 0 : newViewport.Width; newViewport.Height = (int) newViewport.Height < 0 ? 0 : newViewport.Height; if( ( newViewport.Width > 0 ) && ( newViewport.Height > 0 ) ) { CD3DDevice9::Get()->SetViewport( &newViewport ); ppane->PaintAll( psurface ); } psurface->Offset(-ppane->m_offset); psurface->RestoreClipRect(rectClipOld); if( ( newViewport.Width > 0 ) && ( newViewport.Height > 0 ) ) { CD3DDevice9::Get()->SetViewport( &oldViewport ); } } m_bNeedPaint = false; m_bPaintAll = false; } }
void DrawItem(Surface* pSurface, const WinRect& rect, bool fSelected, int iFirstSlot) { IEngineFont* pfont = m_pchatInfo->IsFromLeader() ? TrekResources::SmallBoldFont() : TrekResources::SmallFont(); WinPoint pt(rect.Min() + WinPoint(3,3)); for ( int i = iFirstSlot; i < m_vMsgLines.GetCount() && pt.Y() < rect.YMax(); i++ ) { pSurface->DrawString(pfont, m_pchatInfo->GetColor(), pt, m_vMsgLines[i]); pt += WinPoint(0, m_ptLineSize.Y()); } }