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:
authorNathan Craddock <nzcraddock@gmail.com>2020-08-18 05:03:06 +0300
committerNathan Craddock <nzcraddock@gmail.com>2020-08-18 05:03:06 +0300
commit63cd866f5547ec625061da7491cdf69e714b2edf (patch)
tree8b276f76cbf2366be9e31eed57be2289e162b5b5 /source/blender/editors/space_outliner/outliner_draw.c
parent965aadd02ac3ce3d469f638b139ef7e96c55b834 (diff)
Outliner: Move active highlight code to common function
Drawing the roundrect highlights for icons had duplicate code, move to a shared function. No functional changes.
Diffstat (limited to 'source/blender/editors/space_outliner/outliner_draw.c')
-rw-r--r--source/blender/editors/space_outliner/outliner_draw.c66
1 files changed, 31 insertions, 35 deletions
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index de7b13533ce..5a101cceb2f 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -2891,6 +2891,22 @@ static void outliner_icon_background_colors(float icon_color[4], float icon_bord
icon_border[3] = 0.2f;
}
+static void outliner_draw_active_highlight(const float minx,
+ const float miny,
+ const float maxx,
+ const float maxy,
+ const float ufac,
+ const float icon_color[4],
+ const float icon_border[4])
+{
+ UI_draw_roundbox_corner_set(UI_CNR_ALL);
+ UI_draw_roundbox_aa(true, minx, miny + ufac, maxx, maxy - ufac, UI_UNIT_Y / 4.0f, icon_color);
+
+ /* border around it */
+ UI_draw_roundbox_aa(false, minx, miny + ufac, maxx, maxy - ufac, UI_UNIT_Y / 4.0f, icon_border);
+ GPU_blend(true); /* Roundbox disables. */
+}
+
static void outliner_draw_iconrow_doit(uiBlock *block,
TreeElement *te,
const uiFontStyle *fstyle,
@@ -2911,24 +2927,14 @@ static void outliner_draw_iconrow_doit(uiBlock *block,
UI_GetThemeColor4fv(TH_EDITED_OBJECT, icon_color);
icon_border[3] = 0.3f;
}
- UI_draw_roundbox_corner_set(UI_CNR_ALL);
-
- UI_draw_roundbox_aa(true,
- (float)*offsx,
- (float)ys + ufac,
- (float)*offsx + UI_UNIT_X,
- (float)ys + UI_UNIT_Y - ufac,
- (float)UI_UNIT_Y / 4.0f,
- icon_color);
- /* border around it */
- UI_draw_roundbox_aa(false,
- (float)*offsx,
- (float)ys + ufac,
- (float)*offsx + UI_UNIT_X,
- (float)ys + UI_UNIT_Y - ufac,
- (float)UI_UNIT_Y / 4.0f,
- icon_border);
- GPU_blend(true); /* Roundbox disables. */
+
+ outliner_draw_active_highlight((float)*offsx,
+ (float)ys,
+ (float)*offsx + UI_UNIT_X,
+ (float)ys + UI_UNIT_Y,
+ ufac,
+ icon_color,
+ icon_color);
}
if (tselem->flag & TSE_HIGHLIGHTED) {
@@ -3192,23 +3198,13 @@ static void outliner_draw_tree_element(bContext *C,
/* active circle */
if (active != OL_DRAWSEL_NONE) {
- UI_draw_roundbox_corner_set(UI_CNR_ALL);
- UI_draw_roundbox_aa(true,
- (float)startx + offsx + UI_UNIT_X,
- (float)*starty + ufac,
- (float)startx + offsx + 2.0f * UI_UNIT_X,
- (float)*starty + UI_UNIT_Y - ufac,
- UI_UNIT_Y / 4.0f,
- icon_bgcolor);
- /* border around it */
- UI_draw_roundbox_aa(false,
- (float)startx + offsx + UI_UNIT_X,
- (float)*starty + ufac,
- (float)startx + offsx + 2.0f * UI_UNIT_X,
- (float)*starty + UI_UNIT_Y - ufac,
- UI_UNIT_Y / 4.0f,
- icon_border);
- GPU_blend(true); /* roundbox disables it */
+ outliner_draw_active_highlight((float)startx + offsx + UI_UNIT_X,
+ (float)*starty,
+ (float)startx + offsx + 2.0f * UI_UNIT_X,
+ (float)*starty + UI_UNIT_Y,
+ ufac,
+ icon_bgcolor,
+ icon_border);
te->flag |= TE_ACTIVE; /* For lookup in display hierarchies. */
}