コード例 #1
0
CFX_FloatRect CPDF_ClipPath::GetClipBox() const {
  CFX_FloatRect rect;
  bool bStarted = false;
  if (GetPathCount() > 0) {
    rect = GetPath(0).GetBoundingBox();
    for (size_t i = 1; i < GetPathCount(); ++i) {
      CFX_FloatRect path_rect = GetPath(i).GetBoundingBox();
      rect.Intersect(path_rect);
    }
    bStarted = true;
  }

  CFX_FloatRect layer_rect;
  bool bLayerStarted = false;
  for (size_t i = 0; i < GetTextCount(); ++i) {
    CPDF_TextObject* pTextObj = GetText(i);
    if (pTextObj) {
      if (bLayerStarted) {
        layer_rect.Union(CFX_FloatRect(pTextObj->GetBBox()));
      } else {
        layer_rect = CFX_FloatRect(pTextObj->GetBBox());
        bLayerStarted = true;
      }
    } else {
      if (bStarted) {
        rect.Intersect(layer_rect);
      } else {
        rect = layer_rect;
        bStarted = true;
      }
      bLayerStarted = false;
    }
  }
  return rect;
}
コード例 #2
0
std::pair<size_t, size_t>
CRepositoryBrowserSelection::FindURL (const CTSVNPath& url) const
{
    for (size_t i = 0, repoCount = GetRepositoryCount(); i < repoCount; ++i)
        for (size_t k = 0, pathCount = GetPathCount (i); k < pathCount; ++k)
            if (GetURL (i, k).IsEquivalentTo (url))
                return std::make_pair (i, k);

    return std::pair<size_t, size_t>((size_t)-1, (size_t)-1);
}
コード例 #3
0
CString CRemoteFileDialog::GetFirstPath()
{
	if (GetPathCount())
	{
		return m_aFiles[0].sFilePath;
	}

	// else
	return _T("");
}
コード例 #4
0
void DiscoveryDan::Update()
{
	if (!_hasGoal)
	{
		for (int nodeX = 0; nodeX < X_NODES; nodeX += 1)
		{
			if (GetFogState(nodeX, _playerPositionYNode, NODE_COORDS) == 1)
			{
				_targetX = nodeX * PIXELS_IN_NODES;
				_targetY = _playerPositionY;
				_hasGoal = true;
				CalculatePathFromXYtoXY(_playerPositionX, _playerPositionY, _targetX, _targetY, PIXEL_COORDS);
				return;
			}
		}
		for (int nodeX = 0; nodeX < X_NODES; nodeX += 1)
		{
			for (int nodeY = 0; nodeY < Y_NODES; nodeY += 1)
			{
				if (GetNodeState(nodeX, nodeY, NODE_COORDS) == spExit)
				{
					_targetX = nodeX * PIXELS_IN_NODES;
					_targetY = nodeY * PIXELS_IN_NODES;
					_hasGoal = true;
					CalculatePathFromXYtoXY(_playerPositionX, _playerPositionY, _targetX, _targetY, PIXEL_COORDS);
					return;
				}
			}
		}
	}
	else
	{
		if (_pathCount > GetPathCount())
		{
			_pathCount = 0;
			_hasGoal = false;
		}
		_pathCount += 1;

		if (_playerPositionXNode < GetNextPathXPos(_playerPositionXNode, _playerPositionYNode, NODE_COORDS))
		{
			_goRight = true;
		}
		else
		{
			_goLeft = true;
		}

		if ((_playerPositionYNode - 1) > GetNextPathYPos(_playerPositionXNode, _playerPositionYNode, NODE_COORDS))
		{
			_jump = true;
		}
	}
}
コード例 #5
0
PathManager::~PathManager()
{
	size_t count = GetPathCount();
	
	for(size_t i=0; i < count; ++i)
	{
		delete m_paths.at(i);
	}

	m_paths.clear();
	m_pkPathManager = NULL;
}
コード例 #6
0
CFX_FloatRect CPDF_ClipPath::GetClipBox() const {
  CFX_FloatRect rect;
  bool bStarted = false;
  int count = GetPathCount();
  if (count) {
    rect = GetPath(0).GetBoundingBox();
    for (int i = 1; i < count; i++) {
      CFX_FloatRect path_rect = GetPath(i).GetBoundingBox();
      rect.Intersect(path_rect);
    }
    bStarted = true;
  }
  count = GetTextCount();
  if (count) {
    CFX_FloatRect layer_rect;
    bool bLayerStarted = false;
    for (int i = 0; i < count; i++) {
      CPDF_TextObject* pTextObj = GetText(i);
      if (!pTextObj) {
        if (!bStarted) {
          rect = layer_rect;
          bStarted = true;
        } else {
          rect.Intersect(layer_rect);
        }
        bLayerStarted = false;
      } else {
        if (!bLayerStarted) {
          layer_rect = CFX_FloatRect(pTextObj->GetBBox(nullptr));
          bLayerStarted = true;
        } else {
          layer_rect.Union(CFX_FloatRect(pTextObj->GetBBox(nullptr)));
        }
      }
    }
  }
  return rect;
}