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

Function rend_DrawScaledBitmap

renderer/HardwareBaseGPU.cpp:242–290  ·  view source on GitHub ↗

draws a scaled 2d bitmap to our buffer

Source from the content-addressed store, hash-verified

240
241// draws a scaled 2d bitmap to our buffer
242void rend_DrawScaledBitmap(int x1, int y1, int x2, int y2, int bm, float u0, float v0, float u1, float v1, int color,
243 float *alphas) {
244 g3Point *ptr_pnts[4];
245 g3Point pnts[4];
246 float r, g, b;
247 if (color != -1) {
248 r = GR_COLOR_RED(color) / 255.0;
249 g = GR_COLOR_GREEN(color) / 255.0;
250 b = GR_COLOR_BLUE(color) / 255.0;
251 }
252 for (int i = 0; i < 4; i++) {
253 if (color == -1)
254 pnts[i].p3_l = 1.0;
255 else {
256 pnts[i].p3_r = r;
257 pnts[i].p3_g = g;
258 pnts[i].p3_b = b;
259 }
260 if (alphas) {
261 pnts[i].p3_a = alphas[i];
262 }
263
264 pnts[i].p3_z = 1.0f;
265 pnts[i].p3_flags = PF_PROJECTED;
266 }
267
268 pnts[0].p3_sx = x1;
269 pnts[0].p3_sy = y1;
270 pnts[0].p3_u = u0;
271 pnts[0].p3_v = v0;
272 pnts[1].p3_sx = x2;
273 pnts[1].p3_sy = y1;
274 pnts[1].p3_u = u1;
275 pnts[1].p3_v = v0;
276 pnts[2].p3_sx = x2;
277 pnts[2].p3_sy = y2;
278 pnts[2].p3_u = u1;
279 pnts[2].p3_v = v1;
280 pnts[3].p3_sx = x1;
281 pnts[3].p3_sy = y2;
282 pnts[3].p3_u = u0;
283 pnts[3].p3_v = v1;
284 ptr_pnts[0] = &pnts[0];
285 ptr_pnts[1] = &pnts[1];
286 ptr_pnts[2] = &pnts[2];
287 ptr_pnts[3] = &pnts[3];
288 rend_SetTextureType(TT_LINEAR);
289 rend_DrawPolygon2D(bm, ptr_pnts, 4);
290}
291
292// given a chunked bitmap, renders it.
293void rend_DrawChunkedBitmap(chunked_bitmap *chunk, int x, int y, uint8_t alpha) {

Callers 15

rend_DrawSimpleBitmapFunction · 0.70
ui_DoCursorFunction · 0.50
ui_DrawBitmapFunction · 0.50
OnDrawMethod · 0.50
DebugGraph_RenderFunction · 0.50
RenderHUDQuadFunction · 0.50
TelcomRenderDrawHiLitesFunction · 0.50
TelcomRenderScanlineFunction · 0.50
TelcomRenderMouseFunction · 0.50
TelcomDisplayStaticFunction · 0.50
TelcomDoPowerEffectFunction · 0.50

Calls 5

GR_COLOR_REDFunction · 0.85
GR_COLOR_GREENFunction · 0.85
GR_COLOR_BLUEFunction · 0.85
rend_DrawPolygon2DFunction · 0.85
rend_SetTextureTypeFunction · 0.70

Tested by

no test coverage detected