mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-10 22:51:58 +00:00
gl_engine: fix by coding convention.
A *a; (x) A* a; (o) A &a; (x) A& a; (o)
This commit is contained in:
parent
af190033bb
commit
a61c8cc360
5 changed files with 22 additions and 22 deletions
|
@ -52,9 +52,9 @@ class GlGeometry;
|
||||||
|
|
||||||
struct GlShape
|
struct GlShape
|
||||||
{
|
{
|
||||||
float viewWd;
|
float viewWd;
|
||||||
float viewHt;
|
float viewHt;
|
||||||
RenderUpdateFlag updateFlag;
|
RenderUpdateFlag updateFlag;
|
||||||
unique_ptr<GlGeometry> geometry;
|
unique_ptr<GlGeometry> geometry;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -44,12 +44,12 @@ const GlSize GlGeometry::getPrimitiveSize(const uint32_t primitiveIndex) const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool GlGeometry::decomposeOutline(const Shape &shape)
|
bool GlGeometry::decomposeOutline(const Shape& shape)
|
||||||
{
|
{
|
||||||
const PathCommand *cmds = nullptr;
|
const PathCommand* cmds = nullptr;
|
||||||
auto cmdCnt = shape.pathCommands(&cmds);
|
auto cmdCnt = shape.pathCommands(&cmds);
|
||||||
|
|
||||||
Point *pts = nullptr;
|
Point* pts = nullptr;
|
||||||
auto ptsCnt = shape.pathCoords(const_cast<const Point**>(&pts));
|
auto ptsCnt = shape.pathCoords(const_cast<const Point**>(&pts));
|
||||||
|
|
||||||
//No actual shape data
|
//No actual shape data
|
||||||
|
@ -117,11 +117,11 @@ bool GlGeometry::decomposeOutline(const Shape &shape)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GlGeometry::generateAAPoints(TVG_UNUSED const Shape &shape, float strokeWd, RenderUpdateFlag flag)
|
bool GlGeometry::generateAAPoints(TVG_UNUSED const Shape& shape, float strokeWd, RenderUpdateFlag flag)
|
||||||
{
|
{
|
||||||
for (auto& shapeGeometry : mPrimitives)
|
for (auto& shapeGeometry : mPrimitives)
|
||||||
{
|
{
|
||||||
std::vector<PointNormals> normalInfo;
|
vector<PointNormals> normalInfo;
|
||||||
constexpr float blurDir = -1.0f;
|
constexpr float blurDir = -1.0f;
|
||||||
float antiAliasWidth = 1.0f;
|
float antiAliasWidth = 1.0f;
|
||||||
vector<SmoothPoint>& aaPts = shapeGeometry.mAAPoints;
|
vector<SmoothPoint>& aaPts = shapeGeometry.mAAPoints;
|
||||||
|
@ -192,7 +192,7 @@ bool GlGeometry::generateAAPoints(TVG_UNUSED const Shape &shape, float strokeWd,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GlGeometry::tesselate(TVG_UNUSED const Shape &shape, float viewWd, float viewHt, RenderUpdateFlag flag)
|
bool GlGeometry::tesselate(TVG_UNUSED const Shape& shape, float viewWd, float viewHt, RenderUpdateFlag flag)
|
||||||
{
|
{
|
||||||
for (auto& shapeGeometry : mPrimitives)
|
for (auto& shapeGeometry : mPrimitives)
|
||||||
{
|
{
|
||||||
|
@ -289,7 +289,7 @@ void GlGeometry::updateBuffer(uint32_t location, const VertexDataArray& vertexAr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
GlPoint GlGeometry::normalizePoint(const GlPoint &pt, float viewWd, float viewHt)
|
GlPoint GlGeometry::normalizePoint(const GlPoint& pt, float viewWd, float viewHt)
|
||||||
{
|
{
|
||||||
GlPoint p;
|
GlPoint p;
|
||||||
p.x = (pt.x * 2.0f / viewWd) - 1.0f;
|
p.x = (pt.x * 2.0f / viewWd) - 1.0f;
|
||||||
|
@ -297,31 +297,31 @@ GlPoint GlGeometry::normalizePoint(const GlPoint &pt, float viewWd, float viewHt
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GlGeometry::addGeometryPoint(VertexDataArray &geometry, const GlPoint &pt, float viewWd, float viewHt, float opacity)
|
void GlGeometry::addGeometryPoint(VertexDataArray& geometry, const GlPoint &pt, float viewWd, float viewHt, float opacity)
|
||||||
{
|
{
|
||||||
VertexData tv = { normalizePoint(pt, viewWd, viewHt), opacity};
|
VertexData tv = { normalizePoint(pt, viewWd, viewHt), opacity};
|
||||||
geometry.vertices.push_back(tv);
|
geometry.vertices.push_back(tv);
|
||||||
}
|
}
|
||||||
|
|
||||||
GlPoint GlGeometry::getNormal(const GlPoint &p1, const GlPoint &p2)
|
GlPoint GlGeometry::getNormal(const GlPoint& p1, const GlPoint& p2)
|
||||||
{
|
{
|
||||||
GlPoint normal = p1 - p2;
|
GlPoint normal = p1 - p2;
|
||||||
normal.normalize();
|
normal.normalize();
|
||||||
return GlPoint(-normal.y, normal.x);
|
return GlPoint(-normal.y, normal.x);
|
||||||
}
|
}
|
||||||
|
|
||||||
float GlGeometry::dotProduct(const GlPoint &p1, const GlPoint &p2)
|
float GlGeometry::dotProduct(const GlPoint& p1, const GlPoint& p2)
|
||||||
{
|
{
|
||||||
return (p1.x * p2.x + p1.y * p2.y);
|
return (p1.x * p2.x + p1.y * p2.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
GlPoint GlGeometry::extendEdge(const GlPoint &pt, const GlPoint &normal, float scalar)
|
GlPoint GlGeometry::extendEdge(const GlPoint& pt, const GlPoint& normal, float scalar)
|
||||||
{
|
{
|
||||||
GlPoint tmp = (normal * scalar);
|
GlPoint tmp = (normal * scalar);
|
||||||
return (pt + tmp);
|
return (pt + tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GlGeometry::addPoint(GlPrimitive& primitve, const GlPoint &pt, GlPoint &min, GlPoint &max)
|
void GlGeometry::addPoint(GlPrimitive& primitve, const GlPoint& pt, GlPoint& min, GlPoint& max)
|
||||||
{
|
{
|
||||||
if (pt.x < min.x) min.x = pt.x;
|
if (pt.x < min.x) min.x = pt.x;
|
||||||
if (pt.y < min.y) min.y = pt.y;
|
if (pt.y < min.y) min.y = pt.y;
|
||||||
|
@ -330,14 +330,14 @@ void GlGeometry::addPoint(GlPrimitive& primitve, const GlPoint &pt, GlPoint &min
|
||||||
primitve.mAAPoints.push_back(GlPoint(pt.x, pt.y));
|
primitve.mAAPoints.push_back(GlPoint(pt.x, pt.y));
|
||||||
}
|
}
|
||||||
|
|
||||||
void GlGeometry::addTriangleFanIndices(uint32_t &curPt, std::vector<uint32_t> &indices)
|
void GlGeometry::addTriangleFanIndices(uint32_t& curPt, vector<uint32_t>& indices)
|
||||||
{
|
{
|
||||||
indices.push_back(0);
|
indices.push_back(0);
|
||||||
indices.push_back(curPt - 1);
|
indices.push_back(curPt - 1);
|
||||||
indices.push_back(curPt);
|
indices.push_back(curPt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GlGeometry::addQuadIndices(uint32_t &curPt, std::vector<uint32_t> &indices)
|
void GlGeometry::addQuadIndices(uint32_t& curPt, vector<uint32_t>& indices)
|
||||||
{
|
{
|
||||||
indices.push_back(curPt);
|
indices.push_back(curPt);
|
||||||
indices.push_back(curPt + 1);
|
indices.push_back(curPt + 1);
|
||||||
|
@ -348,7 +348,7 @@ void GlGeometry::addQuadIndices(uint32_t &curPt, std::vector<uint32_t> &indices)
|
||||||
curPt += 4;
|
curPt += 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GlGeometry::isBezierFlat(const GlPoint &p1, const GlPoint &c1, const GlPoint &c2, const GlPoint &p2)
|
bool GlGeometry::isBezierFlat(const GlPoint& p1, const GlPoint& c1, const GlPoint& c2, const GlPoint& p2)
|
||||||
{
|
{
|
||||||
GlPoint diff1 = (c1 * 3.0f) - (p1 * 2.0f) - p2;
|
GlPoint diff1 = (c1 * 3.0f) - (p1 * 2.0f) - p2;
|
||||||
GlPoint diff2 = (c2 * 3.0f) - (p2 * 2.0f) - p1;
|
GlPoint diff2 = (c2 * 3.0f) - (p2 * 2.0f) - p1;
|
||||||
|
@ -365,7 +365,7 @@ bool GlGeometry::isBezierFlat(const GlPoint &p1, const GlPoint &c1, const GlPoin
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GlGeometry::decomposeCubicCurve(GlPrimitive& primitve, const GlPoint &pt1, const GlPoint &cpt1, const GlPoint &cpt2, const GlPoint &pt2, GlPoint &min, GlPoint &max)
|
void GlGeometry::decomposeCubicCurve(GlPrimitive& primitve, const GlPoint& pt1, const GlPoint& cpt1, const GlPoint& cpt2, const GlPoint& pt2, GlPoint& min, GlPoint& max)
|
||||||
{
|
{
|
||||||
if (isBezierFlat(pt1, cpt1, cpt2, pt2))
|
if (isBezierFlat(pt1, cpt1, cpt2, pt2))
|
||||||
{
|
{
|
||||||
|
|
|
@ -96,7 +96,7 @@ bool GlRenderer::postRender()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool GlRenderer::render(const Shape& shape, void *data)
|
bool GlRenderer::render(const Shape& shape, void* data)
|
||||||
{
|
{
|
||||||
GlShape* sdata = static_cast<GlShape*>(data);
|
GlShape* sdata = static_cast<GlShape*>(data);
|
||||||
if (!sdata) return false;
|
if (!sdata) return false;
|
||||||
|
|
|
@ -26,7 +26,7 @@
|
||||||
#include <GLES2/gl2.h>
|
#include <GLES2/gl2.h>
|
||||||
|
|
||||||
|
|
||||||
shared_ptr<GlShader> GlShader::gen(const char * vertSrc, const char * fragSrc)
|
shared_ptr<GlShader> GlShader::gen(const char* vertSrc, const char* fragSrc)
|
||||||
{
|
{
|
||||||
shared_ptr<GlShader> shader = make_shared<GlShader>();
|
shared_ptr<GlShader> shader = make_shared<GlShader>();
|
||||||
shader->createShader(vertSrc, fragSrc);
|
shader->createShader(vertSrc, fragSrc);
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
class GlShader
|
class GlShader
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static std::shared_ptr<GlShader> gen(const char * vertSrc, const char * fragSrc);
|
static std::shared_ptr<GlShader> gen(const char* vertSrc, const char* fragSrc);
|
||||||
~GlShader();
|
~GlShader();
|
||||||
|
|
||||||
uint32_t getVertexShader();
|
uint32_t getVertexShader();
|
||||||
|
|
Loading…
Add table
Reference in a new issue