mirror of
https://github.com/thorvg/thorvg.git
synced 2025-07-23 14:48:24 +00:00
sw_engine: Replace non-portable min/max with tvgMath.h macros
This would fail building with Visual Studio 2017, at least downstream in Godot where we undefine old Windows compilers' non-standard `min`/`max` macros (see `minmax.h`/`NOMINMAX`).
This commit is contained in:
parent
922e3e10c0
commit
4d58dae59f
3 changed files with 11 additions and 5 deletions
1
AUTHORS
1
AUTHORS
|
@ -14,3 +14,4 @@ Patryk Kaczmarek <patryk.k@partner.samsung.com>
|
|||
Michal Maciola <m.maciola@samsung.com>
|
||||
Peter Vullings <peter@projectitis.com>
|
||||
K. S. Ernest (iFire) Lee <ernest.lee@chibifire.com>
|
||||
Rémi Verschelde <rverschelde@gmail.com>
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "tvgSwCommon.h"
|
||||
#include "tvgTaskScheduler.h"
|
||||
#include "tvgSwRenderer.h"
|
||||
#include "tvgMath.h"
|
||||
|
||||
/************************************************************************/
|
||||
/* Internal Class Implementation */
|
||||
|
@ -594,10 +595,10 @@ void* SwRenderer::prepareCommon(SwTask* task, const RenderTransform* transform,
|
|||
task->surface = surface;
|
||||
task->mpool = mpool;
|
||||
task->flags = flags;
|
||||
task->bbox.min.x = max(static_cast<SwCoord>(0), static_cast<SwCoord>(vport.x));
|
||||
task->bbox.min.y = max(static_cast<SwCoord>(0), static_cast<SwCoord>(vport.y));
|
||||
task->bbox.max.x = min(static_cast<SwCoord>(surface->w), static_cast<SwCoord>(vport.x + vport.w));
|
||||
task->bbox.max.y = min(static_cast<SwCoord>(surface->h), static_cast<SwCoord>(vport.y + vport.h));
|
||||
task->bbox.min.x = mathMax(static_cast<SwCoord>(0), static_cast<SwCoord>(vport.x));
|
||||
task->bbox.min.y = mathMax(static_cast<SwCoord>(0), static_cast<SwCoord>(vport.y));
|
||||
task->bbox.max.x = mathMin(static_cast<SwCoord>(surface->w), static_cast<SwCoord>(vport.x + vport.w));
|
||||
task->bbox.max.y = mathMin(static_cast<SwCoord>(surface->h), static_cast<SwCoord>(vport.y + vport.h));
|
||||
|
||||
if (!task->pushed) {
|
||||
task->pushed = true;
|
||||
|
|
|
@ -29,6 +29,10 @@
|
|||
#include "tvgCommon.h"
|
||||
|
||||
|
||||
#define mathMin(x, y) (((x) < (y)) ? (x) : (y))
|
||||
#define mathMax(x, y) (((x) > (y)) ? (x) : (y))
|
||||
|
||||
|
||||
static inline bool mathZero(float a)
|
||||
{
|
||||
return (fabsf(a) < FLT_EPSILON) ? true : false;
|
||||
|
@ -154,4 +158,4 @@ static inline Matrix mathMultiply(const Matrix* lhs, const Matrix* rhs)
|
|||
}
|
||||
|
||||
|
||||
#endif //_TVG_MATH_H_
|
||||
#endif //_TVG_MATH_H_
|
||||
|
|
Loading…
Add table
Reference in a new issue