     @_filledTriangle pointA, pointB, pointC, color
     @_filledTriangle pointC, pointB, pointD, color
 
+  _bresenham: (pointA, pointB) ->
+    bresenham pointA[0], pointA[1],
+              pointB[0], pointB[1]
+
   # Draws a filled triangle
   _filledTriangle: (pointA, pointB, pointC, color) ->
     a = @_bresenham pointB, pointC

    # Filter out any points outside of the visible area
    # TODO: benchmark - is it more effective to filter double points, or does
    # it req more computing time than actually setting points multiple times?

    last = null
    points = a.concat(b).concat(c)
    .filter (point) => 0 <= point.y < @height

    position = @_project x, y
    @buffer.writeText text, position[0], position[1], color, center

  line: (from, to, color, width = 1) ->
    from = @_project from[0], from[1]
    to = @_project to[0], to[1]
    @_line from, to, color, width

  polyline: (points, color, width = 1) ->
    projected = (@_project point[0], point[1] for point in points)
    for i in [1...projected.length]
      @_line projected[i-1], projected[i], width, color

  setBackground: (color) ->
    @buffer.setGlobalBackground color
