It is not good idea to construct path object every time when call Draw method.
Is it better to keep path object and clear/set points every time?
Update:
One more question – what is difference between ‘reset’ and ‘rewind’ path object?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, it is better to reset the path and set the points rather than instatiating a new one. This prevents excessive allocation of memory, which can lead to frequent garbage collection. When the GC runs the graphics may pause for a moment, especially on older devices so you want to keep this to a minimum.
The
reset()andrewind()methods both have pretty much the same effect, except thatrewind()keeps the internal data structure intact, which can improve performance particularly if your path always has the same number of points.