Code Cleanup: pass rectangles as const in insterface files
This commit is contained in:
parent
f64b3732be
commit
1ed822202f
Notes:
blender-bot
2023-02-14 11:35:51 +01:00
Referenced by issue #37461, Blender crashes when I set a frame to 0 in Timeline.
|
@ -904,8 +904,8 @@ void uiIDContextProperty(struct bContext *C, struct PointerRNA *ptr, struct Prop
|
|||
void uiStyleFontSet(struct uiFontStyle *fs);
|
||||
void uiStyleFontDrawExt(struct uiFontStyle *fs, const struct rcti *rect, const char *str,
|
||||
size_t len, float *r_xofs, float *r_yofs);
|
||||
void uiStyleFontDraw(struct uiFontStyle *fs, struct rcti *rect, const char *str);
|
||||
void uiStyleFontDrawRotated(struct uiFontStyle *fs, struct rcti *rect, const char *str);
|
||||
void uiStyleFontDraw(struct uiFontStyle *fs, const struct rcti *rect, const char *str);
|
||||
void uiStyleFontDrawRotated(struct uiFontStyle *fs, const struct rcti *rect, const char *str);
|
||||
|
||||
int UI_GetStringWidth(const char *str); // XXX temp
|
||||
void UI_DrawString(float x, float y, const char *str); // XXX temp
|
||||
|
|
|
@ -208,7 +208,7 @@ short UI_view2d_mouse_in_scrollers(const struct bContext *C, struct View2D *v2d,
|
|||
|
||||
/* cached text drawing in v2d, to allow pixel-aligned draw as post process */
|
||||
void UI_view2d_text_cache_add(struct View2D *v2d, float x, float y, const char *str, const char col[4]);
|
||||
void UI_view2d_text_cache_rectf(struct View2D *v2d, struct rctf *rect, const char *str, const char col[4]);
|
||||
void UI_view2d_text_cache_rectf(struct View2D *v2d, const struct rctf *rect, const char *str, const char col[4]);
|
||||
void UI_view2d_text_cache_draw(struct ARegion *ar);
|
||||
|
||||
/* operators */
|
||||
|
|
|
@ -395,7 +395,7 @@ void uiRoundBox(float minx, float miny, float maxx, float maxy, float rad)
|
|||
|
||||
/* ************** SPECIAL BUTTON DRAWING FUNCTIONS ************* */
|
||||
|
||||
void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *rect)
|
||||
void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti *rect)
|
||||
{
|
||||
#ifdef WITH_HEADLESS
|
||||
(void)rect;
|
||||
|
@ -526,7 +526,7 @@ static void histogram_draw_one(float r, float g, float b, float alpha,
|
|||
|
||||
#define HISTOGRAM_TOT_GRID_LINES 4
|
||||
|
||||
void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *recti)
|
||||
void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti *recti)
|
||||
{
|
||||
Histogram *hist = (Histogram *)but->poin;
|
||||
int res = hist->x_resolution;
|
||||
|
@ -594,7 +594,7 @@ void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol)
|
|||
|
||||
#undef HISTOGRAM_TOT_GRID_LINES
|
||||
|
||||
void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *recti)
|
||||
void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti *recti)
|
||||
{
|
||||
Scopes *scopes = (Scopes *)but->poin;
|
||||
rctf rect;
|
||||
|
@ -825,7 +825,7 @@ static void vectorscope_draw_target(float centerx, float centery, float diam, co
|
|||
glEnd();
|
||||
}
|
||||
|
||||
void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *recti)
|
||||
void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti *recti)
|
||||
{
|
||||
const float skin_rad = DEG2RADF(123.0f); /* angle in radians of the skin tone line */
|
||||
Scopes *scopes = (Scopes *)but->poin;
|
||||
|
@ -912,7 +912,7 @@ void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wco
|
|||
glDisable(GL_BLEND);
|
||||
}
|
||||
|
||||
void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *rect)
|
||||
void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti *rect)
|
||||
{
|
||||
ColorBand *coba;
|
||||
CBData *cbd;
|
||||
|
@ -1037,7 +1037,7 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *rect)
|
|||
|
||||
}
|
||||
|
||||
void ui_draw_but_NORMAL(uiBut *but, uiWidgetColors *wcol, rcti *rect)
|
||||
void ui_draw_but_NORMAL(uiBut *but, uiWidgetColors *wcol, const rcti *rect)
|
||||
{
|
||||
static GLuint displist = 0;
|
||||
int a, old[8];
|
||||
|
@ -1130,7 +1130,7 @@ void ui_draw_but_NORMAL(uiBut *but, uiWidgetColors *wcol, rcti *rect)
|
|||
}
|
||||
}
|
||||
|
||||
static void ui_draw_but_curve_grid(rcti *rect, float zoomx, float zoomy, float offsx, float offsy, float step)
|
||||
static void ui_draw_but_curve_grid(const rcti *rect, float zoomx, float zoomy, float offsx, float offsy, float step)
|
||||
{
|
||||
float dx, dy, fx, fy;
|
||||
|
||||
|
@ -1163,7 +1163,7 @@ static void gl_shaded_color(unsigned char *col, int shade)
|
|||
col[2] - shade > 0 ? col[2] - shade : 0);
|
||||
}
|
||||
|
||||
void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect)
|
||||
void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, const rcti *rect)
|
||||
{
|
||||
CurveMapping *cumap;
|
||||
CurveMap *cuma;
|
||||
|
@ -1362,7 +1362,7 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect
|
|||
fdrawbox(rect->xmin, rect->ymin, rect->xmax, rect->ymax);
|
||||
}
|
||||
|
||||
void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *recti)
|
||||
void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti *recti)
|
||||
{
|
||||
rctf rect;
|
||||
int ok = 0, width, height;
|
||||
|
@ -1488,7 +1488,7 @@ void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wc
|
|||
glDisable(GL_BLEND);
|
||||
}
|
||||
|
||||
void ui_draw_but_NODESOCKET(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *recti)
|
||||
void ui_draw_but_NODESOCKET(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti *recti)
|
||||
{
|
||||
static const float size = 5.0f;
|
||||
|
||||
|
|
|
@ -502,22 +502,22 @@ struct AutoComplete;
|
|||
|
||||
/* interface_panel.c */
|
||||
extern int ui_handler_panel_region(struct bContext *C, const struct wmEvent *event, struct ARegion *ar);
|
||||
extern void ui_draw_aligned_panel(struct uiStyle *style, uiBlock *block, rcti *rect);
|
||||
extern void ui_draw_aligned_panel(struct uiStyle *style, uiBlock *block, const rcti *rect);
|
||||
|
||||
/* interface_draw.c */
|
||||
extern void ui_dropshadow(const rctf *rct, float radius, float aspect, float alpha, int select);
|
||||
|
||||
void ui_draw_gradient(const rcti *rect, const float hsv[3], const int type, const float alpha);
|
||||
|
||||
void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, rcti *rect);
|
||||
void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, rcti *rect);
|
||||
void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, rcti *rect);
|
||||
void ui_draw_but_COLORBAND(uiBut *but, struct uiWidgetColors *wcol, rcti *rect);
|
||||
void ui_draw_but_NORMAL(uiBut *but, struct uiWidgetColors *wcol, rcti *rect);
|
||||
void ui_draw_but_CURVE(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, rcti *rect);
|
||||
void ui_draw_but_IMAGE(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, rcti *rect);
|
||||
void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, rcti *rect);
|
||||
void ui_draw_but_NODESOCKET(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, rcti *rect);
|
||||
void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, const rcti *rect);
|
||||
void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, const rcti *rect);
|
||||
void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, const rcti *rect);
|
||||
void ui_draw_but_COLORBAND(uiBut *but, struct uiWidgetColors *wcol, const rcti *rect);
|
||||
void ui_draw_but_NORMAL(uiBut *but, struct uiWidgetColors *wcol, const rcti *rect);
|
||||
void ui_draw_but_CURVE(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, const rcti *rect);
|
||||
void ui_draw_but_IMAGE(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, const rcti *rect);
|
||||
void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, const rcti *rect);
|
||||
void ui_draw_but_NODESOCKET(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, const rcti *rect);
|
||||
|
||||
/* interface_handlers.c */
|
||||
extern void ui_pan_to_scroll(const struct wmEvent *event, int *type, int *val);
|
||||
|
|
|
@ -413,7 +413,7 @@ static void ui_draw_x_icon(float x, float y)
|
|||
|
||||
#define PNL_ICON UI_UNIT_X /* could be UI_UNIT_Y too */
|
||||
|
||||
static void ui_draw_panel_scalewidget(rcti *rect)
|
||||
static void ui_draw_panel_scalewidget(const rcti *rect)
|
||||
{
|
||||
float xmin, xmax, dx;
|
||||
float ymin, ymax, dy;
|
||||
|
@ -464,7 +464,7 @@ static void ui_draw_panel_dragwidget(const rctf *rect)
|
|||
}
|
||||
|
||||
|
||||
static void ui_draw_aligned_panel_header(uiStyle *style, uiBlock *block, rcti *rect, char dir)
|
||||
static void ui_draw_aligned_panel_header(uiStyle *style, uiBlock *block, const rcti *rect, char dir)
|
||||
{
|
||||
Panel *panel = block->panel;
|
||||
rcti hrect;
|
||||
|
@ -497,7 +497,7 @@ static void ui_draw_aligned_panel_header(uiStyle *style, uiBlock *block, rcti *r
|
|||
}
|
||||
|
||||
/* panel integrated in buttonswindow, tool/property lists etc */
|
||||
void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect)
|
||||
void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, const rcti *rect)
|
||||
{
|
||||
Panel *panel = block->panel;
|
||||
rcti headrect;
|
||||
|
|
|
@ -873,7 +873,7 @@ static void ui_searchbox_select(bContext *C, ARegion *ar, uiBut *but, int step)
|
|||
ED_region_tag_redraw(ar);
|
||||
}
|
||||
|
||||
static void ui_searchbox_butrect(rcti *rect, uiSearchboxData *data, int itemnr)
|
||||
static void ui_searchbox_butrect(rcti *r_rect, uiSearchboxData *data, int itemnr)
|
||||
{
|
||||
/* thumbnail preview */
|
||||
if (data->preview) {
|
||||
|
@ -881,27 +881,27 @@ static void ui_searchbox_butrect(rcti *rect, uiSearchboxData *data, int itemnr)
|
|||
int buth = (BLI_rcti_size_y(&data->bbox) - 2 * MENU_TOP) / data->prv_rows;
|
||||
int row, col;
|
||||
|
||||
*rect = data->bbox;
|
||||
*r_rect = data->bbox;
|
||||
|
||||
col = itemnr % data->prv_cols;
|
||||
row = itemnr / data->prv_cols;
|
||||
|
||||
rect->xmin += col * butw;
|
||||
rect->xmax = rect->xmin + butw;
|
||||
r_rect->xmin += col * butw;
|
||||
r_rect->xmax = r_rect->xmin + butw;
|
||||
|
||||
rect->ymax = data->bbox.ymax - MENU_TOP - (row * buth);
|
||||
rect->ymin = rect->ymax - buth;
|
||||
r_rect->ymax = data->bbox.ymax - MENU_TOP - (row * buth);
|
||||
r_rect->ymin = r_rect->ymax - buth;
|
||||
}
|
||||
/* list view */
|
||||
else {
|
||||
int buth = (BLI_rcti_size_y(&data->bbox) - 2 * MENU_TOP) / SEARCH_ITEMS;
|
||||
|
||||
*rect = data->bbox;
|
||||
rect->xmin = data->bbox.xmin + 3.0f;
|
||||
rect->xmax = data->bbox.xmax - 3.0f;
|
||||
*r_rect = data->bbox;
|
||||
r_rect->xmin = data->bbox.xmin + 3.0f;
|
||||
r_rect->xmax = data->bbox.xmax - 3.0f;
|
||||
|
||||
rect->ymax = data->bbox.ymax - MENU_TOP - itemnr * buth;
|
||||
rect->ymin = rect->ymax - buth;
|
||||
r_rect->ymax = data->bbox.ymax - MENU_TOP - itemnr * buth;
|
||||
r_rect->ymin = r_rect->ymax - buth;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -190,7 +190,7 @@ void uiStyleFontDrawExt(uiFontStyle *fs, const rcti *rect, const char *str,
|
|||
*r_yofs = yofs;
|
||||
}
|
||||
|
||||
void uiStyleFontDraw(uiFontStyle *fs, rcti *rect, const char *str)
|
||||
void uiStyleFontDraw(uiFontStyle *fs, const rcti *rect, const char *str)
|
||||
{
|
||||
float xofs, yofs;
|
||||
uiStyleFontDrawExt(fs, rect, str,
|
||||
|
@ -198,7 +198,7 @@ void uiStyleFontDraw(uiFontStyle *fs, rcti *rect, const char *str)
|
|||
}
|
||||
|
||||
/* drawn same as above, but at 90 degree angle */
|
||||
void uiStyleFontDrawRotated(uiFontStyle *fs, rcti *rect, const char *str)
|
||||
void uiStyleFontDrawRotated(uiFontStyle *fs, const rcti *rect, const char *str)
|
||||
{
|
||||
float height;
|
||||
int xofs, yofs;
|
||||
|
|
|
@ -1520,7 +1520,8 @@ static void colorband_buttons_large(uiLayout *layout, uiBlock *block, ColorBand
|
|||
|
||||
}
|
||||
|
||||
static void colorband_buttons_small(uiLayout *layout, uiBlock *block, ColorBand *coba, rctf *butr, RNAUpdateCb *cb)
|
||||
static void colorband_buttons_small(uiLayout *layout, uiBlock *block, ColorBand *coba, const rctf *butr,
|
||||
RNAUpdateCb *cb)
|
||||
{
|
||||
uiBut *bt;
|
||||
float unit = BLI_rctf_size_x(butr) / 14.0f;
|
||||
|
@ -1556,7 +1557,7 @@ static void colorband_buttons_small(uiLayout *layout, uiBlock *block, ColorBand
|
|||
uiBlockEndAlign(block);
|
||||
}
|
||||
|
||||
static void colorband_buttons_layout(uiLayout *layout, uiBlock *block, ColorBand *coba, rctf *butr,
|
||||
static void colorband_buttons_layout(uiLayout *layout, uiBlock *block, ColorBand *coba, const rctf *butr,
|
||||
int small, RNAUpdateCb *cb)
|
||||
{
|
||||
if (small)
|
||||
|
|
|
@ -118,7 +118,7 @@ typedef struct uiWidgetType {
|
|||
void (*state)(struct uiWidgetType *, int state);
|
||||
void (*draw)(uiWidgetColors *, rcti *, int state, int roundboxalign);
|
||||
void (*custom)(uiBut *, uiWidgetColors *, rcti *, int state, int roundboxalign);
|
||||
void (*text)(uiFontStyle *, uiWidgetColors *, uiBut *, rcti *);
|
||||
void (*text)(uiFontStyle *, uiWidgetColors *, uiBut *, rcti *);
|
||||
|
||||
} uiWidgetType;
|
||||
|
||||
|
@ -606,7 +606,7 @@ static void widget_check_trias(uiWidgetTrias *tria, const rcti *rect)
|
|||
|
||||
|
||||
/* prepares shade colors */
|
||||
static void shadecolors4(char coltop[4], char *coldown, const char *color, short shadetop, short shadedown)
|
||||
static void shadecolors4(char coltop[4], char coldown[4], const char *color, short shadetop, short shadedown)
|
||||
{
|
||||
|
||||
coltop[0] = CLAMPIS(color[0] + shadetop, 0, 255);
|
||||
|
|
|
@ -2172,7 +2172,7 @@ void UI_view2d_text_cache_add(View2D *v2d, float x, float y, const char *str, co
|
|||
}
|
||||
|
||||
/* no clip (yet) */
|
||||
void UI_view2d_text_cache_rectf(View2D *v2d, rctf *rect, const char *str, const char col[4])
|
||||
void UI_view2d_text_cache_rectf(View2D *v2d, const rctf *rect, const char *str, const char col[4])
|
||||
{
|
||||
int len = strlen(str) + 1;
|
||||
View2DString *v2s = MEM_callocN(sizeof(View2DString) + len, "View2DString");
|
||||
|
|
Loading…
Reference in New Issue