forked from bartvdbraak/blender
View2D could potentially divide stuff by zero, giving bad matrices.
This commit is contained in:
parent
dfa30f8207
commit
bde6a939e6
@ -1022,15 +1022,19 @@ static void view2d_map_cur_using_mask(View2D *v2d, rctf *curmasked)
|
||||
void UI_view2d_view_ortho(View2D *v2d)
|
||||
{
|
||||
rctf curmasked;
|
||||
float xofs, yofs;
|
||||
int sizex = BLI_rcti_size_x(&v2d->mask);
|
||||
int sizey = BLI_rcti_size_y(&v2d->mask);
|
||||
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,
|
||||
* but only applied where requested
|
||||
*/
|
||||
/* XXX brecht: instead of zero at least use a tiny offset, otherwise
|
||||
* pixel rounding is effectively random due to float inaccuracy */
|
||||
xofs = 0.001f * BLI_rctf_size_x(&v2d->cur) / BLI_rcti_size_x(&v2d->mask);
|
||||
yofs = 0.001f * BLI_rctf_size_y(&v2d->cur) / BLI_rcti_size_y(&v2d->mask);
|
||||
if (sizex > 0)
|
||||
xofs = 0.001f * BLI_rctf_size_x(&v2d->cur) / BLI_rcti_size_x(&v2d->mask);
|
||||
if (sizey > 0)
|
||||
yofs = 0.001f * BLI_rctf_size_y(&v2d->cur) / BLI_rcti_size_y(&v2d->mask);
|
||||
|
||||
/* apply mask-based adjustments to cur rect (due to scrollers), to eliminate scaling artifacts */
|
||||
view2d_map_cur_using_mask(v2d, &curmasked);
|
||||
|
Loading…
Reference in New Issue
Block a user