[MPlayer-cvslog] r38188 - trunk/libmenu/menu.c

reimar subversion at mplayerhq.hu
Thu May 28 21:25:15 EEST 2020


Author: reimar
Date: Thu May 28 21:25:15 2020
New Revision: 38188

Log:
menu.c: optimize libmenu box drawing.

As the lines it draws are all identical it is enough to
allocate a single line and draw with stride 0.
Admittedly it would be even more efficient to have
a special function for this, but that would be
enough extra effort to not seem worth it.

Modified:
   trunk/libmenu/menu.c

Modified: trunk/libmenu/menu.c
==============================================================================
--- trunk/libmenu/menu.c	Wed May 27 23:25:01 2020	(r38187)
+++ trunk/libmenu/menu.c	Thu May 28 21:25:15 2020	(r38188)
@@ -747,14 +747,14 @@ void menu_draw_box(mp_image_t* mpi,unsig
   {
     int stride = (w+15)&(~15); // round to 16
 #if HAVE_LOCAL_ALIGNED
-    DECLARE_ALIGNED(16, char, pic)[stride*h];
-    DECLARE_ALIGNED(16, char, pic_alpha)[stride*h];
+    DECLARE_ALIGNED(16, char, pic)[stride];
+    DECLARE_ALIGNED(16, char, pic_alpha)[stride];
 #else
-    char pic[stride*h],pic_alpha[stride*h];
+    char pic[stride],pic_alpha[stride];
 #endif
-    memset(pic,g,stride*h);
-    memset(pic_alpha,alpha,stride*h);
-    draw_alpha(w,h,pic,pic_alpha,stride,
+    memset(pic,g,stride);
+    memset(pic_alpha,alpha,stride);
+    draw_alpha(w,h,pic,pic_alpha,0,
                mpi->planes[0] + y * mpi->stride[0] + x * (mpi->bpp>>3),
                mpi->stride[0]);
   }


More information about the MPlayer-cvslog mailing list