diff options
Diffstat (limited to 'source/blender/editors/interface/view2d.c')
-rw-r--r-- | source/blender/editors/interface/view2d.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index e88e7e3e7af..06f13c35e0b 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -1019,8 +1019,9 @@ static void view2d_map_cur_using_mask(View2D *v2d, rctf *curmasked) void UI_view2d_view_ortho(View2D *v2d) { rctf curmasked; - int sizex = BLI_rcti_size_x(&v2d->mask); - int sizey = BLI_rcti_size_y(&v2d->mask); + const int sizex = BLI_rcti_size_x(&v2d->mask); + const int sizey = BLI_rcti_size_y(&v2d->mask); + const float eps = 0.001f; float xofs = 0.0f, yofs = 0.0f; /* pixel offsets (-GLA_PIXEL_OFS) are needed to get 1:1 correspondence with pixels for smooth UI drawing, @@ -1029,9 +1030,9 @@ void UI_view2d_view_ortho(View2D *v2d) /* XXX brecht: instead of zero at least use a tiny offset, otherwise * pixel rounding is effectively random due to float inaccuracy */ if (sizex > 0) - xofs = 0.001f * BLI_rctf_size_x(&v2d->cur) / BLI_rcti_size_x(&v2d->mask); + xofs = eps * BLI_rctf_size_x(&v2d->cur) / sizex; if (sizey > 0) - yofs = 0.001f * BLI_rctf_size_y(&v2d->cur) / BLI_rcti_size_y(&v2d->mask); + yofs = eps * BLI_rctf_size_y(&v2d->cur) / sizey; /* apply mask-based adjustments to cur rect (due to scrollers), to eliminate scaling artifacts */ view2d_map_cur_using_mask(v2d, &curmasked); @@ -1040,12 +1041,12 @@ void UI_view2d_view_ortho(View2D *v2d) /* XXX ton: this flag set by outliner, for icons */ if (v2d->flag & V2D_PIXELOFS_X) { - curmasked.xmin = floorf(curmasked.xmin) - (0.001f + xofs); - curmasked.xmax = floorf(curmasked.xmax) - (0.001f + xofs); + curmasked.xmin = floorf(curmasked.xmin) - (eps + xofs); + curmasked.xmax = floorf(curmasked.xmax) - (eps + xofs); } if (v2d->flag & V2D_PIXELOFS_Y) { - curmasked.ymin = floorf(curmasked.ymin) - (0.001f + yofs); - curmasked.ymax = floorf(curmasked.ymax) - (0.001f + yofs); + curmasked.ymin = floorf(curmasked.ymin) - (eps + yofs); + curmasked.ymax = floorf(curmasked.ymax) - (eps + yofs); } /* set matrix on all appropriate axes */ |