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:
authorYevgeny Makarov <jenkm>2020-03-16 00:50:32 +0300
committerClément Foucault <foucault.clem@gmail.com>2020-03-16 01:19:01 +0300
commitac1dcdbf0665612fa38346388b6bc62c23906903 (patch)
treefe70e513a467d03fbf8cf2d3baa09140145a4ddd /source/blender/editors/interface/interface_widgets.c
parent7a19a99675369b6e1069bc30eba7a1c6f7432972 (diff)
UI: Add an Outline to the Popover Arrows
Reviewed By: billreynish, fclem Differential Revision: https://developer.blender.org/D5873
Diffstat (limited to 'source/blender/editors/interface/interface_widgets.c')
-rw-r--r--source/blender/editors/interface/interface_widgets.c41
1 files changed, 28 insertions, 13 deletions
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index 220f5642052..b61d54e6cff 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -4990,22 +4990,37 @@ static void ui_draw_popover_back_impl(const uiWidgetColors *wcol,
if (ELEM(direction, UI_DIR_UP, UI_DIR_DOWN)) {
uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
- immUniformColor4ubv(wcol->inner);
+
+ const bool is_down = (direction == UI_DIR_DOWN);
+ const int sign = is_down ? 1 : -1;
+ float y = is_down ? rect->ymax : rect->ymin;
+
GPU_blend(true);
immBegin(GPU_PRIM_TRIS, 3);
- if (direction == UI_DIR_DOWN) {
- const float y = rect->ymax;
- immVertex2f(pos, cent_x - unit_half, y);
- immVertex2f(pos, cent_x + unit_half, y);
- immVertex2f(pos, cent_x, y + unit_half);
- }
- else {
- const float y = rect->ymin;
- immVertex2f(pos, cent_x - unit_half, y);
- immVertex2f(pos, cent_x + unit_half, y);
- immVertex2f(pos, cent_x, y - unit_half);
- }
+ immUniformColor4ub(UNPACK3(wcol->outline), 166);
+ immVertex2f(pos, cent_x - unit_half, y);
+ immVertex2f(pos, cent_x + unit_half, y);
+ immVertex2f(pos, cent_x, y + sign * unit_half);
immEnd();
+
+ y = y - sign * round(U.pixelsize * 1.41);
+
+ GPU_blend(false);
+ immBegin(GPU_PRIM_TRIS, 3);
+ immUniformColor4ub(0, 0, 0, 0);
+ immVertex2f(pos, cent_x - unit_half, y);
+ immVertex2f(pos, cent_x + unit_half, y);
+ immVertex2f(pos, cent_x, y + sign * unit_half);
+ immEnd();
+
+ GPU_blend(true);
+ immBegin(GPU_PRIM_TRIS, 3);
+ immUniformColor4ubv(wcol->inner);
+ immVertex2f(pos, cent_x - unit_half, y);
+ immVertex2f(pos, cent_x + unit_half, y);
+ immVertex2f(pos, cent_x, y + sign * unit_half);
+ immEnd();
+
immUnbindProgram();
}