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

Method chopTopMips

Engine/source/gfx/bitmap/gBitmap.cpp:500–529  ·  view source on GitHub ↗

--------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

498
499//--------------------------------------------------------------------------
500void GBitmap::chopTopMips(U32 mipsToChop)
501{
502 U32 scalePower = getMin(mipsToChop, getNumMipLevels() - 1);
503 U32 newMipCount = getNumMipLevels() - scalePower;
504
505 U32 realWidth = getMax((U32)1, getWidth() >> scalePower);
506 U32 realHeight = getMax((U32)1, getHeight() >> scalePower);
507
508 U8 *destBits = mBits;
509
510 U32 destOffsets[c_maxMipLevels];
511
512 for (U32 i = scalePower; i<mNumMipLevels; i++)
513 {
514 // Copy to the new bitmap...
515 dMemcpy(destBits,
516 getWritableBits(i),
517 getSurfaceSize(i));
518
519 destOffsets[i - scalePower] = destBits - mBits;
520 destBits += getSurfaceSize(i);
521 }
522
523 dMemcpy(mMipLevelOffsets, destOffsets, sizeof(destOffsets));
524
525 mWidth = realWidth;
526 mHeight = realHeight;
527 mByteSize = destBits - mBits;
528 mNumMipLevels = newMipCount;
529}
530
531//--------------------------------------------------------------------------
532void GBitmap::extrudeMipLevelsDetail()

Callers 2

gBitmap.cppFile · 0.80

Calls 4

getMaxFunction · 0.85
getWidthFunction · 0.85
getHeightFunction · 0.50
dMemcpyFunction · 0.50

Tested by

no test coverage detected