mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-02-17 20:52:36 +01:00
Cleanup.
This commit is contained in:
27
src/bgfx_p.h
27
src/bgfx_p.h
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user