Clean up a few remaining functions

This commit is contained in:
asarium committed 2017-08-23 14:42:54 +02:00
1 parent 7a3029d1e3
commit 6dbd7c34e6
8 files changed
+40 -70

No files matched your search

-28
View File
@@ -2075,34 +2075,6 @@ void gr_shield_icon(coord2d coords[6], int resize_mode)
g3_render_shield_icon(&gr_screen.current_color, coords, resize_mode);
}
void gr_rect(int x, int y, int w, int h, int resize_mode)
{
if (gr_screen.mode == GR_STUB) {
return;
}
g3_render_colored_rect(&gr_screen.current_color, x, y, w, h, resize_mode);
}
void gr_shade(int x, int y, int w, int h, int resize_mode)
{
int r, g, b, a;
if (gr_screen.mode == GR_STUB) {
return;
}
r = (int)gr_screen.current_shader.r;
g = (int)gr_screen.current_shader.g;
b = (int)gr_screen.current_shader.b;
a = (int)gr_screen.current_shader.c;
color clr;
gr_init_alphacolor(&clr, r, g, b, a);
g3_render_colored_rect(&clr, x, y, w, h, resize_mode);
}
void gr_set_bitmap(int bitmap_num, int alphablend_mode, int bitblt_mode, float alpha)
{
gr_screen.current_alpha = alpha;
-2
View File
@@ -883,8 +883,6 @@ void gr_set_bitmap(int bitmap_num, int alphablend = GR_ALPHABLEND_NONE, int bitb
#define gr_clear GR_CALL(gr_screen.gf_clear)
void gr_shield_icon(coord2d coords[6], const int resize_mode = GR_RESIZE_FULL);
void gr_rect(int x, int y, int w, int h, int resize_mode = GR_RESIZE_FULL);
void gr_shade(int x, int y, int w, int h, int resize_mode = GR_RESIZE_FULL);
#define gr_zbuffer_get GR_CALL(gr_screen.gf_zbuffer_get)
#define gr_zbuffer_set GR_CALL(gr_screen.gf_zbuffer_set)
-1
View File
@@ -1133,7 +1133,6 @@ void opengl_setup_function_pointers()
// gr_screen.gf_bitmap = gr_opengl_bitmap;
// gr_screen.gf_rect = gr_opengl_rect;
// gr_screen.gf_shade = gr_opengl_shade;
gr_screen.gf_print_screen = gr_opengl_print_screen;
-32
View File
@@ -146,38 +146,6 @@ void opengl_bind_vertex_layout(vertex_layout &layout, uint base_vertex, ubyte* b
GL_state.Array.BindPointersEnd();
}
void gr_opengl_shade(int x, int y, int w, int h, int resize_mode)
{
if (resize_mode != GR_RESIZE_NONE) {
gr_resize_screen_pos(&x, &y, &w, &h, resize_mode);
}
int x1 = (gr_screen.offset_x + x);
int y1 = (gr_screen.offset_y + y);
int x2 = (gr_screen.offset_x + w);
int y2 = (gr_screen.offset_y + h);
if ( (x1 >= gr_screen.max_w) || (y1 >= gr_screen.max_h) ) {
return;
}
CLAMP(x2, x1+1, gr_screen.max_w);
CLAMP(y2, y1+1, gr_screen.max_h);
GL_state.SetAlphaBlendMode(ALPHA_BLEND_ALPHA_BLEND_ALPHA);
GL_state.SetZbufferType(ZBUFFER_TYPE_NONE);
gr_opengl_set_2d_matrix();
color clr;
gr_init_alphacolor(&clr, gr_screen.current_shader.r, gr_screen.current_shader.g, gr_screen.current_shader.b, gr_screen.current_shader.c);
opengl_shader_set_passthrough(false, false, &clr);
opengl_draw_coloured_quad((GLint)x1, (GLint)y1, (GLint)x2, (GLint)y2);
gr_opengl_end_2d_matrix();
}
void gr_opengl_sphere(material* material_def, float rad)
{
opengl_tnl_set_material(material_def, true);
-1
View File
@@ -25,7 +25,6 @@ struct opengl_vertex_bind {
opengl_vert_attrib::attrib_id attribute_id;
};
void gr_opengl_shade(int x, int y, int w, int h, int resize_mode);
void gr_opengl_update_distortion();
void opengl_set_spec_mapping(int tmap_type, float *u_scale, float *v_scale, int stage = 0);
+26
View File
@@ -1054,6 +1054,32 @@ void gr_curve(int xc, int yc, int r, int direction, int resize_mode) {
endDrawing(path);
}
void gr_rect(int x, int y, int w, int h, int resize_mode)
{
auto path = beginDrawing(resize_mode);
path->rectangle(i2fl(x), i2fl(y), i2fl(w), i2fl(h));
path->setFillColor(&gr_screen.current_color);
path->fill();
endDrawing(path);
}
void gr_shade(int x, int y, int w, int h, int resize_mode)
{
auto r = (int)gr_screen.current_shader.r;
auto g = (int)gr_screen.current_shader.g;
auto b = (int)gr_screen.current_shader.b;
auto a = (int)gr_screen.current_shader.c;
color clr;
gr_init_alphacolor(&clr, r, g, b, a);
auto path = beginDrawing(resize_mode);
path->rectangle(i2fl(x), i2fl(y), i2fl(w), i2fl(h));
path->setFillColor(&clr);
path->fill();
endDrawing(path);
}
+3
View File
@@ -46,3 +46,6 @@ void gr_arc(int xc, int yc, float r, float angle_start, float angle_end, bool fi
void gr_curve(int x, int y, int r, int direction, int resize_mode);
void gr_rect(int x, int y, int w, int h, int resize_mode = GR_RESIZE_FULL);
void gr_shade(int x, int y, int w, int h, int resize_mode = GR_RESIZE_FULL);
+11 -6
View File
@@ -1436,8 +1436,6 @@ void draw_open_rect(int x1, int y1, int x2, int y2, int resize_mode = GR_RESIZE_
gr_line(x1, y2, x1, y1, resize_mode);
}
extern void gr_opengl_shade(int x, int y, int w, int h, int resize_mode);
void Window::DoDraw(float frametime)
{
int w, h;
@@ -1448,8 +1446,13 @@ void Window::DoDraw(float frametime)
}
// shade the background of the window so that it's just slightly transparent
gr_set_shader(&WindowShade);
gr_opengl_shade(Coords[0], Coords[1], Coords[2], Coords[3], GR_RESIZE_NONE);
color clr;
gr_init_alphacolor(&clr, WindowShade.r, WindowShade.g, WindowShade.b, WindowShade.c);
gr_set_color_fast(&clr);
w = Coords[3] - Coords[1];
h = Coords[2] - Coords[0];
gr_rect(Coords[0], Coords[1], w, h, GR_RESIZE_NONE);
gr_set_color_fast(&Color_text_normal);
@@ -2732,8 +2735,10 @@ void Slider::DoDraw(float frametime)
auto sliderX = GetSliderOffset();
gr_set_shader(&SliderShade);
gr_opengl_shade(sliderX, BarCoords[1], sliderX + SliderWidth, BarCoords[3], false);
color clr;
gr_init_alphacolor(&clr, SliderShade.r, SliderShade.g, SliderShade.b, SliderShade.c);
gr_set_color_fast(&clr);
gr_rect(sliderX, BarCoords[1], SliderWidth, BarCoords[3] - BarCoords[1], false);
}
int Slider::DoMouseDown(float frametime)