| 822 | } |
| 823 | |
| 824 | void 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 | |
| 852 | long TriTextureRes::UpdateSubresource( unsigned left, unsigned top, unsigned right, unsigned bottom, const void* source, unsigned sourcePitch ) |
nothing calls this directly
no test coverage detected