test: ++code safety

added null check for exceptional case.

Change-Id: I12a5e9724149f607188b67a84e46a033a16270f7
This commit is contained in:
Hermet Park 2020-07-17 17:15:16 +09:00
parent 56c0235dc5
commit a5d1542e44
20 changed files with 63 additions and 14 deletions

View file

@ -10,6 +10,8 @@ static unsigned cnt = 0;
bool tvgUpdateCmds(tvg::Canvas* canvas)
{
if (!canvas) return false;
auto t = ecore_time_get();
//Explicitly clear all retained paint nodes.

View file

@ -6,6 +6,8 @@
void tvgDrawCmds(tvg::Canvas* canvas)
{
if (!canvas) return;
canvas->reserve(5);
//Prepare Round Rectangle

View file

@ -6,6 +6,8 @@
void tvgDrawCmds(tvg::Canvas* canvas)
{
if (!canvas) return;
canvas->reserve(5); //reserve 5 shape nodes (optional)
//Prepare Shape1

View file

@ -12,14 +12,13 @@ using namespace std;
/************************************************************************/
void tvgSwTest(uint32_t* buffer);
void drawSwView(void* data, Eo* obj);
void win_del(void *data, Evas_Object *o, void *ev)
{
elm_exit();
}
void drawSwView(void* data, Eo* obj);
static Eo* createSwView()
{
static uint32_t buffer[WIDTH * HEIGHT];

View file

@ -7,6 +7,8 @@ tvg::Shape* pShape = nullptr;
void tvgDrawCmds(tvg::Canvas* canvas)
{
if (!canvas) return;
//Shape1
auto shape = tvg::Shape::gen();
@ -33,6 +35,8 @@ void tvgDrawCmds(tvg::Canvas* canvas)
void tvgUpdateCmds(tvg::Canvas* canvas, float progress)
{
if (!canvas) return;
/* Update shape directly.
You can update only necessary properties of this shape,
while retaining other properties. */

View file

@ -7,6 +7,8 @@ tvg::Shape* pShape = nullptr;
void tvgDrawCmds(tvg::Canvas* canvas)
{
if (!canvas) return;
//Shape
auto shape = tvg::Shape::gen();
@ -26,6 +28,8 @@ void tvgDrawCmds(tvg::Canvas* canvas)
void tvgUpdateCmds(tvg::Canvas* canvas, float progress)
{
if (!canvas) return;
/* Update shape directly.
You can update only necessary properties of this shape,
while retaining other properties. */

View file

@ -9,6 +9,8 @@ tvg::Shape* pShape3 = nullptr;
void tvgDrawCmds(tvg::Canvas* canvas)
{
if (!canvas) return;
//Shape1
auto shape = tvg::Shape::gen();
@ -83,6 +85,8 @@ void tvgDrawCmds(tvg::Canvas* canvas)
void tvgUpdateCmds(tvg::Canvas* canvas, float progress)
{
if (!canvas) return;
/* Update shape directly.
You can update only necessary properties of this shape,
while retaining other properties. */

View file

@ -6,6 +6,8 @@
void tvgDrawCmds(tvg::Canvas* canvas)
{
if (!canvas) return;
canvas->reserve(3); //reserve 3 shape nodes (optional)
//Prepare Round Rectangle

View file

@ -6,6 +6,8 @@
void tvgDrawCmds(tvg::Canvas* canvas)
{
if (!canvas) return;
canvas->reserve(3); //reserve 3 shape nodes (optional)
//Prepare Round Rectangle

View file

@ -6,6 +6,8 @@
void tvgDrawCmds(tvg::Canvas* canvas)
{
if (!canvas) return;
//Star
auto shape1 = tvg::Shape::gen();

View file

@ -6,6 +6,8 @@
void tvgDrawCmds(tvg::Canvas* canvas)
{
if (!canvas) return;
/* Star */
//Prepare Path Commands

View file

@ -6,6 +6,8 @@
void tvgDrawCmds(tvg::Canvas* canvas)
{
if (!canvas) return;
canvas->reserve(3); //reserve 3 shape nodes (optional)
//Prepare Round Rectangle

View file

@ -6,6 +6,8 @@
void tvgDrawCmds(tvg::Canvas* canvas)
{
if (!canvas) return;
//Create a Scene
auto scene = tvg::Scene::gen();
scene->reserve(3); //reserve 3 shape nodes (optional)

View file

@ -8,6 +8,8 @@ tvg::Scene* pScene2 = nullptr;
void tvgDrawCmds(tvg::Canvas* canvas)
{
if (!canvas) return;
//Create a Scene1
auto scene = tvg::Scene::gen();
pScene1 = scene.get();
@ -90,6 +92,8 @@ void tvgDrawCmds(tvg::Canvas* canvas)
void tvgUpdateCmds(tvg::Canvas* canvas, float progress)
{
if (!canvas) return;
/* Update scene directly.
You can update only necessary properties of this scene,
while retaining other properties. */

View file

@ -6,6 +6,8 @@
void tvgDrawCmds(tvg::Canvas* canvas)
{
if (!canvas) return;
//Prepare a Shape (Rectangle + Rectangle + Circle + Circle)
auto shape1 = tvg::Shape::gen();
shape1->appendRect(0, 0, 200, 200, 0, 0); //x, y, w, h, rx, ry

View file

@ -6,6 +6,8 @@
void tvgDrawCmds(tvg::Canvas* canvas)
{
if (!canvas) return;
//Shape 1
auto shape1 = tvg::Shape::gen();
shape1->appendRect(50, 50, 200, 200, 0, 0);

View file

@ -6,6 +6,8 @@
void tvgDrawCmds(tvg::Canvas* canvas)
{
if (!canvas) return;
//Test for Stroke Width
for (int i = 0; i < 10; ++i) {
auto shape = tvg::Shape::gen();

View file

@ -31,6 +31,8 @@ void svgDirCallback(const char* name, const char* path, void* data)
void tvgDrawCmds(tvg::Canvas* canvas)
{
if (!canvas) return;
//Background
auto shape = tvg::Shape::gen();
shape->appendRect(0, 0, WIDTH, HEIGHT, 0, 0); //x, y, w, h, rx, ry

View file

@ -9,6 +9,8 @@ tvg::Shape* pShape3 = nullptr;
void tvgDrawCmds(tvg::Canvas* canvas)
{
if (!canvas) return;
//Shape1
auto shape = tvg::Shape::gen();
@ -46,6 +48,8 @@ void tvgDrawCmds(tvg::Canvas* canvas)
void tvgUpdateCmds(tvg::Canvas* canvas, float progress)
{
if (!canvas) return;
/* Update shape directly.
You can update only necessary properties of this shape,
while retaining other properties. */

View file

@ -6,6 +6,8 @@
void tvgDrawCmds(tvg::Canvas* canvas)
{
if (!canvas) return;
//Shape
auto shape = tvg::Shape::gen();
shape->appendRect(-100, -100, 200, 200, 0, 0);
@ -15,6 +17,8 @@ void tvgDrawCmds(tvg::Canvas* canvas)
void tvgUpdateCmds(tvg::Canvas* canvas, float progress)
{
if (!canvas) return;
//Explicitly clear all retained paint nodes.
if (canvas->clear() != tvg::Result::Success) return;