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));
}