@@ -357,9 +357,30 @@ video_buffer_convert_distinct(struct video_buffer *__restrict __self,
357357#define video_surface_getbuffer (self ) (self )-> vs_buffer
358358#define video_surface_getbufferxdim (self ) video_buffer_getxdim (video_surface_getbuffer (self ))
359359#define video_surface_getbufferydim (self ) video_buffer_getydim (video_surface_getbuffer (self ))
360- /* TODO: Change vb_xdim / vb_ydim into vb_dim[2] and use ((flags & VIDEO_GFX_F_XYSWAP) [^ 1]) as index */
361- #define video_surface_getxdim (self ) (__unlikely (video_surface_getflags (self ) & VIDEO_GFX_F_XYSWAP ) ? video_surface_getbufferydim (self ) : video_surface_getbufferxdim (self ))
362- #define video_surface_getydim (self ) (__unlikely (video_surface_getflags (self ) & VIDEO_GFX_F_XYSWAP ) ? video_surface_getbufferxdim (self ) : video_surface_getbufferydim (self ))
360+ #if VIDEO_GFX_F_XYSWAP == 1
361+ #define __video_surface_getxbit (self ) (video_surface_getflags (self ) & VIDEO_GFX_F_XYSWAP )
362+ #elif VIDEO_GFX_F_XYSWAP == 2
363+ #define __video_surface_getxbit (self ) ((video_surface_getflags (self ) & VIDEO_GFX_F_XYSWAP ) >> 1 )
364+ #elif VIDEO_GFX_F_XYSWAP == 4
365+ #define __video_surface_getxbit (self ) ((video_surface_getflags (self ) & VIDEO_GFX_F_XYSWAP ) >> 2 )
366+ #elif VIDEO_GFX_F_XYSWAP == 8
367+ #define __video_surface_getxbit (self ) ((video_surface_getflags (self ) & VIDEO_GFX_F_XYSWAP ) >> 3 )
368+ #elif VIDEO_GFX_F_XYSWAP == 16
369+ #define __video_surface_getxbit (self ) ((video_surface_getflags (self ) & VIDEO_GFX_F_XYSWAP ) >> 4 )
370+ #elif VIDEO_GFX_F_XYSWAP == 32
371+ #define __video_surface_getxbit (self ) ((video_surface_getflags (self ) & VIDEO_GFX_F_XYSWAP ) >> 5 )
372+ #elif VIDEO_GFX_F_XYSWAP == 64
373+ #define __video_surface_getxbit (self ) ((video_surface_getflags (self ) & VIDEO_GFX_F_XYSWAP ) >> 6 )
374+ #elif VIDEO_GFX_F_XYSWAP == 128
375+ #define __video_surface_getxbit (self ) ((video_surface_getflags (self ) & VIDEO_GFX_F_XYSWAP ) >> 7 )
376+ #elif VIDEO_GFX_F_XYSWAP == 256
377+ #define __video_surface_getxbit (self ) ((video_surface_getflags (self ) & VIDEO_GFX_F_XYSWAP ) >> 8 )
378+ #else /* VIDEO_GFX_F_XYSWAP == ... */
379+ #define __video_surface_getxbit (self ) ((video_surface_getflags (self ) & VIDEO_GFX_F_XYSWAP ) ? 1 : 0 )
380+ #endif /* VIDEO_GFX_F_XYSWAP != ... */
381+ #define __video_surface_getybit (self ) (__video_surface_getxbit (self ) ^ 1 )
382+ #define video_surface_getxdim (self ) video_surface_getbuffer (self )-> vb_dim [__video_surface_getxbit (self )]
383+ #define video_surface_getydim (self ) video_surface_getbuffer (self )-> vb_dim [__video_surface_getybit (self )]
363384#define video_surface_hasobjpalette (self ) (((self )-> vs_flags & VIDEO_GFX_F_PALOBJ ) != 0 )
364385#define video_surface_getpalette (self ) (self )-> vs_pal
365386#define video_surface_setpalette (self , palette , isobj ) (void )((self )-> vs_pal = (palette ), (self )-> vs_flags = ((self )-> vs_flags & ~VIDEO_GFX_F_PALOBJ ) | ((isobj ) ? VIDEO_GFX_F_PALOBJ : 0 ))
0 commit comments