MCPcopy Create free account
hub / github.com/carbonengine/trinity / TrimLods

Method TrimLods

trinity/Resources/TriTextureRes.cpp:824–849  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

822}
823
824void TriTextureRes::TrimLods( uint32_t startLod, Tr2TextureLodManager& manager )
825{
826 if( !m_loadedBitmap )
827 {
828 return;
829 }
830 startLod = std::min( startLod, m_maxMip );
831 if( startLod <= m_cpuMip )
832 {
833 return;
834 }
835
836 Tr2BitmapDimensions desc;
837 CreateDescription( *m_loadedBitmap, startLod - m_cpuMip, desc );
838 std::unique_ptr<ImageIO::HostBitmap> bitmap( new ImageIO::HostBitmap() );
839 if( bitmap->CreateFromBitmapDimensions( desc ) )
840 {
841 memcpy( bitmap->GetRawData(), m_loadedBitmap->GetMipRawData( startLod - m_cpuMip ), bitmap->GetRawDataSize() );
842
843 manager.CpuTextureDestroyed( *m_loadedBitmap );
844 manager.CpuTextureCreated( *bitmap );
845
846 std::swap( bitmap, m_loadedBitmap );
847 m_cpuMip = startLod;
848 }
849}
850
851
852long TriTextureRes::UpdateSubresource( unsigned left, unsigned top, unsigned right, unsigned bottom, const void* source, unsigned sourcePitch )

Callers

nothing calls this directly

Calls 4

CreateDescriptionFunction · 0.85
swapFunction · 0.85
CpuTextureDestroyedMethod · 0.80
CpuTextureCreatedMethod · 0.80

Tested by

no test coverage detected