What is faster with PictureBox? Many small redraws or complete redraw.
Posted
by kornelijepetak
on Stack Overflow
See other posts from Stack Overflow
or by kornelijepetak
Published on 2010-05-12T06:01:21Z
Indexed on
2010/05/12
6:04 UTC
Read the original article
Hit count: 310
I have a PictureBox (WinMobile 6 WinForm) on which I draw some images. There is a background image that goes in the background and it does not change. However objects that are drawn on the picturebox are moving during the application so I need to refresh the background.
Since items that are redrawn fill from 50% to 80% of the surface, the question is which of the two is faster:
1) Redraw only parts of the background image that have been changed (previous+next location of the moving object).
2) Redraw complete background and then draw all the objects in their current position.
Now, the reason for asking is because I am not sure how much of processor power is needed for a single drawImage operation and what are the time consuming factors.
I am aware if there is almost complete coverage of the background, it would be stupid to redraw portions of it, because by drawing portions I will have drawn the complete picture. But since sometimes only half of the image had changed (some objects remained in their old position), it may (perhaps) be benefitial to redraw only those regions. But I need your insight on this...
Thanks.
© Stack Overflow or respective owner