added performance setting for image cache size
This commit is contained in:
parent
637509b5d4
commit
55572c59da
2 changed files with 6 additions and 3 deletions
|
@ -123,7 +123,10 @@ const (
|
||||||
var Performance = struct {
|
var Performance = struct {
|
||||||
IgnoreSelfIntersections bool
|
IgnoreSelfIntersections bool
|
||||||
AssumeConvex bool
|
AssumeConvex bool
|
||||||
}{}
|
ImageCacheSize int
|
||||||
|
}{
|
||||||
|
ImageCacheSize: 16_000_000,
|
||||||
|
}
|
||||||
|
|
||||||
// New creates a new canvas with the given viewport coordinates.
|
// New creates a new canvas with the given viewport coordinates.
|
||||||
// While all functions on the canvas use the top left point as
|
// While all functions on the canvas use the top left point as
|
||||||
|
|
|
@ -62,7 +62,7 @@ func (cv *Canvas) LoadImage(src interface{}) (*Image, error) {
|
||||||
return img, nil
|
return img, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cv.reduceCache(16_000_000)
|
cv.reduceCache(Performance.ImageCacheSize)
|
||||||
var srcImg image.Image
|
var srcImg image.Image
|
||||||
switch v := src.(type) {
|
switch v := src.(type) {
|
||||||
case image.Image:
|
case image.Image:
|
||||||
|
@ -105,7 +105,7 @@ func (cv *Canvas) getImage(src interface{}) *Image {
|
||||||
} else if img, ok := cv.images[src]; ok {
|
} else if img, ok := cv.images[src]; ok {
|
||||||
return img
|
return img
|
||||||
}
|
}
|
||||||
cv.reduceCache(16_000_000)
|
cv.reduceCache(Performance.ImageCacheSize)
|
||||||
switch v := src.(type) {
|
switch v := src.(type) {
|
||||||
case *Image:
|
case *Image:
|
||||||
return v
|
return v
|
||||||
|
|
Loading…
Reference in a new issue