Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/gpencil/annotate_draw.c7
-rw-r--r--source/blender/editors/gpencil/annotate_paint.c8
-rw-r--r--source/blender/editors/gpencil/drawgpencil.c9
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c6
-rw-r--r--source/blender/editors/include/ED_screen.h3
-rw-r--r--source/blender/editors/interface/view2d_gizmo_navigate.c13
-rw-r--r--source/blender/editors/screen/area.c24
-rw-r--r--source/blender/editors/space_image/image_draw.c5
-rw-r--r--source/blender/editors/space_image/space_image.c7
-rw-r--r--source/blender/editors/space_sequencer/space_sequencer.c7
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c9
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_navigate.c17
-rw-r--r--source/blender/editors/transform/transform.c7
13 files changed, 60 insertions, 62 deletions
diff --git a/source/blender/editors/gpencil/annotate_draw.c b/source/blender/editors/gpencil/annotate_draw.c
index dce6ed29c05..697d06aa098 100644
--- a/source/blender/editors/gpencil/annotate_draw.c
+++ b/source/blender/editors/gpencil/annotate_draw.c
@@ -936,7 +936,6 @@ static void annotation_draw_data_layers(
/* draw a short status message in the top-right corner */
static void annotation_draw_status_text(const bGPdata *gpd, ARegion *ar)
{
- rcti rect;
/* Cannot draw any status text when drawing OpenGL Renders */
if (G.f & G_FLAG_RENDER_VIEWPORT) {
@@ -944,7 +943,7 @@ static void annotation_draw_status_text(const bGPdata *gpd, ARegion *ar)
}
/* Get bounds of region - Necessary to avoid problems with region overlap */
- ED_region_visible_rect(ar, &rect);
+ const rcti *rect = ED_region_visible_rect(ar);
/* for now, this should only be used to indicate when we are in stroke editmode */
if (gpd->flag & GP_DATA_STROKE_EDITMODE) {
@@ -956,8 +955,8 @@ static void annotation_draw_status_text(const bGPdata *gpd, ARegion *ar)
BLF_width_and_height(
font_id, printable, BLF_DRAW_STR_DUMMY_MAX, &printable_size[0], &printable_size[1]);
- int xco = (rect.xmax - U.widget_unit) - (int)printable_size[0];
- int yco = (rect.ymax - U.widget_unit);
+ int xco = (rect->xmax - U.widget_unit) - (int)printable_size[0];
+ int yco = (rect->ymax - U.widget_unit);
/* text label */
UI_FontThemeColor(font_id, TH_TEXT_HI);
diff --git a/source/blender/editors/gpencil/annotate_paint.c b/source/blender/editors/gpencil/annotate_paint.c
index c9c4a67644e..07b61751b22 100644
--- a/source/blender/editors/gpencil/annotate_paint.c
+++ b/source/blender/editors/gpencil/annotate_paint.c
@@ -2242,11 +2242,9 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
}
}
else if (p->ar) {
- rcti region_rect;
-
- /* Perform bounds check using */
- ED_region_visible_rect(p->ar, &region_rect);
- in_bounds = BLI_rcti_isect_pt_v(&region_rect, event->mval);
+ /* Perform bounds check. */
+ const rcti *region_rect = ED_region_visible_rect(p->ar);
+ in_bounds = BLI_rcti_isect_pt_v(region_rect, event->mval);
}
else {
/* No region */
diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c
index 2b31af5ff1f..7c76f3aeab6 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -1173,15 +1173,14 @@ void ED_gp_draw_fill(tGPDdraw *tgpw)
/* draw a short status message in the top-right corner */
static void UNUSED_FUNCTION(gp_draw_status_text)(const bGPdata *gpd, ARegion *ar)
{
- rcti rect;
/* Cannot draw any status text when drawing OpenGL Renders */
if (G.f & G_FLAG_RENDER_VIEWPORT) {
return;
}
- /* Get bounds of region - Necessary to avoid problems with region overlap */
- ED_region_visible_rect(ar, &rect);
+ /* Get bounds of region - Necessary to avoid problems with region overlap. */
+ const rcti *rect = ED_region_visible_rect(ar);
/* for now, this should only be used to indicate when we are in stroke editmode */
if (gpd->flag & GP_DATA_STROKE_EDITMODE) {
@@ -1193,8 +1192,8 @@ static void UNUSED_FUNCTION(gp_draw_status_text)(const bGPdata *gpd, ARegion *ar
BLF_width_and_height(
font_id, printable, BLF_DRAW_STR_DUMMY_MAX, &printable_size[0], &printable_size[1]);
- int xco = (rect.xmax - U.widget_unit) - (int)printable_size[0];
- int yco = (rect.ymax - U.widget_unit);
+ int xco = (rect->xmax - U.widget_unit) - (int)printable_size[0];
+ int yco = (rect->ymax - U.widget_unit);
/* text label */
UI_FontThemeColor(font_id, TH_TEXT_HI);
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 894fb6eced4..a5425d64c2e 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -3629,11 +3629,9 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event)
}
}
else if (p->ar) {
- rcti region_rect;
-
/* Perform bounds check using */
- ED_region_visible_rect(p->ar, &region_rect);
- in_bounds = BLI_rcti_isect_pt_v(&region_rect, event->mval);
+ const rcti *region_rect = ED_region_visible_rect(p->ar);
+ in_bounds = BLI_rcti_isect_pt_v(region_rect, event->mval);
}
else {
/* No region */
diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h
index e67a3b003fc..c7ee7be49b5 100644
--- a/source/blender/editors/include/ED_screen.h
+++ b/source/blender/editors/include/ED_screen.h
@@ -124,7 +124,8 @@ void ED_region_image_metadata_draw(
void ED_region_image_metadata_panel_draw(struct ImBuf *ibuf, struct uiLayout *layout);
void ED_region_grid_draw(struct ARegion *ar, float zoomx, float zoomy);
float ED_region_blend_alpha(struct ARegion *ar);
-void ED_region_visible_rect(struct ARegion *ar, struct rcti *rect);
+void ED_region_visible_rect_calc(struct ARegion *ar, struct rcti *rect);
+const rcti *ED_region_visible_rect(ARegion *ar);
bool ED_region_is_overlap(int spacetype, int regiontype);
int ED_region_snap_size_test(const struct ARegion *ar);
diff --git a/source/blender/editors/interface/view2d_gizmo_navigate.c b/source/blender/editors/interface/view2d_gizmo_navigate.c
index 883f16c63f2..9b15f2309a1 100644
--- a/source/blender/editors/interface/view2d_gizmo_navigate.c
+++ b/source/blender/editors/interface/view2d_gizmo_navigate.c
@@ -201,21 +201,20 @@ static void WIDGETGROUP_navigate_draw_prepare(const bContext *C, wmGizmoGroup *g
struct NavigateWidgetGroup *navgroup = gzgroup->customdata;
ARegion *ar = CTX_wm_region(C);
- rcti rect_visible;
- ED_region_visible_rect(ar, &rect_visible);
+ const rcti *rect_visible = ED_region_visible_rect(ar);
- if ((navgroup->state.rect_visible.xmax == rect_visible.xmax) &&
- (navgroup->state.rect_visible.ymax == rect_visible.ymax)) {
+ if ((navgroup->state.rect_visible.xmax == rect_visible->xmax) &&
+ (navgroup->state.rect_visible.ymax == rect_visible->ymax)) {
return;
}
- navgroup->state.rect_visible = rect_visible;
+ navgroup->state.rect_visible = *rect_visible;
const float icon_size = GIZMO_SIZE;
const float icon_offset_mini = icon_size * GIZMO_MINI_OFFSET_FAC * UI_DPI_FAC;
const float co[2] = {
- rect_visible.xmax - (icon_offset_mini * 0.75f),
- rect_visible.ymax - (icon_offset_mini * 0.75f),
+ rect_visible->xmax - (icon_offset_mini * 0.75f),
+ rect_visible->ymax - (icon_offset_mini * 0.75f),
};
wmGizmo *gz;
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index d0a3382ee50..1775a0c55a2 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -875,10 +875,9 @@ static void fullscreen_azone_initialize(ScrArea *sa, ARegion *ar)
az->alpha = 0.0f;
if (U.uiflag2 & USER_REGION_OVERLAP) {
- rcti rect_visible;
- ED_region_visible_rect(ar, &rect_visible);
- az->x2 = ar->winrct.xmin + rect_visible.xmax;
- az->y2 = ar->winrct.ymin + rect_visible.ymax;
+ const rcti *rect_visible = ED_region_visible_rect(ar);
+ az->x2 = ar->winrct.xmin + rect_visible->xmax;
+ az->y2 = ar->winrct.ymin + rect_visible->ymax;
}
else {
az->x2 = ar->winrct.xmax;
@@ -1492,6 +1491,9 @@ static void region_rect_recursive(
if (ar->winx != prev_winx || ar->winy != prev_winy) {
ED_region_tag_redraw(ar);
}
+
+ /* Clear, initialize on demand. */
+ memset(&ar->runtime.visible_rect, 0, sizeof(ar->runtime.visible_rect));
}
static void area_calc_totrct(ScrArea *sa, const rcti *window_rect)
@@ -2786,11 +2788,10 @@ void ED_region_info_draw_multiline(ARegion *ar,
uiStyle *style = UI_style_get_dpi();
int fontid = style->widget.uifont_id;
int scissor[4];
- rcti rect;
int num_lines = 0;
/* background box */
- ED_region_visible_rect(ar, &rect);
+ rcti rect = *ED_region_visible_rect(ar);
/* Box fill entire width or just around text. */
if (!full_redraw) {
@@ -3268,7 +3269,7 @@ void ED_region_grid_draw(ARegion *ar, float zoomx, float zoomy)
/* If the area has overlapping regions, it returns visible rect for Region *ar */
/* rect gets returned in local region coordinates */
-void ED_region_visible_rect(ARegion *ar, rcti *rect)
+static void region_visible_rect_calc(ARegion *ar, rcti *rect)
{
ARegion *arn = ar;
@@ -3315,6 +3316,15 @@ void ED_region_visible_rect(ARegion *ar, rcti *rect)
BLI_rcti_translate(rect, -ar->winrct.xmin, -ar->winrct.ymin);
}
+const rcti *ED_region_visible_rect(ARegion *ar)
+{
+ rcti *rect = &ar->runtime.visible_rect;
+ if (rect->xmin == 0 && rect->ymin == 0 && rect->xmax == 0 && rect->ymax == 0) {
+ region_visible_rect_calc(ar, rect);
+ }
+ return rect;
+}
+
/* Cache display helpers */
void ED_region_cache_draw_background(const ARegion *ar)
diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c
index 97a3c7f2480..9a2b0d95c20 100644
--- a/source/blender/editors/space_image/image_draw.c
+++ b/source/blender/editors/space_image/image_draw.c
@@ -156,9 +156,8 @@ void ED_image_draw_info(Scene *scene,
char str[256];
int dx = 6;
/* local coordinate visible rect inside region, to accommodate overlapping ui */
- rcti rect;
- ED_region_visible_rect(ar, &rect);
- const int ymin = rect.ymin;
+ const rcti *rect = ED_region_visible_rect(ar);
+ const int ymin = rect->ymin;
const int dy = ymin + 0.3f * UI_UNIT_Y;
/* text colors */
diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c
index 17f808f727d..33e77d3623e 100644
--- a/source/blender/editors/space_image/space_image.c
+++ b/source/blender/editors/space_image/space_image.c
@@ -501,11 +501,10 @@ static void image_main_region_set_view2d(SpaceImage *sima, ARegion *ar)
int winy = BLI_rcti_size_y(&ar->winrct) + 1;
/* For region overlap, move center so image doesn't overlap header. */
- rcti visible_rect;
- ED_region_visible_rect(ar, &visible_rect);
- const int visible_winy = BLI_rcti_size_y(&visible_rect) + 1;
+ const rcti *visible_rect = ED_region_visible_rect(ar);
+ const int visible_winy = BLI_rcti_size_y(visible_rect) + 1;
int visible_centerx = 0;
- int visible_centery = visible_rect.ymin + (visible_winy - winy) / 2;
+ int visible_centery = visible_rect->ymin + (visible_winy - winy) / 2;
ar->v2d.tot.xmin = 0;
ar->v2d.tot.ymin = 0;
diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c
index 12b446c3f4c..9aa9d14cbc8 100644
--- a/source/blender/editors/space_sequencer/space_sequencer.c
+++ b/source/blender/editors/space_sequencer/space_sequencer.c
@@ -675,10 +675,9 @@ static void sequencer_preview_region_draw(const bContext *C, ARegion *ar)
WM_gizmomap_draw(ar->gizmo_map, C, WM_GIZMOMAP_DRAWSTEP_2D);
if ((U.uiflag & USER_SHOW_FPS) && ED_screen_animation_no_scrub(wm)) {
- rcti rect;
- ED_region_visible_rect(ar, &rect);
- int xoffset = rect.xmin + U.widget_unit;
- int yoffset = rect.ymax;
+ const rcti *rect = ED_region_visible_rect(ar);
+ int xoffset = rect->xmin + U.widget_unit;
+ int yoffset = rect->ymax;
ED_scene_draw_fps(scene, xoffset, &yoffset);
}
}
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 8844428b1bf..6c534ee1b98 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -1382,8 +1382,7 @@ void view3d_draw_region_info(const bContext *C, ARegion *ar)
ED_region_pixelspace(ar);
/* local coordinate visible rect inside region, to accommodate overlapping ui */
- rcti rect;
- ED_region_visible_rect(ar, &rect);
+ const rcti *rect = ED_region_visible_rect(ar);
view3d_draw_border(C, ar);
view3d_draw_grease_pencil(C);
@@ -1399,14 +1398,14 @@ void view3d_draw_region_info(const bContext *C, ARegion *ar)
/* The gizmo handles it's own drawing. */
break;
case USER_MINI_AXIS_TYPE_MINIMAL:
- draw_view_axis(rv3d, &rect);
+ draw_view_axis(rv3d, rect);
case USER_MINI_AXIS_TYPE_NONE:
break;
}
}
- int xoffset = rect.xmin + U.widget_unit;
- int yoffset = rect.ymax;
+ int xoffset = rect->xmin + U.widget_unit;
+ int yoffset = rect->ymax;
if ((v3d->flag2 & V3D_HIDE_OVERLAYS) == 0 && (v3d->overlay.flag & V3D_OVERLAY_HIDE_TEXT) == 0) {
if ((U.uiflag & USER_SHOW_FPS) && ED_screen_animation_no_scrub(wm)) {
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_navigate.c b/source/blender/editors/space_view3d/view3d_gizmo_navigate.c
index ad1a57eb71f..3c911e266a9 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_navigate.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_navigate.c
@@ -246,18 +246,17 @@ static void WIDGETGROUP_navigate_draw_prepare(const bContext *C, wmGizmoGroup *g
copy_v3_v3(navgroup->gz_array[GZ_INDEX_ROTATE]->matrix_offset[i], rv3d->viewmat[i]);
}
- rcti rect_visible;
- ED_region_visible_rect(ar, &rect_visible);
+ const rcti *rect_visible = ED_region_visible_rect(ar);
- if ((navgroup->state.rect_visible.xmax == rect_visible.xmax) &&
- (navgroup->state.rect_visible.ymax == rect_visible.ymax) &&
+ if ((navgroup->state.rect_visible.xmax == rect_visible->xmax) &&
+ (navgroup->state.rect_visible.ymax == rect_visible->ymax) &&
(navgroup->state.rv3d.is_persp == rv3d->is_persp) &&
(navgroup->state.rv3d.is_camera == (rv3d->persp == RV3D_CAMOB)) &&
(navgroup->state.rv3d.viewlock == rv3d->viewlock)) {
return;
}
- navgroup->state.rect_visible = rect_visible;
+ navgroup->state.rect_visible = *rect_visible;
navgroup->state.rv3d.is_persp = rv3d->is_persp;
navgroup->state.rv3d.is_camera = (rv3d->persp == RV3D_CAMOB);
navgroup->state.rv3d.viewlock = rv3d->viewlock;
@@ -268,8 +267,8 @@ static void WIDGETGROUP_navigate_draw_prepare(const bContext *C, wmGizmoGroup *g
const float icon_offset = (icon_size * 0.52f) * GIZMO_OFFSET_FAC * UI_DPI_FAC;
const float icon_offset_mini = icon_size * GIZMO_MINI_OFFSET_FAC * UI_DPI_FAC;
const float co_rotate[2] = {
- rect_visible.xmax - icon_offset,
- rect_visible.ymax - icon_offset,
+ rect_visible->xmax - icon_offset,
+ rect_visible->ymax - icon_offset,
};
float icon_offset_from_axis = 0.0f;
@@ -286,8 +285,8 @@ static void WIDGETGROUP_navigate_draw_prepare(const bContext *C, wmGizmoGroup *g
}
const float co[2] = {
- rect_visible.xmax - icon_offset_from_axis,
- rect_visible.ymax - icon_offset_mini * 0.75f,
+ rect_visible->xmax - icon_offset_from_axis,
+ rect_visible->ymax - icon_offset_mini * 0.75f,
};
wmGizmo *gz;
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index 98203a7e316..14995144c5c 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -2009,19 +2009,18 @@ static void drawTransformView(const struct bContext *C, ARegion *ar, void *arg)
* to warn that autokeying is enabled */
static void drawAutoKeyWarning(TransInfo *UNUSED(t), ARegion *ar)
{
- rcti rect;
const char *printable = IFACE_("Auto Keying On");
float printable_size[2];
int xco, yco;
- ED_region_visible_rect(ar, &rect);
+ const rcti *rect = ED_region_visible_rect(ar);
const int font_id = BLF_default();
BLF_width_and_height(
font_id, printable, BLF_DRAW_STR_DUMMY_MAX, &printable_size[0], &printable_size[1]);
- xco = (rect.xmax - U.widget_unit) - (int)printable_size[0];
- yco = (rect.ymax - U.widget_unit);
+ xco = (rect->xmax - U.widget_unit) - (int)printable_size[0];
+ yco = (rect->ymax - U.widget_unit);
/* warning text (to clarify meaning of overlays)
* - original color was red to match the icon, but that clashes badly with a less nasty border