swr: [rasterizer core] clamp scissor rects to current tile rect

Signed-off-by: Tim Rowley <timothy.o.rowley@intel.com>
This commit is contained in:
Tim Rowley 2016-08-12 16:59:25 -06:00
parent 93fb768c7e
commit 812b45d049
1 changed files with 18 additions and 0 deletions

View File

@ -29,6 +29,7 @@
#include <string.h>
#include <type_traits>
#include <algorithm>
#include "common/os.h"
#include "common/simdintrin.h"
#include "common/swr_assert.h"
@ -95,6 +96,23 @@ OSALIGNLINE(struct) BBOX
{
return !(*this == rhs);
}
BBOX& Intersect(const BBOX& other)
{
this->top = std::max(this->top, other.top);
this->bottom = std::min(this->bottom, other.bottom);
this->left = std::max(this->left, other.left);
this->right = std::min(this->right, other.right);
if (right - left < 0 ||
bottom - top < 0)
{
// Zero area
top = bottom = left = right = 0;
}
return *this;
}
};
struct simdBBox