refactor infrastructure. 35/187035/6
authorHermet Park <hermetpark@gmail.com>
Fri, 17 Aug 2018 09:41:34 +0000 (18:41 +0900)
committerSubhransu Mohanty <sub.mohanty@samsung.com>
Tue, 21 Aug 2018 00:46:52 +0000 (00:46 +0000)
Split common delcaration from lottieplayer.h
This common delcaration will be used in c interface header files.

Change-Id: Icb3e3f182b2f27fc2d7c9bed36ac29c45c813b66

example/lottieview.cpp
example/lottieview.h
inc/lotcommon.h [new file with mode: 0644]
inc/lotplayer.h [new file with mode: 0644]
inc/lottieplayer.h [deleted file]
inc/meson.build
src/lottie/lottieitem.h
src/lottie/lottieplayer.cpp

index 4ec334d73ffe2f97c119f193f0107e12dc5cf76e..c9b68d6475d18c8ae29b8d1eee616eb0f6657cf0 100644 (file)
@@ -1,5 +1,4 @@
 #include"lottieview.h"
-#include"lottieplayer.h"
 
 using namespace lotplayer;
 
index d63d117d4e74f12e7f897f0fe5e9ecd7332a503a..32122ac40fc39eea5c3a37a8477ee0673db212c1 100644 (file)
@@ -14,7 +14,7 @@
 #include <Evas.h>
 #include <Ecore.h>
 #include <Ecore_Evas.h>
