Changeset 505 for trunk/src/engine/image_manager.cc
- Timestamp:
- 07/12/16 20:22:23 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/engine/image_manager.cc
r504 r505 12 12 using namespace nv; 13 13 14 void nv::image_manager::add_base_path( const string_view& path)14 bool image_manager::load_resource( const string_view& filename ) 15 15 { 16 m_paths.emplace_back( path ); 16 c_file_system fs; 17 if ( stream* file = open_stream( fs, filename ) ) 18 { 19 png_loader loader; 20 image_data* result = loader.load( *file ); 21 delete file; 22 if ( result ) 23 { 24 add( filename, result ); 25 return true; 26 } 27 } 28 return false; 17 29 } 18 30 19 bool image_manager::load_resource( const string_view& filename )20 {21 png_loader loader;22 c_file_system fs;23 image_data* result = nullptr;24 if ( fs.exists( filename ) )25 {26 stream* file = fs.open( filename );27 result = loader.load( *file );28 delete file;29 }30 else if ( m_paths.size() > 0 )31 {32 for ( const auto& path : m_paths )33 {34 string128 fpath = path;35 fpath.append( filename );36 if ( fs.exists( fpath ) )37 {38 stream* file = fs.open( fpath );39 result = loader.load( *file );40 delete file;41 break;42 }43 }44 }45 if ( result )46 add( filename, result );47 return result != nullptr;48 }49
Note: See TracChangeset
for help on using the changeset viewer.