added performance setting for image cache size

This commit is contained in:
Thomas Friedel 2020-02-14 16:30:40 +01:00
parent 637509b5d4
commit 55572c59da
2 changed files with 6 additions and 3 deletions

View file

@ -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

View file

@ -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:
@ -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