Ejemplo n.º 1
0
////////////////////////////////////////////////////////////////////////////////////////////////////
// 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;
    }
}
Ejemplo n.º 2
0
	WinPoint GetClusterPoint(CMapPVCluster* pcluster)
	{
		WinPoint pt = WinPoint(
			(int)(m_rectMap.XMin() + ((pcluster->GetScreenX() - m_xMin)/(m_xMax - m_xMin))*(m_rectMap.XSize() - 2*c_nXBorder) + c_nXBorder), 
			(int)(m_rectMap.YMin() + ((pcluster->GetScreenY() - m_yMin)/(m_yMax - m_yMin))*(m_rectMap.YSize() - 2*c_nYBorder) + c_nYBorder)
			);

		return pt;
	}
Ejemplo n.º 3
0
void Window::SetRect(const WinRect& rect)
{
    MoveWindow(m_hwnd, rect.XMin(), rect.YMin(), rect.XSize(), rect.YSize(), true);
}