本文整理汇总了C++中CTextureMap::SetHeight方法的典型用法代码示例。如果您正苦于以下问题:C++ CTextureMap::SetHeight方法的具体用法?C++ CTextureMap::SetHeight怎么用?C++ CTextureMap::SetHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTextureMap
的用法示例。
在下文中一共展示了CTextureMap::SetHeight方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: lock
const CTextureArray& CGUITextureManager::Load(const std::string& strTextureName, bool checkBundleOnly /*= false */)
{
std::string strPath;
static CTextureArray emptyTexture;
int bundle = -1;
int size = 0;
if (!HasTexture(strTextureName, &strPath, &bundle, &size))
return emptyTexture;
if (size) // we found the texture
{
for (int i = 0; i < (int)m_vecTextures.size(); ++i)
{
CTextureMap *pMap = m_vecTextures[i];
if (pMap->GetName() == strTextureName)
{
//CLog::Log(LOGDEBUG, "Total memusage %u", GetMemoryUsage());
return pMap->GetTexture();
}
}
// Whoops, not there.
return emptyTexture;
}
for (ilistUnused i = m_unusedTextures.begin(); i != m_unusedTextures.end(); ++i)
{
CTextureMap* pMap = i->first;
if (pMap->GetName() == strTextureName && i->second > 0)
{
m_vecTextures.push_back(pMap);
m_unusedTextures.erase(i);
return pMap->GetTexture();
}
}
if (checkBundleOnly && bundle == -1)
return emptyTexture;
//Lock here, we will do stuff that could break rendering
CSingleLock lock(g_graphicsContext);
#ifdef _DEBUG_TEXTURES
int64_t start;
start = CurrentHostCounter();
#endif
if (bundle >= 0 && StringUtils::EndsWithNoCase(strPath, ".gif"))
{
CTextureMap* pMap = nullptr;
CBaseTexture **pTextures = nullptr;
int nLoops = 0, width = 0, height = 0;
int* Delay = nullptr;
int nImages = m_TexBundle[bundle].LoadAnim(strTextureName, &pTextures, width, height, nLoops, &Delay);
if (!nImages)
{
CLog::Log(LOGERROR, "Texture manager unable to load bundled file: %s", strTextureName.c_str());
delete[] pTextures;
delete[] Delay;
return emptyTexture;
}
unsigned int maxWidth = 0;
unsigned int maxHeight = 0;
pMap = new CTextureMap(strTextureName, width, height, nLoops);
for (int iImage = 0; iImage < nImages; ++iImage)
{
pMap->Add(pTextures[iImage], Delay[iImage]);
maxWidth = std::max(maxWidth, pTextures[iImage]->GetWidth());
maxHeight = std::max(maxHeight, pTextures[iImage]->GetHeight());
}
pMap->SetWidth((int)maxWidth);
pMap->SetHeight((int)maxHeight);
delete[] pTextures;
delete[] Delay;
if (pMap)
{
m_vecTextures.push_back(pMap);
return pMap->GetTexture();
}
}
else if (StringUtils::EndsWithNoCase(strPath, ".gif") ||
StringUtils::EndsWithNoCase(strPath, ".apng"))
{
CTextureMap* pMap = nullptr;
std::string mimeType;
if (StringUtils::EndsWithNoCase(strPath, ".gif"))
mimeType = "image/gif";
else if (StringUtils::EndsWithNoCase(strPath, ".apng"))
mimeType = "image/apng";
XFILE::CFile file;
XFILE::auto_buffer buf;
CFFmpegImage anim(mimeType);
pMap = new CTextureMap(strTextureName, 0, 0, 0);
if (file.LoadFile(strPath, buf) <= 0 ||
//.........这里部分代码省略.........