Beispiel #1
0
	virtual void Flush(void)
	{
		if (!Active() || !m_fb)
			return;

		if (IsTrueColor())
		{
			LOCK_PIXMAPS;
			while (cPixmapMemory *pm =
					dynamic_cast<cPixmapMemory *>(RenderPixmaps()))
			{
				const uint8_t *src = pm->Data();
				char *dst = m_fb + (Left() + pm->ViewPort().Left()) *
						(m_vinfo.bits_per_pixel / 8 ) +
						(Top() + pm->ViewPort().Top()) * m_finfo.line_length;

				for (int y = 0; y < pm->DrawPort().Height(); y++)
				{
					memcpy(dst, src, pm->DrawPort().Width() * sizeof(tColor));
					src += pm->DrawPort().Width() * sizeof(tColor);
					dst += m_finfo.line_length;
				}
#if APIVERSNUM >= 20110
				DestroyPixmap(pm);
#else
				delete pm;
#endif
			}
		}
		else
		{
			for (int i = 0; cBitmap *bitmap = GetBitmap(i); ++i)
			{
				int x1, y1, x2, y2;
				if (bitmap->Dirty(x1, y1, x2, y2))
				{
					char *dst = m_fb + (Left() + bitmap->X0() + x1) *
							(m_vinfo.bits_per_pixel / 8 ) +
							(Top() + bitmap->Y0() + y1) * m_finfo.line_length;

					for (int y = y1; y <= y2; ++y)
					{
						tColor *p = (tColor *)dst;
						for (int x = x1; x <= x2; ++x)
							*p++ = bitmap->GetColor(x, y);

						dst += m_finfo.line_length;
					}
					bitmap->Clean();
				}
			}
		}
	}
Beispiel #2
0
int __stdcall srv_2d(ioctl_t *io)
{
    u32_t *inp;
    u32_t *outp;

    inp = io->input;
    outp = io->output;

    switch(io->io_code)
    {
        case SRV_GETVERSION:
            if(io->out_size==4)
            {
                *outp = API_VERSION;
                return 0;
            }
            break;

        case PX_CREATE:
            if(io->inp_size==7)
                return CreatePixmap((pixmap_t*)inp);
            break;

        case PX_DESTROY:
            if(io->inp_size==7)
                return DestroyPixmap((pixmap_t*)inp);
            break;

        case PX_CLEAR:
            if(io->inp_size==2)
                return ClearPixmap((io_clear_t*)inp);
            break;

        case PX_DRAW_RECT:
            if(io->inp_size==7)
                return DrawRect((io_draw_t*)inp);
            break;

        case PX_FILL_RECT:
            if(io->inp_size==10)
                return FillRect((io_fill_t*)inp);
            break;

        case PX_LINE:
            if(io->inp_size==6)
                return Line((io_draw_t*)inp);
            break;

        case PX_BLIT:
            if(io->inp_size==8)
                return Blit((io_blit_t*)inp);
            break;

        case  PX_BLIT_TRANSPARENT:
            if(io->inp_size==9)
                return BlitTransparent((io_blit_t*)inp);
            break;

        case PX_BLIT_ALPHA:
            if(io->inp_size==9)
                return RadeonComposite((io_blit_t*)inp);
            break;

        default:
            return ERR_PARAM;
  };

  return ERR_PARAM;
}