mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-08 08:48:39 +09:00
Add Min() and Max() convenience functions for 2d point types.
This will return (min(x1,x2), min(y1,y2)) and equivalent max from 2 passed-in (x1,y1) (x2,y2) points
This commit is contained in:
parent
3bdb386b6e
commit
d4cdecec81
1 changed files with 11 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue