From 81698e71162a63c3ab046c46daee8761ec0591d8 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 18 Jul 2013 13:11:13 +0200 Subject: vo_x11: remove weird inactive code I guess this code was supposed to handle cases like drawing RGBA as ARGB by offsetting it by 1 byte. The code didn't make any sense, though. It used to make sense before mpv switched internal pixel formats from FourCCs to a simple enum. With the FourCCs, "fmt | 128" selected the big endian version of a format. Of course this doesn't work this way with the new pixel formats. It just so happens that there are no formats with whose values match IMGFMT_RGB32|128 or IMGFMT_BGR32|128, so this code was inactive. All involved pixel formats seem to play fine on my setup (though it's little endian only), and the code strictly matches the mpv pixel formats against the format of the X image, so I'm not quite sure why this code was there in the first place. The original commit that added this was b333ae1 (svn 21602): Support for different endianness on client and server with -vo x11 --- video/out/vo_x11.c | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/video/out/vo_x11.c b/video/out/vo_x11.c index b86f851334..ccd9e3243a 100644 --- a/video/out/vo_x11.c +++ b/video/out/vo_x11.c @@ -73,7 +73,6 @@ struct priv { uint32_t image_height; uint32_t in_format; uint32_t out_format; - int out_offset; struct mp_rect src; struct mp_rect dst; @@ -384,18 +383,6 @@ static bool resize(struct vo *vo) } p->out_format = fmte->mpfmt; p->bpp = p->myximage[0]->bits_per_pixel; - p->out_offset = 0; - // We can easily "emulate" non-native RGB32 and BGR32 - if (p->out_format == (IMGFMT_BGR32 | 128) - || p->out_format == (IMGFMT_RGB32 | 128)) - { - p->out_format &= ~128; -#if BYTE_ORDER == BIG_ENDIAN - p->out_offset = 1; -#else - p->out_offset = -1; -#endif - } p->swsContext = sws_getContextFromCmdLine(p->src_w, p->src_h, p->in_format, p->dst_w, p->dst_h, p->out_format); @@ -414,7 +401,6 @@ static void Display_Image(struct priv *p, XImage *myximage) XImage *x_image = p->myximage[p->current_buf]; - x_image->data += p->out_offset; #ifdef HAVE_SHM if (p->Shmem_Flag) { XShmPutImage(vo->x11->display, vo->x11->window, vo->x11->vo_gc, x_image, @@ -427,7 +413,6 @@ static void Display_Image(struct priv *p, XImage *myximage) XPutImage(vo->x11->display, vo->x11->window, vo->x11->vo_gc, x_image, 0, 0, p->dst.x0, p->dst.y0, p->dst_w, p->dst_h); } - x_image->data -= p->out_offset; } static struct mp_image get_x_buffer(struct priv *p, int buf_index) -- cgit v1.2.3