Skip to content

Commit

Permalink
Merge pull request #151 from carbocation/master
Browse files Browse the repository at this point in the history
Use the underlying *vector.Rasterizer.Draw() fast path when calling canvas.Draw()
  • Loading branch information
tdewolff authored Feb 21, 2022
2 parents 2b774ce + cd58c11 commit 5fc7941
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions renderers/rasterizer/rasterizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,14 @@ func (r *Rasterizer) RenderPath(path *canvas.Path, style canvas.Style, m canvas.
fill = fill.Translate(-float64(x)/dpmm, -float64(y)/dpmm)
fill.ToRasterizer(ras, r.resolution)
col := r.ColorSpace.ToLinear(style.FillColor)
ras.Draw(r, image.Rect(x, size.Y-y, x+w, size.Y-y-h), image.NewUniform(col), image.Point{dx, dy})
ras.Draw(r.Image, image.Rect(x, size.Y-y, x+w, size.Y-y-h), image.NewUniform(col), image.Point{dx, dy})
}
if style.HasStroke() {
ras := vector.NewRasterizer(w, h)
stroke = stroke.Translate(-float64(x)/dpmm, -float64(y)/dpmm)
stroke.ToRasterizer(ras, r.resolution)
col := r.ColorSpace.ToLinear(style.StrokeColor)
ras.Draw(r, image.Rect(x, size.Y-y, x+w, size.Y-y-h), image.NewUniform(col), image.Point{dx, dy})
ras.Draw(r.Image, image.Rect(x, size.Y-y, x+w, size.Y-y-h), image.NewUniform(col), image.Point{dx, dy})
}
}

Expand Down

0 comments on commit 5fc7941

Please sign in to comment.