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

Function ui_DrawBitmap

ui/UIDraw.cpp:190–221  ·  view source on GitHub ↗

draws all textures derived from ui_bm_handle.

Source from the content-addressed store, hash-verified

188
189// draws all textures derived from ui_bm_handle.
190void 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
223int ui_GetBitmapWidth(UIBitmapItem *bi) {
224 if (bi->is_chunked()) {

Callers 1

drawMethod · 0.85

Calls 14

bm_wFunction · 0.85
bm_hFunction · 0.85
is_chunkedMethod · 0.80
get_chunked_bitmapMethod · 0.80
get_bitmapMethod · 0.80
rend_DrawChunkedBitmapFunction · 0.50
rend_SetOverlayTypeFunction · 0.50
rend_SetLightingFunction · 0.50
rend_SetColorModelFunction · 0.50
rend_SetZBufferStateFunction · 0.50
rend_SetAlphaTypeFunction · 0.50
rend_SetAlphaValueFunction · 0.50

Tested by

no test coverage detected