#include <stdio.h>
#include <stdint.h>
#include <dali/integration-api/debug.h>
-#include <dali/devel-api/adaptor-framework/file-loader.h>
+#include <dali/devel-api/adaptor-framework/file-stream.h>
namespace PbrDemo
{
bool LoadCubeMapFromKtxFile( const std::string& path, CubeData& cubedata )
{
- std::streampos bufferSize = 0;
- Dali::Vector<char> fileBuffer;
- if( !Dali::FileLoader::ReadFile( path, bufferSize, fileBuffer, FileLoader::FileType::BINARY ) )
- {
- return false;
- }
-
- FILE* fp = fmemopen( &fileBuffer[0], bufferSize, "rb" );
+ Dali::FileStream fileStream( path, Dali::FileStream::READ | Dali::FileStream::BINARY );
+ FILE* fp = fileStream.GetFile();
if( NULL == fp )
{
return false;
int result = fread(&header,1,sizeof(KtxFileHeader),fp);
if( 0 == result )
{
- fclose( fp );
return false;
}
if( fseek(fp, imageSizeOffset, SEEK_END) )
{
- fclose( fp );
return false;
}
lSize = ftell(fp);
if( lSize == -1L )
{
- fclose( fp );
return false;
}
if( fseek(fp, imageSizeOffset, SEEK_SET) )
{
- fclose( fp );
return false;
}
unsigned char* imgPointer = buffer;
result = fread(buffer,1,lSize,fp);
- fclose(fp);
-
if( 0 == result )
{
free( buffer );