Merge pull request #3191 from lioncash/rekt

MathUtil: Minor changes to Rectangle
This commit is contained in:
Markus Wick 2015-11-18 10:40:54 +01:00
commit f172cda50f
2 changed files with 12 additions and 14 deletions

View File

@ -117,19 +117,21 @@ double ApproximateReciprocal(double val);
template<class T>
struct Rectangle
{
T left;
T top;
T right;
T bottom;
T left{};
T top{};
T right{};
T bottom{};
Rectangle()
{ }
constexpr Rectangle() = default;
Rectangle(T theLeft, T theTop, T theRight, T theBottom)
constexpr Rectangle(T theLeft, T theTop, T theRight, T theBottom)
: left(theLeft), top(theTop), right(theRight), bottom(theBottom)
{ }
{}
bool operator==(const Rectangle& r) { return left==r.left && top==r.top && right==r.right && bottom==r.bottom; }
constexpr bool operator==(const Rectangle& r) const
{
return left == r.left && top == r.top && right == r.right && bottom == r.bottom;
}
T GetWidth() const { return abs(right - left); }
T GetHeight() const { return abs(bottom - top); }

View File

@ -106,11 +106,7 @@ void PSTextureEncoder::Encode(u8* dst, u32 format, u32 native_width, u32 bytes_p
D3D11_VIEWPORT vp = CD3D11_VIEWPORT(0.f, 0.f, FLOAT(words_per_row), FLOAT(num_blocks_y));
D3D::context->RSSetViewports(1, &vp);
EFBRectangle fullSrcRect;
fullSrcRect.left = 0;
fullSrcRect.top = 0;
fullSrcRect.right = EFB_WIDTH;
fullSrcRect.bottom = EFB_HEIGHT;
constexpr EFBRectangle fullSrcRect(0, 0, EFB_WIDTH, EFB_HEIGHT);
TargetRectangle targetRect = g_renderer->ConvertEFBRectangle(fullSrcRect);
D3D::context->OMSetRenderTargets(1, &m_outRTV, nullptr);