draws all textures derived from ui_bm_handle.
| 188 | |
| 189 | // draws all textures derived from ui_bm_handle. |
| 190 | void ui_DrawBitmap(UIBitmapItem *bi, int x, int y, uint8_t alpha) { |
| 191 | if (bi->is_chunked()) { |
| 192 | chunked_bitmap *chunk = bi->get_chunked_bitmap(); |
| 193 | rend_DrawChunkedBitmap(chunk, x, y, alpha); |
| 194 | } else { |
| 195 | int bmp_w = bm_w(bi->get_bitmap(), 0); |
| 196 | int bmp_h = bm_h(bi->get_bitmap(), 0); |
| 197 | float u1, v1; |
| 198 | |
| 199 | if ((x + bmp_w) > m_UIDrawRight) { |
| 200 | u1 = ((float)(m_UIDrawRight - x)) / ((float)bmp_w); |
| 201 | bmp_w = m_UIDrawRight - x; |
| 202 | } else |
| 203 | u1 = 1.0f; |
| 204 | |
| 205 | if ((y + bmp_h) > m_UIDrawBottom) { |
| 206 | v1 = ((float)(m_UIDrawBottom - y)) / ((float)bmp_h); |
| 207 | bmp_h = m_UIDrawBottom - y; |
| 208 | } else |
| 209 | v1 = 1.0f; |
| 210 | |
| 211 | rend_SetOverlayType(OT_NONE); |
| 212 | rend_SetLighting(LS_NONE); |
| 213 | rend_SetColorModel(CM_MONO); |
| 214 | rend_SetZBufferState(0); |
| 215 | rend_SetAlphaType(ATF_CONSTANT + ATF_TEXTURE); |
| 216 | rend_SetAlphaValue(alpha); |
| 217 | rend_SetWrapType(WT_CLAMP); |
| 218 | |
| 219 | rend_DrawScaledBitmap(x, y, x + bmp_w, y + bmp_h, bi->get_bitmap(), 0, 0, u1, v1); |
| 220 | } |
| 221 | } |
| 222 | |
| 223 | int ui_GetBitmapWidth(UIBitmapItem *bi) { |
| 224 | if (bi->is_chunked()) { |
no test coverage detected