| 876 | void NewUIWindow::OnDestroy() { bm_DestroyChunkedBitmap(&m_Chunk); } |
| 877 | |
| 878 | void NewUIWindow::LoadBackgroundImage(const char *image_name) { |
| 879 | UIBitmapItem back_bm; |
| 880 | |
| 881 | bm_DestroyChunkedBitmap(&m_Chunk); |
| 882 | memset(&m_Chunk, 0, sizeof(m_Chunk)); |
| 883 | |
| 884 | if (image_name) { |
| 885 | int bm_handle = bm_AllocLoadFileBitmap(IGNORE_TABLE(image_name), 0); |
| 886 | |
| 887 | if (bm_handle <= BAD_BITMAP_HANDLE) { |
| 888 | Error("Unable to load image %s for background.", image_name); |
| 889 | } |
| 890 | |
| 891 | // takes a large static bitmap and breaks it into smaller managable bitmaps |
| 892 | if (!bm_CreateChunkedBitmap(bm_handle, &m_Chunk)) { |
| 893 | Error("Failed to chunk background bitmap %s.", image_name); |
| 894 | } |
| 895 | |
| 896 | back_bm.set_chunked_bitmap(&m_Chunk); |
| 897 | UIWindow::SetBackItem(&back_bm); |
| 898 | bm_FreeBitmap(bm_handle); |
| 899 | } |
| 900 | } |
| 901 | |
| 902 | /////////////////////////////////////////////////////////////////////////////// |
| 903 | // NewUIGameWindow implementation. |
no test coverage detected