[MPlayer-dev-eng] [PATCH]: caca: stop pointless dither reallocation on resize

Paul B. Mahol onemda at gmail.com
Thu Nov 24 21:34:55 CET 2011


Dither reallocation on resize is not needed at all.

==================================================
diff --git a/libvo/vo_caca.c b/libvo/vo_caca.c
index e9892a0..6b89dfe 100644
--- a/libvo/vo_caca.c
+++ b/libvo/vo_caca.c
@@ -62,11 +62,6 @@ static const char     *dither_charset   = "default";
 static const char     *dither_color     = "default";
 static const char     *dither_algo      = "none";

-/* image infos */
-static int image_format;
-static int image_width;
-static int image_height;
-
 static int screen_w, screen_h;

 /* We want 24bpp always for now */
@@ -139,10 +134,18 @@ static int resize(void)
     screen_w = caca_get_canvas_width(canvas);
     screen_h = caca_get_canvas_height(canvas);

-    caca_free_dither(dither);
+    return 0;
+}
+
+static int config(uint32_t width, uint32_t height, uint32_t d_width,
+                  uint32_t d_height, uint32_t flags, char *title,
+                  uint32_t format)
+{
+    showosdmessage = 0;
+    posbar[0]      = '\0';

-    dither = caca_create_dither(bpp, image_width, image_height,
-                                depth * image_width,
+    caca_free_dither(dither);
+    dither = caca_create_dither(bpp, width, height, depth * width,
                                 rmask, gmask, bmask, amask);
     if (dither == NULL) {
         mp_msg(MSGT_VO, MSGL_FATAL, "vo_caca: caca_create_dither failed!\n");
@@ -155,20 +158,6 @@ static int resize(void)
     caca_set_dither_color(dither, dither_color);
     caca_set_dither_algorithm(dither, dither_algo);

-    return 0;
-}
-
-static int config(uint32_t width, uint32_t height, uint32_t d_width,
-                  uint32_t d_height, uint32_t flags, char *title,
-                  uint32_t format)
-{
-    image_height = height;
-    image_width  = width;
-    image_format = format;
-
-    showosdmessage = 0;
-    posbar[0]      = '\0';
-
     return resize();
 }


More information about the MPlayer-dev-eng mailing list