Bug 1321412 - Add Min() and Max() functions to BaseSize. r=kats

MozReview-Commit-ID: 6GTzkpwwDNu

--HG--
extra : rebase_source : 1d8e888649c10f8f044f475095cb592538992946
This commit is contained in:
Botond Ballo 2016-11-23 19:27:27 -05:00
Родитель 3a6277caff
Коммит 3fe1792b18
1 изменённых файлов: 11 добавлений и 0 удалений

Просмотреть файл

@ -6,6 +6,7 @@
#ifndef MOZILLA_GFX_BASESIZE_H_
#define MOZILLA_GFX_BASESIZE_H_
#include <algorithm>
#include "mozilla/Attributes.h"
namespace mozilla {
@ -92,6 +93,16 @@ struct BaseSize {
Sub operator/(const Sub& aSize) const {
return Sub(width / aSize.width, height / aSize.height);
}
friend Sub Min(const Sub& aA, const Sub& aB) {
return Sub(std::min(aA.width, aB.width),
std::min(aA.height, aB.height));
}
friend Sub Max(const Sub& aA, const Sub& aB) {
return Sub(std::max(aA.width, aB.width),
std::max(aA.height, aB.height));
}
};
} // namespace gfx