From 232571c61a0120e71d980e47351d0656475dcbb5 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 15 Sep 2012 11:48:20 +0000 Subject: code cleanup: replace macro for BLI_rect size/center with inline functions. --- .../editors/animation/anim_channels_defines.c | 4 +- source/blender/editors/animation/anim_markers.c | 4 +- source/blender/editors/gpencil/gpencil_edit.c | 4 +- source/blender/editors/gpencil/gpencil_paint.c | 16 +-- source/blender/editors/include/UI_view2d.h | 18 ++- source/blender/editors/interface/interface.c | 34 +++--- source/blender/editors/interface/interface_draw.c | 58 ++++----- .../blender/editors/interface/interface_handlers.c | 70 +++++------ .../blender/editors/interface/interface_intern.h | 2 +- .../blender/editors/interface/interface_layout.c | 6 +- source/blender/editors/interface/interface_panel.c | 24 ++-- .../blender/editors/interface/interface_regions.c | 50 ++++---- source/blender/editors/interface/interface_style.c | 12 +- .../editors/interface/interface_templates.c | 22 ++-- .../blender/editors/interface/interface_widgets.c | 132 ++++++++++---------- source/blender/editors/interface/view2d.c | 136 +++++++++++---------- source/blender/editors/interface/view2d_ops.c | 82 ++++++------- source/blender/editors/mask/mask_draw.c | 8 +- source/blender/editors/mesh/editface.c | 4 +- source/blender/editors/render/render_preview.c | 8 +- source/blender/editors/screen/area.c | 54 ++++---- source/blender/editors/screen/glutil.c | 20 +-- source/blender/editors/screen/screen_ops.c | 4 +- source/blender/editors/screen/screendump.c | 4 +- source/blender/editors/sculpt_paint/paint_cursor.c | 4 +- source/blender/editors/space_action/action_draw.c | 2 +- source/blender/editors/space_action/action_edit.c | 4 +- .../blender/editors/space_action/action_select.c | 2 +- .../blender/editors/space_buttons/buttons_header.c | 2 +- source/blender/editors/space_clip/clip_buttons.c | 2 +- .../editors/space_clip/clip_dopesheet_draw.c | 2 +- source/blender/editors/space_clip/clip_draw.c | 8 +- source/blender/editors/space_clip/clip_editor.c | 8 +- source/blender/editors/space_clip/clip_graph_ops.c | 6 +- source/blender/editors/space_clip/clip_ops.c | 8 +- source/blender/editors/space_clip/space_clip.c | 4 +- .../blender/editors/space_console/space_console.c | 2 +- source/blender/editors/space_file/filesel.c | 8 +- source/blender/editors/space_file/space_file.c | 2 +- source/blender/editors/space_graph/graph_draw.c | 4 +- source/blender/editors/space_graph/graph_edit.c | 4 +- source/blender/editors/space_graph/graph_select.c | 2 +- source/blender/editors/space_image/image_buttons.c | 6 +- source/blender/editors/space_image/image_draw.c | 2 +- source/blender/editors/space_image/image_edit.c | 8 +- source/blender/editors/space_image/image_ops.c | 8 +- source/blender/editors/space_image/space_image.c | 4 +- source/blender/editors/space_logic/logic_buttons.c | 8 +- source/blender/editors/space_nla/nla_edit.c | 4 +- source/blender/editors/space_nla/nla_select.c | 2 +- source/blender/editors/space_node/drawnode.c | 12 +- source/blender/editors/space_node/node_draw.c | 18 +-- source/blender/editors/space_node/node_edit.c | 4 +- source/blender/editors/space_node/node_select.c | 4 +- source/blender/editors/space_node/node_view.c | 8 +- .../blender/editors/space_outliner/outliner_edit.c | 10 +- .../editors/space_sequencer/sequencer_draw.c | 14 +-- .../editors/space_sequencer/sequencer_edit.c | 20 +-- source/blender/editors/space_text/text_draw.c | 2 +- source/blender/editors/space_text/text_ops.c | 4 +- source/blender/editors/space_time/time_ops.c | 2 +- source/blender/editors/space_view3d/view3d_draw.c | 28 ++--- source/blender/editors/space_view3d/view3d_edit.c | 26 ++-- .../blender/editors/space_view3d/view3d_select.c | 4 +- source/blender/editors/transform/transform.c | 16 +-- .../editors/transform/transform_conversions.c | 4 +- source/blender/editors/transform/transform_snap.c | 4 +- 67 files changed, 541 insertions(+), 531 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index 86f729502bb..4c244899205 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -3068,7 +3068,7 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float } /* check if there's enough space for the toggles if the sliders are drawn too */ - if (!(draw_sliders) || (BLI_RCT_SIZE_X(&v2d->mask) > ACHANNEL_BUTTON_WIDTH / 2) ) { + if (!(draw_sliders) || (BLI_rcti_size_x(&v2d->mask) > ACHANNEL_BUTTON_WIDTH / 2) ) { /* protect... */ if (acf->has_setting(ac, ale, ACHANNEL_SETTING_PROTECT)) offset += ICON_WIDTH; @@ -3460,7 +3460,7 @@ void ANIM_channel_draw_widgets(bContext *C, bAnimContext *ac, bAnimListElem *ale } /* check if there's enough space for the toggles if the sliders are drawn too */ - if (!(draw_sliders) || (BLI_RCT_SIZE_X(&v2d->mask) > ACHANNEL_BUTTON_WIDTH / 2) ) { + if (!(draw_sliders) || (BLI_rcti_size_x(&v2d->mask) > ACHANNEL_BUTTON_WIDTH / 2) ) { /* protect... */ if (acf->has_setting(ac, ale, ACHANNEL_SETTING_PROTECT)) { offset += ICON_WIDTH; diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index 445b684c261..270e7fc8f90 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -354,7 +354,7 @@ static void draw_marker(View2D *v2d, TimeMarker *marker, int cfra, int flag) xpos = marker->frame; /* no time correction for framelen! space is drawn with old values */ - ypixels = BLI_RCT_SIZE_Y(&v2d->mask); + ypixels = BLI_rcti_size_y(&v2d->mask); UI_view2d_getscale(v2d, &xscale, &yscale); glScalef(1.0f / xscale, 1.0f, 1.0f); @@ -773,7 +773,7 @@ static int ed_marker_move_modal(bContext *C, wmOperator *op, wmEvent *evt) if (hasNumInput(&mm->num)) break; - dx = BLI_RCT_SIZE_X(&v2d->cur) / BLI_RCT_SIZE_X(&v2d->mask); + dx = BLI_rctf_size_x(&v2d->cur) / BLI_rcti_size_x(&v2d->mask); if (evt->x != mm->evtx) { /* XXX maybe init for first time */ int a, offs, totmark = 0; diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index 5d67b63af18..659e99607f0 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -422,8 +422,8 @@ static void gp_strokepoint_convertcoords(bContext *C, bGPDstroke *gps, bGPDspoin } else { if (subrect) { - mvalf[0] = (((float)pt->x / 100.0f) * BLI_RCT_SIZE_X(subrect)) + subrect->xmin; - mvalf[1] = (((float)pt->y / 100.0f) * BLI_RCT_SIZE_Y(subrect)) + subrect->ymin; + mvalf[0] = (((float)pt->x / 100.0f) * BLI_rctf_size_x(subrect)) + subrect->xmin; + mvalf[1] = (((float)pt->y / 100.0f) * BLI_rctf_size_y(subrect)) + subrect->ymin; } else { mvalf[0] = (float)pt->x / 100.0f * ar->winx; diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index 4e281b96fc3..72a4037bf7d 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -299,8 +299,8 @@ static void gp_stroke_convertcoords(tGPsdata *p, const int mval[2], float out[3] out[1] = (float)(mval[1]) / (float)(p->ar->winy) * 100; } else { /* camera view, use subrect */ - out[0] = ((mval[0] - p->subrect->xmin) / BLI_RCT_SIZE_X(p->subrect)) * 100; - out[1] = ((mval[1] - p->subrect->ymin) / BLI_RCT_SIZE_Y(p->subrect)) * 100; + out[0] = ((mval[0] - p->subrect->xmin) / BLI_rctf_size_x(p->subrect)) * 100; + out[1] = ((mval[1] - p->subrect->ymin) / BLI_rctf_size_y(p->subrect)) * 100; } } } @@ -821,8 +821,8 @@ static void gp_stroke_eraser_dostroke(tGPsdata *p, y0 = (int)(gps->points->y / 100 * p->ar->winy); } else { /* camera view, use subrect */ - x0 = (int)((gps->points->x / 100) * BLI_RCT_SIZE_X(p->subrect)) + p->subrect->xmin; - y0 = (int)((gps->points->y / 100) * BLI_RCT_SIZE_Y(p->subrect)) + p->subrect->ymin; + x0 = (int)((gps->points->x / 100) * BLI_rctf_size_x(p->subrect)) + p->subrect->xmin; + y0 = (int)((gps->points->y / 100) * BLI_rctf_size_y(p->subrect)) + p->subrect->ymin; } } @@ -868,10 +868,10 @@ static void gp_stroke_eraser_dostroke(tGPsdata *p, y1 = (int)(pt2->y / 100 * p->ar->winy); } else { /* camera view, use subrect */ - x0 = (int)((pt1->x / 100) * BLI_RCT_SIZE_X(p->subrect)) + p->subrect->xmin; - y0 = (int)((pt1->y / 100) * BLI_RCT_SIZE_Y(p->subrect)) + p->subrect->ymin; - x1 = (int)((pt2->x / 100) * BLI_RCT_SIZE_X(p->subrect)) + p->subrect->xmin; - y1 = (int)((pt2->y / 100) * BLI_RCT_SIZE_Y(p->subrect)) + p->subrect->ymin; + x0 = (int)((pt1->x / 100) * BLI_rctf_size_x(p->subrect)) + p->subrect->xmin; + y0 = (int)((pt1->y / 100) * BLI_rctf_size_y(p->subrect)) + p->subrect->ymin; + x1 = (int)((pt2->x / 100) * BLI_rctf_size_x(p->subrect)) + p->subrect->xmin; + y1 = (int)((pt2->y / 100) * BLI_rctf_size_y(p->subrect)) + p->subrect->ymin; } } diff --git a/source/blender/editors/include/UI_view2d.h b/source/blender/editors/include/UI_view2d.h index 792c96fe7c8..24759fa778a 100644 --- a/source/blender/editors/include/UI_view2d.h +++ b/source/blender/editors/include/UI_view2d.h @@ -163,7 +163,8 @@ void UI_view2d_view_orthoSpecial(struct ARegion *ar, struct View2D *v2d, short x void UI_view2d_view_restore(const struct bContext *C); /* grid drawing */ -View2DGrid *UI_view2d_grid_calc(struct Scene *scene, struct View2D *v2d, short xunits, short xclamp, short yunits, short yclamp, int winx, int winy); +View2DGrid *UI_view2d_grid_calc(struct Scene *scene, struct View2D *v2d, + short xunits, short xclamp, short yunits, short yclamp, int winx, int winy); void UI_view2d_grid_draw(struct View2D *v2d, View2DGrid *grid, int flag); void UI_view2d_constant_grid_draw(struct View2D *v2d); void UI_view2d_multi_grid_draw(struct View2D *v2d, float step, int level_size, int totlevels); @@ -171,14 +172,21 @@ void UI_view2d_grid_size(View2DGrid *grid, float *r_dx, float *r_dy); void UI_view2d_grid_free(View2DGrid *grid); /* scrollbar drawing */ -View2DScrollers *UI_view2d_scrollers_calc(const struct bContext *C, struct View2D *v2d, short xunits, short xclamp, short yunits, short yclamp); +View2DScrollers *UI_view2d_scrollers_calc(const struct bContext *C, struct View2D *v2d, + short xunits, short xclamp, short yunits, short yclamp); void UI_view2d_scrollers_draw(const struct bContext *C, struct View2D *v2d, View2DScrollers *scrollers); void UI_view2d_scrollers_free(View2DScrollers *scrollers); /* list view tools */ -void UI_view2d_listview_cell_to_view(struct View2D *v2d, short columnwidth, short rowheight, float startx, float starty, int column, int row, struct rctf *rect); -void UI_view2d_listview_view_to_cell(struct View2D *v2d, short columnwidth, short rowheight, float startx, float starty, float viewx, float viewy, int *column, int *row); -void UI_view2d_listview_visible_cells(struct View2D *v2d, short columnwidth, short rowheight, float startx, float starty, int *column_min, int *column_max, int *row_min, int *row_max); +void UI_view2d_listview_cell_to_view(struct View2D *v2d, short columnwidth, short rowheight, + float startx, float starty, int column, int row, + struct rctf *rect); +void UI_view2d_listview_view_to_cell(struct View2D *v2d, short columnwidth, short rowheight, + float startx, float starty, float viewx, float viewy, + int *column, int *row); +void UI_view2d_listview_visible_cells(struct View2D *v2d, short columnwidth, short rowheight, + float startx, float starty, int *column_min, int *column_max, + int *row_min, int *row_max); /* coordinate conversion */ void UI_view2d_region_to_view(struct View2D *v2d, int x, int y, float *viewx, float *viewy); diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 742aed4fbb1..8a0084129dc 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -106,8 +106,8 @@ void ui_block_to_window_fl(const ARegion *ar, uiBlock *block, float *x, float *y float gx, gy; int sx, sy, getsizex, getsizey; - getsizex = BLI_RCT_SIZE_X(&ar->winrct) + 1; - getsizey = BLI_RCT_SIZE_Y(&ar->winrct) + 1; + getsizex = BLI_rcti_size_x(&ar->winrct) + 1; + getsizey = BLI_rcti_size_y(&ar->winrct) + 1; sx = ar->winrct.xmin; sy = ar->winrct.ymin; @@ -152,8 +152,8 @@ void ui_window_to_block_fl(const ARegion *ar, uiBlock *block, float *x, float *y float a, b, c, d, e, f, px, py; int sx, sy, getsizex, getsizey; - getsizex = BLI_RCT_SIZE_X(&ar->winrct) + 1; - getsizey = BLI_RCT_SIZE_Y(&ar->winrct) + 1; + getsizex = BLI_rcti_size_x(&ar->winrct) + 1; + getsizey = BLI_rcti_size_y(&ar->winrct) + 1; sx = ar->winrct.xmin; sy = ar->winrct.ymin; @@ -279,7 +279,7 @@ void ui_bounds_block(uiBlock *block) block->rect.ymax += block->bounds; } - block->rect.xmax = block->rect.xmin + maxf(BLI_RCT_SIZE_X(&block->rect), block->minbounds); + block->rect.xmax = block->rect.xmin + maxf(BLI_rctf_size_x(&block->rect), block->minbounds); /* hardcoded exception... but that one is annoying with larger safety */ bt = block->buttons.first; @@ -307,8 +307,8 @@ static void ui_centered_bounds_block(const bContext *C, uiBlock *block) ui_bounds_block(block); - width = BLI_RCT_SIZE_X(&block->rect); - height = BLI_RCT_SIZE_Y(&block->rect); + width = BLI_rctf_size_x(&block->rect); + height = BLI_rctf_size_y(&block->rect); startx = (xmax * 0.5f) - (width * 0.5f); starty = (ymax * 0.5f) - (height * 0.5f); @@ -332,8 +332,8 @@ static void ui_popup_bounds_block(const bContext *C, uiBlock *block, eBlockBound wm_window_get_size(window, &xmax, &ymax); - oldwidth = BLI_RCT_SIZE_X(&block->rect); - oldheight = BLI_RCT_SIZE_Y(&block->rect); + oldwidth = BLI_rctf_size_x(&block->rect); + oldheight = BLI_rctf_size_y(&block->rect); /* first we ensure wide enough text bounds */ if (bounds_calc == UI_BLOCK_BOUNDS_POPUP_MENU) { @@ -348,8 +348,8 @@ static void ui_popup_bounds_block(const bContext *C, uiBlock *block, eBlockBound ui_bounds_block(block); /* and we adjust the position to fit within window */ - width = BLI_RCT_SIZE_X(&block->rect); - height = BLI_RCT_SIZE_Y(&block->rect); + width = BLI_rctf_size_x(&block->rect); + height = BLI_rctf_size_y(&block->rect); /* avoid divide by zero below, caused by calling with no UI, but better not crash */ oldwidth = oldwidth > 0 ? oldwidth : MAX2(1, width); @@ -495,10 +495,10 @@ static void ui_draw_linkline(uiLinkLine *line, int highlightActiveLines) if (line->from == NULL || line->to == NULL) return; - rect.xmin = BLI_RCT_CENTER_X(&line->from->rect); - rect.ymin = BLI_RCT_CENTER_Y(&line->from->rect); - rect.xmax = BLI_RCT_CENTER_X(&line->to->rect); - rect.ymax = BLI_RCT_CENTER_Y(&line->to->rect); + rect.xmin = BLI_rctf_cent_x(&line->from->rect); + rect.ymin = BLI_rctf_cent_y(&line->from->rect); + rect.xmax = BLI_rctf_cent_x(&line->to->rect); + rect.ymax = BLI_rctf_cent_y(&line->to->rect); if (line->flag & UI_SELECT) glColor3ub(100, 100, 100); @@ -2257,7 +2257,7 @@ void ui_check_but(uiBut *but) /* safety is 4 to enable small number buttons (like 'users') */ - // okwidth= -4 + (BLI_RCT_SIZE_X(&but->rect)); // UNUSED + // okwidth= -4 + (BLI_rcti_size_x(&but->rect)); // UNUSED /* name: */ switch (but->type) { @@ -2265,7 +2265,7 @@ void ui_check_but(uiBut *but) case MENU: case ICONTEXTROW: - if (BLI_RCT_SIZE_X(&but->rect) > 24.0f) { + if (BLI_rctf_size_x(&but->rect) > 24.0f) { UI_GET_BUT_VALUE_INIT(but, value); ui_set_name_menu(but, (int)value); } diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index f535c3c3e2a..f83116da633 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -440,8 +440,8 @@ void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSED(w //glColor4f(1.0, 0.f, 0.f, 1.f); //fdrawbox(rect->xmin, rect->ymin, rect->xmax, rect->ymax) - w = BLI_RCT_SIZE_X(rect); - h = BLI_RCT_SIZE_Y(rect); + w = BLI_rcti_size_x(rect); + h = BLI_rcti_size_y(rect); /* prevent drawing outside widget area */ glGetIntegerv(GL_SCISSOR_BOX, scissor); glScissor(ar->winrct.xmin + rect->xmin, ar->winrct.ymin + rect->ymin, w, h); @@ -494,8 +494,8 @@ static void ui_draw_but_CHARTAB(uiBut *but) charmax = G.charmax = 0xffff; /* Calculate the size of the button */ - width = abs(BLI_RCT_SIZE_X(rect)); - height = abs(BLI_RCT_SIZE_Y(rect)); + width = abs(BLI_rcti_size_x(rect)); + height = abs(BLI_rcti_size_y(rect)); butw = floor(width / 12); buth = floor(height / 6); @@ -633,7 +633,7 @@ static void ui_draw_but_CHARTAB(uiBut *but) #endif /* WITH_INTERNATIONAL */ #endif -static void draw_scope_end(rctf *rect, GLint *scissor) +static void draw_scope_end(const rctf *rect, GLint *scissor) { float scaler_x1, scaler_x2; @@ -643,8 +643,8 @@ static void draw_scope_end(rctf *rect, GLint *scissor) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); /* scale widget */ - scaler_x1 = rect->xmin + BLI_RCT_SIZE_X(rect) / 2 - SCOPE_RESIZE_PAD; - scaler_x2 = rect->xmin + BLI_RCT_SIZE_X(rect) / 2 + SCOPE_RESIZE_PAD; + scaler_x1 = rect->xmin + BLI_rctf_size_x(rect) / 2 - SCOPE_RESIZE_PAD; + scaler_x2 = rect->xmin + BLI_rctf_size_y(rect) / 2 + SCOPE_RESIZE_PAD; glColor4f(0.f, 0.f, 0.f, 0.25f); fdrawline(scaler_x1, rect->ymin - 4, scaler_x2, rect->ymin - 4); @@ -733,8 +733,8 @@ void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol) rect.ymin = (float)recti->ymin + SCOPE_RESIZE_PAD + 2; rect.ymax = (float)recti->ymax - 1; - w = BLI_RCT_SIZE_X(&rect); - h = BLI_RCT_SIZE_Y(&rect) * hist->ymax; + w = BLI_rctf_size_x(&rect); + h = BLI_rctf_size_y(&rect) * hist->ymax; glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); @@ -806,9 +806,9 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), if (scopes->wavefrm_yfac < 0.5f) scopes->wavefrm_yfac = 0.98f; - w = BLI_RCT_SIZE_X(&rect) - 7; - h = BLI_RCT_SIZE_Y(&rect) * scopes->wavefrm_yfac; - yofs = rect.ymin + (BLI_RCT_SIZE_Y(&rect) - h) / 2.0f; + w = BLI_rctf_size_x(&rect) - 7; + h = BLI_rctf_size_y(&rect) * scopes->wavefrm_yfac; + yofs = rect.ymin + (BLI_rctf_size_y(&rect) - h) / 2.0f; w3 = w / 3.0f; /* log scale for alpha */ @@ -1034,8 +1034,8 @@ void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wco rect.ymin = (float)recti->ymin + SCOPE_RESIZE_PAD + 2; rect.ymax = (float)recti->ymax - 1; - w = BLI_RCT_SIZE_X(&rect); - h = BLI_RCT_SIZE_Y(&rect); + w = BLI_rctf_size_x(&rect); + h = BLI_rctf_size_y(&rect); centerx = rect.xmin + w / 2; centery = rect.ymin + h / 2; diam = (w < h) ? w : h; @@ -1267,12 +1267,12 @@ void ui_draw_but_NORMAL(uiBut *but, uiWidgetColors *wcol, rcti *rect) /* transform to button */ glPushMatrix(); - glTranslatef(rect->xmin + 0.5f * BLI_RCT_SIZE_X(rect), rect->ymin + 0.5f * BLI_RCT_SIZE_Y(rect), 0.0f); + glTranslatef(rect->xmin + 0.5f * BLI_rcti_size_x(rect), rect->ymin + 0.5f * BLI_rcti_size_y(rect), 0.0f); - if (BLI_RCT_SIZE_X(rect) < BLI_RCT_SIZE_Y(rect)) - size = BLI_RCT_SIZE_X(rect) / 200.f; + if (BLI_rcti_size_x(rect) < BLI_rcti_size_y(rect)) + size = BLI_rcti_size_x(rect) / 200.f; else - size = BLI_RCT_SIZE_Y(rect) / 200.f; + size = BLI_rcti_size_y(rect) / 200.f; glScalef(size, size, size); @@ -1378,12 +1378,12 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect BLI_rcti_isect(&scissor_new, &ar->winrct, &scissor_new); glScissor(scissor_new.xmin, scissor_new.ymin, - BLI_RCT_SIZE_X(&scissor_new), - BLI_RCT_SIZE_Y(&scissor_new)); + BLI_rcti_size_x(&scissor_new), + BLI_rcti_size_y(&scissor_new)); /* calculate offset and zoom */ - zoomx = (BLI_RCT_SIZE_X(rect) - 2.0f * but->aspect) / BLI_RCT_SIZE_X(&cumap->curr); - zoomy = (BLI_RCT_SIZE_Y(rect) - 2.0f * but->aspect) / BLI_RCT_SIZE_Y(&cumap->curr); + zoomx = (BLI_rcti_size_x(rect) - 2.0f * but->aspect) / BLI_rctf_size_x(&cumap->curr); + zoomy = (BLI_rcti_size_y(rect) - 2.0f * but->aspect) / BLI_rctf_size_y(&cumap->curr); offsx = cumap->curr.xmin - but->aspect / zoomx; offsy = cumap->curr.ymin - but->aspect / zoomy; @@ -1561,8 +1561,8 @@ void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wc rect.ymin = (float)recti->ymin + SCOPE_RESIZE_PAD + 2; rect.ymax = (float)recti->ymax - 1; - width = BLI_RCT_SIZE_X(&rect) + 1; - height = BLI_RCT_SIZE_Y(&rect); + width = BLI_rctf_size_x(&rect) + 1; + height = BLI_rctf_size_y(&rect); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); @@ -1637,8 +1637,8 @@ void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wc glTranslatef(rect.xmin + track_pos[0], rect.ymin + track_pos[1], 0.f); glScissor(ar->winrct.xmin + rect.xmin, ar->winrct.ymin + rect.ymin, - BLI_RCT_SIZE_X(&rect), - BLI_RCT_SIZE_Y(&rect)); + BLI_rctf_size_x(&rect), + BLI_rctf_size_y(&rect)); for (a = 0; a < 2; a++) { if (a == 1) { @@ -1729,7 +1729,7 @@ void uiDrawBoxShadow(unsigned char alpha, float minx, float miny, float maxx, fl } -void ui_dropshadow(rctf *rct, float radius, float aspect, float alpha, int UNUSED(select)) +void ui_dropshadow(const rctf *rct, float radius, float aspect, float alpha, int UNUSED(select)) { int i; float rad; @@ -1738,8 +1738,8 @@ void ui_dropshadow(rctf *rct, float radius, float aspect, float alpha, int UNUSE glEnable(GL_BLEND); - if (radius > (BLI_RCT_SIZE_Y(rct) - 10.0f) / 2.0f) - rad = (BLI_RCT_SIZE_Y(rct) - 10.0f) / 2.0f; + if (radius > (BLI_rctf_size_y(rct) - 10.0f) / 2.0f) + rad = (BLI_rctf_size_y(rct) - 10.0f) / 2.0f; else rad = radius; diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index f7b22098835..1ac02958bd2 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -697,10 +697,10 @@ static int ui_but_mouse_inside_icon(uiBut *but, ARegion *ar, wmEvent *event) if (but->imb) ; /* use button size itself */ else if (but->flag & UI_ICON_LEFT) { - rect.xmax = rect.xmin + (BLI_RCT_SIZE_Y(&rect)); + rect.xmax = rect.xmin + (BLI_rcti_size_y(&rect)); } else { - int delta = BLI_RCT_SIZE_X(&rect) - BLI_RCT_SIZE_Y(&rect); + int delta = BLI_rcti_size_x(&rect) - BLI_rcti_size_y(&rect); rect.xmin += delta / 2; rect.xmax -= delta / 2; } @@ -721,7 +721,7 @@ static int ui_but_start_drag(bContext *C, uiBut *but, uiHandleButtonData *data, drag = WM_event_start_drag(C, but->icon, but->dragtype, but->dragpoin, ui_get_but_val(but)); if (but->imb) - WM_event_drag_image(drag, but->imb, but->imb_scale, BLI_RCT_SIZE_X(&but->rect), BLI_RCT_SIZE_Y(&but->rect)); + WM_event_drag_image(drag, but->imb, but->imb_scale, BLI_rctf_size_x(&but->rect), BLI_rctf_size_y(&but->rect)); return 1; } @@ -1309,7 +1309,7 @@ static void ui_textedit_set_cursor_pos(uiBut *but, uiHandleButtonData *data, sho /* XXX solve generic */ if (but->type == NUM || but->type == NUMSLI) - startx += (int)(0.5f * (BLI_RCT_SIZE_Y(&but->rect))); + startx += (int)(0.5f * (BLI_rctf_size_y(&but->rect))); else if (ELEM(but->type, TEX, SEARCH_MENU)) { startx += 5; if (but->flag & UI_HAS_ICON) @@ -2639,7 +2639,7 @@ static int ui_do_but_NUM(bContext *C, uiBlock *block, uiBut *but, uiHandleButton softmax = but->softmax; if (!ui_is_but_float(but)) { - if (mx < (but->rect.xmin + BLI_RCT_SIZE_X(&but->rect) / 3 - 3)) { + if (mx < (but->rect.xmin + BLI_rctf_size_x(&but->rect) / 3 - 3)) { button_activate_state(C, but, BUTTON_STATE_NUM_EDITING); temp = (int)data->value - 1; @@ -2650,7 +2650,7 @@ static int ui_do_but_NUM(bContext *C, uiBlock *block, uiBut *but, uiHandleButton button_activate_state(C, but, BUTTON_STATE_EXIT); } - else if (mx > (but->rect.xmin + (2 * BLI_RCT_SIZE_X(&but->rect) / 3) + 3)) { + else if (mx > (but->rect.xmin + (2 * BLI_rctf_size_x(&but->rect) / 3) + 3)) { button_activate_state(C, but, BUTTON_STATE_NUM_EDITING); temp = (int)data->value + 1; @@ -2665,7 +2665,7 @@ static int ui_do_but_NUM(bContext *C, uiBlock *block, uiBut *but, uiHandleButton button_activate_state(C, but, BUTTON_STATE_TEXT_EDITING); } else { - if (mx < (but->rect.xmin + BLI_RCT_SIZE_X(&but->rect) / 3 - 3)) { + if (mx < (but->rect.xmin + BLI_rctf_size_x(&but->rect) / 3 - 3)) { button_activate_state(C, but, BUTTON_STATE_NUM_EDITING); tempf = (float)data->value - 0.01f * but->a1; @@ -2674,7 +2674,7 @@ static int ui_do_but_NUM(bContext *C, uiBlock *block, uiBut *but, uiHandleButton button_activate_state(C, but, BUTTON_STATE_EXIT); } - else if (mx > but->rect.xmin + (2 * (BLI_RCT_SIZE_X(&but->rect) / 3) + 3)) { + else if (mx > but->rect.xmin + (2 * (BLI_rctf_size_x(&but->rect) / 3) + 3)) { button_activate_state(C, but, BUTTON_STATE_NUM_EDITING); tempf = (float)data->value + 0.01f * but->a1; @@ -2702,14 +2702,14 @@ static int ui_numedit_but_SLI(uiBut *but, uiHandleButtonData *data, const short softmax = but->softmax; softrange = softmax - softmin; - if (but->type == NUMSLI) deler = (BLI_RCT_SIZE_X(&but->rect) - 5.0f * but->aspect); - else if (but->type == HSVSLI) deler = (BLI_RCT_SIZE_X(&but->rect) / 2.0f - 5.0f * but->aspect); + if (but->type == NUMSLI) deler = (BLI_rctf_size_x(&but->rect) - 5.0f * but->aspect); + else if (but->type == HSVSLI) deler = (BLI_rctf_size_x(&but->rect) / 2.0f - 5.0f * but->aspect); else if (but->type == SCROLL) { - int horizontal = (BLI_RCT_SIZE_X(&but->rect) > BLI_RCT_SIZE_Y(&but->rect)); - float size = (horizontal) ? BLI_RCT_SIZE_X(&but->rect) : -BLI_RCT_SIZE_Y(&but->rect); + int horizontal = (BLI_rctf_size_x(&but->rect) > BLI_rctf_size_y(&but->rect)); + float size = (horizontal) ? BLI_rctf_size_x(&but->rect) : -BLI_rctf_size_y(&but->rect); deler = size * (but->softmax - but->softmin) / (but->softmax - but->softmin + but->a1); } - else deler = (BLI_RCT_SIZE_X(&but->rect) - 5.0f * but->aspect); + else deler = (BLI_rctf_size_x(&but->rect) - 5.0f * but->aspect); f = (float)(mx - data->dragstartx) / deler + data->dragfstart; @@ -2792,7 +2792,7 @@ static int ui_do_but_SLI(bContext *C, uiBlock *block, uiBut *but, uiHandleButton } /* alt-click on sides to get "arrows" like in NUM buttons, and match wheel usage above */ else if (event->type == LEFTMOUSE && event->alt) { - int halfpos = BLI_RCT_CENTER_X(&but->rect); + int halfpos = BLI_rctf_cent_x(&but->rect); click = 2; if (mx < halfpos) mx = but->rect.xmin; @@ -2859,12 +2859,12 @@ static int ui_do_but_SLI(bContext *C, uiBlock *block, uiBut *but, uiHandleButton #if 0 if (but->type == SLI) { - f = (float)(mx - but->rect.xmin) / (BLI_RCT_SIZE_X(&but->rect)); /* same as below */ + f = (float)(mx - but->rect.xmin) / (BLI_rctf_size_x(&but->rect)); /* same as below */ } else #endif { - f = (float)(mx - but->rect.xmin) / (BLI_RCT_SIZE_X(&but->rect)); + f = (float)(mx - but->rect.xmin) / (BLI_rctf_size_x(&but->rect)); } f = softmin + f * softrange; @@ -2905,7 +2905,7 @@ static int ui_do_but_SCROLL(bContext *C, uiBlock *block, uiBut *but, uiHandleBut { int mx, my /*, click= 0 */; int retval = WM_UI_HANDLER_CONTINUE; - int horizontal = (BLI_RCT_SIZE_X(&but->rect) > BLI_RCT_SIZE_Y(&but->rect)); + int horizontal = (BLI_rctf_size_x(&but->rect) > BLI_rctf_size_y(&but->rect)); mx = event->x; my = event->y; @@ -3063,7 +3063,7 @@ static int ui_numedit_but_NORMAL(uiBut *but, uiHandleButtonData *data, int mx, i * else we'll get a harmless but annoying jump when first clicking */ fp = data->origvec; - rad = BLI_RCT_SIZE_X(&but->rect); + rad = BLI_rctf_size_x(&but->rect); radsq = rad * rad; if (fp[2] > 0.0f) { @@ -3173,8 +3173,8 @@ static int ui_numedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, int mx, rgb_to_hsv_compat_v(rgb, hsv); /* relative position within box */ - x = ((float)mx_fl - but->rect.xmin) / BLI_RCT_SIZE_X(&but->rect); - y = ((float)my_fl - but->rect.ymin) / BLI_RCT_SIZE_Y(&but->rect); + x = ((float)mx_fl - but->rect.xmin) / BLI_rctf_size_x(&but->rect); + y = ((float)my_fl - but->rect.ymin) / BLI_rctf_size_y(&but->rect); CLAMP(x, 0.0f, 1.0f); CLAMP(y, 0.0f, 1.0f); @@ -3575,7 +3575,7 @@ static int ui_numedit_but_COLORBAND(uiBut *but, uiHandleButtonData *data, int mx if (data->draglastx == mx) return changed; - dx = ((float)(mx - data->draglastx)) / BLI_RCT_SIZE_X(&but->rect); + dx = ((float)(mx - data->draglastx)) / BLI_rctf_size_x(&but->rect); data->dragcbd->pos += dx; CLAMP(data->dragcbd->pos, 0.0f, 1.0f); @@ -3604,7 +3604,7 @@ static int ui_do_but_COLORBAND(bContext *C, uiBlock *block, uiBut *but, uiHandle if (event->ctrl) { /* insert new key on mouse location */ - float pos = ((float)(mx - but->rect.xmin)) / BLI_RCT_SIZE_X(&but->rect); + float pos = ((float)(mx - but->rect.xmin)) / BLI_rctf_size_x(&but->rect); colorband_element_add(coba, pos); button_activate_state(C, but, BUTTON_STATE_EXIT); } @@ -3616,7 +3616,7 @@ static int ui_do_but_COLORBAND(bContext *C, uiBlock *block, uiBut *but, uiHandle /* activate new key when mouse is close */ for (a = 0, cbd = coba->data; a < coba->tot; a++, cbd++) { - xco = but->rect.xmin + (cbd->pos * BLI_RCT_SIZE_X(&but->rect)); + xco = but->rect.xmin + (cbd->pos * BLI_rctf_size_x(&but->rect)); xco = ABS(xco - mx); if (a == coba->cur) xco += 5; // selected one disadvantage if (xco < mindist) { @@ -3657,8 +3657,8 @@ static int ui_numedit_but_CURVE(uiBut *but, uiHandleButtonData *data, int snap, float fx, fy, zoomx, zoomy /*, offsx, offsy */ /* UNUSED */; int a, changed = 0; - zoomx = BLI_RCT_SIZE_X(&but->rect) / BLI_RCT_SIZE_X(&cumap->curr); - zoomy = BLI_RCT_SIZE_Y(&but->rect) / BLI_RCT_SIZE_Y(&cumap->curr); + zoomx = BLI_rctf_size_x(&but->rect) / BLI_rctf_size_x(&cumap->curr); + zoomy = BLI_rctf_size_y(&but->rect) / BLI_rctf_size_y(&cumap->curr); /* offsx= cumap->curr.xmin; */ /* offsy= cumap->curr.ymin; */ @@ -3753,8 +3753,8 @@ static int ui_do_but_CURVE(bContext *C, uiBlock *block, uiBut *but, uiHandleButt float dist, mindist = 200.0f; // 14 pixels radius int sel = -1; - zoomx = BLI_RCT_SIZE_X(&but->rect) / BLI_RCT_SIZE_X(&cumap->curr); - zoomy = BLI_RCT_SIZE_Y(&but->rect) / BLI_RCT_SIZE_Y(&cumap->curr); + zoomx = BLI_rctf_size_x(&but->rect) / BLI_rctf_size_x(&cumap->curr); + zoomy = BLI_rctf_size_y(&but->rect) / BLI_rctf_size_y(&cumap->curr); offsx = cumap->curr.xmin; offsy = cumap->curr.ymin; @@ -3899,7 +3899,7 @@ static int ui_numedit_but_HISTOGRAM(uiBut *but, uiHandleButtonData *data, int mx if (in_scope_resize_zone(but, data->dragstartx, data->dragstarty)) { /* resize histogram widget itself */ - hist->height = BLI_RCT_SIZE_Y(&but->rect) + (data->dragstarty - my); + hist->height = BLI_rctf_size_y(&but->rect) + (data->dragstarty - my); } else { /* scale histogram values (dy / 10 for better control) */ @@ -3983,7 +3983,7 @@ static int ui_numedit_but_WAVEFORM(uiBut *but, uiHandleButtonData *data, int mx, if (in_scope_resize_zone(but, data->dragstartx, data->dragstarty)) { /* resize waveform widget itself */ - scopes->wavefrm_height = BLI_RCT_SIZE_Y(&but->rect) + (data->dragstarty - my); + scopes->wavefrm_height = BLI_rctf_size_y(&but->rect) + (data->dragstarty - my); } else { /* scale waveform values */ @@ -4065,7 +4065,7 @@ static int ui_numedit_but_VECTORSCOPE(uiBut *but, uiHandleButtonData *data, int if (in_scope_resize_zone(but, data->dragstartx, data->dragstarty)) { /* resize vectorscope widget itself */ - scopes->vecscope_height = BLI_RCT_SIZE_Y(&but->rect) + (data->dragstarty - my); + scopes->vecscope_height = BLI_rctf_size_y(&but->rect) + (data->dragstarty - my); } data->draglastx = mx; @@ -4135,8 +4135,8 @@ static int ui_do_but_CHARTAB(bContext *UNUSED(C), uiBlock *UNUSED(block), uiBut if (data->state == BUTTON_STATE_HIGHLIGHT) { if (ELEM3(event->type, LEFTMOUSE, PADENTER, RETKEY) && event->val == KM_PRESS) { /* Calculate the size of the button */ - width = abs(BLI_RCT_SIZE_X(&but->rect)); - height = abs(BLI_RCT_SIZE_Y(&but->rect)); + width = abs(BLI_rctf_size_x(&but->rect)); + height = abs(BLI_rctf_size_y(&but->rect)); butw = floor(width / 12); buth = floor(height / 6); @@ -4268,7 +4268,7 @@ static int ui_numedit_but_TRACKPREVIEW(bContext *C, uiBut *but, uiHandleButtonDa if (in_scope_resize_zone(but, data->dragstartx, data->dragstarty)) { /* resize preview widget itself */ - scopes->track_preview_height = BLI_RCT_SIZE_Y(&but->rect) + (data->dragstarty - my); + scopes->track_preview_height = BLI_rctf_size_y(&but->rect) + (data->dragstarty - my); } else { if (!scopes->track_locked) { @@ -4276,8 +4276,8 @@ static int ui_numedit_but_TRACKPREVIEW(bContext *C, uiBut *but, uiHandleButtonDa scopes->marker = BKE_tracking_marker_ensure(scopes->track, scopes->framenr); scopes->marker->flag &= ~(MARKER_DISABLED | MARKER_TRACKED); - scopes->marker->pos[0] += -dx * scopes->slide_scale[0] / BLI_RCT_SIZE_X(&but->block->rect); - scopes->marker->pos[1] += -dy * scopes->slide_scale[1] / BLI_RCT_SIZE_Y(&but->block->rect); + scopes->marker->pos[0] += -dx * scopes->slide_scale[0] / BLI_rctf_size_x(&but->block->rect); + scopes->marker->pos[1] += -dy * scopes->slide_scale[1] / BLI_rctf_size_y(&but->block->rect); WM_event_add_notifier(C, NC_MOVIECLIP | NA_EDITED, NULL); } diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 928e1671cee..d90d653e841 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -473,7 +473,7 @@ extern int ui_handler_panel_region(struct bContext *C, struct wmEvent *event); extern void ui_draw_aligned_panel(struct uiStyle *style, uiBlock *block, rcti *rect); /* interface_draw.c */ -extern void ui_dropshadow(rctf *rct, float radius, float aspect, float alpha, int select); +extern void ui_dropshadow(const rctf *rct, float radius, float aspect, float alpha, int select); void ui_draw_gradient(rcti *rect, const float hsv[3], const int type, const float alpha); diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 803fd928085..8ffbcd6d399 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -239,10 +239,8 @@ static void ui_item_size(uiItem *item, int *r_w, int *r_h) if (item->type == ITEM_BUTTON) { uiButtonItem *bitem = (uiButtonItem *)item; - - - if (r_w) *r_w = BLI_RCT_SIZE_X(&bitem->but->rect); - if (r_h) *r_h = BLI_RCT_SIZE_Y(&bitem->but->rect); + if (r_w) *r_w = BLI_rctf_size_x(&bitem->but->rect); + if (r_h) *r_h = BLI_rctf_size_y(&bitem->but->rect); } else { uiLayout *litem = (uiLayout *)item; diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index fa3e04d1351..49e96bea6c6 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -357,14 +357,14 @@ void UI_DrawTriIcon(float x, float y, char dir) } /* triangle 'icon' inside rect */ -static void ui_draw_tria_rect(rctf *rect, char dir) +static void ui_draw_tria_rect(const rctf *rect, char dir) { if (dir == 'h') { - float half = 0.5f * BLI_RCT_SIZE_Y(rect); + float half = 0.5f * BLI_rctf_size_y(rect); ui_draw_anti_tria(rect->xmin, rect->ymin, rect->xmin, rect->ymax, rect->xmax, rect->ymin + half); } else { - float half = 0.5f * BLI_RCT_SIZE_X(rect); + float half = 0.5f * BLI_rctf_size_x(rect); ui_draw_anti_tria(rect->xmin, rect->ymax, rect->xmax, rect->ymax, rect->xmin + half, rect->ymin); } } @@ -479,12 +479,12 @@ static void ui_draw_aligned_panel_header(uiStyle *style, uiBlock *block, rcti *r } } -static void rectf_scale(rctf *rect, float scale) +static void rectf_scale(rctf *rect, const float scale) { - float centx = 0.5f * (rect->xmin + rect->xmax); - float centy = 0.5f * (rect->ymin + rect->ymax); - float sizex = 0.5f * scale * BLI_RCT_SIZE_X(rect); - float sizey = 0.5f * scale * BLI_RCT_SIZE_Y(rect); + float centx = BLI_rctf_cent_x(rect); + float centy = BLI_rctf_cent_y(rect); + float sizex = BLI_rctf_size_x(rect) * 0.5f * scale; + float sizey = BLI_rctf_size_y(rect) * 0.5f * scale; rect->xmin = centx - sizex; rect->xmax = centx + sizex; @@ -547,7 +547,7 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect) /* itemrect smaller */ itemrect.xmax = headrect.xmax - 5.0f / block->aspect; - itemrect.xmin = itemrect.xmax - BLI_RCT_SIZE_Y(&headrect); + itemrect.xmin = itemrect.xmax - BLI_rcti_size_y(&headrect); itemrect.ymin = headrect.ymin; itemrect.ymax = headrect.ymax; @@ -596,7 +596,7 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, rcti *rect) /* itemrect smaller */ itemrect.xmin = headrect.xmin + 5.0f / block->aspect; - itemrect.xmax = itemrect.xmin + BLI_RCT_SIZE_Y(&headrect); + itemrect.xmax = itemrect.xmin + BLI_rcti_size_y(&headrect); itemrect.ymin = headrect.ymin; itemrect.ymax = headrect.ymax; @@ -985,8 +985,8 @@ static void ui_do_drag(const bContext *C, wmEvent *event, Panel *panel) dx = (event->x - data->startx) & ~(PNL_GRID - 1); dy = (event->y - data->starty) & ~(PNL_GRID - 1); - dx *= (float)BLI_RCT_SIZE_X(&ar->v2d.cur) / (float)BLI_RCT_SIZE_X(&ar->winrct); - dy *= (float)BLI_RCT_SIZE_Y(&ar->v2d.cur) / (float)BLI_RCT_SIZE_Y(&ar->winrct); + dx *= (float)BLI_rctf_size_x(&ar->v2d.cur) / (float)BLI_rcti_size_x(&ar->winrct); + dy *= (float)BLI_rctf_size_y(&ar->v2d.cur) / (float)BLI_rcti_size_y(&ar->winrct); if (data->state == PANEL_STATE_DRAG_SCALE) { panel->sizex = MAX2(data->startsizex + dx, UI_PANEL_MINX); diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index dc9347b3852..d5300bffe6f 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -393,7 +393,7 @@ static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *ar) /* draw text */ uiStyleFontSet(&data->fstyle); - bbox.ymax = bbox.ymax - 0.5f * (BLI_RCT_SIZE_Y(&bbox) - data->toth); + bbox.ymax = bbox.ymax - 0.5f * (BLI_rcti_size_y(&bbox) - data->toth); bbox.ymin = bbox.ymax - data->lineh; for (i = 0; i < data->totline; i++) { @@ -732,9 +732,9 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) /* widget rect, in region coords */ data->bbox.xmin = MENU_SHADOW_SIDE; - data->bbox.xmax = BLI_RCT_SIZE_X(&rect_i) + MENU_SHADOW_SIDE; + data->bbox.xmax = BLI_rcti_size_x(&rect_i) + MENU_SHADOW_SIDE; data->bbox.ymin = MENU_SHADOW_BOTTOM; - data->bbox.ymax = BLI_RCT_SIZE_Y(&rect_i) + MENU_SHADOW_BOTTOM; + data->bbox.ymax = BLI_rcti_size_y(&rect_i) + MENU_SHADOW_BOTTOM; /* region bigger for shadow */ ar->winrct.xmin = rect_i.xmin - MENU_SHADOW_SIDE; @@ -867,8 +867,8 @@ static void ui_searchbox_butrect(rcti *rect, uiSearchboxData *data, int itemnr) { /* thumbnail preview */ if (data->preview) { - int butw = BLI_RCT_SIZE_X(&data->bbox) / data->prv_cols; - int buth = (BLI_RCT_SIZE_Y(&data->bbox) - 2 * MENU_TOP) / data->prv_rows; + int butw = BLI_rcti_size_x(&data->bbox) / data->prv_cols; + int buth = (BLI_rcti_size_y(&data->bbox) - 2 * MENU_TOP) / data->prv_rows; int row, col; *rect = data->bbox; @@ -884,7 +884,7 @@ static void ui_searchbox_butrect(rcti *rect, uiSearchboxData *data, int itemnr) } /* list view */ else { - int buth = (BLI_RCT_SIZE_Y(&data->bbox) - 2 * MENU_TOP) / SEARCH_ITEMS; + int buth = (BLI_rcti_size_y(&data->bbox) - 2 * MENU_TOP) / SEARCH_ITEMS; *rect = data->bbox; rect->xmin = data->bbox.xmin + 3.0f; @@ -1097,13 +1097,13 @@ static void ui_searchbox_region_draw_cb(const bContext *UNUSED(C), ARegion *ar) if (data->items.more) { ui_searchbox_butrect(&rect, data, data->items.maxitem - 1); glEnable(GL_BLEND); - UI_icon_draw((BLI_RCT_SIZE_X(&rect)) / 2, rect.ymin - 9, ICON_TRIA_DOWN); + UI_icon_draw((BLI_rcti_size_x(&rect)) / 2, rect.ymin - 9, ICON_TRIA_DOWN); glDisable(GL_BLEND); } if (data->items.offset) { ui_searchbox_butrect(&rect, data, 0); glEnable(GL_BLEND); - UI_icon_draw((BLI_RCT_SIZE_X(&rect)) / 2, rect.ymax - 7, ICON_TRIA_UP); + UI_icon_draw((BLI_rcti_size_x(&rect)) / 2, rect.ymax - 7, ICON_TRIA_UP); glDisable(GL_BLEND); } } @@ -1178,16 +1178,16 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but) /* widget rect, in region coords */ data->bbox.xmin = MENU_SHADOW_SIDE; - data->bbox.xmax = BLI_RCT_SIZE_X(&ar->winrct) - MENU_SHADOW_SIDE; + data->bbox.xmax = BLI_rcti_size_x(&ar->winrct) - MENU_SHADOW_SIDE; data->bbox.ymin = MENU_SHADOW_BOTTOM; - data->bbox.ymax = BLI_RCT_SIZE_Y(&ar->winrct) - MENU_SHADOW_BOTTOM; + data->bbox.ymax = BLI_rcti_size_y(&ar->winrct) - MENU_SHADOW_BOTTOM; /* check if button is lower half */ - if (but->rect.ymax < BLI_RCT_CENTER_Y(&but->block->rect)) { - data->bbox.ymin += BLI_RCT_SIZE_Y(&but->rect); + if (but->rect.ymax < BLI_rctf_cent_y(&but->block->rect)) { + data->bbox.ymin += BLI_rctf_size_y(&but->rect); } else { - data->bbox.ymax -= BLI_RCT_SIZE_Y(&but->rect); + data->bbox.ymax -= BLI_rctf_size_y(&but->rect); } } else { @@ -1202,7 +1202,7 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but) BLI_rctf_translate(&rect_fl, ofsx, ofsy); /* minimal width */ - if (BLI_RCT_SIZE_X(&rect_fl) < 150) { + if (BLI_rctf_size_x(&rect_fl) < 150) { rect_fl.xmax = rect_fl.xmin + 150; /* XXX arbitrary */ } @@ -1235,15 +1235,15 @@ ARegion *ui_searchbox_create(bContext *C, ARegion *butregion, uiBut *but) UI_view2d_to_region_no_clip(&butregion->v2d, 0, but->rect.ymax + ofsy, NULL, &newy1); newy1 += butregion->winrct.ymin; - rect_i.ymax = BLI_RCT_SIZE_Y(&rect_i) + newy1; + rect_i.ymax = BLI_rcti_size_y(&rect_i) + newy1; rect_i.ymin = newy1; } /* widget rect, in region coords */ data->bbox.xmin = MENU_SHADOW_SIDE; - data->bbox.xmax = BLI_RCT_SIZE_X(&rect_i) + MENU_SHADOW_SIDE; + data->bbox.xmax = BLI_rcti_size_x(&rect_i) + MENU_SHADOW_SIDE; data->bbox.ymin = MENU_SHADOW_BOTTOM; - data->bbox.ymax = BLI_RCT_SIZE_Y(&rect_i) + MENU_SHADOW_BOTTOM; + data->bbox.ymax = BLI_rcti_size_y(&rect_i) + MENU_SHADOW_BOTTOM; /* region bigger for shadow */ ar->winrct.xmin = rect_i.xmin - MENU_SHADOW_SIDE; @@ -1358,15 +1358,15 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but, } } - /* aspect = (float)(BLI_RCT_SIZE_X(&block->rect) + 4);*/ /*UNUSED*/ + /* aspect = (float)(BLI_rcti_size_x(&block->rect) + 4);*/ /*UNUSED*/ ui_block_to_window_fl(butregion, but->block, &block->rect.xmin, &block->rect.ymin); ui_block_to_window_fl(butregion, but->block, &block->rect.xmax, &block->rect.ymax); //block->rect.xmin -= 2.0; block->rect.ymin -= 2.0; //block->rect.xmax += 2.0; block->rect.ymax += 2.0; - xsize = BLI_RCT_SIZE_X(&block->rect) + 4; /* 4 for shadow */ - ysize = BLI_RCT_SIZE_Y(&block->rect) + 4; + xsize = BLI_rctf_size_x(&block->rect) + 4; /* 4 for shadow */ + ysize = BLI_rctf_size_y(&block->rect) + 4; /* aspect /= (float)xsize;*/ /*UNUSED*/ { @@ -1497,8 +1497,8 @@ static void ui_block_position(wmWindow *window, ARegion *butregion, uiBut *but, /* safety calculus */ { - const float midx = BLI_RCT_CENTER_X(&butrct); - const float midy = BLI_RCT_CENTER_Y(&butrct); + const float midx = BLI_rctf_cent_x(&butrct); + const float midy = BLI_rctf_cent_y(&butrct); /* when you are outside parent button, safety there should be smaller */ @@ -2343,7 +2343,7 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi if (pup->but) { /* minimum width to enforece */ - minwidth = BLI_RCT_SIZE_X(&pup->but->rect); + minwidth = BLI_rctf_size_x(&pup->but->rect); if (pup->but->type == PULLDOWN || pup->but->menu_create_func) { direction = UI_DOWN; @@ -2385,7 +2385,7 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi * button, so it doesn't overlap the text too much, also note * the offset is negative because we are inverse moving the * block to be under the mouse */ - offset[0] = -(bt->rect.xmin + 0.8f * BLI_RCT_SIZE_X(&bt->rect)); + offset[0] = -(bt->rect.xmin + 0.8f * BLI_rctf_size_x(&bt->rect)); offset[1] = -(bt->rect.ymin + 0.5f * UI_UNIT_Y); } else { @@ -2393,7 +2393,7 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi * on the first item */ offset[0] = 0; for (bt = block->buttons.first; bt; bt = bt->next) - offset[0] = mini(offset[0], -(bt->rect.xmin + 0.8f * BLI_RCT_SIZE_X(&bt->rect))); + offset[0] = mini(offset[0], -(bt->rect.xmin + 0.8f * BLI_rctf_size_x(&bt->rect))); offset[1] = 1.5 * UI_UNIT_Y; } diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c index b16250021d3..acf7712f97b 100644 --- a/source/blender/editors/interface/interface_style.c +++ b/source/blender/editors/interface/interface_style.c @@ -152,17 +152,17 @@ void uiStyleFontDrawExt(uiFontStyle *fs, rcti *rect, const char *str, uiStyleFontSet(fs); height = BLF_ascender(fs->uifont_id); - yofs = ceil(0.5f * (BLI_RCT_SIZE_Y(rect) - height)); + yofs = ceil(0.5f * (BLI_rcti_size_y(rect) - height)); if (fs->align == UI_STYLE_TEXT_CENTER) { - xofs = floor(0.5f * (BLI_RCT_SIZE_X(rect) - BLF_width(fs->uifont_id, str))); + xofs = floor(0.5f * (BLI_rcti_size_x(rect) - BLF_width(fs->uifont_id, str))); /* don't center text if it chops off the start of the text, 2 gives some margin */ if (xofs < 2) { xofs = 2; } } else if (fs->align == UI_STYLE_TEXT_RIGHT) { - xofs = BLI_RCT_SIZE_X(rect) - BLF_width(fs->uifont_id, str) - 1; + xofs = BLI_rcti_size_x(rect) - BLF_width(fs->uifont_id, str) - 1; } /* clip is very strict, so we give it some space */ @@ -209,7 +209,7 @@ void uiStyleFontDrawRotated(uiFontStyle *fs, rcti *rect, const char *str) height = BLF_ascender(fs->uifont_id); /* becomes x-offset when rotated */ - xofs = ceil(0.5f * (BLI_RCT_SIZE_Y(rect) - height)); + xofs = ceil(0.5f * (BLI_rcti_size_y(rect) - height)); /* ignore UI_STYLE, always aligned to top */ @@ -219,8 +219,8 @@ void uiStyleFontDrawRotated(uiFontStyle *fs, rcti *rect, const char *str) angle = 90.0f; /* translate rect to vertical */ - txtrect.xmin = rect->xmin - BLI_RCT_SIZE_Y(rect); - txtrect.ymin = rect->ymin - BLI_RCT_SIZE_X(rect); + txtrect.xmin = rect->xmin - BLI_rcti_size_y(rect); + txtrect.ymin = rect->ymin - BLI_rcti_size_x(rect); txtrect.xmax = rect->xmin; txtrect.ymax = rect->ymin; diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 79b9d313775..6ae653bde90 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -1379,7 +1379,7 @@ 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) { uiBut *bt; - float unit = BLI_RCT_SIZE_X(butr) / 14.0f; + float unit = BLI_rctf_size_x(butr) / 14.0f; float xs = butr->xmin; uiBlockBeginAlign(block); @@ -1405,7 +1405,7 @@ static void colorband_buttons_small(uiLayout *layout, uiBlock *block, ColorBand TIP_("Set interpolation between color stops")); uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL); - bt = uiDefBut(block, BUT_COLORBAND, 0, "", xs, butr->ymin, BLI_RCT_SIZE_X(butr), UI_UNIT_Y, coba, 0, 0, 0, 0, ""); + bt = uiDefBut(block, BUT_COLORBAND, 0, "", xs, butr->ymin, BLI_rctf_size_x(butr), UI_UNIT_Y, coba, 0, 0, 0, 0, ""); uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL); uiBlockEndAlign(block); @@ -1480,7 +1480,7 @@ void uiTemplateHistogram(uiLayout *layout, PointerRNA *ptr, const char *propname hist->height = (hist->height <= UI_UNIT_Y) ? UI_UNIT_Y : hist->height; - bt = uiDefBut(block, HISTOGRAM, 0, "", rect.xmin, rect.ymin, BLI_RCT_SIZE_X(&rect), hist->height, hist, 0, 0, 0, 0, ""); + bt = uiDefBut(block, HISTOGRAM, 0, "", rect.xmin, rect.ymin, BLI_rctf_size_x(&rect), hist->height, hist, 0, 0, 0, 0, ""); uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL); MEM_freeN(cb); @@ -1517,7 +1517,7 @@ void uiTemplateWaveform(uiLayout *layout, PointerRNA *ptr, const char *propname) scopes->wavefrm_height = (scopes->wavefrm_height <= UI_UNIT_Y) ? UI_UNIT_Y : scopes->wavefrm_height; - bt = uiDefBut(block, WAVEFORM, 0, "", rect.xmin, rect.ymin, BLI_RCT_SIZE_X(&rect), scopes->wavefrm_height, scopes, 0, 0, 0, 0, ""); + bt = uiDefBut(block, WAVEFORM, 0, "", rect.xmin, rect.ymin, BLI_rctf_size_x(&rect), scopes->wavefrm_height, scopes, 0, 0, 0, 0, ""); (void)bt; /* UNUSED */ MEM_freeN(cb); @@ -1554,7 +1554,7 @@ void uiTemplateVectorscope(uiLayout *layout, PointerRNA *ptr, const char *propna scopes->vecscope_height = (scopes->vecscope_height <= UI_UNIT_Y) ? UI_UNIT_Y : scopes->vecscope_height; - bt = uiDefBut(block, VECTORSCOPE, 0, "", rect.xmin, rect.ymin, BLI_RCT_SIZE_X(&rect), scopes->vecscope_height, scopes, 0, 0, 0, 0, ""); + bt = uiDefBut(block, VECTORSCOPE, 0, "", rect.xmin, rect.ymin, BLI_rctf_size_x(&rect), scopes->vecscope_height, scopes, 0, 0, 0, 0, ""); uiButSetNFunc(bt, rna_update_cb, MEM_dupallocN(cb), NULL); MEM_freeN(cb); @@ -1569,11 +1569,11 @@ static void curvemap_buttons_zoom_in(bContext *C, void *cumap_v, void *UNUSED(ar float d; /* we allow 20 times zoom */ - if (BLI_RCT_SIZE_X(&cumap->curr) > 0.04f * BLI_RCT_SIZE_X(&cumap->clipr)) { - d = 0.1154f * BLI_RCT_SIZE_X(&cumap->curr); + if (BLI_rctf_size_x(&cumap->curr) > 0.04f * BLI_rctf_size_x(&cumap->clipr)) { + d = 0.1154f * BLI_rctf_size_x(&cumap->curr); cumap->curr.xmin += d; cumap->curr.xmax -= d; - d = 0.1154f * BLI_RCT_SIZE_Y(&cumap->curr); + d = 0.1154f * BLI_rctf_size_y(&cumap->curr); cumap->curr.ymin += d; cumap->curr.ymax -= d; } @@ -1587,8 +1587,8 @@ static void curvemap_buttons_zoom_out(bContext *C, void *cumap_v, void *UNUSED(u float d, d1; /* we allow 20 times zoom, but don't view outside clip */ - if (BLI_RCT_SIZE_X(&cumap->curr) < 20.0f * BLI_RCT_SIZE_X(&cumap->clipr)) { - d = d1 = 0.15f * BLI_RCT_SIZE_X(&cumap->curr); + if (BLI_rctf_size_x(&cumap->curr) < 20.0f * BLI_rctf_size_x(&cumap->clipr)) { + d = d1 = 0.15f * BLI_rctf_size_x(&cumap->curr); if (cumap->flag & CUMA_DO_CLIP) if (cumap->curr.xmin - d < cumap->clipr.xmin) @@ -1601,7 +1601,7 @@ static void curvemap_buttons_zoom_out(bContext *C, void *cumap_v, void *UNUSED(u d1 = -cumap->curr.xmax + cumap->clipr.xmax; cumap->curr.xmax += d1; - d = d1 = 0.15f * BLI_RCT_SIZE_Y(&cumap->curr); + d = d1 = 0.15f * BLI_rctf_size_y(&cumap->curr); if (cumap->flag & CUMA_DO_CLIP) if (cumap->curr.ymin - d < cumap->clipr.ymin) diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 8a7f2d9ca47..6446e7b2808 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -259,8 +259,8 @@ static int round_box_shadow_edges(float (*vert)[2], rcti *rect, float rad, int r rad += step; - if (2.0f * rad > BLI_RCT_SIZE_Y(rect)) - rad = 0.5f * BLI_RCT_SIZE_Y(rect); + if (2.0f * rad > BLI_rcti_size_y(rect)) + rad = 0.5f * BLI_rcti_size_y(rect); minx = rect->xmin - step; miny = rect->ymin - step; @@ -345,8 +345,8 @@ static void round_box__edges(uiWidgetBase *wt, int roundboxalign, rcti *rect, fl const int vnum = ((roundboxalign & (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT)) == (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT) || (roundboxalign & (UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT)) == (UI_CNR_TOP_RIGHT | UI_CNR_BOTTOM_RIGHT)) ? 1 : 2; - minsize = mini(BLI_RCT_SIZE_X(rect) * hnum, - BLI_RCT_SIZE_Y(rect) * vnum); + minsize = mini(BLI_rcti_size_x(rect) * hnum, + BLI_rcti_size_y(rect) * vnum); if (2.0f * rad > minsize) rad = 0.5f * minsize; @@ -491,7 +491,7 @@ static void widget_num_tria(uiWidgetTrias *tria, rcti *rect, float triasize, cha float centx, centy, sizex, sizey, minsize; int a, i1 = 0, i2 = 1; - minsize = mini(BLI_RCT_SIZE_X(rect), BLI_RCT_SIZE_Y(rect)); + minsize = mini(BLI_rcti_size_x(rect), BLI_rcti_size_y(rect)); /* center position and size */ centx = (float)rect->xmin + 0.5f * minsize; @@ -526,7 +526,7 @@ static void widget_scroll_circle(uiWidgetTrias *tria, rcti *rect, float triasize float centx, centy, sizex, sizey, minsize; int a, i1 = 0, i2 = 1; - minsize = mini(BLI_RCT_SIZE_X(rect), BLI_RCT_SIZE_Y(rect)); + minsize = mini(BLI_rcti_size_x(rect), BLI_rcti_size_y(rect)); /* center position and size */ centx = (float)rect->xmin + 0.5f * minsize; @@ -570,14 +570,14 @@ static void widget_menu_trias(uiWidgetTrias *tria, rcti *rect) int a; /* center position and size */ - centx = rect->xmax - 0.5f * BLI_RCT_SIZE_Y(rect); - centy = rect->ymin + 0.5f * BLI_RCT_SIZE_Y(rect); - size = 0.4f * BLI_RCT_SIZE_Y(rect); + centx = rect->xmax - 0.5f * BLI_rcti_size_y(rect); + centy = rect->ymin + 0.5f * BLI_rcti_size_y(rect); + size = 0.4f * BLI_rcti_size_y(rect); /* XXX exception */ - asp = ((float)BLI_RCT_SIZE_X(rect)) / ((float)BLI_RCT_SIZE_Y(rect)); + asp = ((float)BLI_rcti_size_x(rect)) / ((float)BLI_rcti_size_y(rect)); if (asp > 1.2f && asp < 2.6f) - centx = rect->xmax - 0.3f * BLI_RCT_SIZE_Y(rect); + centx = rect->xmax - 0.3f * BLI_rcti_size_y(rect); for (a = 0; a < 6; a++) { tria->vec[a][0] = size * menu_tria_vert[a][0] + centx; @@ -594,9 +594,9 @@ static void widget_check_trias(uiWidgetTrias *tria, rcti *rect) int a; /* center position and size */ - centx = rect->xmin + 0.5f * BLI_RCT_SIZE_Y(rect); - centy = rect->ymin + 0.5f * BLI_RCT_SIZE_Y(rect); - size = 0.5f * BLI_RCT_SIZE_Y(rect); + centx = rect->xmin + 0.5f * BLI_rcti_size_y(rect); + centy = rect->ymin + 0.5f * BLI_rcti_size_y(rect); + size = 0.5f * BLI_rcti_size_y(rect); for (a = 0; a < 6; a++) { tria->vec[a][0] = size * check_tria_vert[a][0] + centx; @@ -840,8 +840,8 @@ static void widget_draw_preview(BIFIconID icon, float UNUSED(alpha), rcti *rect) if (icon == ICON_NONE) return; - w = BLI_RCT_SIZE_X(rect); - h = BLI_RCT_SIZE_Y(rect); + w = BLI_rcti_size_x(rect); + h = BLI_rcti_size_y(rect); size = MIN2(w, h); size -= PREVIEW_PAD * 2; /* padding */ @@ -969,7 +969,7 @@ static void ui_text_clip_give_next_off(uiBut *but) static void ui_text_leftclip(uiFontStyle *fstyle, uiBut *but, rcti *rect) { int border = (but->flag & UI_BUT_ALIGN_RIGHT) ? 8 : 10; - int okwidth = BLI_RCT_SIZE_X(rect) - border; + int okwidth = BLI_rcti_size_x(rect) - border; if (but->flag & UI_HAS_ICON) okwidth -= UI_DPI_ICON_SIZE; @@ -1032,7 +1032,7 @@ static void ui_text_leftclip(uiFontStyle *fstyle, uiBut *but, rcti *rect) static void ui_text_label_rightclip(uiFontStyle *fstyle, uiBut *but, rcti *rect) { int border = (but->flag & UI_BUT_ALIGN_RIGHT) ? 8 : 10; - int okwidth = BLI_RCT_SIZE_X(rect) - border; + int okwidth = BLI_rcti_size_x(rect) - border; char *cpoin = NULL; char *cpend = but->drawstr + strlen(but->drawstr); @@ -1266,7 +1266,7 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB } else if (but->type == MENU && (but->flag & UI_BUT_NODE_LINK)) { int tmp = rect->xmin; - rect->xmin = rect->xmax - BLI_RCT_SIZE_Y(rect) - 1; + rect->xmin = rect->xmax - BLI_rcti_size_y(rect) - 1; widget_draw_icon(but, ICON_LAYER_USED, 1.0f, rect); rect->xmin = tmp; } @@ -1761,8 +1761,8 @@ static void widget_softshadow(rcti *rect, int roundboxalign, float radin, float float quad_strip[WIDGET_SIZE_MAX * 2][2]; /* prevent tooltips to not show round shadow */ - if (2.0f * radout > 0.2f * BLI_RCT_SIZE_Y(&rect1)) - rect1.ymax -= 0.2f * BLI_RCT_SIZE_Y(&rect1); + if (2.0f * radout > 0.2f * BLI_rcti_size_y(&rect1)) + rect1.ymax -= 0.2f * BLI_rcti_size_y(&rect1); else rect1.ymax -= 2.0f * radout; @@ -1844,14 +1844,14 @@ static void ui_hsv_cursor(float x, float y) void ui_hsvcircle_vals_from_pos(float *valrad, float *valdist, rcti *rect, float mx, float my) { /* duplication of code... well, simple is better now */ - float centx = BLI_RCT_CENTER_X_FL(rect); - float centy = BLI_RCT_CENTER_Y_FL(rect); + float centx = BLI_rcti_cent_x_fl(rect); + float centy = BLI_rcti_cent_y_fl(rect); float radius, dist; - if (BLI_RCT_SIZE_X(rect) > BLI_RCT_SIZE_Y(rect)) - radius = (float)BLI_RCT_SIZE_Y(rect) / 2; + if (BLI_rcti_size_x(rect) > BLI_rcti_size_y(rect)) + radius = (float)BLI_rcti_size_y(rect) / 2; else - radius = (float)BLI_RCT_SIZE_X(rect) / 2; + radius = (float)BLI_rcti_size_x(rect) / 2; mx -= centx; my -= centy; @@ -1877,13 +1877,13 @@ static void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect) color_profile = FALSE; radstep = 2.0f * (float)M_PI / (float)tot; - centx = BLI_RCT_CENTER_X_FL(rect); - centy = BLI_RCT_CENTER_Y_FL(rect); + centx = BLI_rcti_cent_x_fl(rect); + centy = BLI_rcti_cent_y_fl(rect); - if (BLI_RCT_SIZE_X(rect) > BLI_RCT_SIZE_Y(rect)) - radius = (float)BLI_RCT_SIZE_Y(rect) / 2; + if (BLI_rcti_size_x(rect) > BLI_rcti_size_y(rect)) + radius = (float)BLI_rcti_size_y(rect) / 2; else - radius = (float)BLI_RCT_SIZE_X(rect) / 2; + radius = (float)BLI_rcti_size_x(rect) / 2; /* color */ ui_get_but_vectorf(but, rgb); @@ -2062,10 +2062,10 @@ void ui_draw_gradient(rcti *rect, const float hsv[3], const int type, const floa } /* rect */ - sx1 = rect->xmin + dx * BLI_RCT_SIZE_X(rect); - sx2 = rect->xmin + (dx + color_step) * BLI_RCT_SIZE_X(rect); + sx1 = rect->xmin + dx * BLI_rcti_size_x(rect); + sx2 = rect->xmin + (dx + color_step) * BLI_rcti_size_x(rect); sy = rect->ymin; - dy = BLI_RCT_SIZE_Y(rect) / 3.0; + dy = BLI_rcti_size_y(rect) / 3.0; glBegin(GL_QUADS); for (a = 0; a < 3; a++, sy += dy) { @@ -2120,8 +2120,8 @@ static void ui_draw_but_HSVCUBE(uiBut *but, rcti *rect) } /* cursor */ - x = rect->xmin + x * BLI_RCT_SIZE_X(rect); - y = rect->ymin + y * BLI_RCT_SIZE_Y(rect); + x = rect->xmin + x * BLI_rcti_size_x(rect); + y = rect->ymin + y * BLI_rcti_size_y(rect); CLAMP(x, rect->xmin + 3.0f, rect->xmax - 3.0f); CLAMP(y, rect->ymin + 3.0f, rect->ymax - 3.0f); @@ -2136,7 +2136,7 @@ static void ui_draw_but_HSVCUBE(uiBut *but, rcti *rect) static void ui_draw_but_HSV_v(uiBut *but, rcti *rect) { uiWidgetBase wtb; - float rad = 0.5f * BLI_RCT_SIZE_X(rect); + float rad = 0.5f * BLI_rcti_size_x(rect); float x, y; float rgb[3], hsv[3], v, range; int color_profile = but->block->color_profile; @@ -2171,8 +2171,8 @@ static void ui_draw_but_HSV_v(uiBut *but, rcti *rect) widgetbase_draw(&wtb, &wcol_tmp); /* cursor */ - x = rect->xmin + 0.5f * BLI_RCT_SIZE_X(rect); - y = rect->ymin + v * BLI_RCT_SIZE_Y(rect); + x = rect->xmin + 0.5f * BLI_rcti_size_x(rect); + y = rect->ymin + v * BLI_rcti_size_y(rect); CLAMP(y, rect->ymin + 3.0f, rect->ymax - 3.0f); ui_hsv_cursor(x, y); @@ -2183,7 +2183,7 @@ static void ui_draw_but_HSV_v(uiBut *but, rcti *rect) /* ************ separator, for menus etc ***************** */ static void ui_draw_separator(rcti *rect, uiWidgetColors *wcol) { - int y = rect->ymin + BLI_RCT_SIZE_Y(rect) / 2 - 1; + int y = rect->ymin + BLI_rcti_size_y(rect) / 2 - 1; unsigned char col[4]; col[0] = wcol->text[0]; @@ -2202,7 +2202,7 @@ static void ui_draw_separator(rcti *rect, uiWidgetColors *wcol) static void widget_numbut(uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign) { uiWidgetBase wtb; - float rad = 0.5f * BLI_RCT_SIZE_Y(rect); + float rad = 0.5f * BLI_rcti_size_y(rect); float textofs = rad * 0.75f; if (state & UI_SELECT) @@ -2283,12 +2283,12 @@ void uiWidgetScrollDraw(uiWidgetColors *wcol, rcti *rect, rcti *slider, int stat widget_init(&wtb); /* determine horizontal/vertical */ - horizontal = (BLI_RCT_SIZE_X(rect) > BLI_RCT_SIZE_Y(rect)); + horizontal = (BLI_rcti_size_x(rect) > BLI_rcti_size_y(rect)); if (horizontal) - rad = 0.5f * BLI_RCT_SIZE_Y(rect); + rad = 0.5f * BLI_rcti_size_y(rect); else - rad = 0.5f * BLI_RCT_SIZE_X(rect); + rad = 0.5f * BLI_rcti_size_x(rect); wtb.shadedir = (horizontal) ? 1 : 0; @@ -2300,7 +2300,7 @@ void uiWidgetScrollDraw(uiWidgetColors *wcol, rcti *rect, rcti *slider, int stat widgetbase_draw(&wtb, wcol); /* slider */ - if ((BLI_RCT_SIZE_X(slider) < 2) || (BLI_RCT_SIZE_Y(slider) < 2)) { + if ((BLI_rcti_size_x(slider) < 2) || (BLI_rcti_size_y(slider) < 2)) { /* pass */ } else { @@ -2366,17 +2366,17 @@ static void widget_scroll(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat rect1 = *rect; /* determine horizontal/vertical */ - horizontal = (BLI_RCT_SIZE_X(rect) > BLI_RCT_SIZE_Y(rect)); + horizontal = (BLI_rcti_size_x(rect) > BLI_rcti_size_y(rect)); if (horizontal) { - fac = BLI_RCT_SIZE_X(rect) / size; + fac = BLI_rcti_size_x(rect) / size; rect1.xmin = rect1.xmin + ceilf(fac * ((float)value - but->softmin)); rect1.xmax = rect1.xmin + ceilf(fac * (but->a1 - but->softmin)); /* ensure minimium size */ - min = BLI_RCT_SIZE_Y(rect); + min = BLI_rcti_size_y(rect); - if (BLI_RCT_SIZE_X(&rect1) < min) { + if (BLI_rcti_size_x(&rect1) < min) { rect1.xmax = rect1.xmin + min; if (rect1.xmax > rect->xmax) { @@ -2386,14 +2386,14 @@ static void widget_scroll(uiBut *but, uiWidgetColors *wcol, rcti *rect, int stat } } else { - fac = BLI_RCT_SIZE_Y(rect) / size; + fac = BLI_rcti_size_y(rect) / size; rect1.ymax = rect1.ymax - ceilf(fac * ((float)value - but->softmin)); rect1.ymin = rect1.ymax - ceilf(fac * (but->a1 - but->softmin)); /* ensure minimium size */ - min = BLI_RCT_SIZE_X(rect); + min = BLI_rcti_size_x(rect); - if (BLI_RCT_SIZE_Y(&rect1) < min) { + if (BLI_rcti_size_y(&rect1) < min) { rect1.ymax = rect1.ymin + min; if (rect1.ymax > rect->ymax) { @@ -2421,10 +2421,10 @@ static void widget_progressbar(uiBut *but, uiWidgetColors *wcol, rcti *rect, int rect_prog.ymax = rect_prog.ymin + 4; rect_bar.ymax = rect_bar.ymin + 4; - w = value * BLI_RCT_SIZE_X(&rect_prog); + w = value * BLI_rcti_size_x(&rect_prog); /* ensure minimium size */ - min = BLI_RCT_SIZE_Y(&rect_prog); + min = BLI_rcti_size_y(&rect_prog); w = MAX2(w, min); rect_bar.xmax = rect_bar.xmin + w; @@ -2444,8 +2444,8 @@ static void widget_link(uiBut *but, uiWidgetColors *UNUSED(wcol), rcti *rect, in UI_ThemeColor(TH_TEXT_HI); - rectlink.xmin = BLI_RCT_CENTER_X(rect); - rectlink.ymin = BLI_RCT_CENTER_Y(rect); + rectlink.xmin = BLI_rcti_cent_x(rect); + rectlink.ymin = BLI_rcti_cent_y(rect); rectlink.xmax = but->linkto[0]; rectlink.ymax = but->linkto[1]; @@ -2467,7 +2467,7 @@ static void widget_numslider(uiBut *but, uiWidgetColors *wcol, rcti *rect, int s /* backdrop first */ /* fully rounded */ - offs = 0.5f * BLI_RCT_SIZE_Y(rect); + offs = 0.5f * BLI_rcti_size_y(rect); toffs = offs * 0.75f; round_box_edges(&wtb, roundboxalign, rect, offs); @@ -2488,7 +2488,7 @@ static void widget_numslider(uiBut *but, uiWidgetColors *wcol, rcti *rect, int s rect1 = *rect; value = ui_get_but_val(but); - fac = ((float)value - but->softmin) * (BLI_RCT_SIZE_X(&rect1) - offs) / (but->softmax - but->softmin); + fac = ((float)value - but->softmin) * (BLI_rcti_size_x(&rect1) - offs) / (but->softmax - but->softmin); /* left part of slider, always rounded */ rect1.xmax = rect1.xmin + ceil(offs + 1.0f); @@ -2621,7 +2621,7 @@ static void widget_menubut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), widgetbase_draw(&wtb, wcol); /* text space */ - rect->xmax -= BLI_RCT_SIZE_Y(rect); + rect->xmax -= BLI_rcti_size_y(rect); } static void widget_menuiconbut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign) @@ -2664,7 +2664,7 @@ static void widget_pulldownbut(uiWidgetColors *wcol, rcti *rect, int state, int { if (state & UI_ACTIVE) { uiWidgetBase wtb; - float rad = 0.5f * BLI_RCT_SIZE_Y(rect); /* 4.0f */ + float rad = 0.5f * BLI_rcti_size_y(rect); /* 4.0f */ widget_init(&wtb); @@ -2710,10 +2710,10 @@ static void widget_optionbut(uiWidgetColors *wcol, rcti *rect, int state, int UN widget_init(&wtb); /* square */ - recttemp.xmax = recttemp.xmin + BLI_RCT_SIZE_Y(&recttemp); + recttemp.xmax = recttemp.xmin + BLI_rcti_size_y(&recttemp); /* smaller */ - delta = 1 + BLI_RCT_SIZE_Y(&recttemp) / 8; + delta = 1 + BLI_rcti_size_y(&recttemp) / 8; recttemp.xmin += delta; recttemp.ymin += delta; recttemp.xmax -= delta; @@ -2730,7 +2730,7 @@ static void widget_optionbut(uiWidgetColors *wcol, rcti *rect, int state, int UN widgetbase_draw(&wtb, wcol); /* text space */ - rect->xmin += BLI_RCT_SIZE_Y(rect) * 0.7 + delta; + rect->xmin += BLI_rcti_size_y(rect) * 0.7 + delta; } @@ -2792,7 +2792,7 @@ static void widget_but(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int static void widget_roundbut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int roundboxalign) { uiWidgetBase wtb; - float rad = 5.0f; /* 0.5f * BLI_RCT_SIZE_Y(rect); */ + float rad = 5.0f; /* 0.5f * BLI_rcti_size_y(rect); */ widget_init(&wtb); @@ -3275,12 +3275,12 @@ void ui_draw_menu_back(uiStyle *UNUSED(style), uiBlock *block, rcti *rect) if (block->flag & UI_BLOCK_CLIPTOP) { /* XXX no scaling for UI here yet */ glColor3ubv((unsigned char *)wt->wcol.text); - UI_DrawTriIcon(BLI_RCT_CENTER_X(rect), rect->ymax - 8, 't'); + UI_DrawTriIcon(BLI_rcti_cent_x(rect), rect->ymax - 8, 't'); } if (block->flag & UI_BLOCK_CLIPBOTTOM) { /* XXX no scaling for UI here yet */ glColor3ubv((unsigned char *)wt->wcol.text); - UI_DrawTriIcon(BLI_RCT_CENTER_X(rect), rect->ymin + 10, 'v'); + UI_DrawTriIcon(BLI_rcti_cent_x(rect), rect->ymin + 10, 'v'); } } } diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index 9c71746d045..3de3f5502b5 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -96,11 +96,11 @@ static void view2d_masks(View2D *v2d) /* check size if: */ if (v2d->scroll & V2D_SCROLL_HORIZONTAL) if (!(v2d->scroll & V2D_SCROLL_SCALE_HORIZONTAL)) - if (BLI_RCT_SIZE_X(&v2d->tot) <= BLI_RCT_SIZE_X(&v2d->cur)) + if (BLI_rctf_size_x(&v2d->tot) <= BLI_rcti_size_x(&v2d->cur)) v2d->scroll |= V2D_SCROLL_HORIZONTAL_HIDE; if (v2d->scroll & V2D_SCROLL_VERTICAL) if (!(v2d->scroll & V2D_SCROLL_SCALE_VERTICAL)) - if (BLI_RCT_SIZE_Y(&v2d->tot) <= BLI_RCT_SIZE_Y(&v2d->cur)) + if (BLI_rctf_size_y(&v2d->tot) <= BLI_rctf_size_y(&v2d->cur)) v2d->scroll |= V2D_SCROLL_VERTICAL_HIDE; #endif scroll = view2d_scroll_mapped(v2d->scroll); @@ -328,8 +328,8 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize) rctf *cur, *tot; /* use mask as size of region that View2D resides in, as it takes into account scrollbars already */ - winx = (float)(BLI_RCT_SIZE_X(&v2d->mask) + 1); - winy = (float)(BLI_RCT_SIZE_Y(&v2d->mask) + 1); + winx = (float)(BLI_rcti_size_x(&v2d->mask) + 1); + winy = (float)(BLI_rcti_size_y(&v2d->mask) + 1); /* get pointers to rcts for less typing */ cur = &v2d->cur; @@ -347,10 +347,10 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize) * - firstly, we calculate the sizes of the rects * - curwidth and curheight are saved as reference... modify width and height values here */ - totwidth = BLI_RCT_SIZE_X(tot); - totheight = BLI_RCT_SIZE_Y(tot); - curwidth = width = BLI_RCT_SIZE_X(cur); - curheight = height = BLI_RCT_SIZE_Y(cur); + totwidth = BLI_rctf_size_x(tot); + totheight = BLI_rctf_size_y(tot); + curwidth = width = BLI_rctf_size_x(cur); + curheight = height = BLI_rctf_size_y(cur); /* if zoom is locked, size on the appropriate axis is reset to mask size */ if (v2d->keepzoom & V2D_LOCKZOOM_X) @@ -499,16 +499,16 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize) /* resize from centerpoint, unless otherwise specified */ if (width != curwidth) { if (v2d->keepofs & V2D_LOCKOFS_X) { - cur->xmax += width - BLI_RCT_SIZE_X(cur); + cur->xmax += width - BLI_rctf_size_x(cur); } else if (v2d->keepofs & V2D_KEEPOFS_X) { if (v2d->align & V2D_ALIGN_NO_POS_X) - cur->xmin -= width - BLI_RCT_SIZE_X(cur); + cur->xmin -= width - BLI_rctf_size_x(cur); else - cur->xmax += width - BLI_RCT_SIZE_X(cur); + cur->xmax += width - BLI_rctf_size_x(cur); } else { - temp = BLI_RCT_CENTER_X(cur); + temp = BLI_rctf_cent_x(cur); dh = width * 0.5f; cur->xmin = temp - dh; @@ -517,16 +517,16 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize) } if (height != curheight) { if (v2d->keepofs & V2D_LOCKOFS_Y) { - cur->ymax += height - BLI_RCT_SIZE_Y(cur); + cur->ymax += height - BLI_rctf_size_y(cur); } else if (v2d->keepofs & V2D_KEEPOFS_Y) { if (v2d->align & V2D_ALIGN_NO_POS_Y) - cur->ymin -= height - BLI_RCT_SIZE_Y(cur); + cur->ymin -= height - BLI_rctf_size_y(cur); else - cur->ymax += height - BLI_RCT_SIZE_Y(cur); + cur->ymax += height - BLI_rctf_size_y(cur); } else { - temp = BLI_RCT_CENTER_Y(cur); + temp = BLI_rctf_cent_y(cur); dh = height * 0.5f; cur->ymin = temp - dh; @@ -540,8 +540,8 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize) float temp, diff; /* recalculate extents of cur */ - curwidth = BLI_RCT_SIZE_X(cur); - curheight = BLI_RCT_SIZE_Y(cur); + curwidth = BLI_rctf_size_x(cur); + curheight = BLI_rctf_size_y(cur); /* width */ if ((curwidth > totwidth) && !(v2d->keepzoom & (V2D_KEEPZOOM | V2D_LOCKZOOM_X | V2D_LIMITZOOM))) { @@ -592,7 +592,7 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize) */ if ((cur->xmin < tot->xmin) && (cur->xmax > tot->xmax)) { /* outside boundaries on both sides, so take middle-point of tot, and place in balanced way */ - temp = BLI_RCT_CENTER_X(tot); + temp = BLI_rctf_cent_x(tot); diff = curheight * 0.5f; cur->xmin = temp - diff; @@ -642,7 +642,7 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize) */ if ((cur->ymin < tot->ymin) && (cur->ymax > tot->ymax)) { /* outside boundaries on both sides, so take middle-point of tot, and place in balanced way */ - temp = BLI_RCT_CENTER_Y(tot); + temp = BLI_rctf_cent_y(tot); diff = curheight * 0.5f; cur->ymin = temp - diff; @@ -791,8 +791,8 @@ void UI_view2d_curRect_reset(View2D *v2d) float width, height; /* assume width and height of 'cur' rect by default, should be same size as mask */ - width = (float)(BLI_RCT_SIZE_X(&v2d->mask) + 1); - height = (float)(BLI_RCT_SIZE_Y(&v2d->mask) + 1); + width = (float)(BLI_rcti_size_x(&v2d->mask) + 1); + height = (float)(BLI_rcti_size_y(&v2d->mask) + 1); /* handle width - posx and negx flags are mutually exclusive, so watch out */ if ((v2d->align & V2D_ALIGN_NO_POS_X) && !(v2d->align & V2D_ALIGN_NO_NEG_X)) { @@ -958,8 +958,8 @@ static void view2d_map_cur_using_mask(View2D *v2d, rctf *curmasked) *curmasked = v2d->cur; if (view2d_scroll_mapped(v2d->scroll)) { - float dx = BLI_RCT_SIZE_X(&v2d->cur) / ((float)(BLI_RCT_SIZE_X(&v2d->mask) + 1)); - float dy = BLI_RCT_SIZE_Y(&v2d->cur) / ((float)(BLI_RCT_SIZE_Y(&v2d->mask) + 1)); + float dx = BLI_rctf_size_x(&v2d->cur) / ((float)(BLI_rcti_size_x(&v2d->mask) + 1)); + float dy = BLI_rctf_size_y(&v2d->cur) / ((float)(BLI_rcti_size_y(&v2d->mask) + 1)); if (v2d->mask.xmin != 0) curmasked->xmin -= dx * (float)v2d->mask.xmin; @@ -985,8 +985,8 @@ void UI_view2d_view_ortho(View2D *v2d) */ /* XXX brecht: instead of zero at least use a tiny offset, otherwise * pixel rounding is effectively random due to float inaccuracy */ - xofs = 0.001f * BLI_RCT_SIZE_X(&v2d->cur) / BLI_RCT_SIZE_X(&v2d->mask); - yofs = 0.001f * BLI_RCT_SIZE_Y(&v2d->cur) / BLI_RCT_SIZE_Y(&v2d->mask); + xofs = 0.001f * BLI_rctf_size_x(&v2d->cur) / BLI_rcti_size_x(&v2d->mask); + yofs = 0.001f * BLI_rctf_size_y(&v2d->cur) / BLI_rcti_size_y(&v2d->mask); /* apply mask-based adjustments to cur rect (due to scrollers), to eliminate scaling artifacts */ view2d_map_cur_using_mask(v2d, &curmasked); @@ -1044,8 +1044,8 @@ void UI_view2d_view_orthoSpecial(ARegion *ar, View2D *v2d, short xaxis) void UI_view2d_view_restore(const bContext *C) { ARegion *ar = CTX_wm_region(C); - int width = BLI_RCT_SIZE_X(&ar->winrct) + 1; - int height = BLI_RCT_SIZE_Y(&ar->winrct) + 1; + int width = BLI_rcti_size_x(&ar->winrct) + 1; + int height = BLI_rcti_size_y(&ar->winrct) + 1; wmOrtho2(0.0f, (float)width, 0.0f, (float)height); glLoadIdentity(); @@ -1117,7 +1117,8 @@ static void step_to_grid(float *step, int *power, int unit) * - winx = width of region we're drawing to, note: not used but keeping for completeness. * - winy = height of region we're drawing into */ -View2DGrid *UI_view2d_grid_calc(Scene *scene, View2D *v2d, short xunits, short xclamp, short yunits, short yclamp, int UNUSED(winx), int winy) +View2DGrid *UI_view2d_grid_calc(Scene *scene, View2D *v2d, + short xunits, short xclamp, short yunits, short yclamp, int UNUSED(winx), int winy) { View2DGrid *grid; @@ -1140,8 +1141,8 @@ View2DGrid *UI_view2d_grid_calc(Scene *scene, View2D *v2d, short xunits, short x /* calculate x-axis grid scale (only if both args are valid) */ if (ELEM(V2D_ARG_DUMMY, xunits, xclamp) == 0) { - space = BLI_RCT_SIZE_X(&v2d->cur); - pixels = (float)BLI_RCT_SIZE_X(&v2d->mask); + space = BLI_rctf_size_x(&v2d->cur); + pixels = (float)BLI_rcti_size_x(&v2d->mask); if (pixels != 0.0f) { grid->dx = (U.v2d_min_gridsize * space) / (seconddiv * pixels); @@ -1158,7 +1159,7 @@ View2DGrid *UI_view2d_grid_calc(Scene *scene, View2D *v2d, short xunits, short x /* calculate y-axis grid scale (only if both args are valid) */ if (ELEM(V2D_ARG_DUMMY, yunits, yclamp) == 0) { - space = BLI_RCT_SIZE_Y(&v2d->cur); + space = BLI_rctf_size_y(&v2d->cur); pixels = (float)winy; grid->dy = U.v2d_min_gridsize * space / pixels; @@ -1206,7 +1207,7 @@ void UI_view2d_grid_draw(View2D *v2d, View2DGrid *grid, int flag) vec2[1] = v2d->cur.ymax; /* minor gridlines */ - step = (BLI_RCT_SIZE_X(&v2d->mask) + 1) / U.v2d_min_gridsize; + step = (BLI_rcti_size_x(&v2d->mask) + 1) / U.v2d_min_gridsize; UI_ThemeColor(TH_GRID); for (a = 0; a < step; a++) { @@ -1240,7 +1241,7 @@ void UI_view2d_grid_draw(View2D *v2d, View2DGrid *grid, int flag) vec1[0] = grid->startx; vec2[0] = v2d->cur.xmax; - step = (BLI_RCT_SIZE_Y(&v2d->mask) + 1) / U.v2d_min_gridsize; + step = (BLI_rcti_size_y(&v2d->mask) + 1) / U.v2d_min_gridsize; UI_ThemeColor(TH_GRID); for (a = 0; a <= step; a++) { @@ -1414,7 +1415,8 @@ struct View2DScrollers { }; /* Calculate relevant scroller properties */ -View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, short xunits, short xclamp, short yunits, short yclamp) +View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, + short xunits, short xclamp, short yunits, short yclamp) { View2DScrollers *scrollers; rcti vert, hor; @@ -1457,8 +1459,8 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, short /* horizontal scrollers */ if (scroll & V2D_SCROLL_HORIZONTAL) { /* scroller 'button' extents */ - totsize = BLI_RCT_SIZE_X(&v2d->tot); - scrollsize = (float)BLI_RCT_SIZE_X(&hor); + totsize = BLI_rctf_size_x(&v2d->tot); + scrollsize = (float)BLI_rcti_size_x(&hor); if (totsize == 0.0f) totsize = 1.0f; /* avoid divide by zero */ fac1 = (v2d->cur.xmin - v2d->tot.xmin) / totsize; @@ -1498,8 +1500,8 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, short /* vertical scrollers */ if (scroll & V2D_SCROLL_VERTICAL) { /* scroller 'button' extents */ - totsize = BLI_RCT_SIZE_Y(&v2d->tot); - scrollsize = (float)BLI_RCT_SIZE_Y(&vert); + totsize = BLI_rctf_size_y(&v2d->tot); + scrollsize = (float)BLI_rcti_size_y(&vert); if (totsize == 0.0f) totsize = 1.0f; /* avoid divide by zero */ fac1 = (v2d->cur.ymin - v2d->tot.ymin) / totsize; @@ -1547,7 +1549,7 @@ View2DScrollers *UI_view2d_scrollers_calc(const bContext *C, View2D *v2d, short scrollers->grid = UI_view2d_grid_calc(CTX_data_scene(C), v2d, xunits, xclamp, yunits, yclamp, - BLI_RCT_SIZE_X(&hor), BLI_RCT_SIZE_Y(&vert)); + BLI_rcti_size_x(&hor), BLI_rcti_size_y(&vert)); } /* return scrollers */ @@ -1631,7 +1633,7 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v */ if ((v2d->keepzoom & V2D_LOCKZOOM_X) == 0 && (v2d->scroll & V2D_SCROLL_SCALE_HORIZONTAL) && - (BLI_RCT_SIZE_X(&slider) > V2D_SCROLLER_HANDLE_SIZE)) + (BLI_rcti_size_x(&slider) > V2D_SCROLLER_HANDLE_SIZE)) { state |= UI_SCROLL_ARROWS; } @@ -1651,11 +1653,11 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v * - fac is x-coordinate to draw to * - dfac is gap between scale markings */ - fac = (grid->startx - v2d->cur.xmin) / BLI_RCT_SIZE_X(&v2d->cur); - fac = (float)hor.xmin + fac * BLI_RCT_SIZE_X(&hor); + fac = (grid->startx - v2d->cur.xmin) / BLI_rctf_size_x(&v2d->cur); + fac = (float)hor.xmin + fac * BLI_rcti_size_x(&hor); - dfac = grid->dx / BLI_RCT_SIZE_X(&v2d->cur); - dfac = dfac * BLI_RCT_SIZE_X(&hor); + dfac = grid->dx / BLI_rctf_size_x(&v2d->cur); + dfac = dfac * BLI_rcti_size_x(&hor); /* set starting value, and text color */ UI_ThemeColor(TH_TEXT); @@ -1742,7 +1744,7 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v */ if ((v2d->keepzoom & V2D_LOCKZOOM_Y) == 0 && (v2d->scroll & V2D_SCROLL_SCALE_VERTICAL) && - (BLI_RCT_SIZE_Y(&slider) > V2D_SCROLLER_HANDLE_SIZE)) + (BLI_rcti_size_y(&slider) > V2D_SCROLLER_HANDLE_SIZE)) { state |= UI_SCROLL_ARROWS; } @@ -1765,11 +1767,11 @@ void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *v * - these involve a correction for horizontal scrollbar * NOTE: it's assumed that that scrollbar is there if this is involved! */ - fac = (grid->starty - v2d->cur.ymin) / BLI_RCT_SIZE_Y(&v2d->cur); - fac = vert.ymin + fac * BLI_RCT_SIZE_Y(&vert); + fac = (grid->starty - v2d->cur.ymin) / BLI_rctf_size_y(&v2d->cur); + fac = vert.ymin + fac * BLI_rcti_size_y(&vert); - dfac = grid->dy / BLI_RCT_SIZE_Y(&v2d->cur); - dfac = dfac * BLI_RCT_SIZE_Y(&vert); + dfac = grid->dy / BLI_rctf_size_y(&v2d->cur); + dfac = dfac * BLI_rcti_size_y(&vert); /* set starting value, and text color */ UI_ThemeColor(TH_TEXT); @@ -1823,7 +1825,9 @@ void UI_view2d_scrollers_free(View2DScrollers *scrollers) * - column, row = the 2d-coordinates (in 2D-view / 'tot' rect space) the cell exists at * - rect = coordinates of the cell (passed as single var instead of 4 separate, as it's more useful this way) */ -void UI_view2d_listview_cell_to_view(View2D *v2d, short columnwidth, short rowheight, float startx, float starty, int column, int row, rctf *rect) +void UI_view2d_listview_cell_to_view(View2D *v2d, short columnwidth, short rowheight, + float startx, float starty, + int column, int row, rctf *rect) { /* sanity checks */ if (ELEM(NULL, v2d, rect)) { @@ -1927,17 +1931,17 @@ void UI_view2d_region_to_view(View2D *v2d, int x, int y, float *r_viewx, float * float div, ofs; if (r_viewx) { - div = (float)BLI_RCT_SIZE_X(&v2d->mask); + div = (float)BLI_rcti_size_x(&v2d->mask); ofs = (float)v2d->mask.xmin; - *r_viewx = v2d->cur.xmin + BLI_RCT_SIZE_X(&v2d->cur) * ((float)x - ofs) / div; + *r_viewx = v2d->cur.xmin + BLI_rctf_size_x(&v2d->cur) * ((float)x - ofs) / div; } if (r_viewy) { - div = (float)BLI_RCT_SIZE_Y(&v2d->mask); + div = (float)BLI_rcti_size_y(&v2d->mask); ofs = (float)v2d->mask.ymin; - *r_viewy = v2d->cur.ymin + BLI_RCT_SIZE_Y(&v2d->cur) * ((float)y - ofs) / div; + *r_viewy = v2d->cur.ymin + BLI_rctf_size_y(&v2d->cur) * ((float)y - ofs) / div; } } @@ -1956,15 +1960,15 @@ void UI_view2d_view_to_region(View2D *v2d, float x, float y, int *regionx, int * *regiony = V2D_IS_CLIPPED; /* express given coordinates as proportional values */ - x = (x - v2d->cur.xmin) / BLI_RCT_SIZE_X(&v2d->cur); - y = (y - v2d->cur.ymin) / BLI_RCT_SIZE_Y(&v2d->cur); + x = (x - v2d->cur.xmin) / BLI_rctf_size_x(&v2d->cur); + y = (y - v2d->cur.ymin) / BLI_rctf_size_y(&v2d->cur); /* check if values are within bounds */ if ((x >= 0.0f) && (x <= 1.0f) && (y >= 0.0f) && (y <= 1.0f)) { if (regionx) - *regionx = (int)(v2d->mask.xmin + x * BLI_RCT_SIZE_X(&v2d->mask)); + *regionx = (int)(v2d->mask.xmin + x * BLI_rcti_size_x(&v2d->mask)); if (regiony) - *regiony = (int)(v2d->mask.ymin + y * BLI_RCT_SIZE_Y(&v2d->mask)); + *regiony = (int)(v2d->mask.ymin + y * BLI_rcti_size_y(&v2d->mask)); } } @@ -1977,12 +1981,12 @@ void UI_view2d_view_to_region(View2D *v2d, float x, float y, int *regionx, int * void UI_view2d_to_region_no_clip(View2D *v2d, float x, float y, int *regionx, int *regiony) { /* step 1: express given coordinates as proportional values */ - x = (x - v2d->cur.xmin) / BLI_RCT_SIZE_X(&v2d->cur); - y = (y - v2d->cur.ymin) / BLI_RCT_SIZE_Y(&v2d->cur); + x = (x - v2d->cur.xmin) / BLI_rctf_size_x(&v2d->cur); + y = (y - v2d->cur.ymin) / BLI_rctf_size_y(&v2d->cur); /* step 2: convert proportional distances to screen coordinates */ - x = v2d->mask.xmin + x * BLI_RCT_SIZE_X(&v2d->mask); - y = v2d->mask.ymin + y * BLI_RCT_SIZE_Y(&v2d->mask); + x = v2d->mask.xmin + x * BLI_rcti_size_x(&v2d->mask); + y = v2d->mask.ymin + y * BLI_rcti_size_y(&v2d->mask); /* although we don't clamp to lie within region bounds, we must avoid exceeding size of ints */ if (regionx) { @@ -2035,8 +2039,8 @@ View2D *UI_view2d_fromcontext_rwin(const bContext *C) */ void UI_view2d_getscale(View2D *v2d, float *x, float *y) { - if (x) *x = BLI_RCT_SIZE_X(&v2d->mask) / BLI_RCT_SIZE_X(&v2d->cur); - if (y) *y = BLI_RCT_SIZE_Y(&v2d->mask) / BLI_RCT_SIZE_Y(&v2d->cur); + if (x) *x = BLI_rcti_size_x(&v2d->mask) / BLI_rctf_size_x(&v2d->cur); + if (y) *y = BLI_rcti_size_y(&v2d->mask) / BLI_rctf_size_y(&v2d->cur); } /* Check if mouse is within scrollers @@ -2142,7 +2146,7 @@ void UI_view2d_text_cache_draw(ARegion *ar) const char *str = (const char *)(v2s + 1); int xofs = 0, yofs; - yofs = ceil(0.5f * (BLI_RCT_SIZE_Y(&v2s->rect) - default_height)); + yofs = ceil(0.5f * (BLI_rcti_size_y(&v2s->rect) - default_height)); if (yofs < 1) yofs = 1; if (col_pack_prev != v2s->col.pack) { diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index 99313edc289..3d3f309a8d4 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -119,10 +119,10 @@ static int view_pan_init(bContext *C, wmOperator *op) vpd->ar = ar; /* calculate translation factor - based on size of view */ - winx = (float)(BLI_RCT_SIZE_X(&ar->winrct) + 1); - winy = (float)(BLI_RCT_SIZE_Y(&ar->winrct) + 1); - vpd->facx = (BLI_RCT_SIZE_X(&v2d->cur)) / winx; - vpd->facy = (BLI_RCT_SIZE_Y(&v2d->cur)) / winy; + winx = (float)(BLI_rcti_size_x(&ar->winrct) + 1); + winy = (float)(BLI_rcti_size_y(&ar->winrct) + 1); + vpd->facx = (BLI_rctf_size_x(&v2d->cur)) / winx; + vpd->facy = (BLI_rctf_size_y(&v2d->cur)) / winy; return 1; } @@ -471,7 +471,7 @@ static int view_scrollup_exec(bContext *C, wmOperator *op) if (RNA_boolean_get(op->ptr, "page")) { ARegion *ar = CTX_wm_region(C); - RNA_int_set(op->ptr, "deltay", BLI_RCT_SIZE_Y(&ar->v2d.mask)); + RNA_int_set(op->ptr, "deltay", BLI_rcti_size_y(&ar->v2d.mask)); } /* apply movement, then we're done */ @@ -590,12 +590,12 @@ static void view_zoomstep_apply(bContext *C, wmOperator *op) facy = RNA_float_get(op->ptr, "zoomfacy"); if (facx >= 0.0f) { - dx = BLI_RCT_SIZE_X(&v2d->cur) * facx; - dy = BLI_RCT_SIZE_Y(&v2d->cur) * facy; + dx = BLI_rctf_size_x(&v2d->cur) * facx; + dy = BLI_rctf_size_y(&v2d->cur) * facy; } else { - dx = (BLI_RCT_SIZE_X(&v2d->cur) / (1.0f + 2.0f * facx)) * facx; - dy = (BLI_RCT_SIZE_Y(&v2d->cur) / (1.0f + 2.0f * facy)) * facy; + dx = (BLI_rctf_size_x(&v2d->cur) / (1.0f + 2.0f * facx)) * facx; + dy = (BLI_rctf_size_y(&v2d->cur) / (1.0f + 2.0f * facy)) * facy; } /* only resize view on an axis if change is allowed */ @@ -611,7 +611,7 @@ static void view_zoomstep_apply(bContext *C, wmOperator *op) } else { if (U.uiflag & USER_ZOOM_TO_MOUSEPOS) { - float mval_fac = (vzd->mx_2d - v2d->cur.xmin) / BLI_RCT_SIZE_X(&v2d->cur); + float mval_fac = (vzd->mx_2d - v2d->cur.xmin) / BLI_rctf_size_x(&v2d->cur); float mval_faci = 1.0f - mval_fac; float ofs = (mval_fac * dx) - (mval_faci * dx); @@ -636,7 +636,7 @@ static void view_zoomstep_apply(bContext *C, wmOperator *op) } else { if (U.uiflag & USER_ZOOM_TO_MOUSEPOS) { - float mval_fac = (vzd->my_2d - v2d->cur.ymin) / BLI_RCT_SIZE_Y(&v2d->cur); + float mval_fac = (vzd->my_2d - v2d->cur.ymin) / BLI_rctf_size_y(&v2d->cur); float mval_faci = 1.0f - mval_fac; float ofs = (mval_fac * dy) - (mval_faci * dy); @@ -845,7 +845,7 @@ static void view_zoomdrag_apply(bContext *C, wmOperator *op) } else { if (U.uiflag & USER_ZOOM_TO_MOUSEPOS) { - float mval_fac = (vzd->mx_2d - v2d->cur.xmin) / BLI_RCT_SIZE_X(&v2d->cur); + float mval_fac = (vzd->mx_2d - v2d->cur.xmin) / BLI_rctf_size_x(&v2d->cur); float mval_faci = 1.0f - mval_fac; float ofs = (mval_fac * dx) - (mval_faci * dx); @@ -864,7 +864,7 @@ static void view_zoomdrag_apply(bContext *C, wmOperator *op) } else { if (U.uiflag & USER_ZOOM_TO_MOUSEPOS) { - float mval_fac = (vzd->my_2d - v2d->cur.ymin) / BLI_RCT_SIZE_Y(&v2d->cur); + float mval_fac = (vzd->my_2d - v2d->cur.ymin) / BLI_rctf_size_y(&v2d->cur); float mval_faci = 1.0f - mval_fac; float ofs = (mval_fac * dy) - (mval_faci * dy); @@ -942,8 +942,8 @@ static int view_zoomdrag_invoke(bContext *C, wmOperator *op, wmEvent *event) * with magnify information that is stored in x axis */ fac = 0.01f * (event->x - event->prevx); - dx = fac * BLI_RCT_SIZE_X(&v2d->cur) / 10.0f; - dy = fac * BLI_RCT_SIZE_Y(&v2d->cur) / 10.0f; + dx = fac * BLI_rctf_size_x(&v2d->cur) / 10.0f; + dy = fac * BLI_rctf_size_y(&v2d->cur) / 10.0f; RNA_float_set(op->ptr, "deltax", dx); RNA_float_set(op->ptr, "deltay", dy); @@ -1009,14 +1009,14 @@ static int view_zoomdrag_modal(bContext *C, wmOperator *op, wmEvent *event) float dist; /* x-axis transform */ - dist = BLI_RCT_SIZE_X(&v2d->mask) / 2.0f; + dist = BLI_rcti_size_x(&v2d->mask) / 2.0f; dx = 1.0f - (fabsf(vzd->lastx - dist) + 2.0f) / (fabsf(event->x - dist) + 2.0f); - dx *= 0.5f * BLI_RCT_SIZE_X(&v2d->cur); + dx *= 0.5f * BLI_rctf_size_x(&v2d->cur); /* y-axis transform */ - dist = BLI_RCT_SIZE_Y(&v2d->mask) / 2.0f; + dist = BLI_rcti_size_y(&v2d->mask) / 2.0f; dy = 1.0f - (fabsf(vzd->lasty - dist) + 2.0f) / (fabsf(event->y - dist) + 2.0f); - dy *= 0.5f * BLI_RCT_SIZE_Y(&v2d->cur); + dy *= 0.5f * BLI_rctf_size_y(&v2d->cur); } else { /* 'continuous' or 'dolly' */ @@ -1024,11 +1024,11 @@ static int view_zoomdrag_modal(bContext *C, wmOperator *op, wmEvent *event) /* x-axis transform */ fac = 0.01f * (event->x - vzd->lastx); - dx = fac * BLI_RCT_SIZE_X(&v2d->cur); + dx = fac * BLI_rctf_size_x(&v2d->cur); /* y-axis transform */ fac = 0.01f * (event->y - vzd->lasty); - dy = fac * BLI_RCT_SIZE_Y(&v2d->cur); + dy = fac * BLI_rctf_size_y(&v2d->cur); #if 0 /* continuous zoom shouldn't move that fast... */ if (U.viewzoom == USER_ZOOM_CONT) { // XXX store this setting as RNA prop? @@ -1161,17 +1161,17 @@ static int view_borderzoom_exec(bContext *C, wmOperator *op) /* TODO: is this zoom factor calculation valid? It seems to produce same results everytime... */ if ((v2d->keepzoom & V2D_LOCKZOOM_X) == 0) { - size = BLI_RCT_SIZE_X(&cur_new); - zoom = size / BLI_RCT_SIZE_X(&rect); - center = BLI_RCT_CENTER_X(&cur_new); + size = BLI_rctf_size_x(&cur_new); + zoom = size / BLI_rctf_size_x(&rect); + center = BLI_rctf_cent_x(&cur_new); cur_new.xmin = center - (size * zoom); cur_new.xmax = center + (size * zoom); } if ((v2d->keepzoom & V2D_LOCKZOOM_Y) == 0) { - size = BLI_RCT_SIZE_Y(&cur_new); - zoom = size / BLI_RCT_SIZE_Y(&rect); - center = BLI_RCT_CENTER_Y(&cur_new); + size = BLI_rctf_size_y(&cur_new); + zoom = size / BLI_rctf_size_y(&rect); + center = BLI_rctf_cent_y(&cur_new); cur_new.ymin = center - (size * zoom); cur_new.ymax = center + (size * zoom); @@ -1221,14 +1221,14 @@ struct SmoothView2DStore { */ static float smooth_view_rect_to_fac(const rctf *rect_a, const rctf *rect_b) { - float size_a[2] = {BLI_RCT_SIZE_X(rect_a), - BLI_RCT_SIZE_Y(rect_a)}; - float size_b[2] = {BLI_RCT_SIZE_X(rect_b), - BLI_RCT_SIZE_Y(rect_b)}; - float cent_a[2] = {BLI_RCT_CENTER_X(rect_a), - BLI_RCT_CENTER_Y(rect_a)}; - float cent_b[2] = {BLI_RCT_CENTER_X(rect_b), - BLI_RCT_CENTER_Y(rect_b)}; + float size_a[2] = {BLI_rctf_size_x(rect_a), + BLI_rctf_size_y(rect_a)}; + float size_b[2] = {BLI_rctf_size_x(rect_b), + BLI_rctf_size_y(rect_b)}; + float cent_a[2] = {BLI_rctf_cent_x(rect_a), + BLI_rctf_cent_y(rect_a)}; + float cent_b[2] = {BLI_rctf_cent_x(rect_b), + BLI_rctf_cent_y(rect_b)}; float fac_max = 0.0f; float tfac; @@ -1501,8 +1501,8 @@ static void scroller_activate_init(bContext *C, wmOperator *op, wmEvent *event, if (in_scroller == 'h') { /* horizontal scroller - calculate adjustment factor first */ - mask_size = (float)BLI_RCT_SIZE_X(&v2d->hor); - vsm->fac = BLI_RCT_SIZE_X(&v2d->tot) / mask_size; + mask_size = (float)BLI_rcti_size_x(&v2d->hor); + vsm->fac = BLI_rctf_size_x(&v2d->tot) / mask_size; /* get 'zone' (i.e. which part of scroller is activated) */ vsm->zone = mouse_in_scroller_handle(event->mval[0], v2d->hor.xmin, v2d->hor.xmax, scrollers->hor_min, scrollers->hor_max); @@ -1517,8 +1517,8 @@ static void scroller_activate_init(bContext *C, wmOperator *op, wmEvent *event, } else { /* vertical scroller - calculate adjustment factor first */ - mask_size = (float)BLI_RCT_SIZE_Y(&v2d->vert); - vsm->fac = BLI_RCT_SIZE_Y(&v2d->tot) / mask_size; + mask_size = (float)BLI_rcti_size_y(&v2d->vert); + vsm->fac = BLI_rctf_size_y(&v2d->tot) / mask_size; /* get 'zone' (i.e. which part of scroller is activated) */ vsm->zone = mouse_in_scroller_handle(event->mval[1], v2d->vert.ymin, v2d->vert.ymax, scrollers->vert_min, scrollers->vert_max); @@ -1798,8 +1798,8 @@ static int reset_exec(bContext *C, wmOperator *UNUSED(op)) int winx, winy; /* zoom 1.0 */ - winx = (float)(BLI_RCT_SIZE_X(&v2d->mask) + 1); - winy = (float)(BLI_RCT_SIZE_Y(&v2d->mask) + 1); + winx = (float)(BLI_rcti_size_x(&v2d->mask) + 1); + winy = (float)(BLI_rcti_size_y(&v2d->mask) + 1); v2d->cur.xmax = v2d->cur.xmin + winx; v2d->cur.ymax = v2d->cur.ymin + winy; diff --git a/source/blender/editors/mask/mask_draw.c b/source/blender/editors/mask/mask_draw.c index 655458bd4cb..fe6567424b6 100644 --- a/source/blender/editors/mask/mask_draw.c +++ b/source/blender/editors/mask/mask_draw.c @@ -520,12 +520,12 @@ void ED_mask_draw_region(Mask *mask, ARegion *ar, UI_view2d_to_region_no_clip(&ar->v2d, 0.0f, 0.0f, &x, &y); - /* w = BLI_RCT_SIZE_X(&v2d->tot); */ - /* h = BLI_RCT_SIZE_Y(&v2d->tot);/*/ + /* w = BLI_rctf_size_x(&v2d->tot); */ + /* h = BLI_rctf_size_y(&v2d->tot);/*/ - zoomx = (float)(BLI_RCT_SIZE_X(&ar->winrct) + 1) / (float)(BLI_RCT_SIZE_X(&ar->v2d.cur)); - zoomy = (float)(BLI_RCT_SIZE_Y(&ar->winrct) + 1) / (float)(BLI_RCT_SIZE_Y(&ar->v2d.cur)); + zoomx = (float)(BLI_rcti_size_x(&ar->winrct) + 1) / BLI_rctf_size_x(&ar->v2d.cur); + zoomy = (float)(BLI_rcti_size_y(&ar->winrct) + 1) / BLI_rctf_size_y(&ar->v2d.cur); if (do_scale_applied) { zoomx /= width; diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c index 94e10b53b29..a677f1272a3 100644 --- a/source/blender/editors/mesh/editface.c +++ b/source/blender/editors/mesh/editface.c @@ -533,8 +533,8 @@ int do_paintface_box_select(ViewContext *vc, rcti *rect, int select, int extend) unsigned int *rt; char *selar; int a, index; - int sx = BLI_RCT_SIZE_X(rect) + 1; - int sy = BLI_RCT_SIZE_Y(rect) + 1; + int sx = BLI_rcti_size_x(rect) + 1; + int sy = BLI_rcti_size_y(rect) + 1; me = BKE_mesh_from_object(ob); diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c index a829ef57b85..6b6018e51d2 100644 --- a/source/blender/editors/render/render_preview.c +++ b/source/blender/editors/render/render_preview.c @@ -485,8 +485,8 @@ static int ed_preview_draw_rect(ScrArea *sa, Scene *sce, ID *id, int split, int char name[32]; int do_gamma_correct = FALSE, do_predivide = FALSE; int offx = 0; - int newx = BLI_RCT_SIZE_X(rect); - int newy = BLI_RCT_SIZE_Y(rect); + int newx = BLI_rcti_size_x(rect); + int newy = BLI_rcti_size_y(rect); if (id && GS(id->name) != ID_TE) { /* exception: don't color manage texture previews - show the raw values */ @@ -569,8 +569,8 @@ void ED_preview_draw(const bContext *C, void *idp, void *parentp, void *slotp, r SpaceButs *sbuts = sa->spacedata.first; rcti newrect; int ok; - int newx = BLI_RCT_SIZE_X(rect); - int newy = BLI_RCT_SIZE_Y(rect); + int newx = BLI_rcti_size_x(rect); + int newy = BLI_rcti_size_y(rect); newrect.xmin = rect->xmin; newrect.xmax = rect->xmin; diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 0bfe5d04e5e..d14514546f5 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -104,8 +104,8 @@ static void region_draw_emboss(ARegion *ar, rcti *scirct) void ED_region_pixelspace(ARegion *ar) { - int width = BLI_RCT_SIZE_X(&ar->winrct) + 1; - int height = BLI_RCT_SIZE_Y(&ar->winrct) + 1; + int width = BLI_rcti_size_x(&ar->winrct) + 1; + int height = BLI_rcti_size_y(&ar->winrct) + 1; wmOrtho2(-GLA_PIXEL_OFS, (float)width - GLA_PIXEL_OFS, -GLA_PIXEL_OFS, (float)height - GLA_PIXEL_OFS); glLoadIdentity(); @@ -901,10 +901,10 @@ static void region_azone_add(ScrArea *sa, ARegion *ar, int alignment) static int rct_fits(rcti *rect, char dir, int size) { if (dir == 'h') { - return BLI_RCT_SIZE_X(rect) - size; + return BLI_rcti_size_x(rect) - size; } else { /* 'v' */ - return BLI_RCT_SIZE_Y(rect) - size; + return BLI_rcti_size_y(rect) - size; } } @@ -1010,7 +1010,7 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, int if (alignment == RGN_ALIGN_HSPLIT) { if (rct_fits(remainder, 'h', prefsizex) > 4) { - ar->winrct.xmax = BLI_RCT_CENTER_X(remainder); + ar->winrct.xmax = BLI_rcti_cent_x(remainder); remainder->xmin = ar->winrct.xmax + 1; } else { @@ -1019,7 +1019,7 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, int } else { if (rct_fits(remainder, 'v', prefsizey) > 4) { - ar->winrct.ymax = BLI_RCT_CENTER_Y(remainder); + ar->winrct.ymax = BLI_rcti_cent_y(remainder); remainder->ymin = ar->winrct.ymax + 1; } else { @@ -1051,20 +1051,20 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, int } if (quad) { if (quad == 1) { /* left bottom */ - ar->winrct.xmax = BLI_RCT_CENTER_X(remainder); - ar->winrct.ymax = BLI_RCT_CENTER_Y(remainder); + ar->winrct.xmax = BLI_rcti_cent_x(remainder); + ar->winrct.ymax = BLI_rcti_cent_y(remainder); } else if (quad == 2) { /* left top */ - ar->winrct.xmax = BLI_RCT_CENTER_X(remainder); - ar->winrct.ymin = BLI_RCT_CENTER_Y(remainder) + 1; + ar->winrct.xmax = BLI_rcti_cent_x(remainder); + ar->winrct.ymin = BLI_rcti_cent_y(remainder) + 1; } else if (quad == 3) { /* right bottom */ - ar->winrct.xmin = BLI_RCT_CENTER_X(remainder) + 1; - ar->winrct.ymax = BLI_RCT_CENTER_Y(remainder); + ar->winrct.xmin = BLI_rcti_cent_x(remainder) + 1; + ar->winrct.ymax = BLI_rcti_cent_y(remainder); } else { /* right top */ - ar->winrct.xmin = BLI_RCT_CENTER_X(remainder) + 1; - ar->winrct.ymin = BLI_RCT_CENTER_Y(remainder) + 1; + ar->winrct.xmin = BLI_rcti_cent_x(remainder) + 1; + ar->winrct.ymin = BLI_rcti_cent_y(remainder) + 1; BLI_rcti_init(remainder, 0, 0, 0, 0); } @@ -1073,8 +1073,8 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, int } /* for speedup */ - ar->winx = BLI_RCT_SIZE_X(&ar->winrct) + 1; - ar->winy = BLI_RCT_SIZE_Y(&ar->winrct) + 1; + ar->winx = BLI_rcti_size_x(&ar->winrct) + 1; + ar->winy = BLI_rcti_size_y(&ar->winrct) + 1; /* set winrect for azones */ if (ar->flag & (RGN_FLAG_HIDDEN | RGN_FLAG_TOO_SMALL)) { @@ -1096,8 +1096,8 @@ static void region_rect_recursive(ScrArea *sa, ARegion *ar, rcti *remainder, int if (ar->alignment & RGN_SPLIT_PREV) { if (ar->prev) { remainder = remainder_prev; - ar->prev->winx = BLI_RCT_SIZE_X(&ar->prev->winrct) + 1; - ar->prev->winy = BLI_RCT_SIZE_Y(&ar->prev->winrct) + 1; + ar->prev->winx = BLI_rcti_size_x(&ar->prev->winrct) + 1; + ar->prev->winy = BLI_rcti_size_y(&ar->prev->winrct) + 1; } } @@ -1133,8 +1133,8 @@ static void area_calc_totrct(ScrArea *sa, int sizex, int sizey) else sa->totrct.ymax = sa->v2->vec.y; /* for speedup */ - sa->winx = BLI_RCT_SIZE_X(&sa->totrct) + 1; - sa->winy = BLI_RCT_SIZE_Y(&sa->totrct) + 1; + sa->winx = BLI_rcti_size_x(&sa->totrct) + 1; + sa->winy = BLI_rcti_size_y(&sa->totrct) + 1; } @@ -1268,8 +1268,8 @@ void ED_region_init(bContext *C, ARegion *ar) /* refresh can be called before window opened */ region_subwindow(CTX_wm_window(C), ar); - ar->winx = BLI_RCT_SIZE_X(&ar->winrct) + 1; - ar->winy = BLI_RCT_SIZE_Y(&ar->winrct) + 1; + ar->winx = BLI_rcti_size_x(&ar->winrct) + 1; + ar->winy = BLI_rcti_size_y(&ar->winrct) + 1; /* UI convention */ wmOrtho2(-0.01f, ar->winx - 0.01f, -0.01f, ar->winy - 0.01f); @@ -1574,7 +1574,7 @@ void ED_region_panels(const bContext *C, ARegion *ar, int vertical, const char * newcontext = UI_view2d_tab_set(v2d, contextnr); if (vertical) { - w = BLI_RCT_SIZE_X(&v2d->cur); + w = BLI_rctf_size_x(&v2d->cur); em = (ar->type->prefsizex) ? UI_UNIT_Y / 2 : UI_UNIT_Y; } else { @@ -1769,7 +1769,7 @@ void ED_region_header(const bContext *C, ARegion *ar) } /* always as last */ - UI_view2d_totRect_set(&ar->v2d, maxco + UI_UNIT_X + 80, BLI_RCT_SIZE_Y(&ar->v2d.tot)); + UI_view2d_totRect_set(&ar->v2d, maxco + UI_UNIT_X + 80, BLI_rctf_size_y(&ar->v2d.tot)); /* restore view matrix? */ UI_view2d_view_restore(C); @@ -1798,16 +1798,16 @@ void ED_region_info_draw(ARegion *ar, const char *text, int block, float alpha) /* background box */ rect = ar->winrct; rect.xmin = 0; - rect.ymin = BLI_RCT_SIZE_Y(&ar->winrct) - header_height; + rect.ymin = BLI_rcti_size_y(&ar->winrct) - header_height; if (block) { - rect.xmax = BLI_RCT_SIZE_X(&ar->winrct); + rect.xmax = BLI_rcti_size_x(&ar->winrct); } else { rect.xmax = rect.xmin + BLF_width(fontid, text) + 24; } - rect.ymax = BLI_RCT_SIZE_Y(&ar->winrct); + rect.ymax = BLI_rcti_size_y(&ar->winrct); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c index c93f4156eeb..24053d76672 100644 --- a/source/blender/editors/screen/glutil.c +++ b/source/blender/editors/screen/glutil.c @@ -669,8 +669,8 @@ void glaDrawPixelsSafe(float x, float y, int img_w, int img_h, int row_w, int fo void glaDefine2DArea(rcti *screen_rect) { - const int sc_w = BLI_RCT_SIZE_X(screen_rect) + 1; - const int sc_h = BLI_RCT_SIZE_Y(screen_rect) + 1; + const int sc_w = BLI_rcti_size_x(screen_rect) + 1; + const int sc_h = BLI_rcti_size_y(screen_rect) + 1; glViewport(screen_rect->xmin, screen_rect->ymin, sc_w, sc_h); glScissor(screen_rect->xmin, screen_rect->ymin, sc_w, sc_h); @@ -714,10 +714,10 @@ void gla2DSetMap(gla2DDrawInfo *di, rctf *rect) di->world_rect = *rect; - sc_w = BLI_RCT_SIZE_X(&di->screen_rect); - sc_h = BLI_RCT_SIZE_Y(&di->screen_rect); - wo_w = BLI_RCT_SIZE_X(&di->world_rect); - wo_h = BLI_RCT_SIZE_Y(&di->world_rect); + sc_w = BLI_rcti_size_x(&di->screen_rect); + sc_h = BLI_rcti_size_y(&di->screen_rect); + wo_w = BLI_rcti_size_x(&di->world_rect); + wo_h = BLI_rcti_size_y(&di->world_rect); di->wo_to_sc[0] = sc_w / wo_w; di->wo_to_sc[1] = sc_h / wo_h; @@ -745,10 +745,10 @@ gla2DDrawInfo *glaBegin2DDraw(rcti *screen_rect, rctf *world_rect) di->world_rect.ymax = di->screen_rect.ymax; } - sc_w = BLI_RCT_SIZE_X(&di->screen_rect); - sc_h = BLI_RCT_SIZE_Y(&di->screen_rect); - wo_w = BLI_RCT_SIZE_X(&di->world_rect); - wo_h = BLI_RCT_SIZE_Y(&di->world_rect); + sc_w = BLI_rcti_size_x(&di->screen_rect); + sc_h = BLI_rcti_size_y(&di->screen_rect); + wo_w = BLI_rcti_size_x(&di->world_rect); + wo_h = BLI_rcti_size_y(&di->world_rect); di->wo_to_sc[0] = sc_w / wo_w; di->wo_to_sc[1] = sc_h / wo_h; diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 50a210e5d7c..f7f1c281153 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -1635,10 +1635,10 @@ static int area_max_regionsize(ScrArea *sa, ARegion *scalear, AZEdge edge) int dist; if (edge == AE_RIGHT_TO_TOPLEFT || edge == AE_LEFT_TO_TOPRIGHT) { - dist = BLI_RCT_SIZE_X(&sa->totrct); + dist = BLI_rcti_size_x(&sa->totrct); } else { /* AE_BOTTOM_TO_TOPLEFT, AE_TOP_TO_BOTTOMRIGHT */ - dist = BLI_RCT_SIZE_Y(&sa->totrct); + dist = BLI_rcti_size_y(&sa->totrct); } /* subtractwidth of regions on opposite side diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c index 5e54119118a..301df719142 100644 --- a/source/blender/editors/screen/screendump.c +++ b/source/blender/editors/screen/screendump.c @@ -149,8 +149,8 @@ static void screenshot_crop(ImBuf *ibuf, rcti crop) { unsigned int *to = ibuf->rect; unsigned int *from = ibuf->rect + crop.ymin * ibuf->x + crop.xmin; - int crop_x = BLI_RCT_SIZE_X(&crop); - int crop_y = BLI_RCT_SIZE_Y(&crop); + int crop_x = BLI_rcti_size_x(&crop); + int crop_y = BLI_rcti_size_y(&crop); int y; if (crop_x > 0 && crop_y > 0) { diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c index 8616d4e66eb..dec75aaa6ff 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.c @@ -441,8 +441,8 @@ static void paint_draw_alpha_overlay(Sculpt *sd, Brush *brush, else { quad.xmin = 0; quad.ymin = 0; - quad.xmax = BLI_RCT_SIZE_X(&vc->ar->winrct); - quad.ymax = BLI_RCT_SIZE_Y(&vc->ar->winrct); + quad.xmax = BLI_rcti_size_x(&vc->ar->winrct); + quad.ymax = BLI_rcti_size_y(&vc->ar->winrct); } /* set quad color */ diff --git a/source/blender/editors/space_action/action_draw.c b/source/blender/editors/space_action/action_draw.c index 878fd20b27e..10adeb3e721 100644 --- a/source/blender/editors/space_action/action_draw.c +++ b/source/blender/editors/space_action/action_draw.c @@ -89,7 +89,7 @@ void draw_channel_names(bContext *C, bAnimContext *ac, ARegion *ar) * start of list offset, and the second is as a correction for the scrollers. */ height = ((items * ACHANNEL_STEP) + (ACHANNEL_HEIGHT * 2)); - if (height > BLI_RCT_SIZE_Y(&v2d->mask)) { + if (height > BLI_rcti_size_y(&v2d->mask)) { /* don't use totrect set, as the width stays the same * (NOTE: this is ok here, the configuration is pretty straightforward) */ diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c index c95f1dba31d..7635f85a37e 100644 --- a/source/blender/editors/space_action/action_edit.c +++ b/source/blender/editors/space_action/action_edit.c @@ -365,13 +365,13 @@ static int actkeys_viewall(bContext *C, const short onlySel) /* set the horizontal range, with an extra offset so that the extreme keys will be in view */ get_keyframe_extents(&ac, &v2d->cur.xmin, &v2d->cur.xmax, onlySel); - extra = 0.1f * BLI_RCT_SIZE_X(&v2d->cur); + extra = 0.1f * BLI_rctf_size_x(&v2d->cur); v2d->cur.xmin -= extra; v2d->cur.xmax += extra; /* set vertical range */ v2d->cur.ymax = 0.0f; - v2d->cur.ymin = (float)-BLI_RCT_SIZE_Y(&v2d->mask); + v2d->cur.ymin = (float)-BLI_rcti_size_y(&v2d->mask); /* do View2D syncing */ UI_view2d_sync(CTX_wm_screen(C), CTX_wm_area(C), v2d, V2D_LOCK_COPY); diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c index 9ab79d73e76..ab2b473baa0 100644 --- a/source/blender/editors/space_action/action_select.c +++ b/source/blender/editors/space_action/action_select.c @@ -309,7 +309,7 @@ static int actkeys_borderselect_exec(bContext *C, wmOperator *op) * - the frame-range select option is favored over the channel one (x over y), as frame-range one is often * used for tweaking timing when "blocking", while channels is not that useful... */ - if (BLI_RCT_SIZE_X(&rect) >= BLI_RCT_SIZE_Y(&rect)) + if (BLI_rcti_size_x(&rect) >= BLI_rcti_size_y(&rect)) mode = ACTKEYS_BORDERSEL_FRAMERANGE; else mode = ACTKEYS_BORDERSEL_CHANNELS; diff --git a/source/blender/editors/space_buttons/buttons_header.c b/source/blender/editors/space_buttons/buttons_header.c index 4bcd4a933ed..ebba7d92819 100644 --- a/source/blender/editors/space_buttons/buttons_header.c +++ b/source/blender/editors/space_buttons/buttons_header.c @@ -148,7 +148,7 @@ void buttons_header_buttons(const bContext *C, ARegion *ar) uiBlockEndAlign(block); /* always as last */ - UI_view2d_totRect_set(&ar->v2d, xco + (UI_UNIT_X / 2), BLI_RCT_SIZE_Y(&ar->v2d.tot)); + UI_view2d_totRect_set(&ar->v2d, xco + (UI_UNIT_X / 2), BLI_rctf_size_y(&ar->v2d.tot)); uiEndBlock(C, block); uiDrawBlock(C, block); diff --git a/source/blender/editors/space_clip/clip_buttons.c b/source/blender/editors/space_clip/clip_buttons.c index 0a1e1d75098..969b0e25928 100644 --- a/source/blender/editors/space_clip/clip_buttons.c +++ b/source/blender/editors/space_clip/clip_buttons.c @@ -174,7 +174,7 @@ void uiTemplateTrack(uiLayout *layout, PointerRNA *ptr, const char *propname) scopes->track_preview_height = (scopes->track_preview_height <= UI_UNIT_Y) ? UI_UNIT_Y : scopes->track_preview_height; - uiDefBut(block, TRACKPREVIEW, 0, "", rect.xmin, rect.ymin, BLI_RCT_SIZE_X(&rect), + uiDefBut(block, TRACKPREVIEW, 0, "", rect.xmin, rect.ymin, BLI_rctf_size_x(&rect), scopes->track_preview_height, scopes, 0, 0, 0, 0, ""); } diff --git a/source/blender/editors/space_clip/clip_dopesheet_draw.c b/source/blender/editors/space_clip/clip_dopesheet_draw.c index 5d890155e25..cc1b8d444bc 100644 --- a/source/blender/editors/space_clip/clip_dopesheet_draw.c +++ b/source/blender/editors/space_clip/clip_dopesheet_draw.c @@ -274,7 +274,7 @@ void clip_draw_dopesheet_channels(const bContext *C, ARegion *ar) dopesheet = &tracking->dopesheet; height = (dopesheet->tot_channel * CHANNEL_STEP) + (CHANNEL_HEIGHT * 2); - if (height > BLI_RCT_SIZE_Y(&v2d->mask)) { + if (height > BLI_rcti_size_y(&v2d->mask)) { /* don't use totrect set, as the width stays the same * (NOTE: this is ok here, the configuration is pretty straightforward) */ diff --git a/source/blender/editors/space_clip/clip_draw.c b/source/blender/editors/space_clip/clip_draw.c index d486caeacc2..b22c9a60bdc 100644 --- a/source/blender/editors/space_clip/clip_draw.c +++ b/source/blender/editors/space_clip/clip_draw.c @@ -957,12 +957,12 @@ static void draw_marker_texts(SpaceClip *sc, MovieTrackingTrack *track, MovieTra static void view2d_to_region_float(View2D *v2d, float x, float y, float *regionx, float *regiony) { /* express given coordinates as proportional values */ - x = -v2d->cur.xmin / BLI_RCT_SIZE_X(&v2d->cur); - y = -v2d->cur.ymin / BLI_RCT_SIZE_Y(&v2d->cur); + x = -v2d->cur.xmin / BLI_rctf_size_x(&v2d->cur); + y = -v2d->cur.ymin / BLI_rctf_size_y(&v2d->cur); /* convert proportional distances to screen coordinates */ - *regionx = v2d->mask.xmin + x * BLI_RCT_SIZE_X(&v2d->mask); - *regiony = v2d->mask.ymin + y * BLI_RCT_SIZE_Y(&v2d->mask); + *regionx = v2d->mask.xmin + x * BLI_rcti_size_x(&v2d->mask); + *regiony = v2d->mask.ymin + y * BLI_rcti_size_y(&v2d->mask); } static void draw_tracking_tracks(SpaceClip *sc, ARegion *ar, MovieClip *clip, diff --git a/source/blender/editors/space_clip/clip_editor.c b/source/blender/editors/space_clip/clip_editor.c index f2a48f299cf..32f91671daf 100644 --- a/source/blender/editors/space_clip/clip_editor.c +++ b/source/blender/editors/space_clip/clip_editor.c @@ -149,8 +149,8 @@ void ED_space_clip_get_zoom(SpaceClip *sc, ARegion *ar, float *zoomx, float *zoo ED_space_clip_get_size(sc, &width, &height); - *zoomx = (float)(BLI_RCT_SIZE_X(&ar->winrct) + 1) / (float)(BLI_RCT_SIZE_X(&ar->v2d.cur) * width); - *zoomy = (float)(BLI_RCT_SIZE_Y(&ar->winrct) + 1) / (float)(BLI_RCT_SIZE_Y(&ar->v2d.cur) * height); + *zoomx = (float)(BLI_rcti_size_x(&ar->winrct) + 1) / (BLI_rctf_size_x(&ar->v2d.cur) * width); + *zoomy = (float)(BLI_rcti_size_y(&ar->winrct) + 1) / (BLI_rctf_size_y(&ar->v2d.cur) * height); } void ED_space_clip_get_aspect(SpaceClip *sc, float *aspx, float *aspy) @@ -388,8 +388,8 @@ int ED_clip_view_selection(const bContext *C, ARegion *ar, int fit) ED_space_clip_get_aspect(sc, &aspx, &aspy); - width = BLI_RCT_SIZE_X(&ar->winrct) + 1; - height = BLI_RCT_SIZE_Y(&ar->winrct) + 1; + width = BLI_rcti_size_x(&ar->winrct) + 1; + height = BLI_rcti_size_y(&ar->winrct) + 1; zoomx = (float)width / w / aspx; zoomy = (float)height / h / aspy; diff --git a/source/blender/editors/space_clip/clip_graph_ops.c b/source/blender/editors/space_clip/clip_graph_ops.c index f48d4e8d946..fa235bd2997 100644 --- a/source/blender/editors/space_clip/clip_graph_ops.c +++ b/source/blender/editors/space_clip/clip_graph_ops.c @@ -580,11 +580,11 @@ static int view_all_exec(bContext *C, wmOperator *UNUSED(op)) } /* we need an extra "buffer" factor on either side so that the endpoints are visible */ - extra = 0.01f * BLI_RCT_SIZE_X(&v2d->cur); + extra = 0.01f * BLI_rctf_size_x(&v2d->cur); v2d->cur.xmin -= extra; v2d->cur.xmax += extra; - extra = 0.01f * BLI_RCT_SIZE_Y(&v2d->cur); + extra = 0.01f * BLI_rctf_size_y(&v2d->cur); v2d->cur.ymin -= extra; v2d->cur.ymax += extra; @@ -610,7 +610,7 @@ void CLIP_OT_graph_view_all(wmOperatorType *ot) void ED_clip_graph_center_current_frame(Scene *scene, ARegion *ar) { View2D *v2d = &ar->v2d; - float extra = BLI_RCT_SIZE_X(&v2d->cur) / 2.0f; + float extra = BLI_rctf_size_x(&v2d->cur) / 2.0f; /* set extents of view to start/end frames */ v2d->cur.xmin = (float)CFRA - extra; diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c index aa2cadbd2d3..5c338f3e6f1 100644 --- a/source/blender/editors/space_clip/clip_ops.c +++ b/source/blender/editors/space_clip/clip_ops.c @@ -90,9 +90,9 @@ static void sclip_zoom_set(const bContext *C, float zoom, float location[2]) if ((width < 4) && (height < 4)) sc->zoom = oldzoom; - else if (BLI_RCT_SIZE_X(&ar->winrct) <= sc->zoom) + else if (BLI_rcti_size_x(&ar->winrct) <= sc->zoom) sc->zoom = oldzoom; - else if (BLI_RCT_SIZE_Y(&ar->winrct) <= sc->zoom) + else if (BLI_rcti_size_y(&ar->winrct) <= sc->zoom) sc->zoom = oldzoom; } @@ -726,8 +726,8 @@ static int view_all_exec(bContext *C, wmOperator *op) h = h * aspy; /* check if the image will fit in the image with zoom == 1 */ - width = BLI_RCT_SIZE_X(&ar->winrct) + 1; - height = BLI_RCT_SIZE_Y(&ar->winrct) + 1; + width = BLI_rcti_size_x(&ar->winrct) + 1; + height = BLI_rcti_size_y(&ar->winrct) + 1; if (fit_view) { const int margin = 5; /* margin from border */ diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c index 7f43c404095..3f925df30c7 100644 --- a/source/blender/editors/space_clip/space_clip.c +++ b/source/blender/editors/space_clip/space_clip.c @@ -1036,8 +1036,8 @@ static void movieclip_main_area_set_view2d(const bContext *C, ARegion *ar) if (clip) h *= clip->aspy / clip->aspx / clip->tracking.camera.pixel_aspect; - winx = BLI_RCT_SIZE_X(&ar->winrct) + 1; - winy = BLI_RCT_SIZE_Y(&ar->winrct) + 1; + winx = BLI_rcti_size_x(&ar->winrct) + 1; + winy = BLI_rcti_size_y(&ar->winrct) + 1; ar->v2d.tot.xmin = 0; ar->v2d.tot.ymin = 0; diff --git a/source/blender/editors/space_console/space_console.c b/source/blender/editors/space_console/space_console.c index a4f7e30ed7b..b7ef278275e 100644 --- a/source/blender/editors/space_console/space_console.c +++ b/source/blender/editors/space_console/space_console.c @@ -142,7 +142,7 @@ static void console_main_area_init(wmWindowManager *wm, ARegion *ar) /* always keep the bottom part of the view aligned, less annoying */ if (prev_y_min != ar->v2d.cur.ymin) { - const float cur_y_range = BLI_RCT_SIZE_Y(&ar->v2d.cur); + const float cur_y_range = BLI_rctf_size_y(&ar->v2d.cur); ar->v2d.cur.ymin = prev_y_min; ar->v2d.cur.ymax = prev_y_min + cur_y_range; } diff --git a/source/blender/editors/space_file/filesel.c b/source/blender/editors/space_file/filesel.c index 09231efd367..1fa89e5db9a 100644 --- a/source/blender/editors/space_file/filesel.c +++ b/source/blender/editors/space_file/filesel.c @@ -270,12 +270,12 @@ int ED_fileselect_layout_numfiles(FileLayout *layout, ARegion *ar) int numfiles; if (layout->flag & FILE_LAYOUT_HOR) { - int width = (int)(BLI_RCT_SIZE_X(&ar->v2d.cur) - 2 * layout->tile_border_x); + int width = (int)(BLI_rctf_size_x(&ar->v2d.cur) - 2 * layout->tile_border_x); numfiles = (int)((float)width / (float)layout->tile_w + 0.5f); return numfiles * layout->rows; } else { - int height = (int)(BLI_RCT_SIZE_Y(&ar->v2d.cur) - 2 * layout->tile_border_y); + int height = (int)(BLI_rctf_size_y(&ar->v2d.cur) - 2 * layout->tile_border_y); numfiles = (int)((float)height / (float)layout->tile_h + 0.5f); return numfiles * layout->columns; } @@ -503,7 +503,7 @@ void ED_fileselect_init_layout(struct SpaceFile *sfile, ARegion *ar) layout->prv_border_y = 6; layout->tile_w = layout->prv_w + 2 * layout->prv_border_x; layout->tile_h = layout->prv_h + 2 * layout->prv_border_y + textheight; - layout->width = (int)(BLI_RCT_SIZE_X(&v2d->cur) - 2 * layout->tile_border_x); + layout->width = (int)(BLI_rctf_size_x(&v2d->cur) - 2 * layout->tile_border_x); layout->columns = layout->width / (layout->tile_w + 2 * layout->tile_border_x); if (layout->columns > 0) layout->rows = numfiles / layout->columns + 1; // XXX dirty, modulo is zero @@ -522,7 +522,7 @@ void ED_fileselect_init_layout(struct SpaceFile *sfile, ARegion *ar) layout->prv_border_x = 0; layout->prv_border_y = 0; layout->tile_h = textheight * 3 / 2; - layout->height = (int)(BLI_RCT_SIZE_Y(&v2d->cur) - 2 * layout->tile_border_y); + layout->height = (int)(BLI_rctf_size_y(&v2d->cur) - 2 * layout->tile_border_y); layout->rows = layout->height / (layout->tile_h + 2 * layout->tile_border_y); column_widths(sfile->files, layout); diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c index 4b568b43695..509a4f00c49 100644 --- a/source/blender/editors/space_file/space_file.c +++ b/source/blender/editors/space_file/space_file.c @@ -537,7 +537,7 @@ static void file_ui_area_draw(const bContext *C, ARegion *ar) glClear(GL_COLOR_BUFFER_BIT); /* scrolling here is just annoying, disable it */ - ar->v2d.cur.ymax = BLI_RCT_SIZE_Y(&ar->v2d.cur); + ar->v2d.cur.ymax = BLI_rctf_size_y(&ar->v2d.cur); ar->v2d.cur.ymin = 0; /* set view2d view matrix for scrolling (without scrollers) */ diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index e4bda15bc7d..ef2e56afca0 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -88,7 +88,7 @@ static void draw_fcurve_modifier_controls_envelope(FModifier *fcm, View2D *v2d) { FMod_Envelope *env = (FMod_Envelope *)fcm->data; FCM_EnvelopeData *fed; - const float fac = 0.05f * BLI_RCT_SIZE_X(&v2d->cur); + const float fac = 0.05f * BLI_rctf_size_x(&v2d->cur); int i; /* draw two black lines showing the standard reference levels */ @@ -137,7 +137,7 @@ static void draw_fcurve_modifier_controls_envelope(FModifier *fcm, View2D *v2d) static void draw_fcurve_vertices_keyframes(FCurve *fcu, SpaceIpo *UNUSED(sipo), View2D *v2d, short edit, short sel) { BezTriple *bezt = fcu->bezt; - const float fac = 0.05f * BLI_RCT_SIZE_X(&v2d->cur); + const float fac = 0.05f * BLI_rctf_size_x(&v2d->cur); int i; /* we use bgl points not standard gl points, to workaround vertex diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c index f01d64b46b8..7107a6a2369 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -229,11 +229,11 @@ static int graphkeys_viewall(bContext *C, const short do_sel_only, const short i &cur_new.ymin, &cur_new.ymax, do_sel_only, include_handles); - extra = 0.1f * BLI_RCT_SIZE_X(&cur_new); + extra = 0.1f * BLI_rctf_size_x(&cur_new); cur_new.xmin -= extra; cur_new.xmax += extra; - extra = 0.1f * BLI_RCT_SIZE_Y(&cur_new); + extra = 0.1f * BLI_rctf_size_y(&cur_new); cur_new.ymin -= extra; cur_new.ymax += extra; diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c index 633f2b72cf6..e2fc1657379 100644 --- a/source/blender/editors/space_graph/graph_select.c +++ b/source/blender/editors/space_graph/graph_select.c @@ -325,7 +325,7 @@ static int graphkeys_borderselect_exec(bContext *C, wmOperator *op) * - the frame-range select option is favored over the channel one (x over y), as frame-range one is often * used for tweaking timing when "blocking", while channels is not that useful... */ - if ((BLI_RCT_SIZE_X(&rect)) >= (BLI_RCT_SIZE_Y(&rect))) + if ((BLI_rcti_size_x(&rect)) >= (BLI_rcti_size_y(&rect))) mode = BEZT_OK_FRAMERANGE; else mode = BEZT_OK_VALUERANGE; diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c index c372973b7b0..3728d68fdbc 100644 --- a/source/blender/editors/space_image/image_buttons.c +++ b/source/blender/editors/space_image/image_buttons.c @@ -228,13 +228,13 @@ static void preview_cb(ScrArea *sa, struct uiBlock *block) int mval[2]; if (G.scene->r.mode & R_BORDER) { - winx *= BLI_RCT_SIZE_X(&G.scene->r.border); - winy *= BLI_RCT_SIZE_Y(&G.scene->r.border); + winx *= BLI_rcti_size_x(&G.scene->r.border); + winy *= BLI_rctf_size_y(&G.scene->r.border); } /* while dragging we need to update the rects, otherwise it doesn't end with correct one */ - BLI_rctf_init(&dispf, 15.0f, BLI_RCT_SIZE_X(&block->rect) - 15.0f, 15.0f, (BLI_RCT_SIZE_Y(&block->rect)) - 15.0f); + BLI_rctf_init(&dispf, 15.0f, BLI_rcti_size_x(&block->rect) - 15.0f, 15.0f, (BLI_rctf_size_y(&block->rect)) - 15.0f); ui_graphics_to_window_rct(sa->win, &dispf, disprect); /* correction for gla draw */ diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index 638a2ac6681..52bb44d4e19 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -118,7 +118,7 @@ void ED_image_draw_info(Scene *scene, ARegion *ar, int color_manage, int use_def /* noisy, high contrast make impossible to read if lower alpha is used. */ glColor4ub(0, 0, 0, 190); - glRecti(0.0, 0.0, BLI_RCT_SIZE_X(&ar->winrct) + 1, 20); + glRecti(0.0, 0.0, BLI_rcti_size_x(&ar->winrct) + 1, 20); glDisable(GL_BLEND); BLF_size(blf_mono_font, 11, 72); diff --git a/source/blender/editors/space_image/image_edit.c b/source/blender/editors/space_image/image_edit.c index 79d01491df7..92433449985 100644 --- a/source/blender/editors/space_image/image_edit.c +++ b/source/blender/editors/space_image/image_edit.c @@ -161,8 +161,8 @@ void ED_space_image_get_size(SpaceImage *sima, int *width, int *height) *height = (scene->r.ysch * scene->r.size) / 100; if ((scene->r.mode & R_BORDER) && (scene->r.mode & R_CROP)) { - *width *= BLI_RCT_SIZE_X(&scene->r.border); - *height *= BLI_RCT_SIZE_Y(&scene->r.border); + *width *= BLI_rctf_size_x(&scene->r.border); + *height *= BLI_rctf_size_y(&scene->r.border); } } @@ -204,8 +204,8 @@ void ED_space_image_get_zoom(SpaceImage *sima, ARegion *ar, float *zoomx, float ED_space_image_get_size(sima, &width, &height); - *zoomx = (float)(BLI_RCT_SIZE_X(&ar->winrct) + 1) / (float)(BLI_RCT_SIZE_X(&ar->v2d.cur) * width); - *zoomy = (float)(BLI_RCT_SIZE_Y(&ar->winrct) + 1) / (float)(BLI_RCT_SIZE_Y(&ar->v2d.cur) * height); + *zoomx = (float)(BLI_rcti_size_x(&ar->winrct) + 1) / (float)(BLI_rctf_size_x(&ar->v2d.cur) * width); + *zoomy = (float)(BLI_rcti_size_y(&ar->winrct) + 1) / (float)(BLI_rctf_size_y(&ar->v2d.cur) * height); } void ED_space_image_get_uv_aspect(SpaceImage *sima, float *aspx, float *aspy) diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 16804c5a1c6..096ae0d756a 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -99,9 +99,9 @@ static void sima_zoom_set(SpaceImage *sima, ARegion *ar, float zoom, float locat if ((width < 4) && (height < 4)) sima->zoom = oldzoom; - else if (BLI_RCT_SIZE_X(&ar->winrct) <= sima->zoom) + else if (BLI_rcti_size_x(&ar->winrct) <= sima->zoom) sima->zoom = oldzoom; - else if (BLI_RCT_SIZE_Y(&ar->winrct) <= sima->zoom) + else if (BLI_rcti_size_y(&ar->winrct) <= sima->zoom) sima->zoom = oldzoom; } @@ -582,8 +582,8 @@ static int image_view_all_exec(bContext *C, wmOperator *UNUSED(op)) h = height * aspy; /* check if the image will fit in the image with (zoom == 1) */ - width = BLI_RCT_SIZE_X(&ar->winrct) + 1; - height = BLI_RCT_SIZE_Y(&ar->winrct) + 1; + width = BLI_rcti_size_x(&ar->winrct) + 1; + height = BLI_rcti_size_y(&ar->winrct) + 1; if ((w >= width || h >= height) && (width > 0 && height > 0)) { /* find the zoom value that will fit the image in the image space */ diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index 5b288bd6149..4d4129b3420 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -558,8 +558,8 @@ static void image_main_area_set_view2d(SpaceImage *sima, ARegion *ar) if (ima) h *= ima->aspy / ima->aspx; - winx = BLI_RCT_SIZE_X(&ar->winrct) + 1; - winy = BLI_RCT_SIZE_Y(&ar->winrct) + 1; + winx = BLI_rcti_size_x(&ar->winrct) + 1; + winy = BLI_rcti_size_y(&ar->winrct) + 1; ar->v2d.tot.xmin = 0; ar->v2d.tot.ymin = 0; diff --git a/source/blender/editors/space_logic/logic_buttons.c b/source/blender/editors/space_logic/logic_buttons.c index abffb955405..abdfa0ef4dd 100644 --- a/source/blender/editors/space_logic/logic_buttons.c +++ b/source/blender/editors/space_logic/logic_buttons.c @@ -84,10 +84,10 @@ static int cut_links_intersect(uiLinkLine *line, float mcoords[][2], int tot) int i, b; rcti rectlink; - rectlink.xmin = (int)BLI_RCT_CENTER_X(&line->from->rect); - rectlink.ymin = (int)BLI_RCT_CENTER_Y(&line->from->rect); - rectlink.xmax = (int)BLI_RCT_CENTER_X(&line->to->rect); - rectlink.ymax = (int)BLI_RCT_CENTER_Y(&line->to->rect); + rectlink.xmin = (int)BLI_rctf_cent_x(&line->from->rect); + rectlink.ymin = (int)BLI_rctf_cent_y(&line->from->rect); + rectlink.xmax = (int)BLI_rctf_cent_x(&line->to->rect); + rectlink.ymax = (int)BLI_rctf_cent_y(&line->to->rect); if (ui_link_bezier_points(&rectlink, coord_array, LINK_RESOL)) { for (i=0; icur.xmin, &v2d->cur.xmax, onlySel); - extra = 0.1f * BLI_RCT_SIZE_X(&v2d->cur); + extra = 0.1f * BLI_rctf_size_x(&v2d->cur); v2d->cur.xmin -= extra; v2d->cur.xmax += extra; /* set vertical range */ v2d->cur.ymax = 0.0f; - v2d->cur.ymin = (float)-BLI_RCT_SIZE_Y(&v2d->mask); + v2d->cur.ymin = (float)-BLI_rcti_size_y(&v2d->mask); /* do View2D syncing */ UI_view2d_sync(CTX_wm_screen(C), CTX_wm_area(C), v2d, V2D_LOCK_COPY); diff --git a/source/blender/editors/space_nla/nla_select.c b/source/blender/editors/space_nla/nla_select.c index 222c2414fcb..79be0d0a194 100644 --- a/source/blender/editors/space_nla/nla_select.c +++ b/source/blender/editors/space_nla/nla_select.c @@ -309,7 +309,7 @@ static int nlaedit_borderselect_exec(bContext *C, wmOperator *op) * - the frame-range select option is favored over the channel one (x over y), as frame-range one is often * used for tweaking timing when "blocking", while channels is not that useful... */ - if (BLI_RCT_SIZE_X(&rect) >= BLI_RCT_SIZE_Y(&rect)) + if (BLI_rcti_size_x(&rect) >= BLI_rcti_size_y(&rect)) mode = NLA_BORDERSEL_FRAMERANGE; else mode = NLA_BORDERSEL_CHANNELS; diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index 1f266c98020..5c3cbf40bbc 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -70,7 +70,7 @@ #include "node_intern.h" /* own include */ /* XXX interface.h */ -extern void ui_dropshadow(rctf *rct, float radius, float aspect, float alpha, int select); +extern void ui_dropshadow(const rctf *rct, float radius, float aspect, float alpha, int select); /* ****************** SOCKET BUTTON DRAW FUNCTIONS ***************** */ @@ -387,7 +387,7 @@ static void node_buts_normal(uiLayout *layout, bContext *UNUSED(C), PointerRNA * bt = uiDefButF(block, BUT_NORMAL, B_NODE_EXEC, "", (int)butr->xmin, (int)butr->xmin, - (short)BLI_RCT_SIZE_X(butr), (short)BLI_RCT_SIZE_X(butr), + (short)BLI_rctf_size_x(butr), (short)BLI_rctf_size_x(butr), nor, 0.0f, 1.0f, 0, 0, ""); uiButSetFunc(bt, node_normal_cb, ntree, node); } @@ -523,7 +523,7 @@ static void node_update_group(const bContext *C, bNodeTree *ntree, bNode *gnode) rect->ymax += NODE_DY; /* input sockets */ - dy = BLI_RCT_CENTER_Y(rect) + (NODE_DY * (BLI_countlist(&gnode->inputs) - 1)); + dy = BLI_rctf_cent_y(rect) + (NODE_DY * (BLI_countlist(&gnode->inputs) - 1)); gsock = ngroup->inputs.first; sock = gnode->inputs.first; while (gsock || sock) { @@ -571,7 +571,7 @@ static void node_update_group(const bContext *C, bNodeTree *ntree, bNode *gnode) } /* output sockets */ - dy = BLI_RCT_CENTER_Y(rect) + (NODE_DY * (BLI_countlist(&gnode->outputs) - 1)); + dy = BLI_rctf_cent_y(rect) + (NODE_DY * (BLI_countlist(&gnode->outputs) - 1)); gsock = ngroup->outputs.first; sock = gnode->outputs.first; while (gsock || sock) { @@ -837,7 +837,7 @@ static void node_draw_group(const bContext *C, ARegion *ar, SpaceNode *snode, bN layout = uiBlockLayout(gnode->block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, (int)(rect.xmin + NODE_MARGIN_X), (int)(rect.ymax + (group_header - (2.5f * dpi_fac))), - mini((int)(BLI_RCT_SIZE_X(&rect) - 18.0f), node_group_frame + 20), group_header, UI_GetStyle()); + mini((int)(BLI_rctf_size_x(&rect) - 18.0f), node_group_frame + 20), group_header, UI_GetStyle()); RNA_pointer_create(&ntree->id, &RNA_Node, gnode, &ptr); uiTemplateIDBrowse(layout, (bContext *)C, &ptr, "node_tree", NULL, NULL, NULL); uiBlockLayoutResolve(gnode->block, NULL, NULL); @@ -979,7 +979,7 @@ static void node_draw_frame_label(bNode *node, const float aspect) ascender = BLF_ascender(fontid); /* 'x' doesn't need aspect correction */ - x = BLI_RCT_CENTER_X(rct) - (0.5f * width); + x = BLI_rctf_cent_x(rct) - (0.5f * width); y = rct->ymax - (((NODE_DY / 4) / aspect) + (ascender * aspect)); BLF_position(fontid, x, y, 0); diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index 7d35f566140..fd14cf1a408 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -65,7 +65,7 @@ /* width of socket columns in group display */ #define NODE_GROUP_FRAME 120 /* XXX interface.h */ -extern void ui_dropshadow(rctf *rct, float radius, float aspect, float alpha, int select); +extern void ui_dropshadow(const rctf *rct, float radius, float aspect, float alpha, int select); /* XXX update functions for node editor are a mess, needs a clear concept */ void ED_node_tree_update(SpaceNode *snode, Scene *scene) @@ -343,7 +343,7 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node) if (node->prvr.ymax < node->prvr.ymin) SWAP(float, node->prvr.ymax, node->prvr.ymin); } else { - float oldh = BLI_RCT_SIZE_Y(&node->prvr); + float oldh = BLI_rctf_size_y(&node->prvr); if (oldh == 0.0f) oldh = 0.6f * node->width - NODE_DY; dy -= NODE_DYS / 2; @@ -584,9 +584,9 @@ void node_socket_circle_draw(bNodeTree *UNUSED(ntree), bNodeSocket *sock, float /* not a callback */ static void node_draw_preview(bNodePreview *preview, rctf *prv) { - float xscale = BLI_RCT_SIZE_X(prv) / ((float)preview->xsize); - float yscale = BLI_RCT_SIZE_Y(prv) / ((float)preview->ysize); - float tile = BLI_RCT_SIZE_X(prv) / 10.0f; + float xscale = BLI_rctf_size_x(prv) / ((float)preview->xsize); + float yscale = BLI_rctf_size_y(prv) / ((float)preview->ysize); + float tile = BLI_rctf_size_x(prv) / 10.0f; float x, y; /* draw checkerboard backdrop to show alpha */ @@ -852,8 +852,8 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b { bNodeSocket *sock; rctf *rct = &node->totr; - float dx, centy = BLI_RCT_CENTER_Y(rct); - float hiddenrad = BLI_RCT_SIZE_Y(rct) / 2.0f; + float dx, centy = BLI_rctf_cent_y(rct); + float hiddenrad = BLI_rctf_size_y(rct) / 2.0f; float socket_size = NODE_SOCKSIZE * U.dpi / 72; int color_id = node_get_colorid(node); char showname[128]; /* 128 is used below */ @@ -932,7 +932,7 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b uiDefBut(node->block, LABEL, 0, showname, (int)(rct->xmin + (NODE_MARGIN_X / snode->aspect_sqrt)), (int)(centy - 10), - (short)(BLI_RCT_SIZE_X(rct) - 18.0f - 12.0f), (short)NODE_DY, + (short)(BLI_rctf_size_x(rct) - 18.0f - 12.0f), (short)NODE_DY, NULL, 0, 0, 0, 0, ""); } @@ -1108,7 +1108,7 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d) glEnable(GL_MAP1_VERTEX_3); /* aspect+font, set each time */ - snode->aspect = BLI_RCT_SIZE_X(&v2d->cur) / (float)ar->winx; + snode->aspect = BLI_rctf_size_x(&v2d->cur) / (float)ar->winx; snode->aspect_sqrt = sqrtf(snode->aspect); // XXX snode->curfont= uiSetCurFont_ext(snode->aspect); diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index cc386da2e93..64a8d96a74f 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -2067,8 +2067,8 @@ static int node_clipboard_paste_exec(bContext *C, wmOperator *op) /* calculate "barycenter" for placing on mouse cursor */ zero_v2(center); for (node = clipboard_nodes_lb->first, num_nodes = 0; node; node = node->next, num_nodes++) { - center[0] += BLI_RCT_CENTER_X(&node->totr); - center[1] += BLI_RCT_CENTER_Y(&node->totr); + center[0] += BLI_rctf_cent_x(&node->totr); + center[1] += BLI_rctf_cent_y(&node->totr); } mul_v2_fl(center, 1.0 / num_nodes); diff --git a/source/blender/editors/space_node/node_select.c b/source/blender/editors/space_node/node_select.c index a56d76a3ef7..f7757ce49b4 100644 --- a/source/blender/editors/space_node/node_select.c +++ b/source/blender/editors/space_node/node_select.c @@ -555,8 +555,8 @@ static int do_lasso_select_node(bContext *C, int mcords[][2], short moves, short /* do actual selection */ for (node = snode->edittree->nodes.first; node; node = node->next) { int screen_co[2]; - const float cent[2] = {BLI_RCT_CENTER_X(&node->totr), - BLI_RCT_CENTER_Y(&node->totr)}; + const float cent[2] = {BLI_rctf_cent_x(&node->totr), + BLI_rctf_cent_y(&node->totr)}; /* marker in screen coords */ UI_view2d_view_to_region(&ar->v2d, diff --git a/source/blender/editors/space_node/node_view.c b/source/blender/editors/space_node/node_view.c index 8e38247348f..747ccfe7957 100644 --- a/source/blender/editors/space_node/node_view.c +++ b/source/blender/editors/space_node/node_view.c @@ -72,8 +72,8 @@ static int space_node_view_flag(bContext *C, SpaceNode *snode, ARegion *ar, cons int tot = 0; int has_frame = FALSE; - oldwidth = BLI_RCT_SIZE_X(&ar->v2d.cur); - oldheight = BLI_RCT_SIZE_Y(&ar->v2d.cur); + oldwidth = BLI_rctf_size_x(&ar->v2d.cur); + oldheight = BLI_rctf_size_y(&ar->v2d.cur); BLI_rctf_init_minmax(&cur_new); @@ -91,8 +91,8 @@ static int space_node_view_flag(bContext *C, SpaceNode *snode, ARegion *ar, cons } if (tot) { - width = BLI_RCT_SIZE_X(&cur_new); - height = BLI_RCT_SIZE_Y(&cur_new); + width = BLI_rctf_size_x(&cur_new); + height = BLI_rctf_size_y(&cur_new); /* for single non-frame nodes, don't zoom in, just pan view, * but do allow zooming out, this allows for big nodes to be zoomed out */ diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c index 0874ddcb279..d7e180f982b 100644 --- a/source/blender/editors/space_outliner/outliner_edit.c +++ b/source/blender/editors/space_outliner/outliner_edit.c @@ -579,11 +579,11 @@ static int outliner_show_active_exec(bContext *C, wmOperator *UNUSED(op)) te = outliner_find_id(so, &so->tree, (ID *)OBACT); if (te) { /* make te->ys center of view */ - ytop = (int)(te->ys + BLI_RCT_SIZE_Y(&v2d->mask) / 2); + ytop = (int)(te->ys + BLI_rcti_size_y(&v2d->mask) / 2); if (ytop > 0) ytop = 0; v2d->cur.ymax = (float)ytop; - v2d->cur.ymin = (float)(ytop - BLI_RCT_SIZE_Y(&v2d->mask)); + v2d->cur.ymin = (float)(ytop - BLI_rcti_size_y(&v2d->mask)); /* make te->xs ==> te->xend center of view */ xdelta = (int)(te->xs - v2d->cur.xmin); @@ -615,7 +615,7 @@ void OUTLINER_OT_show_active(wmOperatorType *ot) static int outliner_scroll_page_exec(bContext *C, wmOperator *op) { ARegion *ar = CTX_wm_region(C); - int dy = BLI_RCT_SIZE_Y(&ar->v2d.mask); + int dy = BLI_rcti_size_y(&ar->v2d.mask); int up = 0; if (RNA_boolean_get(op->ptr, "up")) @@ -760,10 +760,10 @@ static void outliner_find_panel(Scene *UNUSED(scene), ARegion *ar, SpaceOops *so tselem->flag |= TSE_SELECTED; /* make te->ys center of view */ - ytop = (int)(te->ys + BLI_RCT_SIZE_Y(&ar->v2d.mask) / 2); + ytop = (int)(te->ys + BLI_rctf_size_y(&ar->v2d.mask) / 2); if (ytop > 0) ytop = 0; ar->v2d.cur.ymax = (float)ytop; - ar->v2d.cur.ymin = (float)(ytop - BLI_RCT_SIZE_Y(&ar->v2d.mask)); + ar->v2d.cur.ymin = (float)(ytop - BLI_rctf_size_y(&ar->v2d.mask)); /* make te->xs ==> te->xend center of view */ xdelta = (int)(te->xs - ar->v2d.cur.xmin); diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 7363bf2fbd8..f927e83cabe 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -432,7 +432,7 @@ static void draw_seq_extensions(Scene *scene, ARegion *ar, Sequence *seq) y1 = seq->machine + SEQ_STRIP_OFSBOTTOM; y2 = seq->machine + SEQ_STRIP_OFSTOP; - pixely = BLI_RCT_SIZE_Y(&v2d->cur) / BLI_RCT_SIZE_Y(&v2d->mask); + pixely = BLI_rctf_size_y(&v2d->cur) / BLI_rcti_size_y(&v2d->mask); if (pixely <= 0) return; /* can happen when the view is split/resized */ @@ -725,7 +725,7 @@ static void draw_seq_strip(Scene *scene, ARegion *ar, Sequence *seq, int outline /* draw sound wave */ if (seq->type == SEQ_TYPE_SOUND_RAM) { - drawseqwave(scene, seq, x1, y1, x2, y2, BLI_RCT_SIZE_X(&ar->v2d.cur) / ar->winx); + drawseqwave(scene, seq, x1, y1, x2, y2, BLI_rctf_size_x(&ar->v2d.cur) / ar->winx); } /* draw lock */ @@ -1032,10 +1032,10 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq if (draw_overlay) { if (sseq->overlay_type == SEQ_DRAW_OVERLAY_RECT) { rctf tot_clip; - tot_clip.xmin = v2d->tot.xmin + (ABS(BLI_RCT_SIZE_X(&v2d->tot)) * scene->ed->over_border.xmin); - tot_clip.ymin = v2d->tot.ymin + (ABS(BLI_RCT_SIZE_Y(&v2d->tot)) * scene->ed->over_border.ymin); - tot_clip.xmax = v2d->tot.xmin + (ABS(BLI_RCT_SIZE_X(&v2d->tot)) * scene->ed->over_border.xmax); - tot_clip.ymax = v2d->tot.ymin + (ABS(BLI_RCT_SIZE_Y(&v2d->tot)) * scene->ed->over_border.ymax); + tot_clip.xmin = v2d->tot.xmin + (fabsf(BLI_rctf_size_x(&v2d->tot)) * scene->ed->over_border.xmin); + tot_clip.ymin = v2d->tot.ymin + (fabsf(BLI_rctf_size_y(&v2d->tot)) * scene->ed->over_border.ymin); + tot_clip.xmax = v2d->tot.xmin + (fabsf(BLI_rctf_size_x(&v2d->tot)) * scene->ed->over_border.xmax); + tot_clip.ymax = v2d->tot.ymin + (fabsf(BLI_rctf_size_y(&v2d->tot)) * scene->ed->over_border.ymax); glTexCoord2f(scene->ed->over_border.xmin, scene->ed->over_border.ymin); glVertex2f(tot_clip.xmin, tot_clip.ymin); glTexCoord2f(scene->ed->over_border.xmin, scene->ed->over_border.ymax); glVertex2f(tot_clip.xmin, tot_clip.ymax); @@ -1222,7 +1222,7 @@ static void draw_seq_strips(const bContext *C, Editing *ed, ARegion *ar) View2D *v2d = &ar->v2d; Sequence *last_seq = BKE_sequencer_active_get(scene); int sel = 0, j; - float pixelx = BLI_RCT_SIZE_X(&v2d->cur) / BLI_RCT_SIZE_X(&v2d->mask); + float pixelx = BLI_rctf_size_x(&v2d->cur) / BLI_rcti_size_x(&v2d->mask); /* loop through twice, first unselected, then selected */ for (j = 0; j < 2; j++) { diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index f47eb339878..e7d964ba715 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -372,7 +372,7 @@ Sequence *find_nearest_seq(Scene *scene, View2D *v2d, int *hand, const int mval[ if (ed == NULL) return NULL; - pixelx = BLI_RCT_SIZE_X(&v2d->cur) / BLI_RCT_SIZE_X(&v2d->mask); + pixelx = BLI_rctf_size_x(&v2d->cur) / BLI_rcti_size_x(&v2d->mask); UI_view2d_region_to_view(v2d, mval[0], mval[1], &x, &y); @@ -2164,8 +2164,8 @@ static int sequencer_view_zoom_ratio_exec(bContext *C, wmOperator *op) float winx = (int)(rd->size * rd->xsch) / 100; float winy = (int)(rd->size * rd->ysch) / 100; - float facx = BLI_RCT_SIZE_X(&v2d->mask) / winx; - float facy = BLI_RCT_SIZE_Y(&v2d->mask) / winy; + float facx = BLI_rcti_size_x(&v2d->mask) / winx; + float facy = BLI_rcti_size_y(&v2d->mask) / winy; BLI_rctf_resize(&v2d->cur, (int)(winx * facx * ratio) + 1, (int)(winy * facy * ratio) + 1); @@ -2268,7 +2268,7 @@ static int sequencer_view_selected_exec(bContext *C, wmOperator *UNUSED(op)) ymax += ymargin; ymin -= ymargin; - orig_height = BLI_RCT_SIZE_Y(&cur_new); + orig_height = BLI_rctf_size_y(&cur_new); cur_new.xmin = xmin; cur_new.xmax = xmax; @@ -2277,8 +2277,8 @@ static int sequencer_view_selected_exec(bContext *C, wmOperator *UNUSED(op)) cur_new.ymax = ymax; /* only zoom out vertically */ - if (orig_height > BLI_RCT_SIZE_Y(&cur_new)) { - ymid = BLI_RCT_CENTER_Y(&cur_new); + if (orig_height > BLI_rctf_size_y(&cur_new)) { + ymid = BLI_rctf_cent_y(&cur_new); cur_new.ymin = ymid - (orig_height / 2); cur_new.ymax = ymid + (orig_height / 2); @@ -2800,11 +2800,11 @@ static int view_ghost_border_exec(bContext *C, wmOperator *op) if (ed == NULL) return OPERATOR_CANCELLED; - rect.xmin /= (float)(ABS(BLI_RCT_SIZE_X(&v2d->tot))); - rect.ymin /= (float)(ABS(BLI_RCT_SIZE_Y(&v2d->tot))); + rect.xmin /= fabsf(BLI_rctf_size_x(&v2d->tot)); + rect.ymin /= fabsf(BLI_rctf_size_y(&v2d->tot)); - rect.xmax /= (float)(ABS(BLI_RCT_SIZE_X(&v2d->tot))); - rect.ymax /= (float)(ABS(BLI_RCT_SIZE_Y(&v2d->tot))); + rect.xmax /= fabsf(BLI_rctf_size_x(&v2d->tot)); + rect.ymax /= fabsf(BLI_rctf_size_y(&v2d->tot)); rect.xmin += 0.5f; rect.xmax += 0.5f; diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c index 97eb5b41db7..5111d20b8ee 100644 --- a/source/blender/editors/space_text/text_draw.c +++ b/source/blender/editors/space_text/text_draw.c @@ -1232,7 +1232,7 @@ static void draw_textscroll(SpaceText *st, rcti *scroll, rcti *back) uiWidgetScrollDraw(&wcol, scroll, &st->txtbar, (st->flags & ST_SCROLL_SELECT) ? UI_SCROLL_PRESSED : 0); uiSetRoundBox(UI_CNR_ALL); - rad = 0.4f * mini(BLI_RCT_SIZE_X(&st->txtscroll), BLI_RCT_SIZE_Y(&st->txtscroll)); + rad = 0.4f * mini(BLI_rcti_size_x(&st->txtscroll), BLI_rcti_size_y(&st->txtscroll)); UI_GetThemeColor3ubv(TH_HILITE, col); col[3] = 48; glColor4ubv(col); diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index 5af44f93d06..2dd6599cecf 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -2409,8 +2409,8 @@ static int text_scroll_bar_invoke(bContext *C, wmOperator *op, wmEvent *event) /* jump scroll, works in v2d but needs to be added here too :S */ if (event->type == MIDDLEMOUSE) { - tsc->old[0] = ar->winrct.xmin + BLI_RCT_CENTER_X(&st->txtbar); - tsc->old[1] = ar->winrct.ymin + BLI_RCT_CENTER_Y(&st->txtbar); + tsc->old[0] = ar->winrct.xmin + BLI_rcti_cent_x(&st->txtbar); + tsc->old[1] = ar->winrct.ymin + BLI_rcti_cent_y(&st->txtbar); tsc->delta[0] = 0; tsc->delta[1] = 0; diff --git a/source/blender/editors/space_time/time_ops.c b/source/blender/editors/space_time/time_ops.c index 733fd27135b..9067fb6933f 100644 --- a/source/blender/editors/space_time/time_ops.c +++ b/source/blender/editors/space_time/time_ops.c @@ -151,7 +151,7 @@ static int time_view_all_exec(bContext *C, wmOperator *UNUSED(op)) v2d->cur.xmax = (float)PEFRA; /* we need an extra "buffer" factor on either side so that the endpoints are visible */ - extra = 0.01f * BLI_RCT_SIZE_X(&v2d->cur); + extra = 0.01f * BLI_rctf_size_x(&v2d->cur); v2d->cur.xmin -= extra; v2d->cur.xmax += extra; diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 5fbf1971349..2ee9fdd8d96 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -973,10 +973,10 @@ static void view3d_camera_border(Scene *scene, ARegion *ar, View3D *v3d, RegionV rect_camera = params.viewplane; /* get camera border within viewport */ - viewborder_r->xmin = ((rect_camera.xmin - rect_view.xmin) / BLI_RCT_SIZE_X(&rect_view)) * ar->winx; - viewborder_r->xmax = ((rect_camera.xmax - rect_view.xmin) / BLI_RCT_SIZE_X(&rect_view)) * ar->winx; - viewborder_r->ymin = ((rect_camera.ymin - rect_view.ymin) / BLI_RCT_SIZE_Y(&rect_view)) * ar->winy; - viewborder_r->ymax = ((rect_camera.ymax - rect_view.ymin) / BLI_RCT_SIZE_Y(&rect_view)) * ar->winy; + viewborder_r->xmin = ((rect_camera.xmin - rect_view.xmin) / BLI_rctf_size_x(&rect_view)) * ar->winx; + viewborder_r->xmax = ((rect_camera.xmax - rect_view.xmin) / BLI_rctf_size_x(&rect_view)) * ar->winx; + viewborder_r->ymin = ((rect_camera.ymin - rect_view.ymin) / BLI_rctf_size_y(&rect_view)) * ar->winy; + viewborder_r->ymax = ((rect_camera.ymax - rect_view.ymin) / BLI_rctf_size_y(&rect_view)) * ar->winy; } void ED_view3d_calc_camera_border_size(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D *rv3d, float size_r[2]) @@ -984,8 +984,8 @@ void ED_view3d_calc_camera_border_size(Scene *scene, ARegion *ar, View3D *v3d, R rctf viewborder; view3d_camera_border(scene, ar, v3d, rv3d, &viewborder, TRUE, TRUE); - size_r[0] = BLI_RCT_SIZE_X(&viewborder); - size_r[1] = BLI_RCT_SIZE_Y(&viewborder); + size_r[0] = BLI_rctf_size_x(&viewborder); + size_r[1] = BLI_rctf_size_y(&viewborder); } void ED_view3d_calc_camera_border(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D *rv3d, @@ -1341,7 +1341,7 @@ static void backdrawview3d(Scene *scene, ARegion *ar, View3D *v3d) glDisable(GL_MULTISAMPLE_ARB); region_scissor_winrct(ar, &winrct); - glScissor(winrct.xmin, winrct.ymin, BLI_RCT_SIZE_X(&winrct), BLI_RCT_SIZE_Y(&winrct)); + glScissor(winrct.xmin, winrct.ymin, BLI_rcti_size_x(&winrct), BLI_rcti_size_y(&winrct)); glClearColor(0.0, 0.0, 0.0, 0.0); if (v3d->zbuf) { @@ -2045,8 +2045,8 @@ void view3d_update_depths_rect(ARegion *ar, ViewDepths *d, rcti *rect) x = rect->xmin; y = rect->ymin; - w = BLI_RCT_SIZE_X(rect); - h = BLI_RCT_SIZE_Y(rect); + w = BLI_rcti_size_x(rect); + h = BLI_rcti_size_y(rect); if (w <= 0 || h <= 0) { if (d->depths) @@ -2879,10 +2879,10 @@ static int view3d_main_area_draw_engine(const bContext *C, ARegion *ar, int draw ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &viewborder, FALSE); - cliprct.xmin = viewborder.xmin + scene->r.border.xmin * BLI_RCT_SIZE_X(&viewborder); - cliprct.ymin = viewborder.ymin + scene->r.border.ymin * BLI_RCT_SIZE_Y(&viewborder); - cliprct.xmax = viewborder.xmin + scene->r.border.xmax * BLI_RCT_SIZE_X(&viewborder); - cliprct.ymax = viewborder.ymin + scene->r.border.ymax * BLI_RCT_SIZE_Y(&viewborder); + cliprct.xmin = viewborder.xmin + scene->r.border.xmin * BLI_rctf_size_x(&viewborder); + cliprct.ymin = viewborder.ymin + scene->r.border.ymin * BLI_rctf_size_y(&viewborder); + cliprct.xmax = viewborder.xmin + scene->r.border.xmax * BLI_rctf_size_x(&viewborder); + cliprct.ymax = viewborder.ymin + scene->r.border.ymax * BLI_rctf_size_y(&viewborder); cliprct.xmin += ar->winrct.xmin; cliprct.xmax += ar->winrct.xmin; @@ -2896,7 +2896,7 @@ static int view3d_main_area_draw_engine(const bContext *C, ARegion *ar, int draw if (cliprct.xmax > cliprct.xmin && cliprct.ymax > cliprct.ymin) { glGetIntegerv(GL_SCISSOR_BOX, scissor); - glScissor(cliprct.xmin, cliprct.ymin, BLI_RCT_SIZE_X(&cliprct), BLI_RCT_SIZE_Y(&cliprct)); + glScissor(cliprct.xmin, cliprct.ymin, BLI_rcti_size_x(&cliprct), BLI_rcti_size_y(&cliprct)); } else return 0; diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 7accdb0c0e4..726d95c31b9 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -375,17 +375,17 @@ typedef struct ViewOpsData { #define TRACKBALLSIZE (1.1) -static void calctrackballvec(rcti *rect, int mx, int my, float vec[3]) +static void calctrackballvec(const rcti *rect, int mx, int my, float vec[3]) { float x, y, radius, d, z, t; radius = TRACKBALLSIZE; /* normalize x and y */ - x = BLI_RCT_CENTER_X(rect) - mx; - x /= (float)(BLI_RCT_SIZE_X(rect) / 4); - y = BLI_RCT_CENTER_Y(rect) - my; - y /= (float)(BLI_RCT_SIZE_Y(rect) / 2); + x = BLI_rcti_cent_x(rect) - mx; + x /= (float)(BLI_rcti_size_x(rect) / 4); + y = BLI_rcti_cent_y(rect) - my; + y /= (float)(BLI_rcti_size_y(rect) / 2); d = sqrt(x * x + y * y); if (d < radius * (float)M_SQRT1_2) { /* Inside sphere */ @@ -1666,8 +1666,8 @@ static void viewzoom_apply(ViewOpsData *vod, int x, int y, const short viewzoom, int ctr[2], len1, len2; /* method which zooms based on how far you move the mouse */ - ctr[0] = BLI_RCT_CENTER_X(&vod->ar->winrct); - ctr[1] = BLI_RCT_CENTER_Y(&vod->ar->winrct); + ctr[0] = BLI_rcti_cent_x(&vod->ar->winrct); + ctr[1] = BLI_rcti_cent_y(&vod->ar->winrct); len1 = (int)sqrt((ctr[0] - x) * (ctr[0] - x) + (ctr[1] - y) * (ctr[1] - y)) + 5; len2 = (int)sqrt((ctr[0] - vod->origx) * (ctr[0] - vod->origx) + (ctr[1] - vod->origy) * (ctr[1] - vod->origy)) + 5; @@ -2619,10 +2619,10 @@ static int render_border_exec(bContext *C, wmOperator *op) /* calculate range */ ED_view3d_calc_camera_border(scene, ar, v3d, rv3d, &vb, FALSE); - scene->r.border.xmin = ((float)rect.xmin - vb.xmin) / BLI_RCT_SIZE_X(&vb); - scene->r.border.ymin = ((float)rect.ymin - vb.ymin) / BLI_RCT_SIZE_Y(&vb); - scene->r.border.xmax = ((float)rect.xmax - vb.xmin) / BLI_RCT_SIZE_X(&vb); - scene->r.border.ymax = ((float)rect.ymax - vb.ymin) / BLI_RCT_SIZE_Y(&vb); + scene->r.border.xmin = ((float)rect.xmin - vb.xmin) / BLI_rctf_size_x(&vb); + scene->r.border.ymin = ((float)rect.ymin - vb.ymin) / BLI_rctf_size_y(&vb); + scene->r.border.xmax = ((float)rect.xmax - vb.xmin) / BLI_rctf_size_x(&vb); + scene->r.border.ymax = ((float)rect.ymax - vb.ymin) / BLI_rctf_size_y(&vb); /* actually set border */ CLAMP(scene->r.border.xmin, 0.0f, 1.0f); @@ -2786,8 +2786,8 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op) } /* work out the ratios, so that everything selected fits when we zoom */ - xscale = (BLI_RCT_SIZE_X(&rect) / vb[0]); - yscale = (BLI_RCT_SIZE_Y(&rect) / vb[1]); + xscale = (BLI_rcti_size_x(&rect) / vb[0]); + yscale = (BLI_rcti_size_y(&rect) / vb[1]); new_dist *= maxf(xscale, yscale); /* zoom in as required, or as far as we can go */ diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index 166a62562fd..a10cc38b6c5 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -654,8 +654,8 @@ static int do_paintvert_box_select(ViewContext *vc, rcti *rect, int select, int unsigned int *rt; int a, index; char *selar; - int sx = BLI_RCT_SIZE_X(rect) + 1; - int sy = BLI_RCT_SIZE_Y(rect) + 1; + int sx = BLI_rcti_size_x(rect) + 1; + int sy = BLI_rcti_size_y(rect) + 1; me = vc->obact->data; diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index a3fb4e851e2..d067e8acae2 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -126,11 +126,11 @@ static void convertViewVec2D(View2D *v2d, float r_vec[3], int dx, int dy) { float divx, divy; - divx = BLI_RCT_SIZE_X(&v2d->mask); - divy = BLI_RCT_SIZE_Y(&v2d->mask); + divx = BLI_rcti_size_x(&v2d->mask); + divy = BLI_rcti_size_y(&v2d->mask); - r_vec[0] = BLI_RCT_SIZE_X(&v2d->cur) * dx / divx; - r_vec[1] = BLI_RCT_SIZE_Y(&v2d->cur) * dy / divy; + r_vec[0] = BLI_rctf_size_x(&v2d->cur) * dx / divx; + r_vec[1] = BLI_rctf_size_y(&v2d->cur) * dy / divy; r_vec[2] = 0.0f; } @@ -139,11 +139,11 @@ static void convertViewVec2D_mask(View2D *v2d, float r_vec[3], int dx, int dy) float divx, divy; float mulx, muly; - divx = BLI_RCT_SIZE_X(&v2d->mask); - divy = BLI_RCT_SIZE_Y(&v2d->mask); + divx = BLI_rcti_size_x(&v2d->mask); + divy = BLI_rcti_size_y(&v2d->mask); - mulx = BLI_RCT_SIZE_X(&v2d->cur); - muly = BLI_RCT_SIZE_Y(&v2d->cur); + mulx = BLI_rctf_size_x(&v2d->cur); + muly = BLI_rctf_size_y(&v2d->cur); /* difference with convertViewVec2D */ /* clamp w/h, mask only */ diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 181f9fe6036..2e001cdabcf 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -5554,8 +5554,8 @@ static void createTransObject(bContext *C, TransInfo *t) static void NodeToTransData(TransData *td, TransData2D *td2d, bNode *node) { /* hold original location */ - float locxy[2] = {BLI_RCT_CENTER_X(&node->totr), - BLI_RCT_CENTER_Y(&node->totr)}; + float locxy[2] = {BLI_rctf_cent_x(&node->totr), + BLI_rctf_cent_y(&node->totr)}; copy_v2_v2(td2d->loc, locxy); td2d->loc[2] = 0.0f; diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index b88ae68e00b..6e371e5e002 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -960,8 +960,8 @@ static void TargetSnapOffset(TransInfo *t, TransData *td) if (t->spacetype == SPACE_NODE && td != NULL) { bNode *node = td->extra; char border = t->tsnap.snapNodeBorder; - float width = BLI_RCT_SIZE_X(&node->totr); - float height = BLI_RCT_SIZE_Y(&node->totr); + float width = BLI_rctf_size_x(&node->totr); + float height = BLI_rctf_size_y(&node->totr); if (border & NODE_LEFT) t->tsnap.snapTarget[0] -= 0.5f * width; -- cgit v1.2.3