Previous 199869 Revisions Next

r34723 Wednesday 28th January, 2015 at 23:29:17 UTC by Couriersud
Converted blit13.h to templates and fixed a number of bugs around
different ycc formats. (nw)
[src/osd/sdl]blit13.h draw13.c

trunk/src/osd/sdl/blit13.h
r243234r243235
55//  INLINE
66//============================================================
77
8INLINE UINT32 premult32(UINT32 pixel)
8inline UINT32 premult32(const UINT32 pixel)
99{
10   UINT8 a = (pixel >> 24) & 0xff;
11   UINT8 r = (pixel >> 16) & 0xff;
12   UINT8 g = (pixel >> 8) & 0xff;
13   UINT8 b = (pixel >> 0) & 0xff;
10   const UINT16 a = (pixel >> 24) & 0xff;
11   const UINT16 r = (pixel >> 16) & 0xff;
12   const UINT16 g = (pixel >> 8) & 0xff;
13   const UINT16 b = (pixel >> 0) & 0xff;
1414
1515   return 0xFF000000 |
16      (((UINT16)r * (UINT16)a) / 255) << 16 |
17      (((UINT16)g * (UINT16)a) / 255) << 8 |
18      (((UINT16)b * (UINT16)a) / 255);
16      ((r * a) / 255) << 16 |
17      ((g * a) / 255) << 8 |
18      ((b * a) / 255);
1919}
2020
21#define CLUL(x) ((int) (x) < 0 ? 0 : ((x) > 65535 ? 255 : (x)>>8))
21inline UINT32 CLUL(const UINT32 x)
22{
23   return ((INT32) x < 0) ? 0 : ((x > 65535) ? 255 : x >> 8);
24}
2225
23INLINE UINT32 ycc_to_rgb(UINT8 y, UINT8 cb, UINT8 cr)
26inline UINT32 ycc_to_rgb(const UINT8 y, const UINT8 cb, const UINT8 cr)
2427{
25   unsigned int r, g, b, common;
28   const UINT32 common = 298 * y - 56992;
29   const UINT32 r = (common +            409 * cr);
30   const UINT32 g = (common - 100 * cb - 208 * cr + 91776);
31   const UINT32 b = (common + 516 * cb - 13696);
2632
27   common = 298 * y - 56992;
28   r = (common +            409 * cr);
29   g = (common - 100 * cb - 208 * cr + 91776);
30   b = (common + 516 * cb - 13696);
31
3233   return 0xff000000 | (CLUL(r)<<16) | (CLUL(g)<<8) | (CLUL(b));
3334}
3435
35INLINE UINT32 pixel_ycc_to_rgb(UINT16 *pixel)
36inline UINT32 pixel_ycc_to_rgb(const UINT16 *pixel)
3637{
37   UINT32 p = *(UINT32 *)((FPTR) pixel & ~1);
38
39   const UINT32 p = *(UINT32 *)((FPTR) pixel & ~3);
3840   return ycc_to_rgb((*pixel >> 8) & 0xff, (p) & 0xff, (p>>16) & 0xff);
3941}
4042
41INLINE UINT32 pixel_ycc_to_rgb_pal(UINT16 *pixel, const rgb_t *palette)
43inline UINT32 pixel_ycc_to_rgb_pal(const UINT16 *pixel, const rgb_t *palette)
4244{
43   UINT32 p = *(UINT32 *)((FPTR) pixel & ~1);
45   const UINT32 p = *(UINT32 *)((FPTR) pixel & ~3);
4446   return ycc_to_rgb(palette[(*pixel >> 8) & 0xff], (p) & 0xff, (p>>16) & 0xff);
4547}
4648
r243234r243235
4850//  Pixel conversions
4951//============================================================
5052
51#define OP_ARGB32_ARGB32(_src) (_src)
5253
53#define OP_RGB32_ARGB32(_src) ((_src) | 0xff000000)
54#define FUNC_DEF(source) op(const source &src, const rgb_t *palbase)
55#define FUNCTOR(name, x...) \
56    template<typename _source, typename _dest> \
57    struct name { _dest FUNC_DEF(_source) { x } };
5458
55#define OP_RGB32PAL_ARGB32(_src) \
56   (palbase[0x200 + (((_src) >> 16) & 0xff) ] | \
57      palbase[0x100 + (((_src) >> 8) & 0xff) ] | \
58      palbase[((_src) & 0xff) ] | 0xff000000)
59FUNCTOR(op_argb32_argb32, return src; )
60FUNCTOR(op_rgb32_argb32,  return src | 0xff000000; )
61FUNCTOR(op_pal16_argb32,  return 0xff000000 |palbase[src]; )
62FUNCTOR(op_pal16_rgb32,   return palbase[src]; )
63FUNCTOR(op_rgb32pal_argb32,
64    return palbase[0x200 + (((src) >> 16) & 0xff) ] |
65        palbase[0x100 + (((src) >> 8) & 0xff) ] |
66        palbase[((src) & 0xff) ] | 0xff000000; )
5967
60#define OP_PAL16_ARGB32(_src) (0xff000000 | palbase[_src])
68FUNCTOR(op_pal16a_argb32, return palbase[src]; )
6169
62#define OP_PAL16A_ARGB32(_src) (palbase[_src])
70FUNCTOR(op_rgb15_argb32,
71      return 0xff000000 | ((src & 0x7c00) << 9) | ((src & 0x03e0) << 6)
72            | ((src & 0x001f) << 3) | ((((src & 0x7c00) << 9)
73            | ((src & 0x03e0) << 6) | ((src & 0x001f) << 3) >> 5) & 0x070707); )
6374
64#define OP_RGB15_ARGB32(_src) (0xff000000 | ((_src & 0x7c00) << 9) | ((_src & 0x03e0) << 6) | ((_src & 0x001f) << 3) | \
65   ((((_src & 0x7c00) << 9) | ((_src & 0x03e0) << 6) | ((_src & 0x001f) << 3) >> 5) & 0x070707))
75FUNCTOR(op_rgb15pal_argb32,
76      return 0xff000000 | palbase[0x40 + ((src >> 10) & 0x1f)] |
77        palbase[0x20 + ((src >> 5) & 0x1f)] | palbase[0x00 + ((src >> 0) & 0x1f)]; )
6678
67#define OP_RGB15PAL_ARGB32(_src) (0xff000000 | palbase[0x40 + ((_src >> 10) & 0x1f)] | \
68      palbase[0x20 + ((_src >> 5) & 0x1f)] | palbase[0x00 + ((_src >> 0) & 0x1f)])
79FUNCTOR(op_argb32_rgb32, return premult32(src); )
80FUNCTOR(op_pal16a_rgb32, return premult32(palbase[src]); )
81FUNCTOR(op_pal16_argb1555,
82      return (palbase[src]&0xf80000) >> 9 |
83            (palbase[src]&0x00f800) >> 6 |
84            (palbase[src]&0x0000f8) >> 3 | 0x8000; )
6985
70#define OP_ARGB32_RGB32(_pixel) premult32(_pixel)
86FUNCTOR(op_rgb15_argb1555, return src | 0x8000; )
7187
72#define OP_PAL16A_RGB32(_src) premult32(palbase[_src])
88FUNCTOR(op_rgb15pal_argb1555,
89      return (palbase[src >> 10] & 0xf8) << 7 |
90            (palbase[(src >> 5) & 0x1f] & 0xf8) << 2 |
91            (palbase[src & 0x1f] & 0xf8) >> 3 | 0x8000; )
7392
74#define OP_PAL16_ARGB1555(_src) ((palbase[_src]&0xf80000) >> 9 | \
75         (palbase[_src]&0x00f800) >> 6 | \
76         (palbase[_src]&0x0000f8) >> 3 | 0x8000)
93FUNCTOR(op_yuv16_uyvy, return src; )
94FUNCTOR(op_yuv16pal_uyvy, return (palbase[(src >> 8) & 0xff] << 8) | (src & 0x00ff); )
7795
78#define OP_RGB15_ARGB1555(_src) ((_src) | 0x8000)
96// FIXME: wrong ... see non_pal version
97FUNCTOR(op_yuv16pal_yvyu, return (palbase[(src >> 8) & 0xff] & 0xff) | ((src & 0xff) << 8); )
98FUNCTOR(op_yuv16_yvyu, return ((src & 0xff00ff00) >> 8 ) | (src << 24) | ((src >> 8) & 0x00ff00); )
7999
80#define OP_RGB15PAL_ARGB1555(_src) ((palbase[(_src) >> 10] & 0xf8) << 7 | \
81         (palbase[((_src) >> 5) & 0x1f] & 0xf8) << 2 | \
82         (palbase[(_src) & 0x1f] & 0xf8) >> 3 | 0x8000)
100FUNCTOR(op_yuv16_yuy2, return ((src & 0xff00ff00) >> 8) | ((src & 0x00ff00ff) << 8); )
83101
84#define OP_YUV16_UYVY(_src) (_src)
102FUNCTOR(op_yuv16pal_yuy2,
103      return  (palbase[(src>>8) & 0xff]) |
104            (palbase[(src>>24) & 0xff]<<16) |
105            ((src<<8)&0xff00ff00);)
85106
86#define OP_YUV16PAL_UYVY(_src) ((palbase[((_src) >> 8) & 0xff] << 8) | ((_src) & 0x00ff))
107FUNCTOR(op_yuv16_argb32,
108      return (UINT64) ycc_to_rgb((src >>  8) & 0xff, src & 0xff , (src>>16) & 0xff)
109    | ((UINT64)ycc_to_rgb((src >> 24) & 0xff, src & 0xff , (src>>16) & 0xff) << 32); )
87110
88#define OP_YUV16PAL_YVYU(_src) ((palbase[((_src) >> 8) & 0xff] & 0xff) | ((_src & 0xff) << 8))
111FUNCTOR(op_yuv16pal_argb32,
112      return (UINT64)ycc_to_rgb(palbase[(src >>  8) & 0xff], src & 0xff , (src>>16) & 0xff)
113    | ((UINT64)ycc_to_rgb(palbase[(src >> 24) & 0xff], src & 0xff , (src>>16) & 0xff) << 32);)
89114
90#define OP_YUV16_YVYU(_src) ((((_src) >> 8) & 0xff) | ((_src & 0xff) << 8))
115FUNCTOR(op_yuv16_argb32rot, return pixel_ycc_to_rgb(&src) ; )
91116
92#define OP_YUV16_YUY2(_src) ( ((_src) & 0xff00ff00) | \
93   (((_src)>>16)&0xff) | (((_src)<<16)&0xff0000) )
117FUNCTOR(op_yuv16pal_argb32rot, return pixel_ycc_to_rgb_pal(&src, palbase); )
94118
95#define OP_YUV16PAL_YUY2(_src) ( (palbase[((_src)>>8) & 0xff]) | \
96      (palbase[((_src)>>24) & 0xff]<<16) | \
97   (((_src)<<8)&0xff00ff00) )
98
99#define OP_YUV16_ARGB32(_src) \
100      (UINT64) ycc_to_rgb(((_src) >>  8) & 0xff, (_src) & 0xff , ((_src)>>16) & 0xff) \
101   | ((UINT64)ycc_to_rgb(((_src) >> 24) & 0xff, (_src) & 0xff , ((_src)>>16) & 0xff) << 32)
102
103#define OP_YUV16PAL_ARGB32(_src) \
104      (UINT64)ycc_to_rgb(palbase[((_src) >>  8) & 0xff], (_src) & 0xff , ((_src)>>16) & 0xff) \
105   | ((UINT64)ycc_to_rgb(palbase[((_src) >> 24) & 0xff], (_src) & 0xff , ((_src)>>16) & 0xff) << 32)
106
107#define OP_YUV16_ARGB32ROT(_src) pixel_ycc_to_rgb(&(_src))
108
109#define OP_YUV16PAL_ARGB32ROT(_src) pixel_ycc_to_rgb_pal(&(_src), palbase)
110
111119//============================================================
112120//  Copy and rotation
113121//============================================================
114122
115#define TEXCOPY_M( _name, _src_type, _dest_type,  _op, _len_div) \
116INLINE void texcopy_##_name (const texture_info *texture, const render_texinfo *texsource) { \
117   ATTR_UNUSED const rgb_t *palbase = texsource->palette(); \
118   int x, y; \
119   /* loop over Y */ \
120   for (y = 0; y < texsource->height; y++) { \
121      _src_type *src = (_src_type *)texsource->base + y * texsource->rowpixels / (_len_div); \
122      _dest_type *dst = (_dest_type *)((UINT8 *)texture->m_pixels + y * texture->m_pitch); \
123      x = texsource->width / (_len_div); \
124      while (x > 0) { \
125         *dst++ = _op(*src); \
126         src++; \
127         x--; \
128      } \
129   } \
123template<typename _src_type, typename _dest_type, typename _op, int _len_div>
124void texcopy(const texture_info *texture, const render_texinfo *texsource)
125{
126   ATTR_UNUSED const rgb_t *palbase = texsource->palette();
127   int x, y;
128    _op op;
129   /* loop over Y */
130   for (y = 0; y < texsource->height; y++) {
131      _src_type *src = (_src_type *)texsource->base + y * texsource->rowpixels / (_len_div);
132      _dest_type *dst = (_dest_type *)((UINT8 *)texture->m_pixels + y * texture->m_pitch);
133      x = texsource->width / (_len_div);
134      while (x > 0) {
135         *dst++ = op.op(*src, palbase);
136         src++;
137         x--;
138      }
139   }
130140}
131141
132#define TEXCOPY( _name, _src_type, _dest_type,  _op) \
133   TEXCOPY_M( _name, _src_type, _dest_type,  _op, 1)
142#define TEXCOPYA(a, b, c, d) \
143inline void texcopy_ ## a(const texture_info *texture, const render_texinfo *texsource) \
144{ return texcopy<b, c, op_ ## a <b, c>, d>(texture, texsource); }
134145
135#define TEXROT( _name, _src_type, _dest_type, _op) \
136INLINE void texcopy_rot_##_name (const texture_info *texture, const render_texinfo *texsource) { \
137   ATTR_UNUSED const rgb_t *palbase = texsource->palette(); \
138   int x, y; \
139   const quad_setup_data *setup = &texture->m_setup; \
140   int dudx = setup->dudx; \
141   int dvdx = setup->dvdx; \
142   /* loop over Y */ \
143   for (y = 0; y < setup->rotheight; y++) { \
144      INT32 curu = setup->startu + y * setup->dudy; \
145      INT32 curv = setup->startv + y * setup->dvdy; \
146      _dest_type *dst = (_dest_type *)((UINT8 *)texture->m_pixels + y * texture->m_pitch); \
147      x = setup->rotwidth; \
148      while (x>0) { \
149         _src_type *src = (_src_type *) texsource->base + (curv >> 16) * texsource->rowpixels + (curu >> 16); \
150         *dst++ = _op(*src); \
151         curu += dudx; \
152         curv += dvdx; \
153         x--; \
154      } \
155   } \
146template<typename _src_type, typename _dest_type, typename _op>
147void texcopy_rot(const texture_info *texture, const render_texinfo *texsource)
148{
149    ATTR_UNUSED const rgb_t *palbase = texsource->palette();
150    int x, y;
151    const quad_setup_data *setup = &texture->m_setup;
152    int dudx = setup->dudx;
153    int dvdx = setup->dvdx;
154    _op op;
155    /* loop over Y */
156    for (y = 0; y < setup->rotheight; y++) {
157        INT32 curu = setup->startu + y * setup->dudy;
158        INT32 curv = setup->startv + y * setup->dvdy;
159        _dest_type *dst = (_dest_type *)((UINT8 *)texture->m_pixels + y * texture->m_pitch);
160        x = setup->rotwidth;
161        while (x>0) {
162            _src_type *src = (_src_type *) texsource->base + (curv >> 16) * texsource->rowpixels + (curu >> 16);
163            *dst++ = op.op(*src, palbase);
164            curu += dudx;
165            curv += dvdx;
166            x--;
167        }
168    }
156169}
157170
158//TEXCOPY(argb32_argb32, UINT32, UINT32, OP_ARGB32_ARGB32)
171#define TEXROTA(a, b, c) \
172inline void texcopy_rot_ ## a(const texture_info *texture, const render_texinfo *texsource) \
173{ return texcopy_rot<b, c, op_ ## a <b, c> >(texture, texsource); }
159174
160TEXCOPY(rgb32_argb32,  UINT32, UINT32, OP_RGB32_ARGB32)
161TEXCOPY(rgb32pal_argb32,  UINT32, UINT32, OP_RGB32PAL_ARGB32)
162TEXCOPY(pal16_argb32,  UINT16, UINT32, OP_PAL16_ARGB32)
163TEXCOPY(pal16a_argb32,  UINT16, UINT32, OP_PAL16A_ARGB32)
164TEXCOPY(rgb15_argb32,  UINT16, UINT32, OP_RGB15_ARGB32)
165TEXCOPY(rgb15pal_argb32,  UINT16, UINT32, OP_RGB15PAL_ARGB32)
175TEXCOPYA(rgb32_argb32,  UINT32, UINT32, 1)
176TEXCOPYA(rgb32pal_argb32,  UINT32, UINT32, 1)
177TEXCOPYA(pal16_argb32,  UINT16, UINT32, 1)
178TEXCOPYA(pal16a_argb32,  UINT16, UINT32, 1)
179TEXCOPYA(rgb15_argb32,  UINT16, UINT32, 1)
180TEXCOPYA(rgb15pal_argb32,  UINT16, UINT32, 1)
166181
167TEXCOPY(pal16_argb1555,  UINT16, UINT16, OP_PAL16_ARGB1555)
168TEXCOPY(rgb15_argb1555,  UINT16, UINT16, OP_RGB15_ARGB1555)
169TEXCOPY(rgb15pal_argb1555,  UINT16, UINT16, OP_RGB15PAL_ARGB1555)
182TEXCOPYA(pal16_argb1555,  UINT16, UINT16, 1)
183TEXCOPYA(rgb15_argb1555,  UINT16, UINT16, 1)
184TEXCOPYA(rgb15pal_argb1555,  UINT16, UINT16, 1)
170185
171TEXCOPY(argb32_rgb32, UINT32, UINT32, OP_ARGB32_RGB32)
172TEXCOPY(pal16a_rgb32,  UINT16, UINT32, OP_PAL16A_RGB32)
186TEXCOPYA(argb32_rgb32, UINT32, UINT32, 1)
187TEXCOPYA(pal16a_rgb32,  UINT16, UINT32, 1)
173188
174TEXCOPY_M(yuv16_argb32, UINT32, UINT64, OP_YUV16_ARGB32, 2)
175TEXCOPY_M(yuv16pal_argb32, UINT32, UINT64, OP_YUV16PAL_ARGB32, 2)
189TEXCOPYA(yuv16_argb32, UINT32, UINT64, 2)
190TEXCOPYA(yuv16pal_argb32, UINT32, UINT64, 2)
176191
177//TEXCOPY(yuv16_uyvy, UINT16, UINT16, OP_YUV16_UYVY)
192//TEXCOPYA(yuv16_uyvy, UINT16, UINT16, OP_YUV16_UYVY)
178193
179TEXCOPY(yuv16pal_uyvy, UINT16, UINT16, OP_YUV16PAL_UYVY)
194TEXCOPYA(yuv16pal_uyvy, UINT16, UINT16, 1)
180195
181TEXCOPY(yuv16_yvyu, UINT16, UINT16, OP_YUV16_YVYU)
182TEXCOPY(yuv16pal_yvyu, UINT16, UINT16, OP_YUV16PAL_YVYU)
196TEXCOPYA(yuv16_yvyu, UINT32, UINT32, 2)
197TEXCOPYA(yuv16pal_yvyu, UINT16, UINT16, 1)
183198
184TEXCOPY_M(yuv16_yuy2, UINT32, UINT32, OP_YUV16_YUY2, 2)
185TEXCOPY_M(yuv16pal_yuy2, UINT32, UINT32, OP_YUV16PAL_YUY2, 2)
199TEXCOPYA(yuv16_yuy2, UINT32, UINT32, 2)
200TEXCOPYA(yuv16pal_yuy2, UINT32, UINT32, 2)
186201
187202
188TEXROT(argb32_argb32, UINT32, UINT32, OP_ARGB32_ARGB32)
189TEXROT(rgb32_argb32,  UINT32, UINT32, OP_RGB32_ARGB32)
190TEXROT(rgb32pal_argb32,  UINT32, UINT32, OP_RGB32PAL_ARGB32)
191TEXROT(pal16_argb32,  UINT16, UINT32, OP_PAL16_ARGB32)
192TEXROT(pal16a_argb32,  UINT16, UINT32, OP_PAL16A_ARGB32)
193TEXROT(rgb15_argb32,  UINT16, UINT32, OP_RGB15_ARGB32)
194TEXROT(rgb15pal_argb32,  UINT16, UINT32, OP_RGB15PAL_ARGB32)
195203
196TEXROT(pal16_argb1555,  UINT16, UINT16, OP_PAL16_ARGB1555)
197TEXROT(rgb15_argb1555,  UINT16, UINT16, OP_RGB15_ARGB1555)
198TEXROT(rgb15pal_argb1555,  UINT16, UINT16, OP_RGB15PAL_ARGB1555)
204TEXROTA(argb32_argb32, UINT32, UINT32)
205TEXROTA(rgb32_argb32,  UINT32, UINT32)
206TEXROTA(pal16_argb32,  UINT16, UINT32)
207TEXROTA(pal16_rgb32,  UINT16, UINT32)
199208
200TEXROT(argb32_rgb32, UINT32, UINT32, OP_ARGB32_RGB32)
201TEXROT(pal16a_rgb32,  UINT16, UINT32, OP_PAL16A_RGB32)
209TEXROTA(rgb32pal_argb32,  UINT32, UINT32)
210TEXROTA(pal16a_argb32,  UINT16, UINT32)
211TEXROTA(rgb15_argb32,  UINT16, UINT32)
212TEXROTA(rgb15pal_argb32,  UINT16, UINT32)
202213
203TEXROT(yuv16_argb32, UINT16, UINT32, OP_YUV16_ARGB32ROT)
204TEXROT(yuv16pal_argb32, UINT16, UINT32, OP_YUV16PAL_ARGB32ROT)
214TEXROTA(pal16_argb1555,  UINT16, UINT16)
215TEXROTA(rgb15_argb1555,  UINT16, UINT16)
216TEXROTA(rgb15pal_argb1555,  UINT16, UINT16)
217
218TEXROTA(argb32_rgb32, UINT32, UINT32)
219TEXROTA(pal16a_rgb32,  UINT16, UINT32)
220
221TEXROTA(yuv16_argb32rot, UINT16, UINT32)
222TEXROTA(yuv16pal_argb32rot, UINT16, UINT32)
trunk/src/osd/sdl/draw13.c
r243234r243235
4848
4949static inline bool is_opaque(const float &a)
5050{
51   return (a >= 1.0f);
51    return (a >= 1.0f);
5252}
5353
5454static inline bool is_transparent(const float &a)
5555{
56   return (a <  0.0001f);
56    return (a <  0.0001f);
5757}
5858
5959//============================================================
r243234r243235
6363
6464struct quad_setup_data
6565{
66   quad_setup_data()
67   : dudx(0), dvdx(0), dudy(0), dvdy(0), startu(0), startv(0),
68      rotwidth(0), rotheight(0)
69   {}
70   void compute(const render_primitive &prim);
66    quad_setup_data()
67    : dudx(0), dvdx(0), dudy(0), dvdy(0), startu(0), startv(0),
68      rotwidth(0), rotheight(0)
69    {}
70    void compute(const render_primitive &prim);
7171
7272   INT32           dudx, dvdx, dudy, dvdy;
7373   INT32           startu, startv;
r243234r243235
105105/* texture_info holds information about a texture */
106106class texture_info
107107{
108   friend class simple_list<texture_info>;
108    friend class simple_list<texture_info>;
109109public:
110   texture_info(SDL_Renderer *renderer, const render_texinfo &texsource, const quad_setup_data &setup, const UINT32 flags);
111   ~texture_info();
110    texture_info(SDL_Renderer *renderer, const render_texinfo &texsource, const quad_setup_data &setup, const UINT32 flags);
111    ~texture_info();
112112
113   void set_data(const render_texinfo &texsource, const UINT32 flags);
114   void render_quad(const render_primitive *prim, const int x, const int y);
115   bool matches(const render_primitive &prim, const quad_setup_data &setup);
113    void set_data(const render_texinfo &texsource, const UINT32 flags);
114    void render_quad(const render_primitive *prim, const int x, const int y);
115    bool matches(const render_primitive &prim, const quad_setup_data &setup);
116116
117   copy_info_t *compute_size_type();
117    copy_info_t *compute_size_type();
118118
119119   void                *m_pixels;            // pixels for the texture
120120   int                 m_pitch;
r243234r243235
125125   osd_ticks_t         m_last_access;
126126
127127   int raw_width() const { return m_texinfo.width; }
128   int raw_height() const { return m_texinfo.height; }
128    int raw_height() const { return m_texinfo.height; }
129129
130   texture_info *next() { return m_next; }
131   const render_texinfo &texinfo() const { return m_texinfo; }
132   render_texinfo &texinfo() { return m_texinfo; }
130    texture_info *next() { return m_next; }
131    const render_texinfo &texinfo() const { return m_texinfo; }
132    render_texinfo &texinfo() { return m_texinfo; }
133133
134   const HashT hash() const { return m_hash; }
135   const UINT32 flags() const { return m_flags; }
136   const bool is_pixels_owned() const { // do we own / allocated it ?
137      return false && ((m_sdl_access == SDL_TEXTUREACCESS_STATIC)
138            && (m_copyinfo->func != NULL)) ;
139   }
134    const HashT hash() const { return m_hash; }
135    const UINT32 flags() const { return m_flags; }
136    // FIXME:
137    const bool is_pixels_owned() const { // do we own / allocated it ?
138        return false && ((m_sdl_access == SDL_TEXTUREACCESS_STATIC)
139                && (m_copyinfo->func != NULL)) ;
140    }
140141
141142private:
142   Uint32              m_sdl_access;
143   SDL_Renderer *      m_renderer;
144   render_texinfo      m_texinfo;            // copy of the texture info
145   HashT               m_hash;               // hash value for the texture (must be >= pointer size)
146   UINT32              m_flags;              // rendering flags
143    Uint32              m_sdl_access;
144    SDL_Renderer *      m_renderer;
145    render_texinfo      m_texinfo;            // copy of the texture info
146    HashT               m_hash;               // hash value for the texture (must be >= pointer size)
147    UINT32              m_flags;              // rendering flags
147148
148   SDL_Texture *       m_texture_id;
149   int                 m_is_rotated;
149    SDL_Texture *       m_texture_id;
150    int                 m_is_rotated;
150151
151   int                 m_format;             // texture format
152   SDL_BlendMode       m_sdl_blendmode;
152    int                 m_format;             // texture format
153    SDL_BlendMode       m_sdl_blendmode;
153154
154   texture_info *      m_next;               // next texture in the list
155    texture_info *      m_next;               // next texture in the list
155156};
156157
157158/* sdl_info is the information about SDL for the current screen */
158159struct sdl_info
159160{
160   sdl_info()
161   : m_blittimer(0), m_renderer(NULL),
162      m_hofs(0), m_vofs(0),
163      m_resize_pending(0), m_resize_width(0), m_resize_height(0),
164      m_last_blit_time(0), m_last_blit_pixels(0)
165   {}
161    sdl_info()
162    : m_blittimer(0), m_renderer(NULL),
163      m_hofs(0), m_vofs(0),
164      m_resize_pending(0), m_resize_width(0), m_resize_height(0),
165      m_last_blit_time(0), m_last_blit_pixels(0)
166    {}
166167
167   void render_quad(texture_info *texture, const render_primitive *prim, const int x, const int y);
168    void render_quad(texture_info *texture, const render_primitive *prim, const int x, const int y);
168169
169   texture_info *texture_find(const render_primitive &prim, const quad_setup_data &setup);
170   texture_info *texture_update(const render_primitive &prim);
170    texture_info *texture_find(const render_primitive &prim, const quad_setup_data &setup);
171    texture_info *texture_update(const render_primitive &prim);
171172
172173   INT32           m_blittimer;
173174
r243234r243235
227228#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}
228229#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}
229230
231
230232static copy_info_t blit_info_default[] =
231233{
232234   /* no rotation */
r243234r243235
283285   ENTRY(RGB32_PALETTED,   ARGB8888,   4, 1, rot_rgb32pal_argb32),
284286   ENTRY(RGB32_PALETTED,   RGB888,     4, 1, rot_rgb32pal_argb32),
285287
286   ENTRY(YUY16,            ARGB8888,   4, 1, rot_yuv16_argb32),
287   ENTRY(YUY16,            RGB888,     4, 1, rot_yuv16_argb32),
288   ENTRY(YUY16,            ARGB8888,   4, 1, rot_yuv16_argb32rot),
289   ENTRY(YUY16,            RGB888,     4, 1, rot_yuv16_argb32rot),
288290
289   ENTRY(YUY16_PALETTED,   ARGB8888,   4, 1, rot_yuv16pal_argb32),
290   ENTRY(YUY16_PALETTED,   RGB888,     4, 1, rot_yuv16pal_argb32),
291   ENTRY(YUY16_PALETTED,   ARGB8888,   4, 1, rot_yuv16pal_argb32rot),
292   ENTRY(YUY16_PALETTED,   RGB888,     4, 1, rot_yuv16pal_argb32rot),
291293
292294   ENTRY(PALETTE16,        ARGB8888,   4, 1, rot_pal16_argb32),
293295   ENTRY(PALETTE16,        RGB888,     4, 1, rot_pal16_argb32),


Previous 199869 Revisions Next


© 1997-2024 The MAME Team