Coming up with a really good answer to this question ("what pixels should we light up?") is really tricky, and people who design real graphics hardware spend an enormous amount of time making sure that their definitions properly account for all sorts of corner cases and interactions between different features of rasterization. For instance, what's the right thing to do if the endpoints are in the same placeâ€”should you light up a pixel, or not? How do you make sure there aren't gaps between line segments that share an endpoint? Etc.
Microsoft gives a nice illustration of some of the intricacies of line rasterization rules here: https://msdn.microsoft.com/en-us/library/windows/desktop/cc627092(v=vs.85).aspx