lotplayer: improve header format. 20/187020/3
authorHermet Park <hermetpark@gmail.com>
Fri, 17 Aug 2018 08:19:08 +0000 (17:19 +0900)
committerSubhransu Mohanty <sub.mohanty@samsung.com>
Mon, 20 Aug 2018 03:30:09 +0000 (03:30 +0000)
1. add namespace.
2. remove unnecessary export attribute.
3. hide prviate member.

This is one ongoing improvement.

Change-Id: I342e4d5e65370190ac55972b02f2fede1aee6d06

example/lottieview.cpp
example/lottieview.h
inc/lottieplayer.h
src/lottie/lottieplayer.cpp

index 5b30fd9..4ec334d 100644 (file)
@@ -1,6 +1,8 @@
 #include"lottieview.h"
 #include"lottieplayer.h"
 
+using namespace lotplayer;
+
 static Eina_Bool
 animator(void *data , double pos)
 {
index 681fb8b..44543ab 100644 (file)
@@ -16,7 +16,6 @@
 #include <Ecore_Evas.h>
 #include"lottieplayer.h"
 #include<future>
-class LOTPlayer;
 class LottieView
 {
 public:
@@ -54,7 +53,7 @@ public:
     Evas_Object             *mVg;
     int                      mRepeatCount;
     LottieView::RepeatMode   mRepeatMode;
-    LOTPlayer               *mPlayer;
+    lotplayer::LOTPlayer    *mPlayer;
     Ecore_Animator          *mAnimator{nullptr};
     bool                     mLoop;
     int                      mCurCount;
index ee981ae..3dbbbc6 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef LOTPLAYER_H
-#define LOTPLAYER_H
+#ifndef _LOTPLAYER_H_
+#define _LOTPLAYER_H_
 
 #include <future>
 #include <vector>
 #endif
 #endif
 
+//TODO: Hide this.
 class LOTPlayerPrivate;
-class LOTNode;
+#define _LOTPLAYER_DECLARE_PRIVATE(A) \
+   class A##Private *d;
 
-struct LOT_EXPORT LOTBuffer {
-    uint32_t *buffer = nullptr;
-    int       width = 0;
-    int       height = 0;
-    int       bytesPerLine = 0;
-    bool      clear = true;
-};
-
-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);
-
-public:
-    LOTPlayerPrivate *d;
-};
+struct LOTNode {
 
 #define ChangeFlagNone 0x0000
 #define ChangeFlagPath 0x0001
 #define ChangeFlagPaint 0x0010
 #define ChangeFlagAll (ChangeFlagPath & ChangeFlagPaint)
 
-struct LOTNode {
-
     enum BrushType { BrushSolid, BrushGradient };
     enum FillRule { EvenOdd, Winding };
     enum JoinStyle { MiterJoin, BevelJoin, RoundJoin };
@@ -112,4 +83,39 @@ struct LOTNode {
     Gradient  mGradient;
 };
 
-#endif  // LOTPLAYER_H
+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 39f30b2..ecb2c88 100644 (file)
@@ -6,6 +6,8 @@
 
 #include <fstream>
 
+using namespace lotplayer;
+
 class LOTPlayerPrivate {
 
 public: