Round negative drawing coordinates correctly

This commit is contained in:
Thomas Goyne 2014-05-16 11:46:07 -07:00
parent 229b6cf63d
commit c78db67cba

View file

@ -28,6 +28,7 @@
#include <algorithm> #include <algorithm>
#include <boost/algorithm/string/predicate.hpp> #include <boost/algorithm/string/predicate.hpp>
#include <boost/lexical_cast.hpp> #include <boost/lexical_cast.hpp>
#include <cmath>
#include <functional> #include <functional>
enum { enum {
@ -50,7 +51,7 @@ namespace {
val = (val + shift_x) * scale_x; val = (val + shift_x) * scale_x;
else else
val = (val + shift_y) * scale_y; val = (val + shift_y) * scale_y;
val = int(val * 8 + .5) / 8.0; // round to eighth-pixels val = round(val * 8) / 8.0; // round to eighth-pixels
final += float_to_string(val); final += float_to_string(val);
final += ' '; final += ' ';
is_x = !is_x; is_x = !is_x;