删除 DecoratorController 中的背景图缓存 (#2710)

This commit is contained in:
Glavo 2024-01-31 01:09:11 +08:00 committed by GitHub
parent 7556ef21c4
commit 0bcda9eb46
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -183,8 +183,6 @@ public class DecoratorController {
return new Background(new BackgroundImage(image, BackgroundRepeat.NO_REPEAT, BackgroundRepeat.NO_REPEAT, BackgroundPosition.DEFAULT, new BackgroundSize(800, 480, false, false, true, true)));
}
private volatile Image defaultBackground;
/**
* Load background image from bg/, background.png, background.jpg, background.gif
*/
@ -199,12 +197,7 @@ public class DecoratorController {
if (!image.isPresent()) {
image = tryLoadImage(Paths.get("background.gif"));
}
return image.orElseGet(() -> {
if (defaultBackground == null)
defaultBackground = newBuiltinImage("/assets/img/background.jpg");
return defaultBackground;
});
return image.orElseGet(() -> newBuiltinImage("/assets/img/background.jpg"));
}
private Optional<Image> randomImageIn(Path imageDir) {