replace gc.Current.Path.Clear() with gc.Current.Path = draw2d.NewPathStorage(); fixes #61
This commit is contained in:
parent
781a0defe5
commit
08a6c87a0b
5 changed files with 5 additions and 11 deletions
|
@ -199,7 +199,7 @@ func (gc *GraphicContext) Stroke(paths ...*draw2d.PathStorage) {
|
|||
pathConverter.Convert(paths...)
|
||||
|
||||
gc.paint(gc.strokeRasterizer, gc.Current.StrokeColor)
|
||||
gc.Current.Path.Clear()
|
||||
gc.Current.Path = draw2d.NewPathStorage()
|
||||
}
|
||||
|
||||
func (gc *GraphicContext) Fill(paths ...*draw2d.PathStorage) {
|
||||
|
@ -211,7 +211,7 @@ func (gc *GraphicContext) Fill(paths ...*draw2d.PathStorage) {
|
|||
pathConverter.Convert(paths...)
|
||||
|
||||
gc.paint(gc.fillRasterizer, gc.Current.FillColor)
|
||||
gc.Current.Path.Clear()
|
||||
gc.Current.Path = draw2d.NewPathStorage()
|
||||
}
|
||||
|
||||
func (gc *GraphicContext) FillStroke(paths ...*draw2d.PathStorage) {
|
||||
|
|
|
@ -205,7 +205,7 @@ func (gc *GraphicContext) draw(style string, paths ...*draw2d.PathStorage) {
|
|||
pathConverter := NewPathConverter(gc.pdf)
|
||||
pathConverter.Convert(paths...)
|
||||
gc.pdf.DrawPath(style)
|
||||
gc.Current.Path.Clear()
|
||||
gc.Current.Path = draw2d.NewPathStorage()
|
||||
}
|
||||
|
||||
// overwrite StackGraphicContext methods
|
||||
|
|
2
image.go
2
image.go
|
@ -269,7 +269,7 @@ func (gc *ImageGraphicContext) paint(rasterizer *raster.Rasterizer, color color.
|
|||
gc.painter.SetColor(color)
|
||||
rasterizer.Rasterize(gc.painter)
|
||||
rasterizer.Clear()
|
||||
gc.Current.Path.Clear()
|
||||
gc.Current.Path = NewPathStorage()
|
||||
}
|
||||
|
||||
// Stroke strokes the paths with the color specified by SetStrokeColor
|
||||
|
|
|
@ -32,12 +32,6 @@ func NewPathStorage() (p *PathStorage) {
|
|||
return
|
||||
}
|
||||
|
||||
func (p *PathStorage) Clear() {
|
||||
p.Commands = p.Commands[0:0]
|
||||
p.Vertices = p.Vertices[0:0]
|
||||
return
|
||||
}
|
||||
|
||||
func (p *PathStorage) appendToPath(cmd PathCmd, Vertices ...float64) {
|
||||
if cap(p.Vertices) <= len(p.Vertices)+6 {
|
||||
a := make([]PathCmd, len(p.Commands), cap(p.Commands)+256)
|
||||
|
|
|
@ -125,7 +125,7 @@ func (gc *StackGraphicContext) GetFontData() FontData {
|
|||
}
|
||||
|
||||
func (gc *StackGraphicContext) BeginPath() {
|
||||
gc.Current.Path.Clear()
|
||||
gc.Current.Path = NewPathStorage()
|
||||
}
|
||||
|
||||
func (gc *StackGraphicContext) IsEmpty() bool {
|
||||
|
|
Loading…
Reference in a new issue