mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-09-17 15:57:18 -04:00
删除 DecoratorController 中的背景图缓存 (#2710)
This commit is contained in:
parent
7556ef21c4
commit
0bcda9eb46
@ -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)));
|
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
|
* Load background image from bg/, background.png, background.jpg, background.gif
|
||||||
*/
|
*/
|
||||||
@ -199,12 +197,7 @@ public class DecoratorController {
|
|||||||
if (!image.isPresent()) {
|
if (!image.isPresent()) {
|
||||||
image = tryLoadImage(Paths.get("background.gif"));
|
image = tryLoadImage(Paths.get("background.gif"));
|
||||||
}
|
}
|
||||||
|
return image.orElseGet(() -> newBuiltinImage("/assets/img/background.jpg"));
|
||||||
return image.orElseGet(() -> {
|
|
||||||
if (defaultBackground == null)
|
|
||||||
defaultBackground = newBuiltinImage("/assets/img/background.jpg");
|
|
||||||
return defaultBackground;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Optional<Image> randomImageIn(Path imageDir) {
|
private Optional<Image> randomImageIn(Path imageDir) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user