From 0ef37712024097091d218259ecaeadaa777ea37b Mon Sep 17 00:00:00 2001 From: couriersud Date: Thu, 29 Jan 2015 00:29:17 +0100 Subject: [PATCH] Converted blit13.h to templates and fixed a number of bugs around different ycc formats. (nw) --- src/osd/sdl/blit13.h | 288 +++++++++++++++++++++++-------------------- src/osd/sdl/draw13.c | 96 ++++++++------- 2 files changed, 202 insertions(+), 182 deletions(-) diff --git a/src/osd/sdl/blit13.h b/src/osd/sdl/blit13.h index 07177d5e750..53475aa2d12 100644 --- a/src/osd/sdl/blit13.h +++ b/src/osd/sdl/blit13.h @@ -5,42 +5,44 @@ // INLINE //============================================================ -INLINE UINT32 premult32(UINT32 pixel) +inline UINT32 premult32(const UINT32 pixel) { - UINT8 a = (pixel >> 24) & 0xff; - UINT8 r = (pixel >> 16) & 0xff; - UINT8 g = (pixel >> 8) & 0xff; - UINT8 b = (pixel >> 0) & 0xff; + const UINT16 a = (pixel >> 24) & 0xff; + const UINT16 r = (pixel >> 16) & 0xff; + const UINT16 g = (pixel >> 8) & 0xff; + const UINT16 b = (pixel >> 0) & 0xff; return 0xFF000000 | - (((UINT16)r * (UINT16)a) / 255) << 16 | - (((UINT16)g * (UINT16)a) / 255) << 8 | - (((UINT16)b * (UINT16)a) / 255); + ((r * a) / 255) << 16 | + ((g * a) / 255) << 8 | + ((b * a) / 255); } -#define CLUL(x) ((int) (x) < 0 ? 0 : ((x) > 65535 ? 255 : (x)>>8)) - -INLINE UINT32 ycc_to_rgb(UINT8 y, UINT8 cb, UINT8 cr) +inline UINT32 CLUL(const UINT32 x) { - unsigned int r, g, b, common; + return ((INT32) x < 0) ? 0 : ((x > 65535) ? 255 : x >> 8); +} - common = 298 * y - 56992; - r = (common + 409 * cr); - g = (common - 100 * cb - 208 * cr + 91776); - b = (common + 516 * cb - 13696); +inline UINT32 ycc_to_rgb(const UINT8 y, const UINT8 cb, const UINT8 cr) +{ + const UINT32 common = 298 * y - 56992; + const UINT32 r = (common + 409 * cr); + const UINT32 g = (common - 100 * cb - 208 * cr + 91776); + const UINT32 b = (common + 516 * cb - 13696); return 0xff000000 | (CLUL(r)<<16) | (CLUL(g)<<8) | (CLUL(b)); } -INLINE UINT32 pixel_ycc_to_rgb(UINT16 *pixel) +inline UINT32 pixel_ycc_to_rgb(const UINT16 *pixel) { - UINT32 p = *(UINT32 *)((FPTR) pixel & ~1); + + const UINT32 p = *(UINT32 *)((FPTR) pixel & ~3); return ycc_to_rgb((*pixel >> 8) & 0xff, (p) & 0xff, (p>>16) & 0xff); } -INLINE UINT32 pixel_ycc_to_rgb_pal(UINT16 *pixel, const rgb_t *palette) +inline UINT32 pixel_ycc_to_rgb_pal(const UINT16 *pixel, const rgb_t *palette) { - UINT32 p = *(UINT32 *)((FPTR) pixel & ~1); + const UINT32 p = *(UINT32 *)((FPTR) pixel & ~3); return ycc_to_rgb(palette[(*pixel >> 8) & 0xff], (p) & 0xff, (p>>16) & 0xff); } @@ -48,157 +50,173 @@ INLINE UINT32 pixel_ycc_to_rgb_pal(UINT16 *pixel, const rgb_t *palette) // Pixel conversions //============================================================ -#define OP_ARGB32_ARGB32(_src) (_src) -#define OP_RGB32_ARGB32(_src) ((_src) | 0xff000000) +#define FUNC_DEF(source) op(const source &src, const rgb_t *palbase) +#define FUNCTOR(name, x...) \ + template \ + struct name { _dest FUNC_DEF(_source) { x } }; -#define OP_RGB32PAL_ARGB32(_src) \ - (palbase[0x200 + (((_src) >> 16) & 0xff) ] | \ - palbase[0x100 + (((_src) >> 8) & 0xff) ] | \ - palbase[((_src) & 0xff) ] | 0xff000000) +FUNCTOR(op_argb32_argb32, return src; ) +FUNCTOR(op_rgb32_argb32, return src | 0xff000000; ) +FUNCTOR(op_pal16_argb32, return 0xff000000 |palbase[src]; ) +FUNCTOR(op_pal16_rgb32, return palbase[src]; ) +FUNCTOR(op_rgb32pal_argb32, + return palbase[0x200 + (((src) >> 16) & 0xff) ] | + palbase[0x100 + (((src) >> 8) & 0xff) ] | + palbase[((src) & 0xff) ] | 0xff000000; ) -#define OP_PAL16_ARGB32(_src) (0xff000000 | palbase[_src]) +FUNCTOR(op_pal16a_argb32, return palbase[src]; ) -#define OP_PAL16A_ARGB32(_src) (palbase[_src]) +FUNCTOR(op_rgb15_argb32, + return 0xff000000 | ((src & 0x7c00) << 9) | ((src & 0x03e0) << 6) + | ((src & 0x001f) << 3) | ((((src & 0x7c00) << 9) + | ((src & 0x03e0) << 6) | ((src & 0x001f) << 3) >> 5) & 0x070707); ) -#define OP_RGB15_ARGB32(_src) (0xff000000 | ((_src & 0x7c00) << 9) | ((_src & 0x03e0) << 6) | ((_src & 0x001f) << 3) | \ - ((((_src & 0x7c00) << 9) | ((_src & 0x03e0) << 6) | ((_src & 0x001f) << 3) >> 5) & 0x070707)) +FUNCTOR(op_rgb15pal_argb32, + return 0xff000000 | palbase[0x40 + ((src >> 10) & 0x1f)] | + palbase[0x20 + ((src >> 5) & 0x1f)] | palbase[0x00 + ((src >> 0) & 0x1f)]; ) -#define OP_RGB15PAL_ARGB32(_src) (0xff000000 | palbase[0x40 + ((_src >> 10) & 0x1f)] | \ - palbase[0x20 + ((_src >> 5) & 0x1f)] | palbase[0x00 + ((_src >> 0) & 0x1f)]) +FUNCTOR(op_argb32_rgb32, return premult32(src); ) +FUNCTOR(op_pal16a_rgb32, return premult32(palbase[src]); ) +FUNCTOR(op_pal16_argb1555, + return (palbase[src]&0xf80000) >> 9 | + (palbase[src]&0x00f800) >> 6 | + (palbase[src]&0x0000f8) >> 3 | 0x8000; ) -#define OP_ARGB32_RGB32(_pixel) premult32(_pixel) +FUNCTOR(op_rgb15_argb1555, return src | 0x8000; ) -#define OP_PAL16A_RGB32(_src) premult32(palbase[_src]) +FUNCTOR(op_rgb15pal_argb1555, + return (palbase[src >> 10] & 0xf8) << 7 | + (palbase[(src >> 5) & 0x1f] & 0xf8) << 2 | + (palbase[src & 0x1f] & 0xf8) >> 3 | 0x8000; ) -#define OP_PAL16_ARGB1555(_src) ((palbase[_src]&0xf80000) >> 9 | \ - (palbase[_src]&0x00f800) >> 6 | \ - (palbase[_src]&0x0000f8) >> 3 | 0x8000) +FUNCTOR(op_yuv16_uyvy, return src; ) +FUNCTOR(op_yuv16pal_uyvy, return (palbase[(src >> 8) & 0xff] << 8) | (src & 0x00ff); ) -#define OP_RGB15_ARGB1555(_src) ((_src) | 0x8000) +// FIXME: wrong ... see non_pal version +FUNCTOR(op_yuv16pal_yvyu, return (palbase[(src >> 8) & 0xff] & 0xff) | ((src & 0xff) << 8); ) +FUNCTOR(op_yuv16_yvyu, return ((src & 0xff00ff00) >> 8 ) | (src << 24) | ((src >> 8) & 0x00ff00); ) -#define OP_RGB15PAL_ARGB1555(_src) ((palbase[(_src) >> 10] & 0xf8) << 7 | \ - (palbase[((_src) >> 5) & 0x1f] & 0xf8) << 2 | \ - (palbase[(_src) & 0x1f] & 0xf8) >> 3 | 0x8000) +FUNCTOR(op_yuv16_yuy2, return ((src & 0xff00ff00) >> 8) | ((src & 0x00ff00ff) << 8); ) -#define OP_YUV16_UYVY(_src) (_src) +FUNCTOR(op_yuv16pal_yuy2, + return (palbase[(src>>8) & 0xff]) | + (palbase[(src>>24) & 0xff]<<16) | + ((src<<8)&0xff00ff00);) -#define OP_YUV16PAL_UYVY(_src) ((palbase[((_src) >> 8) & 0xff] << 8) | ((_src) & 0x00ff)) +FUNCTOR(op_yuv16_argb32, + return (UINT64) ycc_to_rgb((src >> 8) & 0xff, src & 0xff , (src>>16) & 0xff) + | ((UINT64)ycc_to_rgb((src >> 24) & 0xff, src & 0xff , (src>>16) & 0xff) << 32); ) -#define OP_YUV16PAL_YVYU(_src) ((palbase[((_src) >> 8) & 0xff] & 0xff) | ((_src & 0xff) << 8)) +FUNCTOR(op_yuv16pal_argb32, + return (UINT64)ycc_to_rgb(palbase[(src >> 8) & 0xff], src & 0xff , (src>>16) & 0xff) + | ((UINT64)ycc_to_rgb(palbase[(src >> 24) & 0xff], src & 0xff , (src>>16) & 0xff) << 32);) -#define OP_YUV16_YVYU(_src) ((((_src) >> 8) & 0xff) | ((_src & 0xff) << 8)) +FUNCTOR(op_yuv16_argb32rot, return pixel_ycc_to_rgb(&src) ; ) -#define OP_YUV16_YUY2(_src) ( ((_src) & 0xff00ff00) | \ - (((_src)>>16)&0xff) | (((_src)<<16)&0xff0000) ) - -#define OP_YUV16PAL_YUY2(_src) ( (palbase[((_src)>>8) & 0xff]) | \ - (palbase[((_src)>>24) & 0xff]<<16) | \ - (((_src)<<8)&0xff00ff00) ) - -#define OP_YUV16_ARGB32(_src) \ - (UINT64) ycc_to_rgb(((_src) >> 8) & 0xff, (_src) & 0xff , ((_src)>>16) & 0xff) \ - | ((UINT64)ycc_to_rgb(((_src) >> 24) & 0xff, (_src) & 0xff , ((_src)>>16) & 0xff) << 32) - -#define OP_YUV16PAL_ARGB32(_src) \ - (UINT64)ycc_to_rgb(palbase[((_src) >> 8) & 0xff], (_src) & 0xff , ((_src)>>16) & 0xff) \ - | ((UINT64)ycc_to_rgb(palbase[((_src) >> 24) & 0xff], (_src) & 0xff , ((_src)>>16) & 0xff) << 32) - -#define OP_YUV16_ARGB32ROT(_src) pixel_ycc_to_rgb(&(_src)) - -#define OP_YUV16PAL_ARGB32ROT(_src) pixel_ycc_to_rgb_pal(&(_src), palbase) +FUNCTOR(op_yuv16pal_argb32rot, return pixel_ycc_to_rgb_pal(&src, palbase); ) //============================================================ // Copy and rotation //============================================================ -#define TEXCOPY_M( _name, _src_type, _dest_type, _op, _len_div) \ -INLINE void texcopy_##_name (const texture_info *texture, const render_texinfo *texsource) { \ - ATTR_UNUSED const rgb_t *palbase = texsource->palette(); \ - int x, y; \ - /* loop over Y */ \ - for (y = 0; y < texsource->height; y++) { \ - _src_type *src = (_src_type *)texsource->base + y * texsource->rowpixels / (_len_div); \ - _dest_type *dst = (_dest_type *)((UINT8 *)texture->m_pixels + y * texture->m_pitch); \ - x = texsource->width / (_len_div); \ - while (x > 0) { \ - *dst++ = _op(*src); \ - src++; \ - x--; \ - } \ - } \ +template +void texcopy(const texture_info *texture, const render_texinfo *texsource) +{ + ATTR_UNUSED const rgb_t *palbase = texsource->palette(); + int x, y; + _op op; + /* loop over Y */ + for (y = 0; y < texsource->height; y++) { + _src_type *src = (_src_type *)texsource->base + y * texsource->rowpixels / (_len_div); + _dest_type *dst = (_dest_type *)((UINT8 *)texture->m_pixels + y * texture->m_pitch); + x = texsource->width / (_len_div); + while (x > 0) { + *dst++ = op.op(*src, palbase); + src++; + x--; + } + } } -#define TEXCOPY( _name, _src_type, _dest_type, _op) \ - TEXCOPY_M( _name, _src_type, _dest_type, _op, 1) +#define TEXCOPYA(a, b, c, d) \ +inline void texcopy_ ## a(const texture_info *texture, const render_texinfo *texsource) \ +{ return texcopy, d>(texture, texsource); } -#define TEXROT( _name, _src_type, _dest_type, _op) \ -INLINE void texcopy_rot_##_name (const texture_info *texture, const render_texinfo *texsource) { \ - ATTR_UNUSED const rgb_t *palbase = texsource->palette(); \ - int x, y; \ - const quad_setup_data *setup = &texture->m_setup; \ - int dudx = setup->dudx; \ - int dvdx = setup->dvdx; \ - /* loop over Y */ \ - for (y = 0; y < setup->rotheight; y++) { \ - INT32 curu = setup->startu + y * setup->dudy; \ - INT32 curv = setup->startv + y * setup->dvdy; \ - _dest_type *dst = (_dest_type *)((UINT8 *)texture->m_pixels + y * texture->m_pitch); \ - x = setup->rotwidth; \ - while (x>0) { \ - _src_type *src = (_src_type *) texsource->base + (curv >> 16) * texsource->rowpixels + (curu >> 16); \ - *dst++ = _op(*src); \ - curu += dudx; \ - curv += dvdx; \ - x--; \ - } \ - } \ +template +void texcopy_rot(const texture_info *texture, const render_texinfo *texsource) +{ + ATTR_UNUSED const rgb_t *palbase = texsource->palette(); + int x, y; + const quad_setup_data *setup = &texture->m_setup; + int dudx = setup->dudx; + int dvdx = setup->dvdx; + _op op; + /* loop over Y */ + for (y = 0; y < setup->rotheight; y++) { + INT32 curu = setup->startu + y * setup->dudy; + INT32 curv = setup->startv + y * setup->dvdy; + _dest_type *dst = (_dest_type *)((UINT8 *)texture->m_pixels + y * texture->m_pitch); + x = setup->rotwidth; + while (x>0) { + _src_type *src = (_src_type *) texsource->base + (curv >> 16) * texsource->rowpixels + (curu >> 16); + *dst++ = op.op(*src, palbase); + curu += dudx; + curv += dvdx; + x--; + } + } } -//TEXCOPY(argb32_argb32, UINT32, UINT32, OP_ARGB32_ARGB32) +#define TEXROTA(a, b, c) \ +inline void texcopy_rot_ ## a(const texture_info *texture, const render_texinfo *texsource) \ +{ return texcopy_rot >(texture, texsource); } -TEXCOPY(rgb32_argb32, UINT32, UINT32, OP_RGB32_ARGB32) -TEXCOPY(rgb32pal_argb32, UINT32, UINT32, OP_RGB32PAL_ARGB32) -TEXCOPY(pal16_argb32, UINT16, UINT32, OP_PAL16_ARGB32) -TEXCOPY(pal16a_argb32, UINT16, UINT32, OP_PAL16A_ARGB32) -TEXCOPY(rgb15_argb32, UINT16, UINT32, OP_RGB15_ARGB32) -TEXCOPY(rgb15pal_argb32, UINT16, UINT32, OP_RGB15PAL_ARGB32) +TEXCOPYA(rgb32_argb32, UINT32, UINT32, 1) +TEXCOPYA(rgb32pal_argb32, UINT32, UINT32, 1) +TEXCOPYA(pal16_argb32, UINT16, UINT32, 1) +TEXCOPYA(pal16a_argb32, UINT16, UINT32, 1) +TEXCOPYA(rgb15_argb32, UINT16, UINT32, 1) +TEXCOPYA(rgb15pal_argb32, UINT16, UINT32, 1) -TEXCOPY(pal16_argb1555, UINT16, UINT16, OP_PAL16_ARGB1555) -TEXCOPY(rgb15_argb1555, UINT16, UINT16, OP_RGB15_ARGB1555) -TEXCOPY(rgb15pal_argb1555, UINT16, UINT16, OP_RGB15PAL_ARGB1555) +TEXCOPYA(pal16_argb1555, UINT16, UINT16, 1) +TEXCOPYA(rgb15_argb1555, UINT16, UINT16, 1) +TEXCOPYA(rgb15pal_argb1555, UINT16, UINT16, 1) -TEXCOPY(argb32_rgb32, UINT32, UINT32, OP_ARGB32_RGB32) -TEXCOPY(pal16a_rgb32, UINT16, UINT32, OP_PAL16A_RGB32) +TEXCOPYA(argb32_rgb32, UINT32, UINT32, 1) +TEXCOPYA(pal16a_rgb32, UINT16, UINT32, 1) -TEXCOPY_M(yuv16_argb32, UINT32, UINT64, OP_YUV16_ARGB32, 2) -TEXCOPY_M(yuv16pal_argb32, UINT32, UINT64, OP_YUV16PAL_ARGB32, 2) +TEXCOPYA(yuv16_argb32, UINT32, UINT64, 2) +TEXCOPYA(yuv16pal_argb32, UINT32, UINT64, 2) -//TEXCOPY(yuv16_uyvy, UINT16, UINT16, OP_YUV16_UYVY) +//TEXCOPYA(yuv16_uyvy, UINT16, UINT16, OP_YUV16_UYVY) -TEXCOPY(yuv16pal_uyvy, UINT16, UINT16, OP_YUV16PAL_UYVY) +TEXCOPYA(yuv16pal_uyvy, UINT16, UINT16, 1) -TEXCOPY(yuv16_yvyu, UINT16, UINT16, OP_YUV16_YVYU) -TEXCOPY(yuv16pal_yvyu, UINT16, UINT16, OP_YUV16PAL_YVYU) +TEXCOPYA(yuv16_yvyu, UINT32, UINT32, 2) +TEXCOPYA(yuv16pal_yvyu, UINT16, UINT16, 1) -TEXCOPY_M(yuv16_yuy2, UINT32, UINT32, OP_YUV16_YUY2, 2) -TEXCOPY_M(yuv16pal_yuy2, UINT32, UINT32, OP_YUV16PAL_YUY2, 2) +TEXCOPYA(yuv16_yuy2, UINT32, UINT32, 2) +TEXCOPYA(yuv16pal_yuy2, UINT32, UINT32, 2) -TEXROT(argb32_argb32, UINT32, UINT32, OP_ARGB32_ARGB32) -TEXROT(rgb32_argb32, UINT32, UINT32, OP_RGB32_ARGB32) -TEXROT(rgb32pal_argb32, UINT32, UINT32, OP_RGB32PAL_ARGB32) -TEXROT(pal16_argb32, UINT16, UINT32, OP_PAL16_ARGB32) -TEXROT(pal16a_argb32, UINT16, UINT32, OP_PAL16A_ARGB32) -TEXROT(rgb15_argb32, UINT16, UINT32, OP_RGB15_ARGB32) -TEXROT(rgb15pal_argb32, UINT16, UINT32, OP_RGB15PAL_ARGB32) -TEXROT(pal16_argb1555, UINT16, UINT16, OP_PAL16_ARGB1555) -TEXROT(rgb15_argb1555, UINT16, UINT16, OP_RGB15_ARGB1555) -TEXROT(rgb15pal_argb1555, UINT16, UINT16, OP_RGB15PAL_ARGB1555) +TEXROTA(argb32_argb32, UINT32, UINT32) +TEXROTA(rgb32_argb32, UINT32, UINT32) +TEXROTA(pal16_argb32, UINT16, UINT32) +TEXROTA(pal16_rgb32, UINT16, UINT32) -TEXROT(argb32_rgb32, UINT32, UINT32, OP_ARGB32_RGB32) -TEXROT(pal16a_rgb32, UINT16, UINT32, OP_PAL16A_RGB32) +TEXROTA(rgb32pal_argb32, UINT32, UINT32) +TEXROTA(pal16a_argb32, UINT16, UINT32) +TEXROTA(rgb15_argb32, UINT16, UINT32) +TEXROTA(rgb15pal_argb32, UINT16, UINT32) -TEXROT(yuv16_argb32, UINT16, UINT32, OP_YUV16_ARGB32ROT) -TEXROT(yuv16pal_argb32, UINT16, UINT32, OP_YUV16PAL_ARGB32ROT) +TEXROTA(pal16_argb1555, UINT16, UINT16) +TEXROTA(rgb15_argb1555, UINT16, UINT16) +TEXROTA(rgb15pal_argb1555, UINT16, UINT16) + +TEXROTA(argb32_rgb32, UINT32, UINT32) +TEXROTA(pal16a_rgb32, UINT16, UINT32) + +TEXROTA(yuv16_argb32rot, UINT16, UINT32) +TEXROTA(yuv16pal_argb32rot, UINT16, UINT32) diff --git a/src/osd/sdl/draw13.c b/src/osd/sdl/draw13.c index 130080ae54b..b5bfd2ff527 100644 --- a/src/osd/sdl/draw13.c +++ b/src/osd/sdl/draw13.c @@ -48,12 +48,12 @@ enum static inline bool is_opaque(const float &a) { - return (a >= 1.0f); + return (a >= 1.0f); } static inline bool is_transparent(const float &a) { - return (a < 0.0001f); + return (a < 0.0001f); } //============================================================ @@ -63,11 +63,11 @@ static inline bool is_transparent(const float &a) struct quad_setup_data { - quad_setup_data() - : dudx(0), dvdx(0), dudy(0), dvdy(0), startu(0), startv(0), - rotwidth(0), rotheight(0) - {} - void compute(const render_primitive &prim); + quad_setup_data() + : dudx(0), dvdx(0), dudy(0), dvdy(0), startu(0), startv(0), + rotwidth(0), rotheight(0) + {} + void compute(const render_primitive &prim); INT32 dudx, dvdx, dudy, dvdy; INT32 startu, startv; @@ -105,16 +105,16 @@ struct sdl_info; /* texture_info holds information about a texture */ class texture_info { - friend class simple_list; + friend class simple_list; public: - texture_info(SDL_Renderer *renderer, const render_texinfo &texsource, const quad_setup_data &setup, const UINT32 flags); - ~texture_info(); + texture_info(SDL_Renderer *renderer, const render_texinfo &texsource, const quad_setup_data &setup, const UINT32 flags); + ~texture_info(); - void set_data(const render_texinfo &texsource, const UINT32 flags); - void render_quad(const render_primitive *prim, const int x, const int y); - bool matches(const render_primitive &prim, const quad_setup_data &setup); + void set_data(const render_texinfo &texsource, const UINT32 flags); + void render_quad(const render_primitive *prim, const int x, const int y); + bool matches(const render_primitive &prim, const quad_setup_data &setup); - copy_info_t *compute_size_type(); + copy_info_t *compute_size_type(); void *m_pixels; // pixels for the texture int m_pitch; @@ -125,49 +125,50 @@ public: osd_ticks_t m_last_access; int raw_width() const { return m_texinfo.width; } - int raw_height() const { return m_texinfo.height; } + int raw_height() const { return m_texinfo.height; } - texture_info *next() { return m_next; } - const render_texinfo &texinfo() const { return m_texinfo; } - render_texinfo &texinfo() { return m_texinfo; } + texture_info *next() { return m_next; } + const render_texinfo &texinfo() const { return m_texinfo; } + render_texinfo &texinfo() { return m_texinfo; } - const HashT hash() const { return m_hash; } - const UINT32 flags() const { return m_flags; } - const bool is_pixels_owned() const { // do we own / allocated it ? - return false && ((m_sdl_access == SDL_TEXTUREACCESS_STATIC) - && (m_copyinfo->func != NULL)) ; - } + const HashT hash() const { return m_hash; } + const UINT32 flags() const { return m_flags; } + // FIXME: + const bool is_pixels_owned() const { // do we own / allocated it ? + return false && ((m_sdl_access == SDL_TEXTUREACCESS_STATIC) + && (m_copyinfo->func != NULL)) ; + } private: - Uint32 m_sdl_access; - SDL_Renderer * m_renderer; - render_texinfo m_texinfo; // copy of the texture info - HashT m_hash; // hash value for the texture (must be >= pointer size) - UINT32 m_flags; // rendering flags + Uint32 m_sdl_access; + SDL_Renderer * m_renderer; + render_texinfo m_texinfo; // copy of the texture info + HashT m_hash; // hash value for the texture (must be >= pointer size) + UINT32 m_flags; // rendering flags - SDL_Texture * m_texture_id; - int m_is_rotated; + SDL_Texture * m_texture_id; + int m_is_rotated; - int m_format; // texture format - SDL_BlendMode m_sdl_blendmode; + int m_format; // texture format + SDL_BlendMode m_sdl_blendmode; - texture_info * m_next; // next texture in the list + texture_info * m_next; // next texture in the list }; /* sdl_info is the information about SDL for the current screen */ struct sdl_info { - sdl_info() - : m_blittimer(0), m_renderer(NULL), - m_hofs(0), m_vofs(0), - m_resize_pending(0), m_resize_width(0), m_resize_height(0), - m_last_blit_time(0), m_last_blit_pixels(0) - {} + sdl_info() + : m_blittimer(0), m_renderer(NULL), + m_hofs(0), m_vofs(0), + m_resize_pending(0), m_resize_width(0), m_resize_height(0), + m_last_blit_time(0), m_last_blit_pixels(0) + {} - void render_quad(texture_info *texture, const render_primitive *prim, const int x, const int y); + void render_quad(texture_info *texture, const render_primitive *prim, const int x, const int y); - texture_info *texture_find(const render_primitive &prim, const quad_setup_data &setup); - texture_info *texture_update(const render_primitive &prim); + texture_info *texture_find(const render_primitive &prim, const quad_setup_data &setup); + texture_info *texture_update(const render_primitive &prim); INT32 m_blittimer; @@ -227,6 +228,7 @@ static int drawsdl2_xy_to_render_target(sdl_window_info *window, int x, int y, i #define ENTRY_BM(a,b,c,d,f,bm) { SDL_TEXFORMAT_ ## a, SDL_PIXELFORMAT_ ## b, c, d, texcopy_ ## f, bm, #a, #b, 0, 0, 0, 0} #define ENTRY_LR(a,b,c,d,f) { SDL_TEXFORMAT_ ## a, SDL_PIXELFORMAT_ ## b, c, d, texcopy_ ## f, BM_ALL, #a, #b, 0, 0, 0, -1} + static copy_info_t blit_info_default[] = { /* no rotation */ @@ -283,11 +285,11 @@ static copy_info_t blit_info_default[] = ENTRY(RGB32_PALETTED, ARGB8888, 4, 1, rot_rgb32pal_argb32), ENTRY(RGB32_PALETTED, RGB888, 4, 1, rot_rgb32pal_argb32), - ENTRY(YUY16, ARGB8888, 4, 1, rot_yuv16_argb32), - ENTRY(YUY16, RGB888, 4, 1, rot_yuv16_argb32), + ENTRY(YUY16, ARGB8888, 4, 1, rot_yuv16_argb32rot), + ENTRY(YUY16, RGB888, 4, 1, rot_yuv16_argb32rot), - ENTRY(YUY16_PALETTED, ARGB8888, 4, 1, rot_yuv16pal_argb32), - ENTRY(YUY16_PALETTED, RGB888, 4, 1, rot_yuv16pal_argb32), + ENTRY(YUY16_PALETTED, ARGB8888, 4, 1, rot_yuv16pal_argb32rot), + ENTRY(YUY16_PALETTED, RGB888, 4, 1, rot_yuv16pal_argb32rot), ENTRY(PALETTE16, ARGB8888, 4, 1, rot_pal16_argb32), ENTRY(PALETTE16, RGB888, 4, 1, rot_pal16_argb32),