Add operator<<(istream) for size for debugging
This commit is contained in:
parent
b58820e647
commit
69f57a4730
1 changed files with 5 additions and 0 deletions
|
@ -396,6 +396,11 @@ struct size {
|
|||
size operator*(size lhs, double 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) {
|
||||
double scale = std::min(container.width / (double) object.width, container.height / (double) object.height);
|
||||
|
|
Loading…
Reference in a new issue