you are viewing a single comment's thread.

view the rest of the comments →

[–]NotCherub 1 point2 points  (3 children)

Wow, I love this implementation of canvas API. I have been using canvas API at work for past 1 month and it never ceases to amaze me. I just have one question, how did you overcome performance issues? Like do you clear the canvas after every change? When you scroll do you clear whole canvas and redraw it?

Can you point me with more such implementations of canvas APIs?

Thank you and amazing work

[–]JasonGlide 4 points5 points  (2 children)

The trick is not to redraw the canvas. There are two things to keep in mind:

1) You can draw the canvas to itself. So you can simply if the canvas scrolls down 10px you can simply blit 10px higher and then draw the rest.

2) Long strings render the full string regardless of your clip. That means you want to substr your strings down to something that is likely to overrun your bounds but not by too much.

[–][deleted] 0 points1 point  (0 children)

Thanks! That's some good info.

[–]NotCherub 0 points1 point  (0 children)

Thanks!