diff --git a/src/lib/sw_engine/meson.build b/src/lib/sw_engine/meson.build index 5bde72f9..39536436 100644 --- a/src/lib/sw_engine/meson.build +++ b/src/lib/sw_engine/meson.build @@ -5,7 +5,7 @@ source_file = [ 'tvgSwRenderer.h', 'tvgSwRaster.cpp', 'tvgSwRenderer.cpp', - 'tvgSwResMgr.cpp', + 'tvgSwMemPool.cpp', 'tvgSwRle.cpp', 'tvgSwShape.cpp', 'tvgSwStroke.cpp', diff --git a/src/lib/sw_engine/tvgSwCommon.h b/src/lib/sw_engine/tvgSwCommon.h index e7244923..3fc777f7 100644 --- a/src/lib/sw_engine/tvgSwCommon.h +++ b/src/lib/sw_engine/tvgSwCommon.h @@ -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); diff --git a/src/lib/sw_engine/tvgSwResMgr.cpp b/src/lib/sw_engine/tvgSwMemPool.cpp similarity index 93% rename from src/lib/sw_engine/tvgSwResMgr.cpp rename to src/lib/sw_engine/tvgSwMemPool.cpp index 6a21260c..decf7e9e 100644 --- a/src/lib/sw_engine/tvgSwResMgr.cpp +++ b/src/lib/sw_engine/tvgSwMemPool.cpp @@ -35,20 +35,20 @@ static vector 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(); } \ No newline at end of file diff --git a/src/lib/sw_engine/tvgSwRenderer.cpp b/src/lib/sw_engine/tvgSwRenderer.cpp index ec9b47c7..db2f8605 100644 --- a/src/lib/sw_engine/tvgSwRenderer.cpp +++ b/src/lib/sw_engine/tvgSwRenderer.cpp @@ -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; diff --git a/src/lib/sw_engine/tvgSwShape.cpp b/src/lib/sw_engine/tvgSwShape.cpp index 9fde7500..c5f48749 100644 --- a/src/lib/sw_engine/tvgSwShape.cpp +++ b/src/lib/sw_engine/tvgSwShape.cpp @@ -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; diff --git a/src/lib/tvgLoaderMgr.cpp b/src/lib/tvgLoaderMgr.cpp index 8f59eabe..8075e605 100644 --- a/src/lib/tvgLoaderMgr.cpp +++ b/src/lib/tvgLoaderMgr.cpp @@ -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 LoaderMgr::loader(const string& path) { - auto loader = find(path); + auto loader = _find(path); if (loader && loader->open(path.c_str())) return unique_ptr(loader); @@ -97,7 +97,7 @@ unique_ptr LoaderMgr::loader(const string& path) unique_ptr LoaderMgr::loader(const char* data, uint32_t size) { for (int i = 0; i < static_cast(FileType::Unknown); i++) { - auto loader = find(static_cast(i)); + auto loader = _find(static_cast(i)); if (loader && loader->open(data, size)) return unique_ptr(loader); } return nullptr;