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
path: root/source
diff options
context:
space:
mode:
authorHarley Acheson <harley.acheson@gmail.com>2019-09-06 20:02:18 +0300
committerHarley Acheson <harley.acheson@gmail.com>2019-09-06 20:03:22 +0300
commit5289b16d775d3bddd2815f24d56a5eccc53f0c75 (patch)
tree6731c21fd26d9b7291271fc61610b9a93e95b106 /source
parentd83734aa4bad9d5a9fa17dc46f29323a5a679d7c (diff)
UI: File Browser Preview Outlines
File Browser image thumbnails get just a contrasting outline and no shadow. Differential Revision: https://developer.blender.org/D5708 Reviewed by Brecht Van Lommel
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/space_file/file_draw.c37
1 files changed, 15 insertions, 22 deletions
diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c
index 3e16a8473ad..e11ca06494d 100644
--- a/source/blender/editors/space_file/file_draw.c
+++ b/source/blender/editors/space_file/file_draw.c
@@ -223,7 +223,7 @@ static void file_draw_preview(uiBlock *block,
float scaledx, scaledy;
float scale;
int ex, ey;
- bool use_dropshadow = !is_icon &&
+ bool show_outline = !is_icon &&
(typeflags & (FILE_TYPE_IMAGE | FILE_TYPE_MOVIE | FILE_TYPE_BLENDER));
BLI_assert(imb != NULL);
@@ -259,11 +259,6 @@ static void file_draw_preview(uiBlock *block,
xco = sx + (int)dx;
yco = sy - layout->prv_h + (int)dy;
- /* shadow */
- if (use_dropshadow) {
- UI_draw_box_shadow(128, (float)xco, (float)yco, (float)(xco + ex), (float)(yco + ey));
- }
-
GPU_blend(true);
/* the large image */
@@ -344,23 +339,21 @@ static void file_draw_preview(uiBlock *block,
}
}
- /* border */
- if (use_dropshadow) {
+ /* Contrasting outline around some preview types. */
+ if (show_outline) {
GPUVertFormat *format = immVertexFormat();
- uint pos_attr = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
- uint col_attr = GPU_vertformat_attr_add(format, "color", GPU_COMP_F32, 4, GPU_FETCH_FLOAT);
-
- immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR);
- immBegin(GPU_PRIM_LINE_LOOP, 4);
- immAttr4f(col_attr, 1.0f, 1.0f, 1.0f, 0.15f);
- immVertex2f(pos_attr, (float)xco + 1, (float)(yco + ey));
- immAttr4f(col_attr, 1.0f, 1.0f, 1.0f, 0.2f);
- immVertex2f(pos_attr, (float)(xco + ex), (float)(yco + ey));
- immAttr4f(col_attr, 0.0f, 0.0f, 0.0f, 0.2f);
- immVertex2f(pos_attr, (float)(xco + ex), (float)yco + 1);
- immAttr4f(col_attr, 0.0f, 0.0f, 0.0f, 0.3f);
- immVertex2f(pos_attr, (float)xco + 1, (float)yco + 1);
- immEnd();
+ uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
+ immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
+ float border_color[4] = {1.0f, 1.0f, 1.0f, 0.4f};
+ float bgcolor[4];
+ UI_GetThemeColor4fv(TH_BACK, bgcolor);
+ if (rgb_to_grayscale(bgcolor) > 0.5f) {
+ border_color[0] = 0.0f;
+ border_color[1] = 0.0f;
+ border_color[2] = 0.0f;
+ }
+ immUniformColor4fv(border_color);
+ imm_draw_box_wire_2d(pos, (float)xco, (float)yco, (float)(xco + ex), (float)(yco + ey));
immUnbindProgram();
}