Skip to content

Commit

Permalink
make rectangle work better with constexpr, change many things to use …
Browse files Browse the repository at this point in the history
…designated getters/setters (nw)
  • Loading branch information
cuavas committed Jul 27, 2018
1 parent dbb034a commit 2968620
Show file tree
Hide file tree
Showing 110 changed files with 1,010 additions and 1,157 deletions.
4 changes: 2 additions & 2 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -912,12 +912,12 @@ endif
ifeq ($(OS),windows)
ifeq (posix,$(SHELLTYPE))
GCC_VERSION := $(shell $(TOOLCHAIN)$(subst @,,$(CC)) -dumpversion 2> /dev/null)
CLANG_VERSION := $(shell $(TOOLCHAIN)$(subst @,,$(CC)) --version 2> /dev/null| head -n 1 | grep clang | sed "s/^.*[^0-9]\([0-9]\+\.[0-9]\+\.[0-9]\+\).*$$/\1/" | head -n 1)
CLANG_VERSION := $(shell $(TOOLCHAIN)$(subst @,,$(CC)) --version 2> /dev/null| head -n 1 | grep clang | sed "s/^.*[^0-9]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$$/\1/" | head -n 1)
PYTHON_AVAILABLE := $(shell $(PYTHON) --version > /dev/null 2>&1 && echo python)
GIT_AVAILABLE := $(shell git --version > /dev/null 2>&1 && echo git)
else
GCC_VERSION := $(shell $(TOOLCHAIN)$(subst @,,$(CC)) -dumpversion 2> NUL)
CLANG_VERSION := $(shell $(TOOLCHAIN)$(subst @,,$(CC)) --version 2> NUL| head -n 1 | grep clang | sed "s/^.*[^0-9]\([0-9]\+\.[0-9]\+\.[0-9]\+\).*$$/\1/" | head -n 1)
CLANG_VERSION := $(shell $(TOOLCHAIN)$(subst @,,$(CC)) --version 2> NUL| head -n 1 | grep clang | sed "s/^.*[^0-9]\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*$$/\1/" | head -n 1)
PYTHON_AVAILABLE := $(shell $(PYTHON) --version > NUL 2>&1 && echo python)
GIT_AVAILABLE := $(shell git --version > NUL 2>&1 && echo git)
endif
Expand Down
58 changes: 29 additions & 29 deletions src/devices/video/poly.h
Original file line number Diff line number Diff line change
Expand Up @@ -513,8 +513,8 @@ uint32_t poly_manager<_BaseType, _ObjectData, _MaxParams, _MaxPolys>::render_til
// clip coordinates
int32_t v1yclip = v1y;
int32_t v2yclip = v2y + ((m_flags & FLAG_INCLUDE_BOTTOM_EDGE) ? 1 : 0);
v1yclip = std::max(v1yclip, cliprect.min_y);
v2yclip = std::min(v2yclip, cliprect.max_y + 1);
v1yclip = std::max(v1yclip, cliprect.top());
v2yclip = std::min(v2yclip, cliprect.bottom() + 1);
if (v2yclip - v1yclip <= 0)
return 0;

Expand Down Expand Up @@ -558,10 +558,10 @@ uint32_t poly_manager<_BaseType, _ObjectData, _MaxParams, _MaxPolys>::render_til
istopx++;

// apply left/right clipping
if (istartx < cliprect.min_x)
istartx = cliprect.min_x;
if (istopx > cliprect.max_x)
istopx = cliprect.max_x + 1;
if (istartx < cliprect.left())
istartx = cliprect.left();
if (istopx > cliprect.right())
istopx = cliprect.right() + 1;
if (istartx >= istopx)
return 0;

Expand Down Expand Up @@ -658,8 +658,8 @@ uint32_t poly_manager<_BaseType, _ObjectData, _MaxParams, _MaxPolys>::render_tri
// clip coordinates
int32_t v1yclip = v1y;
int32_t v3yclip = v3y + ((m_flags & FLAG_INCLUDE_BOTTOM_EDGE) ? 1 : 0);
v1yclip = std::max(v1yclip, cliprect.min_y);
v3yclip = std::min(v3yclip, cliprect.max_y + 1);
v1yclip = std::max(v1yclip, cliprect.top());
v3yclip = std::min(v3yclip, cliprect.bottom() + 1);
if (v3yclip - v1yclip <= 0)
return 0;

