Could someone please explain what's going on in this rendered background function? Really appreciate it. What are all the variables for?? Seems random to me. The only main point in this function is the fillrect() and the brush right?
But if someone could explain the purpose of the other variables i would appreciate it. Eg. What's dx, dy, wf, wh, rowData for?
dx is 1 / width. this is a common technique for iteration over something in increments, eg if you want to do 10% of something per loop, you do it with this kind of percentage.
so if you look at the for loop on 10, w is 0- width, and now it multiplies by 1/width * increment... do you see what that does?
it does look like whoever coded this has too many redundant variables, and I can't answer what they were thinking. But dx and dy are probably necessary to do that kind of iteration, but that kind of iteration may not be necessary, not 100% sure but it looks... overcooked ... to me.
Ok. Thanks jonnin. I think I understand. What would you have done to simplify it since this is overcooked. I'm trying to simplify it hopefully. But do not know how to since this is such a complicated function. Do not know what to remove or add. Also, why do you think the person who coded this did this kind of incrementation. Why don't he just do a normal iteration without this kind of incrementation involved.
I would do what I understand easily and work it up from there.
lets start with wf and wh. is there any reason for them?
also, can you update a 'brush' instead of create/destroy rapidly in a loop? That looks like a performance hit, but that depends on what the things really are.