本文整理汇总了C++中CArray::SetItemCount方法的典型用法代码示例。如果您正苦于以下问题:C++ CArray::SetItemCount方法的具体用法?C++ CArray::SetItemCount怎么用?C++ CArray::SetItemCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CArray
的用法示例。
在下文中一共展示了CArray::SetItemCount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadInternal
Bool CDDSFile::LoadInternal( CIODevice& ioDevice, Bool decompress )
{
ioDevice.Read( &m_Header, sizeof( EDDSFileHeader ) );
Char* fourCC = (Char*)&m_Header.PixelFormat.FourCC;
fourCC[5] = 0;
m_TextureInfo.MipMapCount = GetMipMapCount( );
m_TextureInfo.Format = GetPixelFormat( );
m_TextureInfo.Width = m_Header.Width;
m_TextureInfo.Height = m_Header.Height;
m_TextureInfo.SliceCount = m_Header.Depth;
m_TextureInfo.Type = GetTextureType( );
// Setup data buffer
m_Data.SetItemCount( GetTextureSize() );
UInt32 r = ioDevice.Read( m_Data.GetBuffer(), m_Data.GetByteCount() );
if( decompress )
{
UInt32 byteCount = 0;
CArray<Byte> byteArray;
byteArray.SetItemCount( m_TextureInfo.Width*m_TextureInfo.Height*4 );
const Byte* blocks = GetSurfaceData( 0,0, byteCount );
int format = 0;
if( m_TextureInfo.Format == nTextureFormat_DXT5 )
format = squish::kDxt5;
else if( m_TextureInfo.Format == nTextureFormat_DXT3 )
format = squish::kDxt3;
else if( m_TextureInfo.Format == nTextureFormat_DXT1 )
format = squish::kDxt1;
if( format )
{
squish::DecompressImage( byteArray.GetBuffer(), m_TextureInfo.Width, m_TextureInfo.Height, blocks, format );
m_TextureInfo.MipMapCount = 1;
m_TextureInfo.Format = nTextureFormat_R8G8B8A8;
m_Data = byteArray;
}
}
return TRUE;
}