Skip to content

Commit f28fffa

Browse files
committed
Cache the second image.
1 parent c732bae commit f28fffa

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

j2me/media/graphics/animation/image/AllBinaryAndroidImageRotationJavaLibraryM/src/main/java/org/allbinary/animation/image/AllBinaryAndroidImageRotationAnimationFactory.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,19 @@ public AllBinaryAndroidImageRotationAnimationFactory(final Image image, final in
9999
this.angleIncrement = angleIncrement;
100100
}
101101

102+
private Image secondImage = null;
103+
102104
@Override
103105
public Animation getInstance(final int instanceId) throws Exception
104106
{
105107
final Image scaledImage = animationFactoryImageScaleUtil.createImage(this.getImage(),
106108
this.animationFactoryInitializationVisitor.width, this.animationFactoryInitializationVisitor.height,
107109
this.scaleProperties.scaleWidth, this.scaleProperties.scaleHeight);
108-
final Image copyOfScaledImage = ImageCopyUtil.getInstance().createImage(scaledImage);
109-
//final Image scaledImage = this.getImage();
110-
//final Image copyOfScaledImage = ImageCopyUtil.getInstance().createImage(scaledImage);
110+
// final Image copyOfScaledImage = ImageCopyUtil.getInstance().createImage(scaledImage);
111+
Image copyOfScaledImage = secondImage;
112+
if(copyOfScaledImage == null) {
113+
secondImage = copyOfScaledImage = ImageCopyUtil.getInstance().createImage(scaledImage);
114+
}
111115

112116
if (this.animationFactoryInitializationVisitor.dx != 0 || this.animationFactoryInitializationVisitor.dy != 0) {
113117

0 commit comments

Comments
 (0)