common sw_engine: code refactoring
authorHermet Park <chuneon.park@samsung.com>
Wed, 4 Nov 2020 10:18:59 +0000 (19:18 +0900)
committerHermet Park <chuneon.park@samsung.com>
Thu, 5 Nov 2020 01:26:30 +0000 (10:26 +0900)
replaced names and fixed out of coding convention.

Change-Id: I1a2f17a3da6ea38e7ef2c00ff787323267439e0e

src/lib/sw_engine/meson.build
src/lib/sw_engine/tvgSwCommon.h
src/lib/sw_engine/tvgSwMemPool.cpp [moved from src/lib/sw_engine/tvgSwResMgr.cpp with 93% similarity]
src/lib/sw_engine/tvgSwRenderer.cpp
src/lib/sw_engine/tvgSwShape.cpp
src/lib/tvgLoaderMgr.cpp

index 5bde72f..3953643 100644 (file)
@@ -5,7 +5,7 @@ source_file = [
    'tvgSwRenderer.h',
    'tvgSwRaster.cpp',
    'tvgSwRenderer.cpp',
-   'tvgSwResMgr.cpp',
+   'tvgSwMemPool.cpp',
    'tvgSwRle.cpp',
    'tvgSwShape.cpp',
    'tvgSwStroke.cpp',
index e724492..3fc777f 100644 (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);
similarity index 93%
rename from src/lib/sw_engine/tvgSwResMgr.cpp
rename to src/lib/sw_engine/tvgSwMemPool.cpp
index 6a21260..decf7e9 100644 (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();
 }
\ No newline at end of file
index ec9b47c..db2f860 100644 (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;
 
index 9fde750..c5f4874 100644 (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;
 
index 8f59eab..8075e60 100644 (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;