diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-12-14 14:31:19 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-12-14 14:36:32 +0300 |
commit | 17253bec0639a910b3f8e5875d1b5b5605123757 (patch) | |
tree | cb66453e61114fef140dba9c52b0f97ab8a341db | |
parent | 9c81833430d7292483450c44443d2c3cd584dd43 (diff) |
Fix T42892: UV pixel snap with negative values
-rw-r--r-- | source/blender/editors/transform/transform_conversions.c | 4 | ||||
-rw-r--r-- | source/blender/editors/uvedit/uvedit_ops.c | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index f571d363fbe..6e06f2e9d43 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -2817,8 +2817,8 @@ void flushTransUVs(TransInfo *t) td->loc2d[1] = td->loc[1] * invy; if ((sima->flag & SI_PIXELSNAP) && (t->state != TRANS_CANCEL)) { - td->loc2d[0] = floorf(width * td->loc2d[0] + 0.5f) / width; - td->loc2d[1] = floorf(height * td->loc2d[1] + 0.5f) / height; + td->loc2d[0] = roundf(width * td->loc2d[0]) / width; + td->loc2d[1] = roundf(height * td->loc2d[1]) / height; } } } diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index 23a5ac80dfb..c70fcdbbd94 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -3189,8 +3189,8 @@ static void UV_OT_select_lasso(wmOperatorType *ot) static void uv_snap_to_pixel(float uvco[2], float w, float h) { - uvco[0] = ((float)((int)((uvco[0] * w) + 0.5f))) / w; - uvco[1] = ((float)((int)((uvco[1] * h) + 0.5f))) / h; + uvco[0] = roundf(uvco[0] * w) / w; + uvco[1] = roundf(uvco[1] * h) / h; } static void uv_snap_cursor_to_pixels(SpaceImage *sima) |