Ejemplo n.º 1
0
void
MacDecorator::_FontsChanged(DesktopSettings& settings,
                            BRegion* updateRegion)
{
    // get previous extent
    if (updateRegion != NULL)
        updateRegion->Include(&GetFootprint());

    _UpdateFont(settings);
    _DoLayout();

    _InvalidateFootprint();
    if (updateRegion != NULL)
        updateRegion->Include(&GetFootprint());
}
Ejemplo n.º 2
0
void
MacDecorator::_SetFlags(uint32 flags, BRegion* updateRegion)
{
    // TODO: we could be much smarter about the update region

    // get previous extent
    if (updateRegion != NULL)
        updateRegion->Include(&GetFootprint());

    _DoLayout();

    _InvalidateFootprint();
    if (updateRegion != NULL)
        updateRegion->Include(&GetFootprint());
}
Ejemplo n.º 3
0
void
WinDecorator::FontsChanged(DesktopSettings& settings, BRegion* updateRegion)
{
	// get previous extent
	if (updateRegion != NULL) {
		BRegion extent;
		GetFootprint(&extent);
		updateRegion->Include(&extent);
	}

	_UpdateFont(settings);
	_DoLayout();

	if (updateRegion != NULL) {
		BRegion extent;
		GetFootprint(&extent);
		updateRegion->Include(&extent);
	}
}
Ejemplo n.º 4
0
void
MacDecorator::_SetLook(DesktopSettings& settings, window_look look,
                       BRegion* updateRegion)
{
    // TODO: we could be much smarter about the update region

    // get previous extent
    if (updateRegion != NULL)
        updateRegion->Include(&GetFootprint());

    fLook = look;

    _UpdateFont(settings);
    _DoLayout();

    _InvalidateFootprint();
    if (updateRegion != NULL)
        updateRegion->Include(&GetFootprint());
}
Ejemplo n.º 5
0
void
WinDecorator::SetFlags(uint32 flags, BRegion* updateRegion)
{
	// TODO: we could be much smarter about the update region

	// get previous extent
	if (updateRegion != NULL) {
		BRegion extent;
		GetFootprint(&extent);
		updateRegion->Include(&extent);
	}

	Decorator::SetFlags(flags, updateRegion);
	_DoLayout();

	if (updateRegion != NULL) {
		BRegion extent;
		GetFootprint(&extent);
		updateRegion->Include(&extent);
	}
}
Ejemplo n.º 6
0
void
WinDecorator::SetLook(DesktopSettings& settings, window_look look,
	BRegion* updateRegion)
{
	// TODO: we could be much smarter about the update region

	// get previous extent
	if (updateRegion != NULL) {
		BRegion extent;
		GetFootprint(&extent);
		updateRegion->Include(&extent);
	}

	fLook = look;

	_UpdateFont(settings);
	_DoLayout();

	if (updateRegion != NULL) {
		BRegion extent;
		GetFootprint(&extent);
		updateRegion->Include(&extent);
	}
}
Ejemplo n.º 7
0
void COptimizePath::SetupOptimize(const abase::vector<A3DPOINT2>& initpath, const APointF& startpos, const APointF& endpos, int catchCount)
{
	assert(!initpath.empty());
	m_Path.clear();
	memset(m_LookUp, 0, sizeof(int) *m_MapWidth *m_MapHeight);
	unsigned int i;
	for (i = 0; i < initpath.size(); i++)
	{
		APointF curpos;
		// 对处理起点和终点进行特殊处理
		if (0 == i && initpath[i] == A3DPOINT2((int)startpos.x, (int)startpos.y))
		{
			curpos = startpos;
		}
		else if (initpath.size() == i+1 && initpath[i] == A3DPOINT2((int)endpos.x, (int)endpos.y))
		{
			curpos = endpos;
		}
		else
		{
			curpos = g_MoveAgentManager.GetMoveMap()->GetPixelCenter(initpath[i]);
		}
		m_Path.push_back(curpos);
		if(GetFootprint(initpath[i].x, initpath[i].y)==0)
		{
			SetFootprint(initpath[i].x, initpath[i].y, i+1);
		}
		else
		{
			//假如之前算法有BUG,简单处理就是路径回溯,到上一次出现这个点的路径清除掉.理论上不应该出现
		}
		//这里可以判断一下Footprint 是否有重复值
	}
	
	m_CurIndex = 0;
	m_CatchCount = catchCount;
}
Ejemplo n.º 8
0
void COptimizePath::_LocalOptimize()
{
	int to_index = a_Min(m_CurIndex + 40, (int)m_Path.size()-1);  //see some nodes further
	
	CLine line;
	APointF dir;
	int new_count = -1;
	abase::vector<APointF> path;
	
	while (to_index - m_CurIndex > 2)
	{
		path.clear();
		if (GetFootprint(m_Path[to_index]) == 0)
		{//not in the original path
		 //
			break;
		}
		/*
		///* Old code that using Cline
		dir = m_Path[to_index] - m_Path[m_CurIndex];
		line.Init(m_Path[m_CurIndex], dir);
		if (_LineTo(line, m_Path[to_index]))
		{
			new_count = line.GetCount();
			break;
		}
		*/
		
		//if(CMoveAgent::OptCanDirectlyMove(m_Path[m_CurIndex],m_Path[to_index],&path))
		if(CMoveAgent::OptCanDirectlyMove(m_Path, m_CurIndex, to_index, &path))
		{
			new_count = path.size()-1;

#ifdef _DEBUG_PF
			char msg[128]={0,};
			sprintf(msg,"\nOptimized Points number %d\n",path.size());
			OutputDebugStringA(msg);

			for (size_t i = 0; i < path.size(); i++)
			{
				APointF    pt2d = path.at(i);	
				char msg[128]={0,};
				sprintf(msg,"original Point (%f , %f)\n",pt2d.x,pt2d.y);
				OutputDebugStringA(msg);
			}
#endif

			break;
		}
		
		to_index -= 1;
	}
	/* Old code that using Cline
	if (new_count > 0)
	{
		line.Reset();
		_AddPathPortion(line, A3DPOINT2((int)m_Path[to_index].x, (int)m_Path[to_index].y), new_count);
	}
	*/
	
	if(new_count>0)
	{

#ifdef _DEBUG_PF
		{
			char msg[128]={0,};
			sprintf(msg,"\n Line Point (%f , %f) to (%f , %f)\n",m_Path[m_CurIndex].x,m_Path[m_CurIndex].y,m_Path[to_index].x,m_Path[to_index].y);
			OutputDebugStringA(msg);
		}
		unsigned int i;
		{
			char msg[128]={0,};
			sprintf(msg,"\n Before Optimize Points number %d \n",m_Path.size());
			OutputDebugStringA(msg);
		}
		for (i = 0; i < m_Path.size(); i++)
		{
			APointF    pt2d = m_Path.at(i);	
			char msg[128]={0,};
			sprintf(msg,"original Point (%f , %f)\n",pt2d.x,pt2d.y);
			OutputDebugStringA(msg);
		}
		{
			char msg[128]={0,};
			sprintf(msg,"\n After Optimize Points number %d \n",m_Path.size());
			OutputDebugStringA(msg);
		}
#endif

		//////////////////////////////////////////////////////////////////////////
		_AddPathPortion(&path, A3DPOINT2((int)m_Path[to_index].x, (int)m_Path[to_index].y), new_count);
		//////////////////////////////////////////////////////////////////////////

#ifdef _DEBUG_PF
		for (i = 0; i < m_Path.size(); i++)
		{
			APointF    pt2d = m_Path.at(i);	
			char msg[128]={0,};
			sprintf(msg,"original Point (%f , %f)\n",pt2d.x,pt2d.y);
			OutputDebugStringA(msg);
		}
#endif
	}
	path.clear();
}