mono/monodevelop — pull request #698 by DavidKarlas (2014-12-31 09:58:05+00:00)
Title: Optimized spaces and tabs rendering + fixed drawing glitch

First commit is for optimisation of rendering. Main improvement comes change that cario.Fill/Stroke are called once per line instead for each space/tab. Another is IndexToLineX use instead of IndexToPos which fetches structure which needs marshalling and few other optimisations like caching textEditorWidth value instead of calling textEditor.Allocation.Width for every space/tab.

Here are videos of difference on [Mac](https://hipchat.xamarin.com/files/1/109/u6BFDEr2CHxHjND/DecorateTabsAndSpacesMac.mov) and [Windows(look at scrollbars)](https://hipchat.xamarin.com/files/1/109/egY4NRQcWkR8Ksg/DrawSpacesAndTabsOptimization.mp4)

Second commit is fixing glitch... I'm guessing we all seen glitch with spaces and tabs rendering like this:
![image](https://cloud.githubusercontent.com/assets/774791/5586801/86cf3a6a-90d9-11e4-9f93-f6e81de409f2.png)

This happens because when scrolling very top line is still in Y minus... and flooring double value with (int)-3.6 results in -3 but System.Math.Floor(-3.6) results into -4. So if tab or space was drawn at time when line was in -Y area it was rendered at wrong position for 1 pixel, hence glitch..