WIP: stop using video directory and hard-linking (#2756).
[dcpomatic.git] / src / lib / pixel_quanta.cc
index 12eea5031a606a88427233b631f30822dde4cba2..07690f3ac3537cd2e5b2528fef7c6278db4775d1 100644 (file)
@@ -34,8 +34,29 @@ PixelQuanta::PixelQuanta (cxml::ConstNodePtr node)
 void
 PixelQuanta::as_xml (xmlpp::Element* node) const
 {
-       node->add_child("X")->add_child_text(dcp::raw_convert<std::string>(x));
-       node->add_child("Y")->add_child_text(dcp::raw_convert<std::string>(y));
+       cxml::add_text_child(node, "X", dcp::raw_convert<std::string>(x));
+       cxml::add_text_child(node, "Y", dcp::raw_convert<std::string>(y));
+}
+
+
+int
+PixelQuanta::round_x (int x_) const
+{
+       return x_ - (x_ % x);
+}
+
+
+int
+PixelQuanta::round_y (int y_) const
+{
+       return y_ - (y_ % y);
+}
+
+
+dcp::Size
+PixelQuanta::round (dcp::Size size) const
+{
+       return dcp::Size (round_x(size.width), round_y(size.height));
 }