Expand Down Expand Up @@ -772,10 +772,10 @@ uint32_t poly_manager<_BaseType, _ObjectData, _MaxParams, _MaxPolys>::render_tri
istopx++;

// apply left/right clipping
if (istartx < cliprect.min_x)
istartx = cliprect.min_x;
if (istopx > cliprect.max_x)
istopx = cliprect.max_x + 1;
if (istartx < cliprect.left())
istartx = cliprect.left();
if (istopx > cliprect.right())
istopx = cliprect.right() + 1;

// set the extent and update the total pixel count
if (istartx >= istopx)
Expand Down Expand Up @@ -848,8 +848,8 @@ template<typename _BaseType, class _ObjectData, int _MaxParams, int _MaxPolys>
uint32_t poly_manager<_BaseType, _ObjectData, _MaxParams, _MaxPolys>::render_triangle_custom(const rectangle &cliprect, render_delegate callback, int startscanline, int numscanlines, const extent_t *extents)
{
// clip coordinates
int32_t v1yclip = std::max(startscanline, cliprect.min_y);
int32_t v3yclip = std::min(startscanline + numscanlines, cliprect.max_y + 1);
int32_t v1yclip = std::max(startscanline, cliprect.top());
int32_t v3yclip = std::min(startscanline + numscanlines, cliprect.bottom() + 1);
if (v3yclip - v1yclip <= 0)
return 0;

Expand Down Expand Up @@ -883,14 +883,14 @@ uint32_t poly_manager<_BaseType, _ObjectData, _MaxParams, _MaxPolys>::render_tri
int32_t istartx = srcextent.startx, istopx = srcextent.stopx;

// apply left/right clipping
if (istartx < cliprect.min_x)
istartx = cliprect.min_x;
if (istartx > cliprect.max_x)
istartx = cliprect.max_x + 1;
if (istopx < cliprect.min_x)
istopx = cliprect.min_x;
if (istopx > cliprect.max_x)
istopx = cliprect.max_x + 1;
if (istartx < cliprect.left())
istartx = cliprect.left();
if (istartx > cliprect.right())
istartx = cliprect.right() + 1;
if (istopx < cliprect.left())
istopx = cliprect.left();
if (istopx > cliprect.right())
istopx = cliprect.right() + 1;

// set the extent and update the total pixel count
extent_t &extent = unit.extent[extnum];
Expand Down Expand Up @@ -956,8 +956,8 @@ uint32_t poly_manager<_BaseType, _ObjectData, _MaxParams, _MaxPolys>::render_pol
// clip coordinates
int32_t minyclip = miny;
int32_t maxyclip = maxy + ((m_flags & FLAG_INCLUDE_BOTTOM_EDGE) ? 1 : 0);
minyclip = std::max(minyclip, cliprect.min_y);
maxyclip = std::min(maxyclip, cliprect.max_y + 1);
minyclip = std::max(minyclip, cliprect.top());
maxyclip = std::min(maxyclip, cliprect.bottom() + 1);
if (maxyclip - minyclip <= 0)
return 0;

Expand Down Expand Up @@ -1092,14 +1092,14 @@ uint32_t poly_manager<_BaseType, _ObjectData, _MaxParams, _MaxPolys>::render_pol
istopx++;

// apply left/right clipping
if (istartx < cliprect.min_x)
if (istartx < cliprect.left())
{
for (int paramnum = 0; paramnum < paramcount; paramnum++)
extent.param[paramnum].start += (cliprect.min_x - istartx) * extent.param[paramnum].dpdx;
istartx = cliprect.min_x;
extent.param[paramnum].start += (cliprect.left() - istartx) * extent.param[paramnum].dpdx;
istartx = cliprect.left();
}
if (istopx > cliprect.max_x)
istopx = cliprect.max_x + 1;
if (istopx > cliprect.right())
istopx = cliprect.right() + 1;

// set the extent and update the total pixel count
if (istartx >= istopx)
Expand Down
Loading

0 comments on commit 2968620

Please sign in to comment.