MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / decompressToGBitmap

Method decompressToGBitmap

Engine/source/gfx/bitmap/ddsFile.cpp:782–803  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

780}
781
782bool DDSFile::decompressToGBitmap(GBitmap *dest)
783{
784 // TBD: do we support other formats?
785 if (mFormat != GFXFormatBC1 && mFormat != GFXFormatBC2 && mFormat != GFXFormatBC3)
786 return false;
787
788 dest->allocateBitmapWithMips(getWidth(), getHeight(), getMipLevels(), GFXFormatR8G8B8A8);
789
790 // Decompress and copy mips...
791
792 U32 numMips = getMipLevels();
793
794 for (U32 i = 0; i < numMips; i++)
795 {
796 U8 *addr = dest->getAddress(0, 0, i);
797 const U8 *mipBuffer = mSurfaces[0]->mMips[i];
798 ImageUtil::decompress(mipBuffer, addr, getWidth(i), getHeight(i), mFormat);
799
800 }
801
802 return true;
803}
804
805DefineEngineFunction( getActiveDDSFiles, S32, (),,
806 "Returns the count of active DDSs files in memory.\n"

Callers 2

gBitmap.cppFile · 0.80

Calls 5

getWidthFunction · 0.85
decompressFunction · 0.85
getAddressMethod · 0.80
getHeightFunction · 0.50

Tested by

no test coverage detected