lottie: refactor VRaster class.

Change-Id: Iadd382d34fcaa67a4cb60b44f22af38051f6f09a
This commit is contained in:
subhransu mohanty 2018-08-21 10:44:40 +09:00 committed by Subhransu Mohanty
parent c12a9916a5
commit 6fb25316ee
4 changed files with 14 additions and 29 deletions

View File

@ -142,7 +142,7 @@ void LOTMaskItem::update(int frameNo, const VMatrix &parentMatrix,
VPath path = mLocalPath;
path.transform(parentMatrix);
mRleTask = VRaster::instance().generateFillInfo(std::move(path), std::move(mRle));
mRleTask = VRaster::generateFillInfo(std::move(path), std::move(mRle));
mRle = VRle();
}

View File

@ -10,11 +10,11 @@ void VDrawable::preprocess()
VDasher dasher(mStroke.mDash.data(), mStroke.mDash.size());
mPath = dasher.dashed(mPath);
}
mRleTask = VRaster::instance().generateStrokeInfo(
mRleTask = VRaster::generateStrokeInfo(
std::move(mPath), std::move(mRle), mStroke.cap, mStroke.join,
mStroke.width, mStroke.meterLimit);
} else {
mRleTask = VRaster::instance().generateFillInfo(
mRleTask = VRaster::generateFillInfo(
std::move(mPath), std::move(mRle), mFillRule);
}
mRle = VRle();

View File

@ -7,6 +7,7 @@
#include "vmatrix.h"
#include "vpath.h"
#include "vtaskqueue.h"
#include "vrle.h"
V_BEGIN_NAMESPACE
@ -383,10 +384,6 @@ public:
static RleTaskScheduler raster_scheduler;
VRaster::VRaster() {}
VRaster::~VRaster() {}
std::future<VRle> VRaster::generateFillInfo(VPath &&path, VRle &&rle,
FillRule fillRule)
{

View File

@ -1,35 +1,23 @@
#ifndef VRASTER_H
#define VRASTER_H
#include <future>
#include "vrle.h"
#include "vglobal.h"
V_BEGIN_NAMESPACE
struct FTOutline;
class VPath;
class VRle;
struct VRasterPrivate;
class VRaster {
public:
~VRaster();
static VRaster &instance()
{
static VRaster Singleton;
return Singleton;
}
VRaster(const VRaster &other) = delete;
VRaster(VRaster &&) = delete;
VRaster &operator=(VRaster const &) = delete;
VRaster &operator=(VRaster &&) = delete;
struct VRaster {
std::future<VRle> generateFillInfo(VPath &&path, VRle &&rle,
FillRule fillRule = FillRule::Winding);
std::future<VRle> generateStrokeInfo(VPath &&path, VRle &&rle, CapStyle cap,
JoinStyle join, float width,
float meterLimit);
static std::future<VRle>
generateFillInfo(VPath &&path, VRle &&rle,
FillRule fillRule = FillRule::Winding);
private:
VRaster();
static std::future<VRle>
generateStrokeInfo(VPath &&path, VRle &&rle,
CapStyle cap, JoinStyle join,
float width, float meterLimit);
};
V_END_NAMESPACE