This commit is contained in:
Branimir Karadžić
2017-02-08 18:17:59 -08:00
parent 03e6076e59
commit aa2a9deb5f
7 changed files with 34 additions and 9 deletions

View File

@@ -273,6 +273,18 @@ namespace bgfx
struct Rect
{
Rect()
{
}
Rect(uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height)
: m_x(_x)
, m_y(_y)
, m_width(_width)
, m_height(_height)
{
}
void clear()
{
m_x =
@@ -294,7 +306,15 @@ namespace bgfx
;
}
void intersect(const Rect& _a, const Rect& _b)
void set(uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height)
{
m_x = _x;
m_y = _y;
m_width = _width;
m_height = _height;
}
void setIntersect(const Rect& _a, const Rect& _b)
{
using namespace bx;
const uint16_t sx = uint16_max(_a.m_x, _b.m_x);
@@ -307,6 +327,11 @@ namespace bgfx
m_height = (uint16_t)uint32_satsub(ey, sy);
}
void intersect(const Rect& _a)
{
setIntersect(*this, _a);
}
uint16_t m_x;
uint16_t m_y;
uint16_t m_width;

View File

@@ -5754,7 +5754,7 @@ BX_PRAGMA_DIAGNOSTIC_POP();
else
{
Rect scissorRect;
scissorRect.intersect(viewScissorRect, _render->m_rectCache.m_cache[scissor]);
scissorRect.setIntersect(viewScissorRect, _render->m_rectCache.m_cache[scissor]);
if (scissorRect.isZeroArea() )
{
continue;

View File

@@ -4909,7 +4909,7 @@ data.NumQualityLevels = 0;
if (BGFX_CLEAR_NONE != clr.m_flags)
{
Rect clearRect = rect;
clearRect.intersect(rect, viewScissorRect);
clearRect.setIntersect(rect, viewScissorRect);
clearQuad(clearRect, clr, _render->m_colorPalette);
}
@@ -5372,7 +5372,7 @@ data.NumQualityLevels = 0;
{
restoreScissor = true;
Rect scissorRect;
scissorRect.intersect(viewScissorRect,_render->m_rectCache.m_cache[scissor]);
scissorRect.setIntersect(viewScissorRect,_render->m_rectCache.m_cache[scissor]);
if (scissorRect.isZeroArea() )
{
continue;

View File

@@ -3795,7 +3795,7 @@ namespace bgfx { namespace d3d9
else
{
Rect scissorRect;
scissorRect.intersect(viewScissorRect, _render->m_rectCache.m_cache[scissor]);
scissorRect.setIntersect(viewScissorRect, _render->m_rectCache.m_cache[scissor]);
if (scissorRect.isZeroArea() )
{
continue;

View File

@@ -6601,7 +6601,7 @@ namespace bgfx { namespace gl
else
{
Rect scissorRect;
scissorRect.intersect(viewScissorRect, _render->m_rectCache.m_cache[scissor]);
scissorRect.setIntersect(viewScissorRect, _render->m_rectCache.m_cache[scissor]);
if (scissorRect.isZeroArea() )
{
continue;

View File

@@ -3416,7 +3416,7 @@ namespace bgfx { namespace mtl
else
{
Rect scissorRect;
scissorRect.intersect(viewScissorRect, _render->m_rectCache.m_cache[scissor]);
scissorRect.setIntersect(viewScissorRect, _render->m_rectCache.m_cache[scissor]);
if (scissorRect.isZeroArea() )
{
continue;

View File

@@ -3805,7 +3805,7 @@ BX_UNUSED(currentSamplerStateIdx);
if (BGFX_CLEAR_NONE != clr.m_flags)
{
Rect clearRect = rect;
clearRect.intersect(rect, viewScissorRect);
clearRect.setIntersect(rect, viewScissorRect);
clearQuad(clearRect, clr, _render->m_colorPalette);
}
@@ -4261,7 +4261,7 @@ BX_UNUSED(currentSamplerStateIdx);
{
restoreScissor = true;
Rect scissorRect;
scissorRect.intersect(viewScissorRect,_render->m_rectCache.m_cache[scissor]);
scissorRect.setIntersect(viewScissorRect,_render->m_rectCache.m_cache[scissor]);
if (scissorRect.isZeroArea() )
{
continue;