MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / bm_ChangeSize

Function bm_ChangeSize

bitmap/bitmain.cpp:1526–1545  ·  view source on GitHub ↗

Changes the size of a bitmap to a new size

Source from the content-addressed store, hash-verified

1524}
1525// Changes the size of a bitmap to a new size
1526void bm_ChangeSize(int handle, int new_w, int new_h) {
1527 int mipped = bm_mipped(handle);
1528 int n;
1529 int mem_used = (GameBitmaps[handle].width * GameBitmaps[handle].height * 2);
1530 n = bm_AllocBitmap(new_w, new_h, mipped * ((new_w * new_h * 2) / 3));
1531 ASSERT(n >= 0);
1532 if (mipped)
1533 GameBitmaps[n].flags |= BF_MIPMAPPED;
1534 if (GameBitmaps[handle].format == BITMAP_FORMAT_4444)
1535 GameBitmaps[n].format = BITMAP_FORMAT_4444;
1536
1537 bm_ScaleBitmapToBitmap(n, handle);
1538 Bitmap_memory_used -= mem_used + (mipped * (mem_used / 3));
1539 mem_free(GameBitmaps[handle].data16);
1540 GameBitmaps[handle].data16 = GameBitmaps[n].data16;
1541 GameBitmaps[handle].width = new_w;
1542 GameBitmaps[handle].height = new_h;
1543 GameBitmaps[n].used = 0;
1544 Num_of_bitmaps--;
1545}
1546// Returns the format of this bitmap
1547int bm_format(int handle) {
1548 if (!GameBitmaps[handle].used) {

Callers 4

ChangeSizeMethod · 0.85
GameToEditorFunction · 0.85
ImportGraphicFunction · 0.85
SGSSnapshotFunction · 0.85

Calls 3

bm_mippedFunction · 0.85
bm_AllocBitmapFunction · 0.85
bm_ScaleBitmapToBitmapFunction · 0.85

Tested by

no test coverage detected