diff --git a/src/renderer/sw_engine/tvgSwCommon.h b/src/renderer/sw_engine/tvgSwCommon.h index 3d73075a..231410cd 100644 --- a/src/renderer/sw_engine/tvgSwCommon.h +++ b/src/renderer/sw_engine/tvgSwCommon.h @@ -26,18 +26,6 @@ #include "tvgCommon.h" #include "tvgRender.h" -#include - -#if 0 -#include -static double timeStamp() -{ - struct timeval tv; - gettimeofday(&tv, NULL); - return (tv.tv_sec + tv.tv_usec / 1000000.0); -} -#endif - #define SW_CURVE_TYPE_POINT 0 #define SW_CURVE_TYPE_CUBIC 1 #define SW_ANGLE_PI (180L << 16) diff --git a/src/renderer/sw_engine/tvgSwRasterTexmap.h b/src/renderer/sw_engine/tvgSwRasterTexmap.h index 8ec2bc0c..d6cd5791 100644 --- a/src/renderer/sw_engine/tvgSwRasterTexmap.h +++ b/src/renderer/sw_engine/tvgSwRasterTexmap.h @@ -34,14 +34,6 @@ struct AASpans int32_t yEnd; }; -static inline void _swap(float& a, float& b, float& tmp) -{ - tmp = a; - a = b; - b = tmp; -} - - //Careful! Shared resource, No support threading static float dudx, dvdx; static float dxdya, dxdyb, dudya, dvdya; @@ -650,28 +642,27 @@ static void _rasterPolygonImage(SwSurface* surface, const SwImage* image, const float off_y; float dxdy[3] = {0.0f, 0.0f, 0.0f}; - float tmp; auto upper = false; //Sort the vertices in ascending Y order if (y[0] > y[1]) { - _swap(x[0], x[1], tmp); - _swap(y[0], y[1], tmp); - _swap(u[0], u[1], tmp); - _swap(v[0], v[1], tmp); + std::swap(x[0], x[1]); + std::swap(y[0], y[1]); + std::swap(u[0], u[1]); + std::swap(v[0], v[1]); } if (y[0] > y[2]) { - _swap(x[0], x[2], tmp); - _swap(y[0], y[2], tmp); - _swap(u[0], u[2], tmp); - _swap(v[0], v[2], tmp); + std::swap(x[0], x[2]); + std::swap(y[0], y[2]); + std::swap(u[0], u[2]); + std::swap(v[0], v[2]); } if (y[1] > y[2]) { - _swap(x[1], x[2], tmp); - _swap(y[1], y[2], tmp); - _swap(u[1], u[2], tmp); - _swap(v[1], v[2], tmp); + std::swap(x[1], x[2]); + std::swap(y[1], y[2]); + std::swap(u[1], u[2]); + std::swap(v[1], v[2]); } //Y indexes diff --git a/src/renderer/tvgCommon.h b/src/renderer/tvgCommon.h index d080ea19..15a2cc4e 100644 --- a/src/renderer/tvgCommon.h +++ b/src/renderer/tvgCommon.h @@ -87,4 +87,16 @@ uint16_t THORVG_VERSION_NUMBER(); #define P(A) ((A)->pImpl) //Access to pimpl. #define PP(A) (((Paint*)(A))->pImpl) //Access to pimpl. + +//for debugging +#if 0 +#include +static inline double THORVG_TIMESTAMP() +{ + struct timeval tv; + gettimeofday(&tv, NULL); + return (tv.tv_sec + tv.tv_usec / 1000000.0); +} +#endif + #endif //_TVG_COMMON_H_ diff --git a/src/renderer/tvgPaint.cpp b/src/renderer/tvgPaint.cpp index 1f198698..b4fb375b 100644 --- a/src/renderer/tvgPaint.cpp +++ b/src/renderer/tvgPaint.cpp @@ -85,17 +85,8 @@ static Result _compFastTrack(Paint* cmpTarget, const RenderTransform* pTransform } //sorting - if (v1.x > v2.x) { - auto tmp = v2.x; - v2.x = v1.x; - v1.x = tmp; - } - - if (v1.y > v2.y) { - auto tmp = v2.y; - v2.y = v1.y; - v1.y = tmp; - } + if (v1.x > v2.x) std::swap(v1.x, v2.x); + if (v1.y > v2.y) std::swap(v1.y, v2.y); viewport.x = static_cast(v1.x); viewport.y = static_cast(v1.y);