diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2018-04-22 23:09:48 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2018-04-22 23:11:48 +0300 |
commit | 46375b8e03b7ac841af4d3cb16eb1561f959bdb7 (patch) | |
tree | 656f5d0f8a06348b86cbf67fe25d3c4e7640f4a5 /source | |
parent | 20a713b7ff0c44f6a56fbee45d274bb3df9f9b71 (diff) |
Embossing for the areas only, with unified color
We bring back embossing however only for areas.
We use the same color for the corners.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/screen/screen_draw.c | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/source/blender/editors/screen/screen_draw.c b/source/blender/editors/screen/screen_draw.c index 172552b3cc3..6bb3bbe7405 100644 --- a/source/blender/editors/screen/screen_draw.c +++ b/source/blender/editors/screen/screen_draw.c @@ -212,6 +212,9 @@ static void draw_join_shape(ScrArea *sa, char dir, unsigned int pos) } } +/* This color is used for the internal area embossing and their round corners. */ +float edge_colors[4] = {0.25f, 0.25f, 0.25f, 1.0f}; + #define CORNER_RESOLUTION 10 static void drawscredge_corner_geometry( int sizex, int sizey, @@ -220,7 +223,6 @@ static void drawscredge_corner_geometry( double angle_offset) { const int radius = ABS(corner_x - center_x); - const float color[4] = {0.0f, 0.0f, 0.0f, 1.0f}; const int line_thickness = U.pixelsize; if (corner_x < center_x) { @@ -270,7 +272,7 @@ static void drawscredge_corner_geometry( tri_array[i + 1][0] = x; tri_array[i + 1][1] = y; } - UI_draw_anti_fan(tri_array, CORNER_RESOLUTION + 1, color); + UI_draw_anti_fan(tri_array, CORNER_RESOLUTION + 1, edge_colors); } #undef CORNER_RESOLUTION @@ -310,6 +312,34 @@ static void drawscredge_corner(ScrArea *sa, int sizex, int sizey) sa->v4->vec.x - size, sa->v4->vec.y + size, M_PI_2 * 3.0f); + + /* Wrap up the corners with a nice embossing. */ + rcti rect = sa->totrct; + + unsigned int pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); + immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); + + immUniformColor4fv(edge_colors); + immBeginAtMost(GWN_PRIM_LINES, 8); + + /* Right. */ + immVertex2f(pos, rect.xmax, rect.ymax); + immVertex2f(pos, rect.xmax, rect.ymin); + + /* Bottom. */ + immVertex2f(pos, rect.xmax, rect.ymin); + immVertex2f(pos, rect.xmin, rect.ymin); + + /* Left. */ + immVertex2f(pos, rect.xmin, rect.ymin); + immVertex2f(pos, rect.xmin, rect.ymax); + + /* Top. */ + immVertex2f(pos, rect.xmin, rect.ymax); + immVertex2f(pos, rect.xmax, rect.ymax); + + immEnd(); + immUnbindProgram(); } /** @@ -411,7 +441,7 @@ void ED_screen_draw_edges(wmWindow *win) if (U.pixelsize > 1.0f) { /* FIXME: doesn't our glLineWidth already scale by U.pixelsize? */ glLineWidth((2.0f * U.pixelsize) - 1); - immUniformColor3ub(0, 0, 0); + immUniformColor3fv(edge_colors); for (sa = screen->areabase.first; sa; sa = sa->next) { drawscredge_area(sa, winsize_x, winsize_y, pos); @@ -419,7 +449,7 @@ void ED_screen_draw_edges(wmWindow *win) } glLineWidth(1); - immUniformColor3ub(0, 0, 0); + immUniformColor3fv(edge_colors); for (sa = screen->areabase.first; sa; sa = sa->next) { drawscredge_area(sa, winsize_x, winsize_y, pos); |