#include "tvgGlGpuBuffer.h"
#include "tvgGlGeometry.h"
-#define NORMALIZED_TOP_3D 1.0f
-#define NORMALIZED_BOTTOM_3D -1.0f
-#define NORMALIZED_LEFT_3D -1.0f
-#define NORMALIZED_RIGHT_3D 1.0f
+#define NORMALIZED_TOP_3D 1.0f
+#define NORMALIZED_BOTTOM_3D -1.0f
+#define NORMALIZED_LEFT_3D -1.0f
+#define NORMALIZED_RIGHT_3D 1.0f
uint32_t GlGeometry::getPrimitiveCount()
{
};
#define ROTATION_MATRIX(xPivot, yPivot) \
- auto radian = mTransform.angle / 180.0f * PI; \
+ auto radian = mTransform.angle / 180.0f * PI; \
auto cosVal = cosf(radian); \
auto sinVal = sinf(radian); \
float rotate[4*4] = { \
- cosVal, -sinVal, 0.0f, 0.0f, \
- sinVal, cosVal, 0.0f, 0.0f,\
- 0.0f, 0.0f, 1.0f, 0.0f, \
+ cosVal, -sinVal, 0.0f, 0.0f, \
+ sinVal, cosVal, 0.0f, 0.0f, \
+ 0.0f, 0.0f, 1.0f, 0.0f, \
(xPivot * (1.0f - cosVal)) - (yPivot * sinVal), (yPivot *(1.0f - cosVal)) + (xPivot * sinVal), 0.0f, 1.0f \
};
#define MULTIPLY_MATRIX(A, B, transform) \
for(auto i = 0; i < 4; ++i) \
- { \
+ { \
for(auto j = 0; j < 4; ++j) \
- { \
- float sum = 0.0; \
- for (auto k = 0; k < 4; ++k) \
+ { \
+ float sum = 0.0; \
+ for (auto k = 0; k < 4; ++k) \
sum += A[k*4+i] * B[j*4+k]; \
transform[j*4+i] = sum; \
- } \
+ } \
}
-#define GET_TRANSFORMATION(xPivot, yPivot, transform) \
- MVP_MATRIX(); \
- ROTATION_MATRIX(xPivot, yPivot); \
- MULTIPLY_MATRIX(mvp, rotate, transform);
+#define GET_TRANSFORMATION(xPivot, yPivot, transform) \
+ MVP_MATRIX(); \
+ ROTATION_MATRIX(xPivot, yPivot); \
+ MULTIPLY_MATRIX(mvp, rotate, transform);
class GlPoint
{
float angle = 0.0f;
float scale = 1.0f;
float w;
- float h;
+ float h;
float matrix[16];
};
unique_ptr<GlGpuBuffer> mGpuBuffer;
vector<GlPrimitive> mPrimitives;
- GlTransform mTransform;
+ GlTransform mTransform;
};
#endif /* _TVG_GL_GEOMETRY_H_ */
Result clear(bool free)
{
- if (!renderer) return Result::InsufficientCondition;
-
//Clear render target before drawing
- if (!renderer->clear()) return Result::InsufficientCondition;
+ if (!renderer || !renderer->clear()) return Result::InsufficientCondition;
//free paints
if (free) {
if (!renderer) return Result::InsufficientCondition;
Array<RenderData> clips;
- auto flag = force ? RenderUpdateFlag::All : RenderUpdateFlag::None;
+ auto flag = force ? RenderUpdateFlag::All : RenderUpdateFlag::None;
//Update single paint node
if (paint) {
Result draw()
{
- if (!renderer) return Result::InsufficientCondition;
-
- if (!renderer->preRender()) return Result::InsufficientCondition;
+ if (!renderer || !renderer->preRender()) return Result::InsufficientCondition;
for (auto paint = paints.data; paint < (paints.data + paints.count); ++paint) {
if (!(*paint)->pImpl->render(*renderer)) return Result::InsufficientCondition;
const char *itr = buf, *itrEnd = buf + bufLength;
char* tmpBuf = (char*)alloca(bufLength + 1);
- if (!buf) return false;
- if (!func) return false;
+ if (!buf || !func) return false;
while (itr < itrEnd) {
const char* p = _simpleXmlSkipWhiteSpace(itr, itrEnd);
{
const char *itr = buf, *itrEnd = buf + bufLength;
- if (!buf) return false;
- if (!func) return false;
+ if (!buf || !func) return false;
#define CB(type, start, end) \
do { \