Add dlog for tizen 18/301918/1 accepted/tizen_unified accepted/tizen_unified_riscv tizen accepted/tizen/unified/20231130.180921 accepted/tizen/unified/riscv/20231211.234130
authorjoogab.yun <joogab.yun@samsung.com>
Mon, 27 Nov 2023 08:39:29 +0000 (17:39 +0900)
committerjoogab.yun <joogab.yun@samsung.com>
Mon, 27 Nov 2023 08:51:27 +0000 (17:51 +0900)
Change-Id: I941937976b3593841c63d1c7ab598fc4dfe417d3

meson.build
meson_options.txt
packaging/rlottie.spec
src/lottie/lottieanimation.cpp
src/lottie/lottieloader.cpp
src/lottie/lottieparser.cpp
src/meson.build
src/vector/vdebug.h
src/vector/vimageloader.cpp

index 46b1ec4..2944f32 100644 (file)
@@ -58,6 +58,9 @@ if get_option('dumptree') == true
     config_h.set10('LOTTIE_DUMP_TREE_SUPPORT', true)
 endif
 
+if get_option('tizen') == true
+    config_h.set10('TIZEN', true)
+endif
 
 configure_file(
   output: 'config.h',
index acc79d2..cfd5646 100644 (file)
@@ -46,3 +46,8 @@ option('cmake',
   type: 'boolean',
   value: false,
   description: 'Enable Generating  CMake config files')
+
+option('tizen',
+   type: 'boolean',
+   value: true,
+   description: 'Enable prints tizen dlogs')
index 9cc674e..11b0989 100644 (file)
@@ -6,8 +6,10 @@ Group:      UI Framework/Services
 License:    MIT and BSD and MPL-2.0
 URL:        http://www.tizen.org/
 Source0:    %{name}-%{version}.tar.gz
+BuildRequires:  pkgconfig
 BuildRequires:  meson
 BuildRequires:  ninja
+BuildRequires:  pkgconfig(dlog)
 Requires(post): /sbin/ldconfig
 Requires(postun): /sbin/ldconfig
 
index afcc400..62e9fbb 100644 (file)
@@ -111,6 +111,7 @@ Surface AnimationImpl::render(size_t frameNo, const Surface &surface,
     bool renderInProgress = mRenderInProgress.load();
     if (renderInProgress) {
         vCritical << "Already Rendering Scheduled for this Animation";
+        LOGE("Already Rendering Scheduled for this Animation\n");
         return surface;
     }
 
@@ -275,6 +276,7 @@ std::unique_ptr<Animation> Animation::loadFromData(
 {
     if (jsonData.empty()) {
         vWarning << "jason data is empty";
+        LOGE("jason data is empty\n");
         return nullptr;
     }
 
@@ -295,6 +297,7 @@ std::unique_ptr<Animation> Animation::loadFromData(std::string jsonData,
 {
     if (jsonData.empty()) {
         vWarning << "jason data is empty";
+        LOGE("jason data is empty\n");
         return nullptr;
     }
 
@@ -313,6 +316,7 @@ std::unique_ptr<Animation> Animation::loadFromFile(const std::string &path,
 {
     if (path.empty()) {
         vWarning << "File path is empty";
+        LOGE("File path is empty\n");
         return nullptr;
     }
 
index 8a52949..58911b5 100644 (file)
@@ -126,6 +126,7 @@ std::shared_ptr<model::Composition> model::loadFromFile(const std::string &path,
 
     if (!f.is_open()) {
         vCritical << "failed to open file = " << path.c_str();
+        LOGE("failed to open file = %s\n", path.c_str());
         return {};
     } else {
         std::string content;
@@ -133,10 +134,18 @@ std::shared_ptr<model::Composition> model::loadFromFile(const std::string &path,
         std::getline(f, content, '\0');
         f.close();
 
-        if (content.empty()) return {};
+        if (content.empty())
+        {
+            LOGE("failed : content is empty\n");
+            return {};
+        }
 
         auto obj = internal::model::parse(const_cast<char *>(content.c_str()),
                                           dirname(path));
+        if (!obj)
+        {
+            LOGE("failed : model of parse is null\n");
+        }
 
         if (obj && cachePolicy) ModelCache::instance().add(path, obj);
 
index e14fd5c..8c7b550 100644 (file)
@@ -394,6 +394,7 @@ bool LottieParserImpl::ParseNext()
 
     if (!r_.IterativeParseNext<parseFlags>(ss_, *this)) {
         vCritical << "Lottie file parsing error";
+        LOGE("Lottie file parsing error\n");
         st_ = kError;
         return false;
     }
@@ -1142,6 +1143,7 @@ model::Object *LottieParserImpl::parseObjectTypeAttr()
     const char *type = GetString();
     if (!type) {
         vWarning << "No object type specified";
+        LOGE("No object type specified\n");
         return nullptr;
     }
     if (0 == strcmp(type, "gr")) {
@@ -1177,6 +1179,7 @@ model::Object *LottieParserImpl::parseObjectTypeAttr()
         return parseReapeaterObject();
     } else if (0 == strcmp(type, "mm")) {
         vWarning << "Merge Path is not supported yet";
+        LOGE("Merge Path is not supported yet\n");
         return nullptr;
     } else {
 #ifdef DEBUG_PARSER
@@ -2388,6 +2391,7 @@ std::shared_ptr<model::Composition> model::parse(char *             str,
     }
 
     vWarning << "Input data is not Lottie format!";
+    LOGE( "Input data is not Lottie format!\n");
     return {};
 }
 
index d93a7e3..529067f 100644 (file)
@@ -22,6 +22,10 @@ if get_option('thread') == true
     rlottie_lib_dep  += dependency('threads')
 endif
 
+if get_option('tizen') == true
+    rlottie_lib_dep += dependency('dlog', required: true)
+endif
+
 rlottie_lib = library('rlottie',
                       include_directories   : inc,
                       version               : meson.project_version(),
@@ -37,6 +41,7 @@ rlottie_dep = declare_dependency(
                                  include_directories: inc,
                                  link_with : rlottie_lib)
 
+
 if (cc.get_id() == 'emscripten')
 
   subdir('wasm')
index 5b6bef5..d24fdbe 100644 (file)
 
 #include "config.h"
 
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "LOTTIE"
+
+#ifdef TIZEN
+#include <dlog.h>
+#define LOGW(fmt, ...) dlog_print(DLOG_WARN, LOG_TAG, "[%s]" fmt, __func__, ##__VA_ARGS__)
+#define LOGE(fmt, ...) dlog_print(DLOG_ERROR, LOG_TAG, "[%s]" fmt, __func__, ##__VA_ARGS__)
+#else
+#define C_RED "\e[31m"
+#define C_YELLOW "\e[33m"
+#define C_END "\e[0m"
+#define LOGW(fmt, ...) printf(C_YELLOW "[" LOG_TAG "]" C_END "[%s]" fmt "\n", __func__, ##__VA_ARGS__)
+#define LOGE(fmt, ...) printf(C_RED "[" LOG_TAG "]" C_END "[%s]" fmt "\n", __func__, ##__VA_ARGS__)
+#endif
+
 #ifdef LOTTIE_LOGGING_SUPPORT
 
 #include <cstdint>
index c2446be..508bd77 100644 (file)
@@ -94,22 +94,33 @@ struct VImageLoader::Impl {
     {
         if (moduleLoad()) {
             vWarning << "Failed to dlopen librlottie-image-loader library";
+            LOGE("Failed to dlopen librlottie-image-loader library\n");
             return;
         }
 
         init();
 
         if (!imageLoad)
+        {
             vWarning << "Failed to find symbol lottie_image_load in "
                         "librlottie-image-loader library";
+            LOGW("Failed to find symbol lottie_image_load in librlottie-image-loader library\n");
+        }
+
 
         if (!imageFree)
+        {
             vWarning << "Failed to find symbol lottie_image_free in "
                         "librlottie-image-loader library";
+            LOGW("Failed to find symbol lottie_image_free in librlottie-image-loader library\n");
+        }
 
         if (!imageFromData)
+        {
             vWarning << "Failed to find symbol lottie_image_load_data in "
                         "librlottie-image-loader library";
+            LOGW("Failed to find symbol lottie_image_load_data in librlottie-image-loader library\n");
+        }
     }
 
     ~Impl() { moduleFree(); }