optimization: cut off file dependencies.
authorHermet Park <chuneon.park@samsung.com>
Wed, 23 Sep 2020 11:51:40 +0000 (20:51 +0900)
committerHermet Park <chuneon.park@samsung.com>
Thu, 24 Sep 2020 01:48:01 +0000 (10:48 +0900)
we should avoid code insertion during file dependencies,
such as #include "xxx.h" which has implementations.

This could increase binary size, we can avoid it as possible.

Current patch improves binary size like this:

From: file(2059008) = text(120360) data(8096) bss(80) dec(128536)
To  : file(1921832) = text(118429) data(7872) bss(56) dec(126357)

More additional patches will come in to optmize binary size.

Change-Id: Iae826752bc80c161c075b5980a485fd27f42e896

40 files changed:
src/lib/sw_engine/tvgSwCommon.h
src/lib/sw_engine/tvgSwFill.cpp
src/lib/sw_engine/tvgSwRaster.cpp
src/lib/sw_engine/tvgSwRenderer.cpp
src/lib/sw_engine/tvgSwRenderer.h
src/lib/sw_engine/tvgSwRle.cpp
src/lib/sw_engine/tvgSwShape.cpp
src/lib/sw_engine/tvgSwStroke.cpp
src/lib/tvgBezier.cpp
src/lib/tvgBezier.h
src/lib/tvgCanvas.cpp
src/lib/tvgCanvasImpl.h
src/lib/tvgCommon.h
src/lib/tvgFill.h
src/lib/tvgGlCanvas.cpp
src/lib/tvgInitializer.cpp
src/lib/tvgLinearGradient.cpp
src/lib/tvgLoader.h
src/lib/tvgLoaderMgr.cpp
src/lib/tvgLoaderMgr.h
src/lib/tvgPaint.h
src/lib/tvgPictureImpl.h
src/lib/tvgRadialGradient.cpp
src/lib/tvgRender.cpp
src/lib/tvgRender.h
src/lib/tvgSceneImpl.h
src/lib/tvgShape.cpp
src/lib/tvgShapePath.h
src/lib/tvgSwCanvas.cpp
src/lib/tvgTaskScheduler.cpp
src/lib/tvgTaskScheduler.h
src/loaders/svg/tvgSimpleXmlParser.cpp
src/loaders/svg/tvgSimpleXmlParser.h
src/loaders/svg/tvgSvgLoader.cpp
src/loaders/svg/tvgSvgLoader.h
src/loaders/svg/tvgSvgLoaderCommon.h
src/loaders/svg/tvgSvgPath.cpp
src/loaders/svg/tvgSvgPath.h
src/loaders/svg/tvgSvgSceneBuilder.cpp
src/loaders/svg/tvgSvgSceneBuilder.h

index 37a40c5..f90f44b 100644 (file)
@@ -23,6 +23,7 @@
 #define _TVG_SW_COMMON_H_
 
 #include "tvgCommon.h"
+#include "tvgRender.h"
 
 #ifdef THORVG_AVX_VECTOR_SUPPORT
     #include <immintrin.h>
index ecb3394..c421371 100644 (file)
@@ -19,6 +19,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
  */
+#include <float.h>
+#include <math.h>
 #include "tvgSwCommon.h"
 
 
index 7b5b986..d75bc2b 100644 (file)
@@ -20,6 +20,7 @@
  * SOFTWARE.
  */
 #include "tvgSwCommon.h"
+#include "tvgRender.h"
 
 /************************************************************************/
 /* Internal Class Implementation                                        */
index ff1055f..8c6ee95 100644 (file)
@@ -20,6 +20,7 @@
  * SOFTWARE.
  */
 #include "tvgSwCommon.h"
+#include "tvgTaskScheduler.h"
 #include "tvgSwRenderer.h"
 
 /************************************************************************/
index 016e444..5b39990 100644 (file)
@@ -22,6 +22,9 @@
 #ifndef _TVG_SW_RENDERER_H_
 #define _TVG_SW_RENDERER_H_
 
+#include <vector>
+#include "tvgRender.h"
+
 struct SwSurface;
 struct SwTask;
 
index 545237d..de20d61 100644 (file)
@@ -22,6 +22,7 @@
 #include <setjmp.h>
 #include <limits.h>
 #include <memory.h>
+
 #include "tvgSwCommon.h"
 
 /************************************************************************/
index 49bcd12..0c6391c 100644 (file)
@@ -19,7 +19,9 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
  */
+#include <math.h>
 #include "tvgSwCommon.h"
+#include "tvgBezier.h"
 
 /************************************************************************/
 /* Internal Class Implementation                                        */
index e87ec4c..9f2dfe1 100644 (file)
@@ -19,6 +19,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
  */
+#include <string.h>
+#include <math.h>
 #include "tvgSwCommon.h"
 
 
index db4d58b..4129e71 100644 (file)
@@ -19,8 +19,9 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
  */
