capi: changed file name. 98/188698/1
authorHermet Park <hermetpark@gmail.com>
Fri, 7 Sep 2018 10:40:02 +0000 (19:40 +0900)
committerHermet Park <hermetpark@gmail.com>
Fri, 7 Sep 2018 10:40:02 +0000 (19:40 +0900)
Change-Id: Ic1c6b550751041f856814d24b668ab9f97606170

src/binding/c/CMakeLists.txt
src/binding/c/lottieanimation_c.cpp [deleted file]
src/binding/c/lottieanimation_capi.cpp [new file with mode: 0644]
src/binding/c/meson.build

index 5d4965d13294361b014c40a41a02edd9b07a217c..7737952a86dce7cbb8b9f49a8f027cae27874556 100644 (file)
@@ -1,6 +1,6 @@
 target_sources(lottie-player
     PRIVATE
-        "${CMAKE_CURRENT_LIST_DIR}/lottieanimation_c.cpp"
+        "${CMAKE_CURRENT_LIST_DIR}/lottieanimation_capi.cpp"
     )
 
 target_include_directories(lottie-player
diff --git a/src/binding/c/lottieanimation_c.cpp b/src/binding/c/lottieanimation_c.cpp
deleted file mode 100644 (file)
index fa2f9f4..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
-#include "lottieanimation.h"
-#include "vdebug.h"
-
-using namespace lottie;
-
-extern "C" {
-
-struct Lottie_Animation_S
-{
-    std::unique_ptr<Animation> mAnimation;
-    size_t                     mCurFrame;
-    LOTNode                   **mNodeArray;
-    size_t                     mArraySize{0};
-    std::future<Surface>          mRenderTask;
-};
-
-LOT_EXPORT Lottie_Animation_S *lottie_animation_from_file(const char *file)
-{
-    if (auto animation = Animation::loadFromFile(file) ) {
-        Lottie_Animation_S *handle = new Lottie_Animation_S();
-        handle->mAnimation = std::move(animation);
-        return handle;
-    } else {
-        return nullptr;
-    }
-}
-
-Lottie_Animation_S *lottie_animation_from_data(const char *data, const char *key)
-{
-    if (auto animation = Animation::loadFromData(data, key) ) {
-        Lottie_Animation_S *handle = new Lottie_Animation_S();
-        handle->mAnimation = std::move(animation);
-        return handle;
-    } else {
-        return nullptr;
-    }
-}
-
-LOT_EXPORT void lottie_animation_destroy(Lottie_Animation_S *animation)
-{
-    if (animation)
-        delete animation;
-}
-
-LOT_EXPORT void lottie_animation_get_size(const Lottie_Animation_S *animation, size_t *w, size_t *h)
-{
-   if (!animation) return;
-
-   animation->mAnimation->size(*w, *h);
-}
-
-LOT_EXPORT double lottie_animation_get_duration(const Lottie_Animation_S *animation)
-{
-   if (!animation) return 0;
-
-   return animation->mAnimation->duration();
-}
-
-LOT_EXPORT size_t lottie_animation_get_totalframe(const Lottie_Animation_S *animation)
-{
-   if (!animation) return 0;
-
-   return animation->mAnimation->totalFrame();
-}
-
-
-LOT_EXPORT double lottie_animation_get_framerate(const Lottie_Animation_S *animation)
-{
-   if (!animation) return 0;
-
-   return animation->mAnimation->frameRate();
-}
-
-LOT_EXPORT void lottie_animation_prepare_frame(Lottie_Animation_S *animation, size_t frameNo, size_t w, size_t h)
-{
-    if (!animation) return;
-
-    auto list = animation->mAnimation->renderList(frameNo, w, h);
-    animation->mNodeArray = list.data();
-    animation->mArraySize = list.size();
-}
-
-LOT_EXPORT size_t lottie_animation_get_node_count(const Lottie_Animation_S *animation)
-{
-   if (!animation) return 0;
-
-   return animation->mArraySize;
-}
-
-LOT_EXPORT const LOTNode* lottie_animation_get_node(const Lottie_Animation_S *animation, size_t idx)
-{
-   if (!animation) return nullptr;
-
-   if (idx >= animation->mArraySize) return nullptr;
-
-   return animation->mNodeArray[idx];
-}
-
-LOT_EXPORT void
-lottie_animation_render_async(Lottie_Animation_S *animation,
-                              size_t frame_number,
-                              uint32_t *buffer,
-                              size_t width,
-                              size_t height,
-                              size_t bytes_per_line)
-{
-    if (!animation) return;
-
-    lottie::Surface surface(buffer, width, height, bytes_per_line);
-    animation->mRenderTask = animation->mAnimation->render(frame_number, surface);
-}
-
-LOT_EXPORT void
-lottie_animation_render_flush(Lottie_Animation_S *animation)
-{
-    if (!animation) return;
-
-    if (animation->mRenderTask.valid()) {
-        animation->mRenderTask.get();
-    }
-}
-
-}
diff --git a/src/binding/c/lottieanimation_capi.cpp b/src/binding/c/lottieanimation_capi.cpp
new file mode 100644 (file)
index 0000000..fa2f9f4
--- /dev/null
@@ -0,0 +1,123 @@
+#include "lottieanimation.h"
+#include "vdebug.h"
+
+using namespace lottie;
+
+extern "C" {
+
+struct Lottie_Animation_S
+{
+    std::unique_ptr<Animation> mAnimation;
+    size_t                     mCurFrame;
+    LOTNode                   **mNodeArray;
+    size_t                     mArraySize{0};
+    std::future<Surface>          mRenderTask;
+};
+
+LOT_EXPORT Lottie_Animation_S *lottie_animation_from_file(const char *file)
+{
+    if (auto animation = Animation::loadFromFile(file) ) {
+        Lottie_Animation_S *handle = new Lottie_Animation_S();
+        handle->mAnimation = std::move(animation);
+        return handle;
+    } else {
+        return nullptr;
+    }
+}
+
+Lottie_Animation_S *lottie_animation_from_data(const char *data, const char *key)
+{
+    if (auto animation = Animation::loadFromData(data, key) ) {
+        Lottie_Animation_S *handle = new Lottie_Animation_S();
+        handle->mAnimation = std::move(animation);
+        return handle;
+    } else {
+        return nullptr;
+    }
+}
+
+LOT_EXPORT void lottie_animation_destroy(Lottie_Animation_S *animation)
+{
+    if (animation)
+        delete animation;
+}
+
+LOT_EXPORT void lottie_animation_get_size(const Lottie_Animation_S *animation, size_t *w, size_t *h)
+{
+   if (!animation) return;
+
+   animation->mAnimation->size(*w, *h);
+}
+
+LOT_EXPORT double lottie_animation_get_duration(const Lottie_Animation_S *animation)
+{
+   if (!animation) return 0;
+
+   return animation->mAnimation->duration();
+}
+
+LOT_EXPORT size_t lottie_animation_get_totalframe(const Lottie_Animation_S *animation)
+{
+   if (!animation) return 0;
+
+   return animation->mAnimation->totalFrame();
+}
+
+
+LOT_EXPORT double lottie_animation_get_framerate(const Lottie_Animation_S *animation)
+{
+   if (!animation) return 0;
+
+   return animation->mAnimation->frameRate();
+}
+
+LOT_EXPORT void lottie_animation_prepare_frame(Lottie_Animation_S *animation, size_t frameNo, size_t w, size_t h)
+{
+    if (!animation) return;
+
+    auto list = animation->mAnimation->renderList(frameNo, w, h);
+    animation->mNodeArray = list.data();
+    animation->mArraySize = list.size();
+}
+
+LOT_EXPORT size_t lottie_animation_get_node_count(const Lottie_Animation_S *animation)
+{
+   if (!animation) return 0;
+
+   return animation->mArraySize;
+}
+
+LOT_EXPORT const LOTNode* lottie_animation_get_node(const Lottie_Animation_S *animation, size_t idx)
+{
+   if (!animation) return nullptr;
+
+   if (idx >= animation->mArraySize) return nullptr;
+
+   return animation->mNodeArray[idx];
+}
+
+LOT_EXPORT void
+lottie_animation_render_async(Lottie_Animation_S *animation,
+                              size_t frame_number,
+                              uint32_t *buffer,
+                              size_t width,
+                              size_t height,
+                              size_t bytes_per_line)
+{
+    if (!animation) return;
+
+    lottie::Surface surface(buffer, width, height, bytes_per_line);
+    animation->mRenderTask = animation->mAnimation->render(frame_number, surface);
+}
+
+LOT_EXPORT void
+lottie_animation_render_flush(Lottie_Animation_S *animation)
+{
+    if (!animation) return;
+
+    if (animation->mRenderTask.valid()) {
+        animation->mRenderTask.get();
+    }
+}
+
+}
index 3c297fcf701adb9217eca7f2378f91d33d2067bd..182aba59c723cf9e80e6b36a03c318cfe7a94af2 100644 (file)
@@ -1,4 +1,4 @@
-source_file = files('lottieanimation_c.cpp')
+source_file = files('lottieanimation_capi.cpp')
 
 binding_c_dep = declare_dependency(
                                       include_directories : include_directories('.'),