diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-08-15 22:41:43 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-08-15 23:44:25 +0300 |
commit | 8f565f5a6ffa4f6170caca2de50a733e8c72367a (patch) | |
tree | 95545357cdaefc10a0d11821c82a483c9aa382cb /source/blender/editors/gpencil/drawgpencil.c | |
parent | 266e7b67fd3e2c219d8646e37a2fb3e393df4bda (diff) |
WM: reuse visible region calculation
Avoids calculating the visible part of a region whenever
on-screen overlays are drawn.
Diffstat (limited to 'source/blender/editors/gpencil/drawgpencil.c')
-rw-r--r-- | source/blender/editors/gpencil/drawgpencil.c | 9 |
1 files changed, 4 insertions, 5 deletions
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); |