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

Function rend_DrawScaledBitmap

legacy/renderer/renderer.cpp:947–1007  ·  view source on GitHub ↗

draws a scaled 2d bitmap to our buffer

Source from the content-addressed store, hash-verified

945}
946// draws a scaled 2d bitmap to our buffer
947void rend_DrawScaledBitmap(int x1, int y1, int x2, int y2, int bm, float u0, float v0, float u1, float v1, int color,
948 float *alphas) {
949 switch (Renderer_type) {
950 case RENDERER_SOFTWARE_16BIT:
951 case RENDERER_SOFTWARE_8BIT:
952 case RENDERER_OPENGL:
953 case RENDERER_GLIDE:
954 case RENDERER_DIRECT3D: {
955 g3Point *ptr_pnts[4];
956 g3Point pnts[4];
957 float r, g, b;
958 if (color != -1) {
959 r = GR_COLOR_RED(color) / 255.0;
960 g = GR_COLOR_GREEN(color) / 255.0;
961 b = GR_COLOR_BLUE(color) / 255.0;
962 }
963 for (int i = 0; i < 4; i++) {
964 if (color == -1)
965 pnts[i].p3_l = 1.0;
966 else {
967 pnts[i].p3_r = r;
968 pnts[i].p3_g = g;
969 pnts[i].p3_b = b;
970 }
971 if (alphas) {
972 pnts[i].p3_a = alphas[i];
973 }
974
975 pnts[i].p3_z = 1.0f;
976 pnts[i].p3_flags = PF_PROJECTED;
977 }
978
979 pnts[0].p3_sx = x1;
980 pnts[0].p3_sy = y1;
981 pnts[0].p3_u = u0;
982 pnts[0].p3_v = v0;
983 pnts[1].p3_sx = x2;
984 pnts[1].p3_sy = y1;
985 pnts[1].p3_u = u1;
986 pnts[1].p3_v = v0;
987 pnts[2].p3_sx = x2;
988 pnts[2].p3_sy = y2;
989 pnts[2].p3_u = u1;
990 pnts[2].p3_v = v1;
991 pnts[3].p3_sx = x1;
992 pnts[3].p3_sy = y2;
993 pnts[3].p3_u = u0;
994 pnts[3].p3_v = v1;
995 ptr_pnts[0] = &pnts[0];
996 ptr_pnts[1] = &pnts[1];
997 ptr_pnts[2] = &pnts[2];
998 ptr_pnts[3] = &pnts[3];
999 rend_SetTextureType(TT_LINEAR);
1000 rend_DrawPolygon(bm, ptr_pnts, 4);
1001 break;
1002 }
1003 default:
1004 Int3();

Callers 2

rend_DrawSimpleBitmapFunction · 0.70

Calls 5

GR_COLOR_REDFunction · 0.85
GR_COLOR_GREENFunction · 0.85
GR_COLOR_BLUEFunction · 0.85
rend_DrawPolygonFunction · 0.85
rend_SetTextureTypeFunction · 0.70

Tested by

no test coverage detected