The priv->locked_rect is locking a surface the size of the playing video , and the local locking is for the size of the display. So in this case it is not a 'shadow' of the other lock, as the parameters are different.
Yep - there's real problem. I mean just "name shadowing". Never mind.
Now I want to answer all your questions in one post... Aaaarg
What's C "speed policy" about such declared pointers inside the for statement? Would it be better this this way (speed wise):
Should be non as its just a cast to make the compiler do the correct address calculation in the loop
I means that the both code snippets translate into the same ASM instructions, right? I hope the compiler doesn't do something dynamically for each from iteration when the pointer is declared inside it.
Yes, but pitch is guaranteed to be greater than width, so it is correct. Otherwise you would have to loop over the clear and probably get a slower solution, given that memset is normally well optimized on most systems.
I see. The memory after each line (if pitch > width) is reserved for cache, so you delete it as well. I'm sure there are no problems with that, I just wanted to make sure you know about it.