-#include"lottieplayer.h"
+#include"lotplayer.h"
 #include<future>
 class LottieView
 {
diff --git a/inc/lotcommon.h b/inc/lotcommon.h
new file mode 100644 (file)
index 0000000..b8efeb6
--- /dev/null
@@ -0,0 +1,86 @@
+#ifndef _LOTCOMMON_H_
+#define _LOTCOMMON_H_
+
+#ifdef _WIN32
+#ifdef LOT_BUILD
+#ifdef DLL_EXPORT
+#define LOT_EXPORT __declspec(dllexport)
+#else
+#define LOT_EXPORT
+#endif
+#else
+#define LOT_EXPORT __declspec(dllimport)
+#endif
+#else
+#ifdef __GNUC__
+#if __GNUC__ >= 4
+#define LOT_EXPORT __attribute__((visibility("default")))
+#else
+#define LOT_EXPORT
+#endif
+#else
+#define LOT_EXPORT
+#endif
+#endif
+
+struct LOTNode {
+
+#define ChangeFlagNone 0x0000
+#define ChangeFlagPath 0x0001
+#define ChangeFlagPaint 0x0010
+#define ChangeFlagAll (ChangeFlagPath & ChangeFlagPaint)
+
+    enum BrushType { BrushSolid, BrushGradient };
+    enum FillRule { EvenOdd, Winding };
+    enum JoinStyle { MiterJoin, BevelJoin, RoundJoin };
+    enum CapStyle { FlatCap, SquareCap, RoundCap };
+
+    struct PathData {
+        const float *ptPtr;
+        int          ptCount;
+        const char*  elmPtr;
+        int          elmCount;
+    };
+
+    struct Color {
+        unsigned char r, g, b, a;
+    };
+
+    struct Stroke {
+        bool      enable;
+        int       width;
+        CapStyle  cap;
+        JoinStyle join;
+        int       meterLimit;
+        float*    dashArray;
+        int       dashArraySize;
+    };
+
+    struct Gradient {
+        enum Type { Linear = 1, Radial = 2 };
+        Gradient::Type type;
+        struct {
+            float x, y;
+        } start, end, center, focal;
+        float cradius;
+        float fradius;
+    };
+
+    int       mFlag;
+    BrushType mType;
+    FillRule  mFillRule;
+    PathData  mPath;
+    Color     mColor;
+    Stroke    mStroke;
+    Gradient  mGradient;
+};
+
+struct LOTBuffer {
+    uint32_t *buffer;
+    int       width;
+    int       height;
+    int       bytesPerLine;
+    bool      clear;
+};
+
+#endif  // _LOTCOMMON_H_
diff --git a/inc/lotplayer.h b/inc/lotplayer.h
new file mode 100644 (file)
index 0000000..75ccaa4
--- /dev/null
@@ -0,0 +1,41 @@
+#ifndef _LOTPLAYER_H_
+#define _LOTPLAYER_H_
+
+#include <future>
+#include <vector>
+
+#include "lotcommon.h"
+
+//TODO: Hide this.
+class LOTPlayerPrivate;
+#define _LOTPLAYER_DECLARE_PRIVATE(A) \
+   class A##Private *d;
+
+namespace lotplayer {
+
+class LOT_EXPORT LOTPlayer {
+public:
+    ~LOTPlayer();
+    LOTPlayer();
+
+    bool setFilePath(const char *filePath);
+
+    float playTime() const;
+
+    float pos();
+
+    const std::vector<LOTNode *> &renderList(float pos) const;
+
+    // TODO: Consider correct position...
+    void              setSize(int width, int height);
+    void              size(int &width, int &height) const;
+    std::future<bool> render(float pos, LOTBuffer buffer, bool forceRender = false);
+    bool              renderSync(float pos, LOTBuffer buffer, bool forceRender = false);
+
+private:
+    _LOTPLAYER_DECLARE_PRIVATE(LOTPlayer);
+};
+
+}  // namespace lotplayer
+
+#endif  // _LOTPLAYER_H_
diff --git a/inc/lottieplayer.h b/inc/lottieplayer.h
deleted file mode 100644 (file)
index 3dbbbc6..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-#ifndef _LOTPLAYER_H_
-#define _LOTPLAYER_H_
-
-#include <future>
-#include <vector>
-
-#ifdef _WIN32
-#ifdef LOT_BUILD
-#ifdef DLL_EXPORT
-#define LOT_EXPORT __declspec(dllexport)
-#else
-#define LOT_EXPORT
-#endif
-#else
-#define LOT_EXPORT __declspec(dllimport)
-#endif
-#else
-#ifdef __GNUC__
-#if __GNUC__ >= 4
-#define LOT_EXPORT __attribute__((visibility("default")))
-#else
-#define LOT_EXPORT
-#endif
-#else
-#define LOT_EXPORT
-#endif
-#endif
-
-//TODO: Hide this.
-class LOTPlayerPrivate;
-#define _LOTPLAYER_DECLARE_PRIVATE(A) \
-   class A##Private *d;
-
-struct LOTNode {
-
-#define ChangeFlagNone 0x0000
-#define ChangeFlagPath 0x0001
-#define ChangeFlagPaint 0x0010
-#define ChangeFlagAll (ChangeFlagPath & ChangeFlagPaint)
-
-    enum BrushType { BrushSolid, BrushGradient };
-    enum FillRule { EvenOdd, Winding };
-    enum JoinStyle { MiterJoin, BevelJoin, RoundJoin };
-    enum CapStyle { FlatCap, SquareCap, RoundCap };
-
-    struct PathData {
-        const float *ptPtr;
-        int          ptCount;
-        const char*  elmPtr;
-        int          elmCount;
-    };
-
-    struct Color {
-        unsigned char r, g, b, a;
-    };
-
-    struct Stroke {
-        bool      enable;
-        int       width;
-        CapStyle  cap;
-        JoinStyle join;
-        int       meterLimit;
-        float*    dashArray;
-        int       dashArraySize;
-    };
-
-    struct Gradient {
-        enum Type { Linear = 1, Radial = 2 };
-        Gradient::Type type;
-        struct {
-            float x, y;
-        } start, end, center, focal;
-        float cradius;
-        float fradius;
-    };
-
-    int       mFlag;
-    BrushType mType;
-    FillRule  mFillRule;
-    PathData  mPath;
-    Color     mColor;
-    Stroke    mStroke;
-    Gradient  mGradient;
-};
-
-struct LOTBuffer {
-    uint32_t *buffer = nullptr;
-    int       width = 0;
-    int       height = 0;
-    int       bytesPerLine = 0;
-    bool      clear = true;
-};
-
-namespace lotplayer {
-
-class LOT_EXPORT LOTPlayer {
-public:
-    ~LOTPlayer();
-    LOTPlayer();
-
-    bool setFilePath(const char *filePath);
-
-    float playTime() const;
-
-    float pos();
-
-    const std::vector<LOTNode *> &renderList(float pos) const;
-
-    // TODO: Consider correct position...
-    void              setSize(int width, int height);
-    void              size(int &width, int &height) const;
-    std::future<bool> render(float pos, LOTBuffer buffer, bool forceRender = false);
-    bool              renderSync(float pos, LOTBuffer buffer, bool forceRender = false);
-
-private:
-    _LOTPLAYER_DECLARE_PRIVATE(LOTPlayer);
-};
-
-}  // namespace lotplayer
-
-#endif  // _LOTPLAYER_H_
index 0b4bb41f4edc26eabf8be39cf7244e1c20cca19b..aa65f1f780b4fe5a874f05a3cf98f9c3236cb2d4 100644 (file)
@@ -1 +1 @@
-install_headers(['lottieplayer.h'])
+install_headers(['lotplayer.h', 'lotcommon.h'])
index a29875f5132590faa37dfa71dca7fe8db8359e21..2cf17b480fa2636f16dc7a272aa8f801382bdb22 100644 (file)
@@ -9,7 +9,7 @@
 #include"vpath.h"
 #include"vpoint.h"
 #include"vpathmesure.h"
-#include"lottieplayer.h"
+#include"lotcommon.h"
 #include"vpainter.h"
 #include"vdrawable.h"
 
index 28a6123b5591849e522526e5c106c0c1491168de..825d84f11ac3ae909cb919cfd7ef1fc10c9012c9 100644 (file)
@@ -1,4 +1,4 @@
-#include <lottieplayer.h>
+#include <lotplayer.h>
 
 #include "lottieitem.h"
 #include "lottieloader.h"