kwo pushed a commit to branch master.

http://git.enlightenment.org/legacy/imlib2.git/commit/?id=1411f6ac6990ac8e64f01cee42d9939704cac665

commit 1411f6ac6990ac8e64f01cee42d9939704cac665
Author: Kim Woelders <k...@woelders.dk>
Date:   Tue Nov 30 08:04:49 2021 +0100

    Refactoring around mmx and rotate function calls
    
    Move call to __imlib_mmx_RotateAA() into __imlib_RotateAA().
    
    Avoids some code duplication.
---
 src/lib/api.c    | 22 ++++------------------
 src/lib/rotate.c | 28 +++++++++++++---------------
 2 files changed, 17 insertions(+), 33 deletions(-)

diff --git a/src/lib/api.c b/src/lib/api.c
index 190b5e6..9bf16df 100644
--- a/src/lib/api.c
+++ b/src/lib/api.c
@@ -4679,15 +4679,8 @@ imlib_create_rotated_image(double angle)
 
    if (ctx->anti_alias)
      {
-#ifdef DO_MMX_ASM
-        if (__imlib_get_cpuid() & CPUID_MMX)
-           __imlib_mmx_RotateAA(im_old->data, im->data, im_old->w, im_old->w,
-                                im_old->h, im->w, sz, sz, x, y, dx, dy, -dy,
-                                dx);
-        else
-#endif
-           __imlib_RotateAA(im_old->data, im->data, im_old->w, im_old->w,
-                            im_old->h, im->w, sz, sz, x, y, dx, dy, -dy, dx);
+        __imlib_RotateAA(im_old->data, im->data, im_old->w, im_old->w,
+                         im_old->h, im->w, sz, sz, x, y, dx, dy, -dy, dx);
      }
    else
      {
@@ -4747,15 +4740,8 @@ imlib_rotate_image_from_buffer(double angle, Imlib_Image 
source_image)
 
    if (ctx->anti_alias)
      {
-#ifdef DO_MMX_ASM
-        if (__imlib_get_cpuid() & CPUID_MMX)
-           __imlib_mmx_RotateAA(im_old->data, im->data, im_old->w, im_old->w,
-                                im_old->h, im->w, sz, sz, x, y, dx, dy, -dy,
-                                dx);
-        else
-#endif
-           __imlib_RotateAA(im_old->data, im->data, im_old->w, im_old->w,
-                            im_old->h, im->w, sz, sz, x, y, dx, dy, -dy, dx);
+        __imlib_RotateAA(im_old->data, im->data, im_old->w, im_old->w,
+                         im_old->h, im->w, sz, sz, x, y, dx, dy, -dy, dx);
      }
    else
      {
diff --git a/src/lib/rotate.c b/src/lib/rotate.c
index 4b9b7b9..968a5a1 100644
--- a/src/lib/rotate.c
+++ b/src/lib/rotate.c
@@ -210,6 +210,15 @@ __imlib_RotateAA(DATA32 * src, DATA32 * dest, int sow, int 
sw, int sh,
    if ((dw < 1) || (dh < 1))
       return;
 
+#ifdef DO_MMX_ASM
+   if (__imlib_get_cpuid() & CPUID_MMX)
+     {
+        __imlib_mmx_RotateAA(src, dest, sow, sw, sh, dow, dw, dh, x, y,
+                             dxh, dyh, dxv, dyv);
+        return;
+     }
+#endif
+
    if (__check_inside_coords(x, y, dxh, dyh, dxv, dyv, dw, dh, sw - 1, sh - 1))
      {
         __imlib_RotateAAInside(src, dest, sow, dow, dw, dh, x, y,
@@ -344,10 +353,6 @@ __imlib_BlendImageToImageSkewed(ImlibImage * im_src, 
ImlibImage * im_dst,
    double              xy2;
    DATA32             *data, *src;
 
-#ifdef DO_MMX_ASM
-   int                 do_mmx;
-#endif
-
    if ((ssw < 0) || (ssh < 0))
       return;
 
@@ -405,15 +410,14 @@ __imlib_BlendImageToImageSkewed(ImlibImage * im_src, 
ImlibImage * im_dst,
    data = malloc(im_dst->w * LINESIZE * sizeof(DATA32));
    if (!data)
       return;
+
    if (aa)
      {
         /*\ Account for virtual transparent border \ */
         x += _ROTATE_PREC_MAX;
         y += _ROTATE_PREC_MAX;
      }
-#ifdef DO_MMX_ASM
-   do_mmx = __imlib_get_cpuid() & CPUID_MMX;
-#endif
+
    for (i = 0; i < im_dst->h; i += LINESIZE)
      {
         int                 x2, y2, w, h, l, r;
@@ -519,14 +523,8 @@ __imlib_BlendImageToImageSkewed(ImlibImage * im_src, 
ImlibImage * im_dst,
           {
              x -= _ROTATE_PREC_MAX;
              y -= _ROTATE_PREC_MAX;
-#ifdef DO_MMX_ASM
-             if (do_mmx)
-                __imlib_mmx_RotateAA(src, data, im_src->w, ssw, ssh, w, w, h,
-                                     x, y, dxh, dyh, dxv, dyv);
-             else
-#endif
-                __imlib_RotateAA(src, data, im_src->w, ssw, ssh, w, w, h,
-                                 x, y, dxh, dyh, dxv, dyv);
+             __imlib_RotateAA(src, data, im_src->w, ssw, ssh, w, w, h,
+                              x, y, dxh, dyh, dxv, dyv);
 
           }
         else

-- 


Reply via email to