-#include "tvgCommon.h"
-
+#include <float.h>
+#include <math.h>
+#include "tvgBezier.h"
 
 /************************************************************************/
 /* Internal Class Implementation                                        */
index df21719..89c8049 100644 (file)
@@ -22,6 +22,8 @@
 #ifndef _TVG_BEZIER_H_
 #define _TVG_BEZIER_H_
 
+#include "tvgCommon.h"
+
 namespace tvg
 {
 
index 0720e04..eb08768 100644 (file)
@@ -19,7 +19,6 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
  */
-#include "tvgCommon.h"
 #include "tvgCanvasImpl.h"
 
 /************************************************************************/
index 8131284..e2de033 100644 (file)
@@ -22,6 +22,7 @@
 #ifndef _TVG_CANVAS_IMPL_H_
 #define _TVG_CANVAS_IMPL_H_
 
+#include <vector>
 #include "tvgPaint.h"
 
 /************************************************************************/
index ecacc82..5eb5743 100644 (file)
 #define _TVG_COMMON_H_
 
 #include "config.h"
-
-#include <iostream>
-#include <vector>
-#include <math.h>
-#include <float.h>
-#include <string.h>
-#include <memory>
-#include <future>
-
 #include "thorvg.h"
 
 using namespace std;
@@ -42,10 +33,4 @@ using namespace tvg;
 
 #define TVG_UNUSED __attribute__ ((__unused__))
 
-#include "tvgBezier.h"
-#include "tvgLoader.h"
-#include "tvgLoaderMgr.h"
-#include "tvgRender.h"
-#include "tvgTaskScheduler.h"
-
 #endif //_TVG_COMMON_H_
index 5036337..a0db584 100644 (file)
@@ -22,6 +22,7 @@
 #ifndef _TVG_FILL_H_
 #define _TVG_FILL_H_
 
+#include <string.h>
 #include "tvgCommon.h"
 
 template<typename T>
index 85bcd1d..416ed44 100644 (file)
@@ -19,7 +19,6 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
  */
-#include "tvgCommon.h"
 #include "tvgCanvasImpl.h"
 
 #ifdef THORVG_GL_RASTER_SUPPORT
index 7dcc8b9..bc0a65f 100644 (file)
@@ -20,6 +20,7 @@
  * SOFTWARE.
  */
 #include "tvgCommon.h"
+#include "tvgTaskScheduler.h"
 #include "tvgLoaderMgr.h"
 
 #ifdef THORVG_SW_RASTER_SUPPORT
index f647d44..ffd9a00 100644 (file)
@@ -19,6 +19,8 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
  */
+#include <float.h>
+#include <math.h>
 #include "tvgFill.h"
 
 /************************************************************************/
index 9c7279e..c02baff 100644 (file)
@@ -22,6 +22,8 @@
 #ifndef _TVG_LOADER_H_
 #define _TVG_LOADER_H_
 
+#include "tvgCommon.h"
+
 namespace tvg
 {
 
index 6ec3213..6ed2d3e 100644 (file)
@@ -19,7 +19,7 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
  */
-#include "tvgCommon.h"
+#include "tvgLoaderMgr.h"
 
 #ifdef THORVG_SVG_LOADER_SUPPORT
     #include "tvgSvgLoader.h"
index 95a0676..81623f2 100644 (file)
@@ -22,6 +22,8 @@
 #ifndef _TVG_LOADER_MGR_H_
 #define _TVG_LOADER_MGR_H_
 
+#include "tvgLoader.h"
+
 struct LoaderMgr
 {
     static bool init();
index 071a45f..4b49520 100644 (file)
@@ -22,7 +22,9 @@
 #ifndef _TVG_PAINT_H_
 #define _TVG_PAINT_H_
 
-#include "tvgCommon.h"
+#include <float.h>
+#include <math.h>
+#include "tvgRender.h"
 
 namespace tvg
 {
index 9b742aa..0f07ed1 100644 (file)
@@ -23,6 +23,7 @@
 #define _TVG_PICTURE_IMPL_H_
 
 #include "tvgPaint.h"
+#include "tvgLoaderMgr.h"
 
 /************************************************************************/
 /* Internal Class Implementation                                        */
index 03164ae..7353350 100644 (file)
@@ -19,6 +19,7 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
  */
+#include <float.h>
 #include "tvgFill.h"
 
 /************************************************************************/
index 10a23e8..84413f0 100644 (file)
@@ -19,7 +19,9 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
  */
-#include "tvgCommon.h"
+#include <float.h>
+#include <math.h>
+#include "tvgRender.h"
 
 /************************************************************************/
 /* Internal Class Implementation                                        */
index 9beb72b..f710a0f 100644 (file)
@@ -22,6 +22,8 @@
 #ifndef _TVG_RENDER_H_
 #define _TVG_RENDER_H_
 
+#include "tvgCommon.h"
+
 namespace tvg
 {
 
index 8073a70..c384d8c 100644 (file)
@@ -22,6 +22,7 @@
 #ifndef _TVG_SCENE_IMPL_H_
 #define _TVG_SCENE_IMPL_H_
 
+#include <vector>
 #include "tvgPaint.h"
 
 /************************************************************************/
index a68c085..0a0a622 100644 (file)
@@ -20,7 +20,6 @@
  * SOFTWARE.
  */
 #include <limits>
-
 #include "tvgShapeImpl.h"
 
 /************************************************************************/
index f3b1f6e..bfbdcf5 100644 (file)
@@ -22,6 +22,7 @@
 #ifndef _TVG_SHAPE_PATH_H_
 #define _TVG_SHAPE_PATH_H_
 
+#include <string.h>
 #include "tvgCommon.h"
 
 /************************************************************************/
index 1a2261a..03337a7 100644 (file)
@@ -19,7 +19,6 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
  */
-#include "tvgCommon.h"
 #include "tvgCanvasImpl.h"
 
 #ifdef THORVG_SW_RASTER_SUPPORT
index bdf6edc..d4c21f1 100644 (file)
@@ -21,7 +21,8 @@
  */
 #include <deque>
 #include <thread>
-#include "tvgCommon.h"
+#include <vector>
+#include "tvgTaskScheduler.h"
 
 /************************************************************************/
 /* Internal Class Implementation                                        */
index 31d1ee1..d94a318 100644 (file)
@@ -22,6 +22,7 @@
 #ifndef _TVG_TASK_SCHEDULER_H_
 #define _TVG_TASK_SCHEDULER_H_
 
+#include <future>
 #include "tvgCommon.h"
 
 namespace tvg
index d287ba7..3918af1 100644 (file)
  * SOFTWARE.
  */
 
+#include <ctype.h>
+#include <cstring>
+#include <alloca.h>
+
 #include "tvgSimpleXmlParser.h"
 
 static const char* _simpleXmlFindWhiteSpace(const char* itr, const char* itrEnd)
index a9f999d..9c19547 100644 (file)
@@ -23,9 +23,7 @@
 #ifndef _TVG_SIMPLE_XML_PARSER_H_
 #define _TVG_SIMPLE_XML_PARSER_H_
 
-#include <ctype.h>
-#include <cstring>
-#include <alloca.h>
+#include "tvgSvgLoaderCommon.h"
 
 enum class SimpleXMLType
 {
index f86f9df..3495fca 100644 (file)
  */
 #include <stddef.h>
 #include <fstream>
+#include <string.h>
+#include <float.h>
+#include <math.h>
+#include "tvgLoaderMgr.h"
+#include "tvgSimpleXmlParser.h"
 #include "tvgSvgLoader.h"
 
-
 /************************************************************************/
 /* Internal Class Implementation                                        */
 /************************************************************************/
index 3cf4cf2..cd04d7d 100644 (file)
@@ -22,7 +22,7 @@
 #ifndef _TVG_SVG_LOADER_H_
 #define _TVG_SVG_LOADER_H_
 
-#include "tvgSvgLoaderCommon.h"
+#include "tvgTaskScheduler.h"
 #include "tvgSvgSceneBuilder.h"
 
 class SvgLoader : public Loader, public Task
index 91896bc..3cbe22d 100644 (file)
@@ -23,7 +23,6 @@
 #define _TVG_SVG_LOADER_COMMON_H_
 
 #include "tvgCommon.h"
-#include "tvgSimpleXmlParser.h"
 
 enum class SvgNodeType
 {
index e3ea03e..3ede0e0 100644 (file)
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
  */
+#include <string.h>
+#include <math.h>
 #include "tvgSvgPath.h"
 
-
 static char* _skipComma(const char* content)
 {
     while (*content && isspace(*content)) {
index 9d853d1..5324a04 100644 (file)
@@ -23,7 +23,8 @@
 #ifndef _TVG_SVG_PATH_H_
 #define _TVG_SVG_PATH_H_
 
-#include "tvgCommon.h"
+#include <vector>
+#include "tvgSvgLoaderCommon.h"
 
 tuple<vector<tvg::PathCommand>, vector<tvg::Point>> svgPathToTvgPath(const char* svg_path_data);
 
index 0f1f80b..f3922cb 100644 (file)
@@ -19,7 +19,9 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
  */
+#include <math.h>
 #include "tvgSvgSceneBuilder.h"
+#include "tvgSvgPath.h"
 
 unique_ptr<LinearGradient> _applyLinearGradientProperty(SvgStyleGradient* g, Shape* vg, float rx, float ry, float rw, float rh)
 {
index 0f93d96..79f111b 100644 (file)
@@ -24,7 +24,6 @@
 #define _TVG_SVG_SCENE_BUILDER_H_
 
 #include "tvgSvgLoaderCommon.h"
-#include "tvgSvgPath.h"
 
 class SvgSceneBuilder
 {