refactor infrastructure.

Split common delcaration from lottieplayer.h
This common delcaration will be used in c interface header files.

Change-Id: Icb3e3f182b2f27fc2d7c9bed36ac29c45c813b66
This commit is contained in:
Hermet Park
2018-08-17 18:41:34 +09:00
committed by Subhransu Mohanty
parent 083ec1abb8
commit d49fb641e0
7 changed files with 53 additions and 48 deletions

View File

@@ -1,5 +1,4 @@
#include"lottieview.h"
#include"lottieplayer.h"
using namespace lotplayer;

View 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
{

View File

@@ -1,8 +1,5 @@
#ifndef _LOTPLAYER_H_
#define _LOTPLAYER_H_
#include <future>
#include <vector>
#ifndef _LOTCOMMON_H_
#define _LOTCOMMON_H_
#ifdef _WIN32
#ifdef LOT_BUILD
@@ -26,11 +23,6 @@
#endif
#endif
//TODO: Hide this.
class LOTPlayerPrivate;
#define _LOTPLAYER_DECLARE_PRIVATE(A) \
class A##Private *d;
struct LOTNode {
#define ChangeFlagNone 0x0000
@@ -84,38 +76,11 @@ struct LOTNode {
};
struct LOTBuffer {
uint32_t *buffer = nullptr;
int width = 0;
int height = 0;
int bytesPerLine = 0;
bool clear = true;
uint32_t *buffer;
int width;
int height;
int bytesPerLine;
bool clear;
};
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_
#endif // _LOTCOMMON_H_

41
inc/lotplayer.h Normal file
View File

@@ -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_

View File

@@ -1 +1 @@
install_headers(['lottieplayer.h'])
install_headers(['lotplayer.h', 'lotcommon.h'])

View 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"

View File

@@ -1,4 +1,4 @@
#include <lottieplayer.h>
#include <lotplayer.h>
#include "lottieitem.h"
#include "lottieloader.h"