Browse files

Use fillRect instead of drawing the quad directly

  • Loading branch information...
1 parent 576fba3 commit d352471cafffec0576fbd69f78f53688f231f478 @cfcosta committed Sep 8, 2012
Showing with 2 additions and 8 deletions.
  1. +2 −8 src/javascripts/geometry.coffee
View
10 src/javascripts/geometry.coffee
@@ -26,15 +26,9 @@ class window.Triangle
canvas.context.fill()
class window.Quad
- constructor: (@point1, @width, @height, @color) ->
+ constructor: (@start, @width, @height, @color) ->
draw: (canvas) ->
canvas.context.fillStyle = @color
- canvas.context.beginPath()
- canvas.context.moveTo(@point1.x, @point1.y)
- canvas.context.lineTo(@point1.x + @width, @point1.y)
- canvas.context.lineTo(@point1.x + @width, @point1.y + @height)
- canvas.context.lineTo(@point1.x, @point1.y + @height)
- canvas.context.closePath()
- canvas.context.fill()
+ canvas.context.fillRect(@start.x, @start.y, @width, @height)

0 comments on commit d352471

Please sign in to comment.