Skip to main content
GameDev.net gamedev.net
🔒 Locked

copy image buffer into screen buffer

Started by Austrian Coder Jan 11, 2005 at 6:08 PM 0 replies 800+ views
Original Post
Austrian Coder
Austrian Coder
Hi guys. I am wokring at the moment on some onscrren menu handling routines for a mutlimeda system. Now i have a framebuffer (720 x 480) and want to copy in a image buffer. I am using this old code - not from me, a person before me coded this.
[SOURCE]
void CopyBlockIntoOSD(int linewidth, int x0, int y0, int x1, int y1, u_char *data)
{
	int i;
	int w;
	u_char *cp;
	u_char *sp = data;


	// linewidth contains the width of one line in the data block,
	// linewidth<=0 uses blockwidth as linewidth
	if (linewidth <= 0)
	{
		w = m_windows[m_lastwindow].x1 - m_windows[m_lastwindow].x0;
	}
	else
	{
		w = linewidth;
	}
	
    for (i = y0; i <= y1; ++i) 
	{
        cp = &m_OSD[i*OSDWIDTH + x0];
        if ((cp+x1-x0+1) < &m_OSD[OSDWIDTH * OSDHEIGHT-1]) 
		{
            for (int xx=0; xx <= (x1-x0); xx++) 
			{
                *(cp+xx) = m_windows[m_lastwindow].colors[*(sp+xx) & 0x0f];
            }
        } 
		else 
		{
            continue;
        }
        sp += w;
	}
}
[/SOURCE]
Now can somebody tell me if there is a faster methode for doing this? Thanks, AC

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.