From a90b79c9a9ceab14327c18083ca7632bda23dc1a Mon Sep 17 00:00:00 2001 From: Chris Tessum Date: Fri, 20 Mar 2015 10:58:15 -0500 Subject: [PATCH] Fixed vgimg origin to match other backends; this fixes a bug that was uncovered by PR #26. --- vg/vgimg/vgimg.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/vg/vgimg/vgimg.go b/vg/vgimg/vgimg.go index 38e1a74f..d9b5c003 100644 --- a/vg/vgimg/vgimg.go +++ b/vg/vgimg/vgimg.go @@ -53,12 +53,11 @@ func New(width, height vg.Length) *Canvas { // minimum point of the given image // should probably be 0,0. func NewImage(img draw.Image) *Canvas { - w := float64(img.Bounds().Max.X - img.Bounds().Min.X) h := float64(img.Bounds().Max.Y - img.Bounds().Min.Y) gc := draw2d.NewGraphicContext(img) gc.SetDPI(dpi) gc.Scale(1, -1) - gc.Translate(+0.5*w, -0.5*h) + gc.Translate(0, -h) return NewImageWithContext(img, gc) }