common taskscheduler: revise functionalities.
[platform/core/graphics/tizenvg.git] / test / testCustomTransform.cpp
index 5945490..50033f9 100644 (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. */
@@ -57,19 +61,19 @@ void tvgUpdateCmds(tvg::Canvas* canvas, float progress)
     auto t12 = m.e11 * -sinVal + m.e12 * cosVal;
     auto t21 = m.e21 * cosVal + m.e22 * sinVal;
     auto t22 = m.e21 * -sinVal + m.e22 * cosVal;
-    auto t31 = m.e31 * cosVal + m.e32 * sinVal;
-    auto t32 = m.e31 * -sinVal + m.e32 * cosVal;
+    auto t13 = m.e31 * cosVal + m.e32 * sinVal;
+    auto t23 = m.e31 * -sinVal + m.e32 * cosVal;
 
     m.e11 = t11;
     m.e12 = t12;
     m.e21 = t21;
     m.e22 = t22;
-    m.e31 = t31;
-    m.e32 = t32;
+    m.e13 = t13;
+    m.e23 = t23;
 
     //translate
-    m.e31 = progress * 300.0f + 300.0f;
-    m.e32 = progress * -100.0f + 300.0f;
+    m.e13 = progress * 300.0f + 300.0f;
+    m.e23 = progress * -100.0f + 300.0f;
 
     pShape->transform(m);
 
@@ -88,7 +92,7 @@ void tvgSwTest(uint32_t* buffer)
 {
     //Create a Canvas
     swCanvas = tvg::SwCanvas::gen();
-    swCanvas->target(buffer, WIDTH, WIDTH, HEIGHT);
+    swCanvas->target(buffer, WIDTH, WIDTH, HEIGHT, tvg::SwCanvas::ARGB8888);
 
     /* Push the shape into the Canvas drawing list
        When this shape is into the canvas list, the shape could update & prepare
@@ -139,14 +143,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();
@@ -178,8 +176,11 @@ int main(int argc, char **argv)
         cout << "tvg engine: opengl" << endl;
     }
 
+    //Threads Count
+    auto threads = std::thread::hardware_concurrency();
+
     //Initialize ThorVG Engine
-    if (tvg::Initializer::init(tvgEngine) == tvg::Result::Success) {
+    if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
 
         elm_init(argc, argv);
 
@@ -208,4 +209,4 @@ int main(int argc, char **argv)
         cout << "engine is not supported" << endl;
     }
     return 0;
-}
\ No newline at end of file
+}