From: "Enrico Weigelt, metux IT consult" <enrico.weig...@gr13.net>
--- .../common/io/sza/SimpleZippedAnimation.java | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/net/sf/freecol/common/io/sza/SimpleZippedAnimation.java b/src/net/sf/freecol/common/io/sza/SimpleZippedAnimation.java index 99af52b0ad6..f796be2e5b6 100644 --- a/src/net/sf/freecol/common/io/sza/SimpleZippedAnimation.java +++ b/src/net/sf/freecol/common/io/sza/SimpleZippedAnimation.java @@ -36,8 +36,6 @@ import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.function.Function; -import java.util.function.Predicate; -import java.util.function.ToIntFunction; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; @@ -118,13 +116,6 @@ public final class SimpleZippedAnimation implements Iterable<AnimationEvent> { } } - private static final Predicate<AnimationEvent> isIAEI = ae -> - ae instanceof ImageAnimationEvent; - private static final ToIntFunction<AnimationEvent> ifIAEIWidth = ae -> - ((ImageAnimationEventImpl)ae).getWidth(); - private static final ToIntFunction<AnimationEvent> ifIAEIHeight = ae -> - ((ImageAnimationEventImpl)ae).getHeight(); - /** The descriptor file to find in the zip files. */ private static final String ANIMATION_DESCRIPTOR_FILE = "animation.txt"; @@ -175,7 +166,17 @@ public final class SimpleZippedAnimation implements Iterable<AnimationEvent> { * @param evl The list of {@code AnimationEvent}s. */ private SimpleZippedAnimation(final List<AnimationEvent> evl) { - this(evl, max(evl, isIAEI, ifIAEIWidth), max(evl, isIAEI, ifIAEIHeight)); + this.events = evl; + int w = 0; + int h = 0; + for (AnimationEvent ae : evl) { + if (ae instanceof ImageAnimationEvent) { + w += Math.max(w, ((ImageAnimationEventImpl)ae).getWidth()); + h += Math.max(h, ((ImageAnimationEventImpl)ae).getHeight()); + } + } + this.width = w; + this.height = h; } /** -- 2.11.0.rc0.7.gbe5a750 ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ Freecol-developers mailing list Freecol-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freecol-developers