[Bf-blender-cvs] [ac1dcdbf066] master: UI: Add an Outline to the Popover Arrows
Yevgeny Makarov
noreply at git.blender.org
Sun Mar 15 23:19:33 CET 2020
Commit: ac1dcdbf0665612fa38346388b6bc62c23906903
Author: Yevgeny Makarov
Date: Sun Mar 15 22:50:32 2020 +0100
Branches: master
https://developer.blender.org/rBac1dcdbf0665612fa38346388b6bc62c23906903
UI: Add an Outline to the Popover Arrows
Reviewed By: billreynish, fclem
Differential Revision: https://developer.blender.org/D5873
===================================================================
M source/blender/editors/interface/interface_widgets.c
===================================================================
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();
}
More information about the Bf-blender-cvs
mailing list