Use const for color array arguments

This commit is contained in:
Julian Eisel
2016-11-22 14:51:34 +01:00
parent 60ce602380
commit a796a84a43
5 changed files with 14 additions and 9 deletions

View File

@@ -308,7 +308,7 @@ typedef enum {
* Functions to draw various shapes, taking theme settings into account.
* Used for code that draws its own UI style elements. */
void UI_draw_roundbox(float minx, float miny, float maxx, float maxy, float rad, float color[4]);
void UI_draw_roundbox(float minx, float miny, float maxx, float maxy, float rad, const float color[4]);
void UI_draw_roundbox_corner_set(int type);
int UI_draw_roundbox_corner_get(void);
void UI_draw_roundbox_unfilled(float minx, float miny, float maxx, float maxy, float rad);

View File

@@ -419,7 +419,7 @@ void UI_draw_roundbox_unfilled(float minx, float miny, float maxx, float maxy, f
}
/* (old, used in outliner) plain antialiased filled box */
void UI_draw_roundbox(float minx, float miny, float maxx, float maxy, float rad, float color[4])
void UI_draw_roundbox(float minx, float miny, float maxx, float maxy, float rad, const float color[4])
{
ui_draw_anti_roundbox(GL_POLYGON, minx, miny, maxx, maxy, rad, roundboxtype & UI_RB_ALPHA, color);
}

View File

@@ -682,7 +682,8 @@ struct wmIMEData *ui_but_ime_data_get(uiBut *but);
/* interface_widgets.c */
void ui_draw_anti_tria(float x1, float y1, float x2, float y2, float x3, float y3);
void ui_draw_anti_roundbox(int mode, float minx, float miny, float maxx, float maxy, float rad, bool use_alpha, float color[4]);
void ui_draw_anti_roundbox(int mode, float minx, float miny, float maxx, float maxy,
float rad, bool use_alpha, const float color[4]);
void ui_draw_menu_back(struct uiStyle *style, uiBlock *block, rcti *rect);
void ui_draw_pie_center(uiBlock *block);
uiWidgetColors *ui_tooltip_get_theme(void);

View File

@@ -314,7 +314,7 @@ void UI_fontstyle_draw_simple_backdrop(
(y + decent) - margin,
x + width + margin,
(y + decent) + height + margin,
margin, (float *)col_bg);
margin, col_bg);
glColor4fv(col_fg);
}

View File

@@ -212,19 +212,23 @@ void ui_draw_anti_tria(float x1, float y1, float x2, float y2, float x3, float y
glDisable(GL_BLEND);
}
void ui_draw_anti_roundbox(int mode, float minx, float miny, float maxx, float maxy, float rad, bool use_alpha, float color[4])
void ui_draw_anti_roundbox(int mode, float minx, float miny, float maxx, float maxy,
float rad, bool use_alpha, const float color[4])
{
float draw_color[4];
int j;
copy_v4_v4(draw_color, color);
glEnable(GL_BLEND);
if (use_alpha) {
color[3] = 0.5f;
draw_color[3] = 0.5f;
}
color[3] *= 0.125f;
draw_color[3] *= 0.125f;
for (j = 0; j < WIDGET_AA_JITTER; j++) {
glTranslate2fv(jit[j]);
UI_draw_roundbox_gl_mode(mode, minx, miny, maxx, maxy, rad, color);
UI_draw_roundbox_gl_mode(mode, minx, miny, maxx, maxy, rad, draw_color);
glTranslatef(-jit[j][0], -jit[j][1], 0.0f);
}