diff options
author | Ton Roosendaal <ton@blender.org> | 2011-01-26 15:26:44 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2011-01-26 15:26:44 +0300 |
commit | efa9d4f7e0921759500e4809a8eb72a4c14b20d5 (patch) | |
tree | 8b47f639050d8172a2a00a8d83fda12550e91147 /source/blender/editors/interface/view2d.c | |
parent | a70e69738191675d8630974b3eef93a2b7236323 (diff) |
Bugfix #25756
Outliner was drawing icons sometimes blurred. Happens when subpixel
positions vary. UI code doesn't suffer this, it makes own ortho for
it.
This fix re-uses an un-used v2d flag (V2D_PIXELOFS_X) to force a 2d
view on pixel exact positions. It's set for outliner only, I need
testing feedback first.
Diffstat (limited to 'source/blender/editors/interface/view2d.c')
-rw-r--r-- | source/blender/editors/interface/view2d.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index ae414c6e557..a2a16afc2f8 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -255,8 +255,6 @@ void UI_view2d_region_reinit(View2D *v2d, short type, int winx, int winy) /* absolutely no scrollers allowed */ v2d->scroll= 0; - /* pixel offsets need to be applied for smooth UI controls */ - v2d->flag |= (V2D_PIXELOFS_X|V2D_PIXELOFS_Y); } break; @@ -980,10 +978,6 @@ void UI_view2d_view_ortho(View2D *v2d) /* pixel offsets (-0.375f) are needed to get 1:1 correspondance with pixels for smooth UI drawing, * but only applied where requsted */ - /* XXX ton: fix this! */ - xofs= 0.0; // (v2d->flag & V2D_PIXELOFS_X) ? 0.375f : 0.0f; - yofs= 0.0; // (v2d->flag & V2D_PIXELOFS_Y) ? 0.375f : 0.0f; - /* XXX brecht: instead of zero at least use a tiny offset, otherwise * pixel rounding is effectively random due to float inaccuracy */ xofs= 0.001f*(v2d->cur.xmax - v2d->cur.xmin)/(v2d->mask.xmax - v2d->mask.xmin); @@ -992,6 +986,19 @@ void UI_view2d_view_ortho(View2D *v2d) /* apply mask-based adjustments to cur rect (due to scrollers), to eliminate scaling artifacts */ view2d_map_cur_using_mask(v2d, &curmasked); + curmasked.xmin-= xofs; curmasked.xmax-=xofs; + curmasked.ymin-= yofs; curmasked.ymax-=yofs; + + /* XXX ton: this flag set by outliner, for icons */ + if(v2d->flag & V2D_PIXELOFS_X) { + curmasked.xmin= floor(curmasked.xmin) + 0.375f; + curmasked.xmax= floor(curmasked.xmax) + 0.375f; + } + if(v2d->flag & V2D_PIXELOFS_Y) { + curmasked.ymin= floor(curmasked.ymin) + 0.375f; + curmasked.ymax= floor(curmasked.ymax) + 0.375f; + } + /* set matrix on all appropriate axes */ wmOrtho2(curmasked.xmin-xofs, curmasked.xmax-xofs, curmasked.ymin-yofs, curmasked.ymax-yofs); |