コード例 #1
0
void CGUILargeTextureManager::ReleaseImage(const std::string &path, bool immediately)
{
  CSingleLock lock(m_listSection);
  for (listIterator it = m_allocated.begin(); it != m_allocated.end(); ++it)
  {
    CLargeTexture *image = *it;
    if (image->GetPath() == path)
    {
      if (image->DecrRef(immediately) && immediately)
        m_allocated.erase(it);
      return;
    }
  }
  for (queueIterator it = m_queued.begin(); it != m_queued.end(); ++it)
  {
    unsigned int id = it->first;
    CLargeTexture *image = it->second;
    if (image->GetPath() == path && image->DecrRef(true))
    {
      // cancel this job
      CJobManager::GetInstance().CancelJob(id);
      m_queued.erase(it);
      return;
    }
  }
}
コード例 #2
0
ファイル: GUILargeTextureManager.cpp プロジェクト: xsedo/xbmc
void CGUILargeTextureManager::ReleaseImage(const CStdString &path, bool immediately)
{
  CSingleLock lock(m_listSection);
  if (path == "image://http%3a%2f%2fcf2.imgobject.com%2ft%2fp%2foriginal%2frXhuBgQyRKB7cW5BRImyVkO89K7.jpg/")
  {
    int a = 0;
  }

  for (listIterator it = m_allocated.begin(); it != m_allocated.end(); ++it)
  {
    CLargeTexture *image = *it;
    if (image->GetPath() == path)
    {
      if (image->DecrRef(immediately) && immediately)
        m_allocated.erase(it);
      return;
    }
  }

  for (queueIterator it = m_queued.begin(); it != m_queued.end(); ++it)
  {
    unsigned int id = it->first;
    CLargeTexture *image = it->second;
    if (image->GetPath() == path && image->DecrRef(true))
    {
      // cancel this job
      CJobManager::GetInstance().CancelJob(id);
      m_queued.erase(it);
      return;
    }
  }

#if defined(__VIDONME_MEDIACENTER__)
  std::deque<std::pair<CImageLoader*, int> >::iterator iter = m_queImageLoaders.begin();
  for (; iter != m_queImageLoaders.end(); ++iter)
  {
    if ((*iter).first->m_path == path)
    {
      (*iter).second--;
      if ((*iter).second == 0)
      {
        delete (*iter).first;
        m_queImageLoaders.erase(iter);
      }

      return;
    }
  }
#endif
}
コード例 #3
0
ファイル: GUILargeTextureManager.cpp プロジェクト: xsedo/xbmc
// if available, increment reference count, and return the image.
// else, add to the queue list if appropriate.
bool CGUILargeTextureManager::GetImage(const CStdString &path, CTextureArray &texture, bool firstRequest)
{
  CSingleLock lock(m_listSection);
  
  if (path == "image://http%3a%2f%2fcf2.imgobject.com%2ft%2fp%2foriginal%2frXhuBgQyRKB7cW5BRImyVkO89K7.jpg/")
  {
    int a = 0;
  }

  for (listIterator it = m_allocated.begin(); it != m_allocated.end(); ++it)
  {
    CLargeTexture *image = *it;
    if (image->GetPath() == path)
    {
      if (firstRequest)
        image->AddRef();
      texture = image->GetTexture();
      return texture.size() > 0;
    }
  }

  if (firstRequest)
    QueueImage(path);

  return true;
}
コード例 #4
0
void CGUILargeTextureManager::ReleaseImage(const CStdString &path, bool immediately)
{
  CSingleLock lock(m_listSection);
  for (listIterator it = m_allocated.begin(); it != m_allocated.end(); ++it)
  {
    CLargeTexture *image = *it;
    if (image->GetPath() == path)
    {
      if (image->DecrRef(immediately) && immediately)
        m_allocated.erase(it);
      return;
    }
  }
  assert(false);
}
コード例 #5
0
// queue the image, and start the background loader if necessary
void CGUILargeTextureManager::QueueImage(const std::string &path, bool useCache)
{
  CSingleLock lock(m_listSection);
  for (queueIterator it = m_queued.begin(); it != m_queued.end(); ++it)
  {
    CLargeTexture *image = it->second;
    if (image->GetPath() == path)
    {
      image->AddRef();
      return; // already queued
    }
  }

  // queue the item
  CLargeTexture *image = new CLargeTexture(path);
  unsigned int jobID = CJobManager::GetInstance().AddJob(new CImageLoader(path, useCache), this, CJob::PRIORITY_NORMAL);
  m_queued.push_back(std::make_pair(jobID, image));
}
コード例 #6
0
ファイル: GUILargeTextureManager.cpp プロジェクト: xsedo/xbmc
// queue the image, and start the background loader if necessary
void CGUILargeTextureManager::QueueImage(const CStdString &path)
{
  CSingleLock lock(m_listSection);
  for (queueIterator it = m_queued.begin(); it != m_queued.end(); ++it)
  {
    CLargeTexture *image = it->second;
    if (image->GetPath() == path)
    {
      image->AddRef();
      return; // already queued
    }
  }

  // queue the item
#if defined(__VIDONME_MEDIACENTER__)
  if (!m_queImageLoaders.empty())
  {
    std::deque<std::pair<CImageLoader*, int> >::iterator iter = m_queImageLoaders.begin();
    for (; iter != m_queImageLoaders.end(); ++iter)
    {
      if ((*iter).first->m_path == path)
      {
        (*iter).second++;
        return;
      }
    }
  }

  if (!m_queued.empty())
  {
    m_queImageLoaders.push_back(std::make_pair(new CImageLoader(path), 1));
  }
  else
  {
    CLargeTexture *image = new CLargeTexture(path);
    unsigned int jobID = CJobManager::GetInstance().AddJob(new CImageLoader(path), this, CJob::PRIORITY_NORMAL);
    m_queued.push_back(make_pair(jobID, image));
  }
#else
  CLargeTexture *image = new CLargeTexture(path);
  unsigned int jobID = CJobManager::GetInstance().AddJob(new CImageLoader(path), this, CJob::PRIORITY_NORMAL);
  m_queued.push_back(make_pair(jobID, image));
#endif
}
コード例 #7
0
// if available, increment reference count, and return the image.
// else, add to the queue list if appropriate.
bool CGUILargeTextureManager::GetImage(const std::string &path, CTextureArray &texture, bool firstRequest, const bool useCache)
{
  CSingleLock lock(m_listSection);
  for (listIterator it = m_allocated.begin(); it != m_allocated.end(); ++it)
  {
    CLargeTexture *image = *it;
    if (image->GetPath() == path)
    {
      if (firstRequest)
        image->AddRef();
      texture = image->GetTexture();
      return texture.size() > 0;
    }
  }

  if (firstRequest)
    QueueImage(path, useCache);

  return true;
}
コード例 #8
0
// if available, increment reference count, and return the image.
// else, add to the queue list if appropriate.
bool CGUILargeTextureManager::GetImage(const CStdString &path, CTextureArray &texture, bool firstRequest)
{
  // note: max size to load images: 2048x1024? (8MB)
  CSingleLock lock(m_listSection);
  for (listIterator it = m_allocated.begin(); it != m_allocated.end(); ++it)
  {
    CLargeTexture *image = *it;
    if (image->GetPath() == path)
    {
      if (firstRequest)
        image->AddRef();
      texture = image->GetTexture();
      return texture.size() > 0;
    }
  }

  if (firstRequest)
    QueueImage(path);

  return true;
}