Previous 199869 Revisions Next

r30951 Thursday 12th June, 2014 at 03:11:37 UTC by R. Belmont
SDL: fix -prescale 0.153 regression. [R. Belmont]
[src/osd/sdl]drawogl.c

trunk/src/osd/sdl/drawogl.c
r30950r30951
22842284//  copyline_palette16
22852285//============================================================
22862286
2287INLINE void copyline_palette16(UINT32 *dst, const UINT16 *src, int width, const rgb_t *palette, int xborderpix)
2287INLINE void copyline_palette16(UINT32 *dst, const UINT16 *src, int width, const rgb_t *palette, int xborderpix, int xprescale)
22882288{
22892289   int x;
22902290
r30950r30951
22922292   if (xborderpix)
22932293      *dst++ = 0xff000000 | palette[*src];
22942294   for (x = 0; x < width; x++)
2295      *dst++ = 0xff000000 | palette[*src++];
2295   {
2296      int srcpix = *src++;
2297      for (int x2 = 0; x2 < xprescale; x2++)
2298         *dst++ = 0xff000000 | palette[srcpix];
2299   }
22962300   if (xborderpix)
22972301      *dst++ = 0xff000000 | palette[*--src];
22982302}
r30950r30951
23032307//  copyline_palettea16
23042308//============================================================
23052309
2306INLINE void copyline_palettea16(UINT32 *dst, const UINT16 *src, int width, const rgb_t *palette, int xborderpix)
2310INLINE void copyline_palettea16(UINT32 *dst, const UINT16 *src, int width, const rgb_t *palette, int xborderpix, int xprescale)
23072311{
23082312   int x;
23092313
r30950r30951
23112315   if (xborderpix)
23122316      *dst++ = palette[*src];
23132317   for (x = 0; x < width; x++)
2314      *dst++ = palette[*src++];
2318   {
2319      int srcpix = *src++;
2320      for (int x2 = 0; x2 < xprescale; x2++)
2321         *dst++ = palette[srcpix];
2322   }
23152323   if (xborderpix)
23162324      *dst++ = palette[*--src];
23172325}
r30950r30951
23222330//  copyline_rgb32
23232331//============================================================
23242332
2325INLINE void copyline_rgb32(UINT32 *dst, const UINT32 *src, int width, const rgb_t *palette, int xborderpix)
2333INLINE void copyline_rgb32(UINT32 *dst, const UINT32 *src, int width, const rgb_t *palette, int xborderpix, int xprescale)
23262334{
23272335   int x;
23282336
r30950r30951
23392347      for (x = 0; x < width; x++)
23402348      {
23412349         rgb_t srcpix = *src++;
2342         *dst++ = 0xff000000 | palette[0x200 + srcpix.r()] | palette[0x100 + srcpix.g()] | palette[srcpix.b()];
2350         for (int x2 = 0; x2 < xprescale; x2++)
2351         {
2352            *dst++ = 0xff000000 | palette[0x200 + srcpix.r()] | palette[0x100 + srcpix.g()] | palette[srcpix.b()];
2353         }
23432354      }
23442355      if (xborderpix)
23452356      {
r30950r30951
23542365      if (xborderpix)
23552366         *dst++ = 0xff000000 | *src;
23562367      for (x = 0; x < width; x++)
2357         *dst++ = 0xff000000 | *src++;
2368      {
2369         rgb_t srcpix = *src++;
2370
2371         for (int x2 = 0; x2 < xprescale; x2++)
2372         {
2373            *dst++ = 0xff000000 | srcpix;
2374         }
2375      }
23582376      if (xborderpix)
23592377         *dst++ = 0xff000000 | *--src;
23602378   }
r30950r30951
23642382//  copyline_argb32
23652383//============================================================
23662384
2367INLINE void copyline_argb32(UINT32 *dst, const UINT32 *src, int width, const rgb_t *palette, int xborderpix)
2385INLINE void copyline_argb32(UINT32 *dst, const UINT32 *src, int width, const rgb_t *palette, int xborderpix, int xprescale)
23682386{
23692387   int x;
23702388
r30950r30951
23812399      for (x = 0; x < width; x++)
23822400      {
23832401         rgb_t srcpix = *src++;
2384         *dst++ = (srcpix & 0xff000000) | palette[0x200 + srcpix.r()] | palette[0x100 + srcpix.g()] | palette[srcpix.b()];
2402         for (int x2 = 0; x2 < xprescale; x2++)
2403            *dst++ = (srcpix & 0xff000000) | palette[0x200 + srcpix.r()] | palette[0x100 + srcpix.g()] | palette[srcpix.b()];
23852404      }
23862405      if (xborderpix)
23872406      {
r30950r30951
23962415      if (xborderpix)
23972416         *dst++ = *src;
23982417      for (x = 0; x < width; x++)
2399         *dst++ = *src++;
2418      {
2419         rgb_t srcpix = *src++;
2420         for (int x2 = 0; x2 < xprescale; x2++)
2421            *dst++ = srcpix;
2422      }
24002423      if (xborderpix)
24012424         *dst++ = *--src;
24022425   }
r30950r30951
24472470//  copyline_yuy16_to_argb
24482471//============================================================
24492472
2450INLINE void copyline_yuy16_to_argb(UINT32 *dst, const UINT16 *src, int width, const rgb_t *palette, int xborderpix)
2473INLINE void copyline_yuy16_to_argb(UINT32 *dst, const UINT16 *src, int width, const rgb_t *palette, int xborderpix, int xprescale)
24512474{
24522475   int x;
24532476
r30950r30951
24722495         UINT16 srcpix1 = *src++;
24732496         UINT8 cb = srcpix0 & 0xff;
24742497         UINT8 cr = srcpix1 & 0xff;
2475         *dst++ = ycc_to_rgb(palette[0x000 + (srcpix0 >> 8)], cb, cr);
2476         *dst++ = ycc_to_rgb(palette[0x000 + (srcpix1 >> 8)], cb, cr);
2498         for (int x2 = 0; x2 < xprescale/2; x2++)
2499         {
2500            *dst++ = ycc_to_rgb(palette[0x000 + (srcpix0 >> 8)], cb, cr);
2501            *dst++ = ycc_to_rgb(palette[0x000 + (srcpix1 >> 8)], cb, cr);
2502         }
24772503      }
24782504      if (xborderpix)
24792505      {
r30950r30951
25042530         UINT16 srcpix1 = *src++;
25052531         UINT8 cb = srcpix0 & 0xff;
25062532         UINT8 cr = srcpix1 & 0xff;
2507         *dst++ = ycc_to_rgb(srcpix0 >> 8, cb, cr);
2508         *dst++ = ycc_to_rgb(srcpix1 >> 8, cb, cr);
2533         for (int x2 = 0; x2 < xprescale/2; x2++)
2534         {
2535            *dst++ = ycc_to_rgb(srcpix0 >> 8, cb, cr);
2536            *dst++ = ycc_to_rgb(srcpix1 >> 8, cb, cr);
2537         }
25092538      }
25102539      if (xborderpix)
25112540      {
r30950r30951
25512580   // when nescesarry copy (and convert) the data
25522581   if (!texture->nocopy)
25532582   {
2554      int y;
2583      int y, y2;
25552584      UINT8 *dst;
25562585
25572586      for (y = 0; y < texsource->height; y++)
25582587      {
2559         dst = (UINT8 *)(texture->data + (y * texture->yprescale + texture->borderpix) * texture->rawwidth);
2560
2561         switch (PRIMFLAG_GET_TEXFORMAT(flags))
2588         for (y2 = 0; y2 < texture->yprescale; y2++)
25622589         {
2563            case TEXFORMAT_PALETTE16:
2564               copyline_palette16((UINT32 *)dst, (UINT16 *)texsource->base + y * texsource->rowpixels, texsource->width, texsource->palette, texture->borderpix);
2565               break;
2590            dst = (UINT8 *)(texture->data + (y * texture->yprescale + texture->borderpix + y2) * texture->rawwidth);
25662591
2567            case TEXFORMAT_PALETTEA16:
2568               copyline_palettea16((UINT32 *)dst, (UINT16 *)texsource->base + y * texsource->rowpixels, texsource->width, texsource->palette, texture->borderpix);
2569               break;
2592            switch (PRIMFLAG_GET_TEXFORMAT(flags))
2593            {
2594               case TEXFORMAT_PALETTE16:
2595                  copyline_palette16((UINT32 *)dst, (UINT16 *)texsource->base + y * texsource->rowpixels, texsource->width, texsource->palette, texture->borderpix, texture->xprescale);
2596                  break;
25702597
2571            case TEXFORMAT_RGB32:
2572               copyline_rgb32((UINT32 *)dst, (UINT32 *)texsource->base + y * texsource->rowpixels, texsource->width, texsource->palette, texture->borderpix);
2573               break;
2598               case TEXFORMAT_PALETTEA16:
2599                  copyline_palettea16((UINT32 *)dst, (UINT16 *)texsource->base + y * texsource->rowpixels, texsource->width, texsource->palette, texture->borderpix, texture->xprescale);
2600                  break;
25742601
2575            case TEXFORMAT_ARGB32:
2576               copyline_argb32((UINT32 *)dst, (UINT32 *)texsource->base + y * texsource->rowpixels, texsource->width, texsource->palette, texture->borderpix);
2577               break;
2602               case TEXFORMAT_RGB32:
2603                  copyline_rgb32((UINT32 *)dst, (UINT32 *)texsource->base + y * texsource->rowpixels, texsource->width, texsource->palette, texture->borderpix, texture->xprescale);
2604                  break;
25782605
2579            case TEXFORMAT_YUY16:
2580               copyline_yuy16_to_argb((UINT32 *)dst, (UINT16 *)texsource->base + y * texsource->rowpixels, texsource->width, texsource->palette, texture->borderpix);
2581               break;
2606               case TEXFORMAT_ARGB32:
2607                  copyline_argb32((UINT32 *)dst, (UINT32 *)texsource->base + y * texsource->rowpixels, texsource->width, texsource->palette, texture->borderpix, texture->xprescale);
2608                  break;
25822609
2583            default:
2584               osd_printf_error("Unknown texture blendmode=%d format=%d\n", PRIMFLAG_GET_BLENDMODE(flags), PRIMFLAG_GET_TEXFORMAT(flags));
2585               break;
2610               case TEXFORMAT_YUY16:
2611                  copyline_yuy16_to_argb((UINT32 *)dst, (UINT16 *)texsource->base + y * texsource->rowpixels, texsource->width, texsource->palette, texture->borderpix, texture->xprescale);
2612                  break;
2613
2614               default:
2615                  osd_printf_error("Unknown texture blendmode=%d format=%d\n", PRIMFLAG_GET_BLENDMODE(flags), PRIMFLAG_GET_TEXFORMAT(flags));
2616                  break;
2617            }
25862618         }
25872619      }
25882620   }

Previous 199869 Revisions Next


© 1997-2024 The MAME Team