mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-13 19:44:28 +00:00
gl_engine: Fix crash in animation callback. Refactor test samples draw function. Fix open shape drawing.
Change-Id: I9ca2cb3951f2229f36292b69221451e0eaf5b6a1
This commit is contained in:
parent
ca6417ec8d
commit
3b385d1d54
21 changed files with 7 additions and 120 deletions
8
src/lib/gl_engine/tvgGlGeometry.cpp
Normal file → Executable file
8
src/lib/gl_engine/tvgGlGeometry.cpp
Normal file → Executable file
|
@ -84,11 +84,11 @@ bool GlGeometry::generateAAPoints(const Shape &shape, float strokeWd, RenderUpda
|
|||
|
||||
size_t fPoint = 0;
|
||||
size_t sPoint = 1;
|
||||
for (size_t i = 0; i < nPoints - 1; ++i)
|
||||
for (size_t i = 0; i < nPoints; ++i)
|
||||
{
|
||||
fPoint = i;
|
||||
sPoint = i + 1;
|
||||
if (sPoint == nPoints - 1)
|
||||
if (fPoint == nPoints - 1)
|
||||
sPoint = 0;
|
||||
|
||||
GlPoint normal = getNormal(aaPts[fPoint].orgPt, aaPts[sPoint].orgPt);
|
||||
|
@ -96,8 +96,8 @@ bool GlGeometry::generateAAPoints(const Shape &shape, float strokeWd, RenderUpda
|
|||
normalInfo[fPoint].normal1 = normal;
|
||||
normalInfo[sPoint].normal2 = normal;
|
||||
}
|
||||
normalInfo[nPoints - 1].normal1 = normalInfo[0].normal1;
|
||||
normalInfo[nPoints - 1].normal2 = normalInfo[0].normal2;
|
||||
normalInfo[0].normal2 = normalInfo[0].normal1;
|
||||
normalInfo[nPoints - 1].normal1 = normalInfo[nPoints - 1].normal2;
|
||||
|
||||
for (uint32_t i = 0; i < nPoints; ++i)
|
||||
{
|
||||
|
|
5
src/lib/gl_engine/tvgGlRenderer.cpp
Normal file → Executable file
5
src/lib/gl_engine/tvgGlRenderer.cpp
Normal file → Executable file
|
@ -64,8 +64,9 @@ bool GlRenderer::flush()
|
|||
|
||||
bool GlRenderer::preRender()
|
||||
{
|
||||
//TODO: called just before render()
|
||||
|
||||
// Blend function for pre multiplied alpha
|
||||
GL_CHECK(glBlendFuncSeparate(GL_ONE, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA));
|
||||
GL_CHECK(glEnable(GL_BLEND));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
6
test/testAsync.cpp
Normal file → Executable file
6
test/testAsync.cpp
Normal file → Executable file
|
@ -113,14 +113,8 @@ void initGLview(Evas_Object *obj)
|
|||
void drawGLview(Evas_Object *obj)
|
||||
{
|
||||
auto gl = elm_glview_gl_api_get(obj);
|
||||
int w, h;
|
||||
elm_glview_size_get(obj, &w, &h);
|
||||
gl->glViewport(0, 0, w, h);
|
||||
gl->glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
gl->glClear(GL_COLOR_BUFFER_BIT);
|
||||
gl->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
gl->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
|
||||
gl->glEnable(GL_BLEND);
|
||||
|
||||
glCanvas->sync();
|
||||
}
|
||||
|
|
6
test/testBlending.cpp
Normal file → Executable file
6
test/testBlending.cpp
Normal file → Executable file
|
@ -101,14 +101,8 @@ void initGLview(Evas_Object *obj)
|
|||
void drawGLview(Evas_Object *obj)
|
||||
{
|
||||
auto gl = elm_glview_gl_api_get(obj);
|
||||
int w, h;
|
||||
elm_glview_size_get(obj, &w, &h);
|
||||
gl->glViewport(0, 0, w, h);
|
||||
gl->glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
gl->glClear(GL_COLOR_BUFFER_BIT);
|
||||
gl->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
gl->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
|
||||
gl->glEnable(GL_BLEND);
|
||||
|
||||
if (glCanvas->draw() == tvg::Result::Success) {
|
||||
glCanvas->sync();
|
||||
|
|
6
test/testBoundary.cpp
Normal file → Executable file
6
test/testBoundary.cpp
Normal file → Executable file
|
@ -90,14 +90,8 @@ void initGLview(Evas_Object *obj)
|
|||
void drawGLview(Evas_Object *obj)
|
||||
{
|
||||
auto gl = elm_glview_gl_api_get(obj);
|
||||
int w, h;
|
||||
elm_glview_size_get(obj, &w, &h);
|
||||
gl->glViewport(0, 0, w, h);
|
||||
gl->glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
gl->glClear(GL_COLOR_BUFFER_BIT);
|
||||
gl->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
gl->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
|
||||
gl->glEnable(GL_BLEND);
|
||||
|
||||
if (glCanvas->draw() == tvg::Result::Success) {
|
||||
glCanvas->sync();
|
||||
|
|
6
test/testCustomTransform.cpp
Normal file → Executable file
6
test/testCustomTransform.cpp
Normal file → Executable file
|
@ -139,14 +139,8 @@ void initGLview(Evas_Object *obj)
|
|||
void drawGLview(Evas_Object *obj)
|
||||
{
|
||||
auto gl = elm_glview_gl_api_get(obj);
|
||||
int w, h;
|
||||
elm_glview_size_get(obj, &w, &h);
|
||||
gl->glViewport(0, 0, w, h);
|
||||
gl->glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
gl->glClear(GL_COLOR_BUFFER_BIT);
|
||||
gl->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
gl->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
|
||||
gl->glEnable(GL_BLEND);
|
||||
|
||||
if (glCanvas->draw() == tvg::Result::Success) {
|
||||
glCanvas->sync();
|
||||
|
|
6
test/testDirectUpdate.cpp
Normal file → Executable file
6
test/testDirectUpdate.cpp
Normal file → Executable file
|
@ -102,14 +102,8 @@ void initGLview(Evas_Object *obj)
|
|||
void drawGLview(Evas_Object *obj)
|
||||
{
|
||||
auto gl = elm_glview_gl_api_get(obj);
|
||||
int w, h;
|
||||
elm_glview_size_get(obj, &w, &h);
|
||||
gl->glViewport(0, 0, w, h);
|
||||
gl->glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
gl->glClear(GL_COLOR_BUFFER_BIT);
|
||||
gl->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
gl->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
|
||||
gl->glEnable(GL_BLEND);
|
||||
|
||||
if (glCanvas->draw() == tvg::Result::Success) {
|
||||
glCanvas->sync();
|
||||
|
|
6
test/testGradientTransform.cpp
Normal file → Executable file
6
test/testGradientTransform.cpp
Normal file → Executable file
|
@ -167,14 +167,8 @@ void initGLview(Evas_Object *obj)
|
|||
void drawGLview(Evas_Object *obj)
|
||||
{
|
||||
auto gl = elm_glview_gl_api_get(obj);
|
||||
int w, h;
|
||||
elm_glview_size_get(obj, &w, &h);
|
||||
gl->glViewport(0, 0, w, h);
|
||||
gl->glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
gl->glClear(GL_COLOR_BUFFER_BIT);
|
||||
gl->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
gl->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
|
||||
gl->glEnable(GL_BLEND);
|
||||
|
||||
if (glCanvas->draw() == tvg::Result::Success) {
|
||||
glCanvas->sync();
|
||||
|
|
6
test/testLinearGradient.cpp
Normal file → Executable file
6
test/testLinearGradient.cpp
Normal file → Executable file
|
@ -119,14 +119,8 @@ void initGLview(Evas_Object *obj)
|
|||
void drawGLview(Evas_Object *obj)
|
||||
{
|
||||
auto gl = elm_glview_gl_api_get(obj);
|
||||
int w, h;
|
||||
elm_glview_size_get(obj, &w, &h);
|
||||
gl->glViewport(0, 0, w, h);
|
||||
gl->glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
gl->glClear(GL_COLOR_BUFFER_BIT);
|
||||
gl->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
gl->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
|
||||
gl->glEnable(GL_BLEND);
|
||||
|
||||
if (glCanvas->draw() == tvg::Result::Success) {
|
||||
glCanvas->sync();
|
||||
|
|
6
test/testMultiShapes.cpp
Normal file → Executable file
6
test/testMultiShapes.cpp
Normal file → Executable file
|
@ -79,14 +79,8 @@ void initGLview(Evas_Object *obj)
|
|||
void drawGLview(Evas_Object *obj)
|
||||
{
|
||||
auto gl = elm_glview_gl_api_get(obj);
|
||||
int w, h;
|
||||
elm_glview_size_get(obj, &w, &h);
|
||||
gl->glViewport(0, 0, w, h);
|
||||
gl->glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
gl->glClear(GL_COLOR_BUFFER_BIT);
|
||||
gl->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
gl->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
|
||||
gl->glEnable(GL_BLEND);
|
||||
|
||||
if (glCanvas->draw() == tvg::Result::Success) {
|
||||
glCanvas->sync();
|
||||
|
|
6
test/testPath.cpp
Normal file → Executable file
6
test/testPath.cpp
Normal file → Executable file
|
@ -96,14 +96,8 @@ void initGLview(Evas_Object *obj)
|
|||
void drawGLview(Evas_Object *obj)
|
||||
{
|
||||
auto gl = elm_glview_gl_api_get(obj);
|
||||
int w, h;
|
||||
elm_glview_size_get(obj, &w, &h);
|
||||
gl->glViewport(0, 0, w, h);
|
||||
gl->glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
gl->glClear(GL_COLOR_BUFFER_BIT);
|
||||
gl->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
gl->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
|
||||
gl->glEnable(GL_BLEND);
|
||||
|
||||
if (glCanvas->draw() == tvg::Result::Success) {
|
||||
glCanvas->sync();
|
||||
|
|
6
test/testPathCopy.cpp
Normal file → Executable file
6
test/testPathCopy.cpp
Normal file → Executable file
|
@ -133,14 +133,8 @@ void initGLview(Evas_Object *obj)
|
|||
void drawGLview(Evas_Object *obj)
|
||||
{
|
||||
auto gl = elm_glview_gl_api_get(obj);
|
||||
int w, h;
|
||||
elm_glview_size_get(obj, &w, &h);
|
||||
gl->glViewport(0, 0, w, h);
|
||||
gl->glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
gl->glClear(GL_COLOR_BUFFER_BIT);
|
||||
gl->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
gl->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
|
||||
gl->glEnable(GL_BLEND);
|
||||
|
||||
if (glCanvas->draw() == tvg::Result::Success) {
|
||||
glCanvas->sync();
|
||||
|
|
6
test/testRadialGradient.cpp
Normal file → Executable file
6
test/testRadialGradient.cpp
Normal file → Executable file
|
@ -119,14 +119,8 @@ void initGLview(Evas_Object *obj)
|
|||
void drawGLview(Evas_Object *obj)
|
||||
{
|
||||
auto gl = elm_glview_gl_api_get(obj);
|
||||
int w, h;
|
||||
elm_glview_size_get(obj, &w, &h);
|
||||
gl->glViewport(0, 0, w, h);
|
||||
gl->glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
gl->glClear(GL_COLOR_BUFFER_BIT);
|
||||
gl->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
gl->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
|
||||
gl->glEnable(GL_BLEND);
|
||||
|
||||
if (glCanvas->draw() == tvg::Result::Success) {
|
||||
glCanvas->sync();
|
||||
|
|
6
test/testScene.cpp
Normal file → Executable file
6
test/testScene.cpp
Normal file → Executable file
|
@ -126,14 +126,8 @@ void initGLview(Evas_Object *obj)
|
|||
void drawGLview(Evas_Object *obj)
|
||||
{
|
||||
auto gl = elm_glview_gl_api_get(obj);
|
||||
int w, h;
|
||||
elm_glview_size_get(obj, &w, &h);
|
||||
gl->glViewport(0, 0, w, h);
|
||||
gl->glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
gl->glClear(GL_COLOR_BUFFER_BIT);
|
||||
gl->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
gl->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
|
||||
gl->glEnable(GL_BLEND);
|
||||
|
||||
if (glCanvas->draw() == tvg::Result::Success) {
|
||||
glCanvas->sync();
|
||||
|
|
6
test/testSceneTransform.cpp
Normal file → Executable file
6
test/testSceneTransform.cpp
Normal file → Executable file
|
@ -163,14 +163,8 @@ void initGLview(Evas_Object *obj)
|
|||
void drawGLview(Evas_Object *obj)
|
||||
{
|
||||
auto gl = elm_glview_gl_api_get(obj);
|
||||
int w, h;
|
||||
elm_glview_size_get(obj, &w, &h);
|
||||
gl->glViewport(0, 0, w, h);
|
||||
gl->glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
gl->glClear(GL_COLOR_BUFFER_BIT);
|
||||
gl->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
gl->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
|
||||
gl->glEnable(GL_BLEND);
|
||||
|
||||
if (glCanvas->draw() == tvg::Result::Success) {
|
||||
glCanvas->sync();
|
||||
|
|
6
test/testShape.cpp
Normal file → Executable file
6
test/testShape.cpp
Normal file → Executable file
|
@ -69,14 +69,8 @@ void initGLview(Evas_Object *obj)
|
|||
void drawGLview(Evas_Object *obj)
|
||||
{
|
||||
auto gl = elm_glview_gl_api_get(obj);
|
||||
int w, h;
|
||||
elm_glview_size_get(obj, &w, &h);
|
||||
gl->glViewport(0, 0, w, h);
|
||||
gl->glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
gl->glClear(GL_COLOR_BUFFER_BIT);
|
||||
gl->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
gl->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
|
||||
gl->glEnable(GL_BLEND);
|
||||
|
||||
if (glCanvas->draw() == tvg::Result::Success) {
|
||||
glCanvas->sync();
|
||||
|
|
6
test/testStroke.cpp
Normal file → Executable file
6
test/testStroke.cpp
Normal file → Executable file
|
@ -116,14 +116,8 @@ void initGLview(Evas_Object *obj)
|
|||
void drawGLview(Evas_Object *obj)
|
||||
{
|
||||
auto gl = elm_glview_gl_api_get(obj);
|
||||
int w, h;
|
||||
elm_glview_size_get(obj, &w, &h);
|
||||
gl->glViewport(0, 0, w, h);
|
||||
gl->glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
gl->glClear(GL_COLOR_BUFFER_BIT);
|
||||
gl->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
gl->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
|
||||
gl->glEnable(GL_BLEND);
|
||||
|
||||
if (glCanvas->draw() == tvg::Result::Success) {
|
||||
glCanvas->sync();
|
||||
|
|
6
test/testStrokeLine.cpp
Normal file → Executable file
6
test/testStrokeLine.cpp
Normal file → Executable file
|
@ -153,14 +153,8 @@ void initGLview(Evas_Object *obj)
|
|||
void drawGLview(Evas_Object *obj)
|
||||
{
|
||||
auto gl = elm_glview_gl_api_get(obj);
|
||||
int w, h;
|
||||
elm_glview_size_get(obj, &w, &h);
|
||||
gl->glViewport(0, 0, w, h);
|
||||
gl->glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
gl->glClear(GL_COLOR_BUFFER_BIT);
|
||||
gl->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
gl->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
|
||||
gl->glEnable(GL_BLEND);
|
||||
|
||||
if (glCanvas->draw() == tvg::Result::Success) {
|
||||
glCanvas->sync();
|
||||
|
|
6
test/testSvg.cpp
Normal file → Executable file
6
test/testSvg.cpp
Normal file → Executable file
|
@ -93,14 +93,8 @@ void initGLview(Evas_Object *obj)
|
|||
void drawGLview(Evas_Object *obj)
|
||||
{
|
||||
auto gl = elm_glview_gl_api_get(obj);
|
||||
int w, h;
|
||||
elm_glview_size_get(obj, &w, &h);
|
||||
gl->glViewport(0, 0, w, h);
|
||||
gl->glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
gl->glClear(GL_COLOR_BUFFER_BIT);
|
||||
gl->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
gl->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
|
||||
gl->glEnable(GL_BLEND);
|
||||
|
||||
if (glCanvas->draw() == tvg::Result::Success) {
|
||||
glCanvas->sync();
|
||||
|
|
6
test/testTransform.cpp
Normal file → Executable file
6
test/testTransform.cpp
Normal file → Executable file
|
@ -130,14 +130,8 @@ void initGLview(Evas_Object *obj)
|
|||
void drawGLview(Evas_Object *obj)
|
||||
{
|
||||
auto gl = elm_glview_gl_api_get(obj);
|
||||
int w, h;
|
||||
elm_glview_size_get(obj, &w, &h);
|
||||
gl->glViewport(0, 0, w, h);
|
||||
gl->glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
gl->glClear(GL_COLOR_BUFFER_BIT);
|
||||
gl->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
gl->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
|
||||
gl->glEnable(GL_BLEND);
|
||||
|
||||
if (glCanvas->draw() == tvg::Result::Success) {
|
||||
glCanvas->sync();
|
||||
|
|
6
test/testUpdate.cpp
Normal file → Executable file
6
test/testUpdate.cpp
Normal file → Executable file
|
@ -91,14 +91,8 @@ void initGLview(Evas_Object *obj)
|
|||
void drawGLview(Evas_Object *obj)
|
||||
{
|
||||
auto gl = elm_glview_gl_api_get(obj);
|
||||
int w, h;
|
||||
elm_glview_size_get(obj, &w, &h);
|
||||
gl->glViewport(0, 0, w, h);
|
||||
gl->glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
gl->glClear(GL_COLOR_BUFFER_BIT);
|
||||
gl->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
gl->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE);
|
||||
gl->glEnable(GL_BLEND);
|
||||
|
||||
if (glCanvas->draw() == tvg::Result::Success) {
|
||||
glCanvas->sync();
|
||||
|
|
Loading…
Add table
Reference in a new issue