common: code refactoring
authorHermet Park <chuneon.park@samsung.com>
Mon, 19 Jul 2021 11:07:58 +0000 (20:07 +0900)
committerJunsuChoi <jsuya.choi@samsung.com>
Thu, 22 Jul 2021 08:24:22 +0000 (17:24 +0900)
unify tvg class identifiers

src/lib/sw_engine/tvgSwFill.cpp
src/lib/sw_engine/tvgSwRaster.cpp
src/lib/tvgCommon.h
src/lib/tvgLinearGradient.cpp
src/lib/tvgPicture.cpp
src/lib/tvgRadialGradient.cpp
src/lib/tvgSaverImpl.h
src/lib/tvgScene.cpp
src/lib/tvgSceneImpl.h
src/lib/tvgShape.cpp

index 19eda1c125d4537b66783b39cf1850e75c312b53..ac7b57fc325d851619789a64d8b374a5c6750ef7 100644 (file)
@@ -276,9 +276,9 @@ bool fillGenColorTable(SwFill* fill, const Fill* fdata, const Matrix* transform,
         if (!_updateColorTable(fill, fdata, surface, opacity)) return false;
     }
 
-    if (fdata->id() == FILL_ID_LINEAR) {
+    if (fdata->id() == TVG_CLASS_ID_LINEAR) {
         return _prepareLinear(fill, static_cast<const LinearGradient*>(fdata), transform);
-    } else if (fdata->id() == FILL_ID_RADIAL) {
+    } else if (fdata->id() == TVG_CLASS_ID_RADIAL) {
         return _prepareRadial(fill, static_cast<const RadialGradient*>(fdata), transform);
     }
 
index b41da00322977d9fce1e5a71adb2b44722f24728..169da04d7b835bc4f59140b00627048fb2ee3b3a 100644 (file)
@@ -1104,7 +1104,7 @@ bool rasterGradientShape(SwSurface* surface, SwShape* shape, unsigned id)
 
     //Fast Track
     if (shape->rect) {
-        if (id == FILL_ID_LINEAR) {
+        if (id == TVG_CLASS_ID_LINEAR) {
             if (translucent) return _rasterTranslucentLinearGradientRect(surface, shape->bbox, shape->fill);
             return _rasterOpaqueLinearGradientRect(surface, shape->bbox, shape->fill);
         } else {
@@ -1113,7 +1113,7 @@ bool rasterGradientShape(SwSurface* surface, SwShape* shape, unsigned id)
         }
     } else {
         if (!shape->rle) return false;
-        if (id == FILL_ID_LINEAR) {
+        if (id == TVG_CLASS_ID_LINEAR) {
             if (translucent) return _rasterTranslucentLinearGradientRle(surface, shape->rle, shape->fill);
             return _rasterOpaqueLinearGradientRle(surface, shape->rle, shape->fill);
         } else {
@@ -1170,7 +1170,7 @@ bool rasterGradientStroke(SwSurface* surface, SwShape* shape, unsigned id)
 
     auto translucent = shape->stroke->fill->translucent || (surface->compositor && surface->compositor->method != CompositeMethod::None);
 
-    if (id == FILL_ID_LINEAR) {
+    if (id == TVG_CLASS_ID_LINEAR) {
         if (translucent) return _rasterTranslucentLinearGradientRle(surface, shape->strokeRle, shape->stroke->fill);
         return _rasterOpaqueLinearGradientRle(surface, shape->strokeRle, shape->stroke->fill);
     } else {
index 1be9fb14fc6b771e41024986852e08b665a8ffa0..6ef28b35c74b32b851325742e7089afc80a4e6c9 100644 (file)
 using namespace std;
 using namespace tvg;
 
-#define FILL_ID_LINEAR 0
-#define FILL_ID_RADIAL 1
-
-#define PAINT_ID_SHAPE   0
-#define PAINT_ID_SCENE   1
-#define PAINT_ID_PICTURE 2
+//TVG class identifier values
+#define TVG_CLASS_ID_UNDEFINED 0
+#define TVG_CLASS_ID_SHAPE     1
+#define TVG_CLASS_ID_SCENE     2
+#define TVG_CLASS_ID_PICTURE   3
+#define TVG_CLASS_ID_LINEAR    4
+#define TVG_CLASS_ID_RADIAL    5
 
 //for MSVC Compat
 #ifdef _MSC_VER
index 2374353e8d11fa02c289c7a353398bfc63d5f7c6..57f2b3f2b44f46b00499af7da6f7517524639bb4 100644 (file)
@@ -54,7 +54,7 @@ struct LinearGradient::Impl
 
 LinearGradient::LinearGradient():pImpl(new Impl())
 {
-    _id = FILL_ID_LINEAR;
+    _id = TVG_CLASS_ID_LINEAR;
     Fill::pImpl->method(new FillDup<LinearGradient::Impl>(pImpl));
 }
 
index acfe2b09eaea2686fa54d76267ce82b88bbcb3d4..7fda461eee6ad9e6547ef8934021656c8a96eac0 100644 (file)
@@ -28,7 +28,7 @@
 
 Picture::Picture() : pImpl(new Impl(this))
 {
-    _id = PAINT_ID_PICTURE;
+    _id = TVG_CLASS_ID_PICTURE;
     Paint::pImpl->method(new PaintMethod<Picture::Impl>(pImpl));
 }
 
index fac2d4e757d83467403a3acd3d0e3449651d0e2f..2680286d111ec7b60e232a7661b353187b84a8ad 100644 (file)
@@ -52,7 +52,7 @@ struct RadialGradient::Impl
 
 RadialGradient::RadialGradient():pImpl(new Impl())
 {
-    _id = FILL_ID_RADIAL;
+    _id = TVG_CLASS_ID_RADIAL;
     Fill::pImpl->method(new FillDup<RadialGradient::Impl>(pImpl));
 }
 
index 8013238eeee07f7345e70c02bfacb2aa0a07c779..deba0f25eda1c030e2c017209179302b34558b64 100644 (file)
@@ -248,7 +248,7 @@ struct Saver::Impl
         writeMemberIndicator(fillTvgFlag);
         skipInBufferMemberDataSize();
 
-        if (f->id() == FILL_ID_RADIAL) {
+        if (f->id() == TVG_CLASS_ID_RADIAL) {
             float argRadial[3];
             auto radGrad = static_cast<const RadialGradient*>(f);
             if (radGrad->radial(argRadial, argRadial + 1,argRadial + 2) != Result::Success) {
@@ -459,15 +459,15 @@ struct Saver::Impl
         ByteCounter dataByteCnt = 0;
 
         switch (paint->id()) {
-            case PAINT_ID_SHAPE: {
+            case TVG_CLASS_ID_SHAPE: {
                 dataByteCnt += serializeShape(paint);
                 break;
             }
-            case PAINT_ID_SCENE: {
+            case TVG_CLASS_ID_SCENE: {
                 dataByteCnt += serializeScene(paint);
                 break;
             }
-            case PAINT_ID_PICTURE: {
+            case TVG_CLASS_ID_PICTURE: {
                 dataByteCnt += serializePicture(paint);
                 break;
             }
index 9ec6f05403a1adacad0ec1ec16e16bea0abdb9c0..08cc7439ee4de65282737a401571e6769d7b1d19 100644 (file)
@@ -27,7 +27,7 @@
 
 Scene::Scene() : pImpl(new Impl(this))
 {
-    _id = PAINT_ID_SCENE;
+    _id = TVG_CLASS_ID_SCENE;
     Paint::pImpl->method(new PaintMethod<Scene::Impl>(pImpl));
 }
 
index d4ef7195ae2bd2a8c9a073d215889482b85a3ae1..eb062be1108c63aea1169ef20f5cbcd3ab6b77c6 100644 (file)
@@ -65,7 +65,7 @@ struct Scene::Impl
 
         //If scene has several children or only scene, it may require composition.
         if (paints.count > 1) return true;
-        if (paints.count == 1 && (*paints.data)->id() == PAINT_ID_SCENE) return true;
+        if (paints.count == 1 && (*paints.data)->id() == TVG_CLASS_ID_SCENE) return true;
         return false;
     }
 
index 3e6719531bff4558928cc747aff5038c46e4547c..1ba9a46e17452484863d98932b683668e83f2f19 100644 (file)
@@ -38,7 +38,7 @@ constexpr auto PATH_KAPPA = 0.552284f;
 
 Shape :: Shape() : pImpl(new Impl(this))
 {
-    _id = PAINT_ID_SHAPE;
+    _id = TVG_CLASS_ID_SHAPE;
     Paint::pImpl->method(new PaintMethod<Shape::Impl>(pImpl));
 }