Is there a way to improve the speed of the transfer between a back buffer and the visible hdc? I am using BitBlt but it seems that this copying process is the slowest part of my application at the moment. Here's a peek at my WM_PAINT routine as it is at the moment:



.elseif eax==WM_PAINT
invoke BeginPaint,hWin,addr ps
mov hDC,eax

;clear the visible area of the hMemDC
invoke GetClientRect,hWin,addr rect
invoke FillRect,hMemDC,addr rect,hBackBrush

invoke DrawCircles,hMemDC


invoke BitBlt,hDC,0,0,rect.right,rect.bottom,hMemDC,0,0,SRCCOPY

invoke EndPaint,hWin,addr ps


The DrawCircles procedure simply takes the coordinates of a list of circles and paints them to the specified DC using the Ellipse function. I've set it to only draw one circle at the moment and it doesn't take much time at all to draw it to the screen. The position of the circle is updated every 10 milliseconds. The most time consuming part of the routine is the BitBlt. If I maximize my dialog then it has to copy around 1310720 pixels from the memory back buffer to the visible hdc 100 times a second.

Is there a quick way to use a back buffer to update the screen every 10 ms or so?
Posted on 2004-06-13 11:30:01 by DeX
You could ofcourse draw the circle on the screen directly.
If you insist on double buffering (do you need it?), you are stuck to blt. With a decent videocard it should not take long though.
Perhaps it is faster if you use DirectDraw, then you are 100% sure that your backbuffer is already in videomemory, and the blt will be accelerated.
But the only way to avoid blt with double buffering is to go fullscreen and use page flipping.
Posted on 2004-06-13 11:51:40 by Scali
Ok thanks,

I don't definatley need double buffering. As I said I am only displaying one circle on the screen at the moment. If I draw directly to the screen then it is much quicker and I don't notice any flicker. I just initially wanted to use double buffering since I thought it would gaurentee no flickering and I thought in asm it would be pretty quick. I will just continue without using a double buffer then and see if flickering really becomes a problem.
Posted on 2004-06-13 12:26:02 by DeX
If you draw a circle through the GDI functions, it doesn't matter at all if you use asm or VB :P
It's not going to be any faster in asm, obviously.
Posted on 2004-06-13 13:10:52 by Scali