Beispiel #1
0
INLINE void blitscreen_dirty0_color16_horzscale(struct osd_bitmap *bitmap)
{
    unsigned short *buffer_scr = SCREEN16 + gfx_xoffset + (320*gfx_yoffset);
    unsigned short *buffer_mem = ((unsigned short*)(bitmap->line[skiplines])) + skipcolumns;
    int buffer_mem_offset = ((bitmap->line[1] - bitmap->line[0])>>1)-gfx_width;
    int step,i;
    int x,y=gfx_display_lines;

    if (gfx_width>320)
    {
        /* Strech */
        step=320/(gfx_width-320);
        do {
            x=320;
            i=step;
            do {
                *buffer_scr++=*buffer_mem++;
                x--;
                i--;
                if (!i) {
                    if (x) {
                        *buffer_scr++=mix_color16(*buffer_mem++,*buffer_mem++);
                        x--;
                        i=step-1;
                    }
                    else {
                        buffer_mem++;
                        i=step;
                    }
                }
            } while (x);
            buffer_mem+=buffer_mem_offset;
            y--;
        } while (y);
    }
    else
    {
        /* Scale */
        step=320/(320-gfx_width);
        do {
            x=320;
            i=1;
            do {
                i--;
                if (i) {
                    *buffer_scr++=*buffer_mem++;
                }
                else {
                    *buffer_scr++=mix_color16(buffer_mem[0],buffer_mem[-1]);
                    i=step;
                }
                x--;
            } while (x);
            buffer_mem+=buffer_mem_offset;
            y--;
        } while (y);
    }

    FLIP_VIDEO;
}
INLINE void blitscreen_dirty0_color16_horzscale(struct osd_bitmap *bitmap)
{
	unsigned short *buffer_scr = SCREEN16 + gfx_xoffset + (DINGOO_SCREEN_WIDTH*gfx_yoffset);
	unsigned short *buffer_mem = ((unsigned short*)(bitmap->line[skiplines])) + skipcolumns;
	int buffer_mem_offset = ((bitmap->line[1] - bitmap->line[0])>>1)-gfx_width;
	int step,i;
	int x,y=gfx_display_lines;
	
	if (gfx_width>DINGOO_SCREEN_WIDTH)
	{
		/* Scale Up */
		step=DINGOO_SCREEN_WIDTH/(gfx_width-DINGOO_SCREEN_WIDTH);
		do {
			x=DINGOO_SCREEN_WIDTH; i=step;
			do {
				*buffer_scr++=*buffer_mem++;
				x--; i--;
				if (!i) { if (x) { *buffer_scr++=mix_color16(*buffer_mem++,*buffer_mem++); x--; i=step-1; } else { buffer_mem++; i=step; } }
			} while (x);
			buffer_mem+=buffer_mem_offset;		
			y--;
		} while (y);
	}
	else
	{
		/* Scale Down */
		step=DINGOO_SCREEN_WIDTH/(DINGOO_SCREEN_WIDTH-gfx_width);
		do {
			x=DINGOO_SCREEN_WIDTH; i=1;
			do {
				i--;
				if (i) { *buffer_scr++=*buffer_mem++; }
				else { *buffer_scr++=mix_color16(buffer_mem[0],buffer_mem[-1]); i=step; }
				x--;
			} while (x);						
			buffer_mem+=buffer_mem_offset;		
			y--;
		} while (y);
	}
	
	FLUSH_CACHE
}
INLINE void blitscreen_dirty0_palettized16_fitscale_merge0(struct osd_bitmap *bitmap)
{
  unsigned int lines=gfx_display_lines;
  unsigned int columns=gfx_display_columns;
  unsigned int src_width=(bitmap->line[1] - bitmap->line[0])>>1;
  unsigned int dst_width=gfx_width;
  unsigned short *src=((unsigned short*)(bitmap->line[skiplines])) + skipcolumns;
  unsigned short *dst=SCREEN16 + gfx_xoffset + (gfx_yoffset * gfx_width);

  unsigned int _iAddY =iAddY;
  unsigned int _iModuloY = iModuloY;
  unsigned int _iAddX = iAddX;
  unsigned int _iModuloX = iModuloX;
  
  int accumulatorY = 0;

  for (unsigned int h = 0; h < lines; h++)
  {

    accumulatorY += _iAddY;
    if (accumulatorY >= _iModuloY || h == lines - 1)
    {
      register unsigned int pixel = 0;
      register unsigned short *dstX=dst;
      register unsigned short *srcX=src;
      register int accumulatorX = 0;

      accumulatorY -= _iModuloY;

      for (register int w = columns - 1; w >= 0; w--)
      {
        register unsigned int srcPixel = palette_16bit_lookup[*srcX++];
        if (accumulatorX >= _iAddX)
        {
          srcPixel = mix_color16(pixel, srcPixel);
        }
        pixel = srcPixel;
    
        accumulatorX += _iAddX;
        if (accumulatorX >= _iModuloX || w == 0)
        {
          *dstX++ = pixel;
          accumulatorX -= _iModuloX;
        }
      }
      dst += dst_width;
    }

    src += src_width;
  }
}
INLINE void blitscreen_dirty0_color16_halfscale(struct osd_bitmap *bitmap)
{
        int x,y;
        unsigned int lines=gfx_display_lines>>1;
        int width=bitmap->line[1] - bitmap->line[0];
        int columns=(gfx_display_columns>>1);
        unsigned short *lb = ((unsigned short*)(bitmap->line[skiplines])) + skipcolumns;
        unsigned short *address = SCREEN16 + (gfx_xoffset/2) + ((gfx_yoffset/2) * gfx_width);

        for (y = 0; y < lines; y++)
        {
                for (x = 0; x < columns; x++)
                {
                        address[x] = mix_color16(lb[(x<<1)], lb[(x<<1)+1]);
                }
                lb+=width;
                address+=gfx_width;
        }

        FLUSH_CACHE
}
INLINE void blitscreen_dirty0_color16_fitscale_merge1(struct osd_bitmap *bitmap)
{
  unsigned int lines=gfx_display_lines;
  unsigned int columns=gfx_display_columns;
  unsigned int src_width=(bitmap->line[1] - bitmap->line[0])>>1;
  unsigned int dst_width=gfx_width;
  unsigned short *src=((unsigned short*)(bitmap->line[skiplines])) + skipcolumns;
  unsigned short *dst=SCREEN16 + gfx_xoffset + (gfx_yoffset * gfx_width);

  unsigned int _iAddY =iAddY;
  unsigned int _iModuloY = iModuloY;
  unsigned int _iAddX = iAddX;
  unsigned int _iModuloX = iModuloX;
  
  unsigned int merge = 0;
  int accumulatorY = 0;

  for (unsigned int h = 0; h < lines; h++)
  {
    register unsigned int pixel = 0;
    register unsigned short *dstX=dst;
    register unsigned short *srcX=src;
    register int accumulatorX = 0;

    for (register int w = columns - 1; w >= 0; w--)
    {
      register unsigned int srcPixel = *srcX++;
      if (accumulatorX >= _iAddX)
      {
        srcPixel = mix_color16(pixel, srcPixel);
      }
      pixel = srcPixel;
  
      accumulatorX += _iAddX;
      if (accumulatorX >= _iModuloX || w == 0)
      {
        if (merge)
        {
           pixel = mix_color16(*dstX, pixel);
        }
        *dstX = pixel;
        dstX++;
        accumulatorX -= _iModuloX;
      }
    }

    accumulatorY += _iAddY;
    if (accumulatorY >= _iModuloY || h == lines - 1)
    {
      dst += dst_width;
      merge = 0;
      accumulatorY -= _iModuloY;
    }
    else
    {
      merge = 1;
    }
    src += src_width; // Next src line
  }

}