Changes the size of a bitmap to a new size
| 1524 | } |
| 1525 | // Changes the size of a bitmap to a new size |
| 1526 | void 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 |
| 1547 | int bm_format(int handle) { |
| 1548 | if (!GameBitmaps[handle].used) { |
no test coverage detected