本文整理汇总了C++中ImageLoader::LoadFromBuffer方法的典型用法代码示例。如果您正苦于以下问题:C++ ImageLoader::LoadFromBuffer方法的具体用法?C++ ImageLoader::LoadFromBuffer怎么用?C++ ImageLoader::LoadFromBuffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageLoader
的用法示例。
在下文中一共展示了ImageLoader::LoadFromBuffer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: memcpy
unsigned int __stdcall Texture::Atlas::ThreadLoadTexture( void* data ) {
Thread::Work *work = ( Thread::Work* ) data;
ThreadDataLoadTexture *loader = ( ThreadDataLoadTexture* ) work->data;
//__log.PrintInfo( Filelevel_DEBUG, "Texture::Atlas::ThreadLoadTexture => begin: data[%d] size[%d; %d]", loader->data->getLength(), loader->size.width, loader->size.height );
//
ImageLoader image;
if( !image.LoadFromBuffer( ( Byte* ) loader->data->getData(), loader->data->getLength() ) ) {
__log.PrintInfo( Filelevel_ERROR, "Texture::Atlas::ThreadLoadTexture => image.LoadFromBuffer failed" );
work->status = Thread::THREAD_WORK_STATUS_ERROR;
return 1;
}
Dword
*dst = ( Dword* ) loader->atlas->textureData.getData(),
*src = ( Dword* ) image.GetImageData();
for( Dword y = 0; y < image.GetImageSize().height; ++y ) {
memcpy( dst + ( loader->item->rect.top + y ) * loader->atlas->size.width + loader->item->rect.left, src + y * image.GetImageSize().width, image.GetImageSize().width * 4 );
}
loader->atlas->FlushToGPU();
//done
delete loader->data;
delete loader;
work->status = Thread::THREAD_WORK_STATUS_DONE;
//__log.PrintInfo( Filelevel_DEBUG, "Texture::Atlas::ThreadLoadTexture => done" );
return 0;
}//ThreadLoadTexture