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:
authorCampbell Barton <ideasman42@gmail.com>2010-12-20 06:59:22 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-12-20 06:59:22 +0300
commit3bed4cbf2b4c09dcb62197b8a8c4ec4224abc8b7 (patch)
treefc800fc89f29db4ac9d951ff148b8424c8cb7c73 /source/blender/editors/interface/view2d.c
parent17f37dceccb99d7eb58f7c29908eeb2bd87cd7ff (diff)
fix [#25283] Edge length display difficult to read
- made theme colors for mesh edge len & face angle/area display. - use %g rather then %f for float display, trims unneeded zeros. - store cached 2d and 3d text color as bytes rather then floats, compare when drawing to avoid setting the context. - use unsigned char for more color functions, avoids casting to glColorubv().
Diffstat (limited to 'source/blender/editors/interface/view2d.c')
-rw-r--r--source/blender/editors/interface/view2d.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c
index 21146dc8cec..13dca032a6c 100644
--- a/source/blender/editors/interface/view2d.c
+++ b/source/blender/editors/interface/view2d.c
@@ -2006,7 +2006,10 @@ static ListBase strings= {NULL, NULL};
typedef struct View2DString {
struct View2DString *next, *prev;
- GLbyte col[4];
+ union {
+ unsigned char ub[4];
+ int pack;
+ } col;
short mval[2];
rcti rect;
} View2DString;
@@ -2026,9 +2029,9 @@ void UI_view2d_text_cache_add(View2D *v2d, float x, float y, const char *str, co
memcpy(v2s_str, str, len);
BLI_addtail(&strings, v2s);
+ v2s->col.pack= *((int *)col);
v2s->mval[0]= mval[0];
v2s->mval[1]= mval[1];
- QUATCOPY(v2s->col, col);
}
}
@@ -2043,17 +2046,18 @@ void UI_view2d_text_cache_rectf(View2D *v2d, rctf *rect, const char *str, const
UI_view2d_to_region_no_clip(v2d, rect->xmin, rect->ymin, &v2s->rect.xmin, &v2s->rect.ymin);
UI_view2d_to_region_no_clip(v2d, rect->xmax, rect->ymax, &v2s->rect.xmax, &v2s->rect.ymax);
+ v2s->col.pack= *((int *)col);
v2s->mval[0]= v2s->rect.xmin;
v2s->mval[1]= v2s->rect.ymin;
BLI_addtail(&strings, v2s);
- QUATCOPY(v2s->col, col);
}
void UI_view2d_text_cache_draw(ARegion *ar)
{
View2DString *v2s;
+ int col_pack_prev= 0;
// glMatrixMode(GL_PROJECTION);
// glPushMatrix();
@@ -2068,7 +2072,10 @@ void UI_view2d_text_cache_draw(ARegion *ar)
yofs= ceil( 0.5f*(v2s->rect.ymax - v2s->rect.ymin - BLF_height_default("28")));
if(yofs<1) yofs= 1;
- glColor3bv(v2s->col);
+ if(col_pack_prev != v2s->col.pack) {
+ glColor3ubv(v2s->col.ub);
+ col_pack_prev= v2s->col.pack;
+ }
if(v2s->rect.xmin >= v2s->rect.xmax)
BLF_draw_default((float)v2s->mval[0]+xofs, (float)v2s->mval[1]+yofs, 0.0, str, 65535);