sw_engine raster: allow image interpolation by increasing tolerance.
authorHermet Park <chuneon.park@samsung.com>
Thu, 11 Nov 2021 12:30:17 +0000 (21:30 +0900)
committerJunsuChoi <jsuya.choi@samsung.com>
Tue, 16 Nov 2021 00:29:54 +0000 (09:29 +0900)
current image interpolation method is a bit awkward,
because xy scale different scale factor is not allowed.

we must improve the algorithm,

but now considering floating point precision,
we allow the interpolation by less ratio floating fraction.

src/lib/sw_engine/tvgSwRaster.cpp

index be24b47097be122dbecd1c1b8e0a2fd47c7a7993..b7f6a4cf9a9389de26dd0afd38282d49d4a5717f 100644 (file)
@@ -1555,12 +1555,9 @@ bool rasterImage(SwSurface* surface, SwImage* image, const Matrix* transform, co
         scale = sqrtf((transform->e11 * transform->e11) + (transform->e21 * transform->e21));
         auto scaleY = sqrtf((transform->e22 * transform->e22) + (transform->e12 * transform->e12));
         //TODO:If the x and y axis scale is different, a separate interpolation algorithm for each axis should be applied.
-        if (fabsf(scale - scaleY) > FLT_EPSILON) scale = 1.0f;
+        if (fabsf(scale - scaleY) > 0.01f) scale = 1.0f;
         if (!mathIdentity(transform)) transformed = true;
-    //TODO: Figure out the scale factor by the image size & drawing region
-    } else {
-        mathIdentity(&itransform);
-    }
+    } else mathIdentity(&itransform);
 
     auto translucent = _translucent(surface, opacity);
     auto downScaleTolerance = 0.5f;