Permalink
Browse files

Use canvas directly for quads

  • Loading branch information...
cfcosta committed Sep 8, 2012
1 parent ca40c2b commit 576fba31752f221e4d3d22101ec5e3cfcfeb3c40
Showing with 8 additions and 1 deletion.
  1. +8 −1 src/javascripts/geometry.coffee
@@ -29,5 +29,12 @@ class window.Quad
constructor: (@point1, @width, @height, @color) ->
draw: (canvas) ->
- canvas.quad(@point1.x, @point1.y, @width, @height, @color)
+ 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()

0 comments on commit 576fba3

Please sign in to comment.