common sw_engine: code refactoring

replaced names and fixed out of coding convention.
This commit is contained in:
Hermet Park 2020-11-04 19:18:59 +09:00
parent 9bb1972ef9
commit 3ab1194773
6 changed files with 22 additions and 22 deletions

View file

@ -5,7 +5,7 @@ source_file = [
'tvgSwRenderer.h',
'tvgSwRaster.cpp',
'tvgSwRenderer.cpp',
'tvgSwResMgr.cpp',
'tvgSwMemPool.cpp',
'tvgSwRle.cpp',
'tvgSwShape.cpp',
'tvgSwStroke.cpp',

View file

@ -295,11 +295,11 @@ void rleFree(SwRleData* rle);
void rleClipPath(SwRleData *rle, const SwRleData *clip);
void rleClipRect(SwRleData *rle, const SwBBox* clip);
bool resMgrInit(uint32_t threads);
bool resMgrTerm();
bool resMgrClear();
SwOutline* resMgrRequestOutline(unsigned idx);
void resMgrRetrieveOutline(unsigned idx);
bool mpoolInit(uint32_t threads);
bool mpoolTerm();
bool mpoolClear();
SwOutline* mpoolReqOutline(unsigned idx);
void mpoolRetOutline(unsigned idx);
bool rasterCompositor(SwSurface* surface);
bool rasterGradientShape(SwSurface* surface, SwShape* shape, unsigned id);

View file

@ -35,20 +35,20 @@ static vector<SwOutline> sharedOutline;
/* External Class Implementation */
/************************************************************************/
SwOutline* resMgrRequestOutline(unsigned idx)
SwOutline* mpoolReqOutline(unsigned idx)
{
return &sharedOutline[idx];
}
void resMgrRetrieveOutline(unsigned idx)
void mpoolRetOutline(unsigned idx)
{
sharedOutline[idx].cntrsCnt = 0;
sharedOutline[idx].ptsCnt = 0;
}
bool resMgrInit(unsigned threads)
bool mpoolInit(unsigned threads)
{
if (threads == 0) threads = 1;
sharedOutline.reserve(threads);
@ -67,7 +67,7 @@ bool resMgrInit(unsigned threads)
}
bool resMgrClear()
bool mpoolClear()
{
for (auto& outline : sharedOutline) {
if (outline.cntrs) {
@ -89,7 +89,7 @@ bool resMgrClear()
}
bool resMgrTerm()
bool mpoolTerm()
{
return resMgrClear();
return mpoolClear();
}

View file

@ -118,7 +118,7 @@ static void _termEngine()
{
if (rendererCnt > 0) return;
resMgrTerm();
mpoolTerm();
}
@ -142,7 +142,7 @@ bool SwRenderer::clear()
for (auto task : tasks) task->get();
tasks.clear();
return resMgrClear();
return mpoolClear();
}
@ -260,7 +260,7 @@ bool SwRenderer::init(uint32_t threads)
if (rendererCnt > 0) return false;
if (initEngine) return true;
if (!resMgrInit(threads)) return false;
if (!mpoolInit(threads)) return false;
initEngine = true;

View file

@ -478,7 +478,7 @@ bool shapeGenRle(SwShape* shape, TVG_UNUSED const Shape* sdata, const SwSize& cl
void shapeDelOutline(SwShape* shape, uint32_t tid)
{
resMgrRetrieveOutline(tid);
mpoolRetOutline(tid);
shape->outline = nullptr;
}
@ -532,7 +532,7 @@ bool shapeGenOutline(SwShape* shape, const Shape* sdata, unsigned tid, const Mat
++outlinePtsCnt; //for close
++outlineCntrsCnt; //for end
shape->outline = resMgrRequestOutline(tid);
shape->outline = mpoolReqOutline(tid);
auto outline = shape->outline;
outline->opened = true;

View file

@ -32,7 +32,7 @@
static int initCnt = 0;
static Loader* find(FileType type)
static Loader* _find(FileType type)
{
switch(type) {
case FileType::Svg: {
@ -49,10 +49,10 @@ static Loader* find(FileType type)
}
static Loader* find(const string& path)
static Loader* _find(const string& path)
{
auto ext = path.substr(path.find_last_of(".") + 1);
if (!ext.compare("svg")) return find(FileType::Svg);
if (!ext.compare("svg")) return _find(FileType::Svg);
return nullptr;
}
@ -86,7 +86,7 @@ bool LoaderMgr::term()
unique_ptr<Loader> LoaderMgr::loader(const string& path)
{
auto loader = find(path);
auto loader = _find(path);
if (loader && loader->open(path.c_str())) return unique_ptr<Loader>(loader);
@ -97,7 +97,7 @@ unique_ptr<Loader> LoaderMgr::loader(const string& path)
unique_ptr<Loader> LoaderMgr::loader(const char* data, uint32_t size)
{
for (int i = 0; i < static_cast<int>(FileType::Unknown); i++) {
auto loader = find(static_cast<FileType>(i));
auto loader = _find(static_cast<FileType>(i));
if (loader && loader->open(data, size)) return unique_ptr<Loader>(loader);
}
return nullptr;