Previous 199869 Revisions Next

r20828 Friday 8th February, 2013 at 12:57:16 UTC by Angelo Salese
First pass in rewriting VDP2 bitmap layers. RGB32 being the first one
[src/mame/includes]stv.h
[src/mame/video]stvvdp2.c

trunk/src/mame/includes/stv.h
r20827r20828
387387
388388   void stv_vdp2_draw_basic_tilemap(bitmap_rgb32 &bitmap, const rectangle &cliprect);
389389   void stv_vdp2_draw_basic_bitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect);
390//   void draw_rgb16_bitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect);
391   void draw_rgb32_bitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect);
390392
391393   void stv_vdp2_drawgfxzoom(bitmap_rgb32 &dest_bmp,const rectangle &clip,gfx_element *gfx, UINT32 code,UINT32 color,int flipx,int flipy,int sx,int sy,int transparency,int transparent_color,int scalex, int scaley,int sprite_screen_width, int sprite_screen_height, int alpha);
392394   void stv_vdp2_drawgfxzoom_rgb555(bitmap_rgb32 &dest_bmp,const rectangle &clip,UINT32 code,UINT32 color,int flipx,int flipy,int sx,int sy,int transparency,int transparent_color,int scalex, int scaley,int sprite_screen_width, int sprite_screen_height, int alpha);
trunk/src/mame/video/stvvdp2.c
r20827r20828
27312731                  int x, x_index = x_index_base;
27322732                  for( x=sx; x<ex; x++ )
27332733                  {
2734               data = (source[(x_index>>16)*2] << 8) | source[(x_index>>16)*2+1];
2734                     data = (source[(x_index>>16)*2] << 8) | source[(x_index>>16)*2+1];
27352735                     b = pal5bit((data & 0x7c00) >> 10);
27362736                     g = pal5bit((data & 0x03e0) >> 5);
27372737                     r = pal5bit( data & 0x001f);
r20827r20828
29992999
30003000}
30013001
3002#define BITMAP_RGB32 4
3003
3004
3005#if 0
3006void saturn_state::draw_rgb16_bitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect)
3007{
3008   // ...
3009}
3010#endif
3011
3012void saturn_state::draw_rgb32_bitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect)
3013{
3014   int xsize, ysize;
3015   int xsrc,ysrc,xdst,ydst;
3016   int src_offs;
3017   UINT8* vram = m_vdp2.gfx_decode;
3018   UINT32 map_offset = stv2_current_tilemap.bitmap_map * 0x20000;
3019   int scrollx = stv2_current_tilemap.scrollx;
3020   int scrolly = stv2_current_tilemap.scrolly;
3021   int r,g,b;
3022   UINT32 dot_data;
3023
3024   /* TODO: clean this up. */
3025   xsize = (stv2_current_tilemap.bitmap_size & 2) ? 1024 : 512;
3026   ysize = (stv2_current_tilemap.bitmap_size & 1) ? 512 : 256;
3027
3028   for(ydst=cliprect.min_y;ydst<cliprect.max_y;ydst++)
3029   {
3030      for(xdst=cliprect.min_x;xdst<cliprect.max_x;xdst++)
3031      {
3032         if(stv_vdp2_window_process(xdst,ydst))
3033            continue;
3034
3035         xsrc = (xdst + scrollx) & (xsize-1);
3036         ysrc = (ydst + scrolly) & (ysize-1);
3037         src_offs = ((xsrc + (ysrc*xsize)) + map_offset) & 0x1ffff;
3038
3039         dot_data = (vram[4*src_offs+0]<<24)|(vram[4*src_offs+1]<<16)|(vram[4*src_offs+2]<<8)|(vram[4*src_offs+3]<<0);
3040
3041         if ((dot_data & 0x80000000) || (stv2_current_tilemap.transparency == STV_TRANSPARENCY_NONE))
3042         {
3043            b = ((dot_data & 0x00ff0000) >> 16);
3044            g = ((dot_data & 0x0000ff00) >> 8);
3045            r = ((dot_data & 0x000000ff) >> 0);
3046
3047            if(stv2_current_tilemap.fade_control & 1)
3048               stv_vdp2_compute_color_offset(&r,&g,&b,stv2_current_tilemap.fade_control & 2);
3049
3050            if ( stv2_current_tilemap.colour_calculation_enabled == 0 )
3051               bitmap.pix32(ydst, xdst) = MAKE_RGB(r, g, b);
3052            else
3053               bitmap.pix32(ydst, xdst) = alpha_blend_r32( bitmap.pix32(ydst, xdst), MAKE_RGB(r, g, b), stv2_current_tilemap.alpha );
3054         }
3055      }
3056   }
3057}
3058
3059
30023060void saturn_state::stv_vdp2_draw_basic_bitmap(bitmap_rgb32 &bitmap, const rectangle &cliprect)
30033061{
30043062//  if(LOG_VDP2) logerror ("bitmap enable %02x size %08x depth %08x\n", stv2_current_tilemap.layer_name, stv2_current_tilemap.bitmap_size, stv2_current_tilemap.colour_depth);
r20827r20828
30173075
30183076   if (!stv2_current_tilemap.enabled) return;
30193077
3078   /* new bitmap code, supposed to rewrite the old one. Not supposed to be clean, but EFFICIENT! */
3079   if(stv2_current_tilemap.incx == 0x10000 && stv2_current_tilemap.incy == 0x10000)
3080   {
3081      switch(stv2_current_tilemap.colour_depth)
3082      {
3083         case BITMAP_RGB32: draw_rgb32_bitmap(bitmap,cliprect); return;
3084      }
3085
3086      /* intentional fall-through*/
3087      popmessage("%d %s %s %s %s",stv2_current_tilemap.colour_depth,
3088                               stv2_current_tilemap.transparency == STV_TRANSPARENCY_NONE ? "no trans" : "trans",
3089                               stv2_current_tilemap.window_control & 6 ? "window" : "no window",
3090                               stv2_current_tilemap.colour_calculation_enabled ? "cc" : "no cc",
3091                               (stv2_current_tilemap.incx == 0x10000 && stv2_current_tilemap.incy == 0x10000) ? "no zoom" : "zoom");
3092   }
3093   else
3094   {
3095      /* intentional fall-through*/
3096      popmessage("%d %s %s %s %s",stv2_current_tilemap.colour_depth,
3097                               stv2_current_tilemap.transparency == STV_TRANSPARENCY_NONE ? "no trans" : "trans",
3098                               stv2_current_tilemap.window_control & 6 ? "window" : "no window",
3099                               stv2_current_tilemap.colour_calculation_enabled ? "cc" : "no cc",
3100                               (stv2_current_tilemap.incx == 0x10000 && stv2_current_tilemap.incy == 0x10000) ? "no zoom" : "zoom");
3101   }
3102
30203103   /* size for n0 / n1 */
30213104   switch (stv2_current_tilemap.bitmap_size)
30223105   {

Previous 199869 Revisions Next


© 1997-2024 The MAME Team