Add operator<<(istream) for size for debugging

This commit is contained in:
Alan De Smet 2019-03-22 22:51:26 -05:00 committed by Stefan Haustein
parent b58820e647
commit 69f57a4730

View file

@ -396,6 +396,11 @@ struct size {
size operator*(size lhs, double scale) { size operator*(size lhs, double scale) {
return size(lhs.width*scale, lhs.height*scale); return size(lhs.width*scale, lhs.height*scale);
} }
std::ostream& operator<<(std::ostream& stream, size sz) {
stream << sz.width << "x" << sz.height;
return stream;
}
size fit_within(size container, size object) { size fit_within(size container, size object) {
double scale = std::min(container.width / (double) object.width, container.height / (double) object.height); double scale = std::min(container.width / (double) object.width, container.height / (double) object.height);