Refactor polygon drawing code

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
Code cleanup

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>