[vlc-commits] vout: epg: use memset

Francois Cartegnie git at videolan.org
Mon Nov 27 20:25:37 CET 2017


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Nov 27 17:36:05 2017 +0100| [3fbd68656b48722b296dd72f011894efa6722a5f] | committer: Francois Cartegnie

vout: epg: use memset

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3fbd68656b48722b296dd72f011894efa6722a5f
---

 src/video_output/video_epg.c | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/src/video_output/video_epg.c b/src/video_output/video_epg.c
index 1115f3a00f..a5c5fafd0f 100644
--- a/src/video_output/video_epg.c
+++ b/src/video_output/video_epg.c
@@ -156,7 +156,7 @@ static subpicture_region_t * vout_OSDEpgSlider(int x, int y,
     int filled_part_width = ratio * width;
 
     for (int j = 0; j < height; j++) {
-        for (int i = 0; i < width; i++) {
+        for (int i = 0; i < width; ) {
             /* Slider border. */
             bool is_outline = j == 0 || j == height - 1 ||
                               i == 0 || i == width  - 1;
@@ -166,7 +166,22 @@ static subpicture_region_t * vout_OSDEpgSlider(int x, int y,
                              i < 3 || i > width  - 4 ||
                              i < filled_part_width;
 
-            picture->p->p_pixels[picture->p->i_pitch * j + i] = 2 * is_border + is_outline;
+            uint8_t color = 2 * is_border + is_outline;
+            if(i >= 3 && i < width - 4)
+            {
+                if(filled_part_width > 4)
+                    memset(&picture->p->p_pixels[picture->p->i_pitch * j + i],
+                           color, filled_part_width - 4);
+                if(width > filled_part_width + 4)
+                    memset(&picture->p->p_pixels[picture->p->i_pitch * j + filled_part_width],
+                           color, width - filled_part_width - 4);
+                i = __MAX(i+1, filled_part_width - 1);
+            }
+            else
+            {
+                picture->p->p_pixels[picture->p->i_pitch * j + i] = color;
+                i++;
+            }
         }
     }
 



More information about the vlc-commits mailing list