mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-03 13:31:27 +12:00
[Utilities] Fixed area_base operator* scalar type
This commit is contained in:
parent
02832d9623
commit
813c3298ad
1 changed files with 10 additions and 4 deletions
|
@ -1,6 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct size2_base
|
struct size2_base
|
||||||
|
@ -670,17 +671,22 @@ struct area_base
|
||||||
{
|
{
|
||||||
return{ x1 / size.width, y1 / size.height, x2 / size.width, y2 / size.height };
|
return{ x1 / size.width, y1 / size.height, x2 / size.width, y2 / size.height };
|
||||||
}
|
}
|
||||||
constexpr area_base operator / (const T& value) const
|
|
||||||
|
template <typename U> requires (std::is_arithmetic_v<U>)
|
||||||
|
constexpr area_base operator / (const U& value) const
|
||||||
{
|
{
|
||||||
return{ x1 / value, y1 / value, x2 / value, y2 / value };
|
return area_base{static_cast<T>(x1 / value), static_cast<T>(y1 / value), static_cast<T>(x2 / value), static_cast<T>(y2 / value)};
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr area_base operator * (const size2_base<T>& size) const
|
constexpr area_base operator * (const size2_base<T>& size) const
|
||||||
{
|
{
|
||||||
return{ x1 * size.width, y1 * size.height, x2 * size.width, y2 * size.height };
|
return{ x1 * size.width, y1 * size.height, x2 * size.width, y2 * size.height };
|
||||||
}
|
}
|
||||||
constexpr area_base operator * (const f32& value) const
|
|
||||||
|
template <typename U> requires (std::is_arithmetic_v<U>)
|
||||||
|
constexpr area_base operator * (const U& value) const
|
||||||
{
|
{
|
||||||
return{ static_cast<T>(x1 * value), static_cast<T>(y1 * value), static_cast<T>(x2 * value), static_cast<T>(y2 * value) };
|
return area_base{static_cast<T>(x1 * value), static_cast<T>(y1 * value), static_cast<T>(x2 * value), static_cast<T>(y2 * value)};
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename NT>
|
template<typename NT>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue