Skip to content

Commit

Permalink
added performance setting for image cache size
Browse files Browse the repository at this point in the history
  • Loading branch information
tfriedel6 committed Feb 14, 2020
1 parent 637509b commit 55572c5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion canvas.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,10 @@ const (
var Performance = struct {
IgnoreSelfIntersections bool
AssumeConvex bool
}{}
ImageCacheSize int
}{
ImageCacheSize: 16_000_000,
}

// New creates a new canvas with the given viewport coordinates.
// While all functions on the canvas use the top left point as
Expand Down
4 changes: 2 additions & 2 deletions images.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (cv *Canvas) LoadImage(src interface{}) (*Image, error) {
return img, nil
}
}
cv.reduceCache(16_000_000)
cv.reduceCache(Performance.ImageCacheSize)
var srcImg image.Image
switch v := src.(type) {
case image.Image:
Expand Down Expand Up @@ -105,7 +105,7 @@ func (cv *Canvas) getImage(src interface{}) *Image {
} else if img, ok := cv.images[src]; ok {
return img
}
cv.reduceCache(16_000_000)
cv.reduceCache(Performance.ImageCacheSize)
switch v := src.(type) {
case *Image:
return v
Expand Down

0 comments on commit 55572c5

Please sign in to comment.