summaryrefslogtreecommitdiff
path: root/src/lib/pixel_quanta.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/pixel_quanta.cc')
-rw-r--r--src/lib/pixel_quanta.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/lib/pixel_quanta.cc b/src/lib/pixel_quanta.cc
index 7c1d285cf..30894ddb7 100644
--- a/src/lib/pixel_quanta.cc
+++ b/src/lib/pixel_quanta.cc
@@ -60,6 +60,19 @@ PixelQuanta::round (dcp::Size size) const
}
+dcp::Size
+PixelQuanta::round(float x_, float y_) const
+{
+ auto round_one = [](float v, int q) {
+ return q == 1
+ ? static_cast<int>(std::lround(v))
+ : (static_cast<int>(v) + static_cast<int>(v) % q);
+ };
+
+ return { round_one(x_, x), round_one(y_, y) };
+}
+
+
PixelQuanta
max (PixelQuanta const& a, PixelQuanta const& b)
{