skin: added ProfileSkinImageRegistry 39/10639/1
authorGiWoong Kim <giwoong.kim@samsung.com>
Mon, 30 Sep 2013 12:17:01 +0000 (21:17 +0900)
committerGiWoong Kim <giwoong.kim@samsung.com>
Tue, 8 Oct 2013 06:12:53 +0000 (15:12 +0900)
Change-Id: I618d68568c7ad31187d33c269033d86dd6d378a1
Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com>
tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java
tizen/src/skin/client/src/org/tizen/emulator/skin/custom/GeneralKeyWindow.java
tizen/src/skin/client/src/org/tizen/emulator/skin/image/ImageRegistry.java
tizen/src/skin/client/src/org/tizen/emulator/skin/image/ProfileSkinImageRegistry.java [new file with mode: 0644]
tizen/src/skin/client/src/org/tizen/emulator/skin/layout/GeneralPurposeSkinComposer.java
tizen/src/skin/client/src/org/tizen/emulator/skin/layout/ProfileSpecificSkinComposer.java
tizen/src/skin/client/src/org/tizen/emulator/skin/menu/KeyWindowKeeper.java
tizen/src/skin/client/src/org/tizen/emulator/skin/util/SkinUtil.java

index b39ee05..9242ea9 100755 (executable)
@@ -251,14 +251,12 @@ public class EmulatorSkin {
 
                /* build a skin layout */
                if (skinInfo.isGeneralPurposeSkin() == false) {
-                       skinComposer = new ProfileSpecificSkinComposer(config, this, shell,
-                                       currentState, imageRegistry, communicator);
+                       skinComposer = new ProfileSpecificSkinComposer(config, this);
 
                        ((ProfileSpecificSkinComposer) skinComposer)
                                        .addProfileSpecificListener(shell);
                } else { /* general purpose skin */
-                       skinComposer = new GeneralPurposeSkinComposer(config, this, shell,
-                                       currentState, imageRegistry);
+                       skinComposer = new GeneralPurposeSkinComposer(config, this);
 
                        ((GeneralPurposeSkinComposer) skinComposer)
                                        .addGeneralPurposeListener(shell);
index b45d993..b8f0911 100644 (file)
@@ -53,7 +53,6 @@ import org.eclipse.swt.widgets.Shell;
 import org.tizen.emulator.skin.EmulatorSkin;
 import org.tizen.emulator.skin.comm.ICommunicator.KeyEventType;
 import org.tizen.emulator.skin.comm.ICommunicator.SendCommand;
-import org.tizen.emulator.skin.comm.sock.SocketCommunicator;
 import org.tizen.emulator.skin.comm.sock.data.KeyEventData;
 import org.tizen.emulator.skin.dbi.KeyMapType;
 import org.tizen.emulator.skin.image.GeneralKeyWindowImageRegistry;
@@ -85,7 +84,6 @@ public class GeneralKeyWindow extends SkinWindow {
        private Image imageFrame; /* nine-patch image */
 
        private Color colorFrame;
-       private SocketCommunicator communicator;
        private GeneralKeyWindowImageRegistry imageRegistry;
        private List<KeyMapType> keyMapList;
 
@@ -97,11 +95,11 @@ public class GeneralKeyWindow extends SkinWindow {
        private boolean isGrabbedShell;
        private Point grabPosition;
 
-       public GeneralKeyWindow(EmulatorSkin skin, Shell parent,
-                       SocketCommunicator communicator, List<KeyMapType> keyMapList) {
-               super(parent, SWT.RIGHT | SWT.CENTER);
+       public GeneralKeyWindow(EmulatorSkin skin, List<KeyMapType> keyMapList) {
+               super(skin.getShell(), SWT.RIGHT | SWT.CENTER);
 
                this.skin = skin;
+               this.parent = skin.getShell();
                if (SwtUtil.isMacPlatform() == false) {
                        this.shell = new Shell(parent,
                                        SWT.NO_TRIM | SWT.RESIZE | SWT.TOOL);
@@ -114,7 +112,6 @@ public class GeneralKeyWindow extends SkinWindow {
                this.frameMaker = new SkinPatches(PATCH_IMAGES_PATH);
 
                this.keyMapList = keyMapList; //TODO: null
-               this.communicator = communicator;
                this.grabPosition = new Point(0, 0);
 
                shell.setText(parent.getText());
@@ -261,7 +258,7 @@ public class GeneralKeyWindow extends SkinWindow {
 
                                                KeyEventData keyEventData = new KeyEventData(
                                                                KeyEventType.PRESSED.value(), keycode, 0, 0);
-                                               communicator.sendToQEMU(
+                                               skin.communicator.sendToQEMU(
                                                                SendCommand.SEND_HARD_KEY_EVENT, keyEventData, false);
                                        }
 
@@ -271,7 +268,7 @@ public class GeneralKeyWindow extends SkinWindow {
 
                                                KeyEventData keyEventData = new KeyEventData(
                                                                KeyEventType.RELEASED.value(), keycode, 0, 0);
-                                               communicator.sendToQEMU(
+                                               skin.communicator.sendToQEMU(
                                                                SendCommand.SEND_HARD_KEY_EVENT, keyEventData, false);
                                        }
 
index 2bf79f1..dc6b8ed 100644 (file)
@@ -29,7 +29,6 @@
 
 package org.tizen.emulator.skin.image;
 
-import java.io.File;
 import java.io.InputStream;
 import java.util.Collection;
 import java.util.HashMap;
@@ -42,7 +41,6 @@ import org.eclipse.swt.graphics.Image;
 import org.eclipse.swt.widgets.Display;
 import org.tizen.emulator.skin.config.EmulatorConfig;
 import org.tizen.emulator.skin.dbi.EmulatorUI;
-import org.tizen.emulator.skin.dbi.ImageListType;
 import org.tizen.emulator.skin.dbi.RotationType;
 import org.tizen.emulator.skin.dbi.RotationsType;
 import org.tizen.emulator.skin.log.SkinLogger;
@@ -61,11 +59,6 @@ public class ImageRegistry {
        private static Logger logger =
                        SkinLogger.getSkinLogger(ImageRegistry.class).getLogger();
 
-       public enum ImageType {
-               IMG_TYPE_MAIN,
-               IMG_TYPE_PRESSED
-       }
-
        public enum ResourceImageName {
                RESOURCE_ABOUT("about_Tizen_SDK.png"),
                RESOURCE_BLANK_GUIDE("blank-guide.png");
@@ -121,7 +114,6 @@ public class ImageRegistry {
 
        private Map<String, Image> resourceImageMap;
        private Map<String, Image> iconImageMap;
-       private Map<String, Image> skinImageMap;
 
        private String skinPath;
 
@@ -156,7 +148,6 @@ public class ImageRegistry {
 
                this.resourceImageMap = new HashMap<String, Image>();
                this.iconImageMap = new HashMap<String, Image>();
-               this.skinImageMap = new HashMap<String, Image>();
 
                init(this.skinPath);
        }
@@ -176,54 +167,6 @@ public class ImageRegistry {
                }
        }
 
-       private String makeKey(Short id, ImageType imageType) {
-               return id + ":" + imageType.ordinal();
-       }
-
-       public Image getSkinImage(Short id, ImageType imageType) {
-               Image image = skinImageMap.get(makeKey(id, imageType));
-
-               if (image == null) {
-                       RotationsType rotations = dbiContents.getRotations();
-
-                       if (null == rotations) {
-                               logger.severe("Fail to loading rotations element from dbi.");
-                               return null;
-                       }
-
-                       logger.info("get skin image from " + skinPath);
-
-                       RotationType targetRotation = SkinRotation.getRotation(id);
-                       List<RotationType> rotationList = rotations.getRotation();
-
-                       for (RotationType rotation : rotationList) {
-                               ImageListType imageList = rotation.getImageList();
-                               if (imageList == null) {
-                                       continue;
-                               }
-
-                               String mainImage = imageList.getMainImage();
-                               String keyPressedImage = imageList.getKeyPressedImage();
-
-                               if (targetRotation.getName().value().equals(rotation.getName().value())) {
-                                       String mainKey = makeKey(id, ImageType.IMG_TYPE_MAIN);
-                                       skinImageMap.put(mainKey,
-                                                       new Image(display, skinPath + File.separator + mainImage));
-
-                                       String pressedKey = makeKey(id, ImageType.IMG_TYPE_PRESSED);
-                                       skinImageMap.put(pressedKey,
-                                                       new Image(display, skinPath + File.separator + keyPressedImage));
-
-                                       break;
-                               }
-                       }
-
-                       image = skinImageMap.get(makeKey(id, imageType));
-               }
-
-               return image;
-       }
-
        public Image getResourceImage(ResourceImageName name) {
                String imageName = name.getName();
                Image image = resourceImageMap.get(imageName);
@@ -314,17 +257,5 @@ public class ImageRegistry {
                                image.dispose();
                        }
                }
-
-               /* skin image */
-               if (null != skinImageMap) {
-                       images = skinImageMap.values();
-
-                       imageIterator = images.iterator();
-
-                       while (imageIterator.hasNext()) {
-                               image = imageIterator.next();
-                               image.dispose();
-                       }
-               }
        }
 }
diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/image/ProfileSkinImageRegistry.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/image/ProfileSkinImageRegistry.java
new file mode 100644 (file)
index 0000000..2a81e58
--- /dev/null
@@ -0,0 +1,152 @@
+/**
+ * Image Resource Management For Profile-Specific Skin
+ *
+ * Copyright (C) 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * GiWoong Kim <giwoong.kim@samsung.com>
+ * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.emulator.skin.image;
+
+import java.io.File;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Logger;
+
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.tizen.emulator.skin.config.EmulatorConfig;
+import org.tizen.emulator.skin.dbi.EmulatorUI;
+import org.tizen.emulator.skin.dbi.ImageListType;
+import org.tizen.emulator.skin.dbi.RotationType;
+import org.tizen.emulator.skin.dbi.RotationsType;
+import org.tizen.emulator.skin.log.SkinLogger;
+import org.tizen.emulator.skin.util.SkinRotation;
+
+public class ProfileSkinImageRegistry {
+       private static Logger logger = SkinLogger.getSkinLogger(
+                       ProfileSkinImageRegistry.class).getLogger();
+
+       public enum SkinImageType {
+               PROFILE_IMAGE_TYPE_NORMAL,
+               PROFILE_IMAGE_TYPE_PRESSED
+       }
+
+       private Display display;
+       private String skinPath;
+       private EmulatorUI dbiContents;
+       private Map<String, Image> skinImageMap;
+
+       /**
+        *  Constructor
+        */
+       public ProfileSkinImageRegistry(EmulatorConfig config,
+                       Display display, String skinPath) {
+               this.display = display;
+               this.skinPath = skinPath;
+               this.dbiContents = config.getDbiContents();
+               this.skinImageMap = new HashMap<String, Image>();
+
+               initialize(skinPath);
+       }
+
+       private void initialize(String argSkinPath) {
+               RotationsType rotations = dbiContents.getRotations();
+
+               if (null == rotations) {
+                       logger.severe("Fail to loading rotations element from XML");
+                       return;
+               }
+
+               List<RotationType> rotationList = rotations.getRotation();
+
+               for (RotationType rotation : rotationList) {
+                       SkinRotation.put(rotation);
+               }
+       }
+
+       private String makeKey(Short id, SkinImageType imageType) {
+               return id + ":" + imageType.ordinal();
+       }
+
+       public Image getSkinImage(Short id, SkinImageType imageType) {
+               Image image = skinImageMap.get(makeKey(id, imageType));
+
+               if (image == null) {
+                       RotationsType rotations = dbiContents.getRotations();
+
+                       if (null == rotations) {
+                               logger.severe("Fail to loading rotations element from XML");
+                               return null;
+                       }
+
+                       logger.info("get skin image from " + skinPath);
+
+                       RotationType targetRotation = SkinRotation.getRotation(id);
+                       List<RotationType> rotationList = rotations.getRotation();
+
+                       for (RotationType rotation : rotationList) {
+                               ImageListType imageList = rotation.getImageList();
+                               if (imageList == null) {
+                                       continue;
+                               }
+
+                               String mainImage = imageList.getMainImage();
+                               String keyPressedImage = imageList.getKeyPressedImage();
+
+                               if (targetRotation.getName().value().equals(rotation.getName().value())) {
+                                       String mainKey = makeKey(id, SkinImageType.PROFILE_IMAGE_TYPE_NORMAL);
+                                       skinImageMap.put(mainKey,
+                                                       new Image(display, skinPath + File.separator + mainImage));
+
+                                       String pressedKey = makeKey(id, SkinImageType.PROFILE_IMAGE_TYPE_PRESSED);
+                                       skinImageMap.put(pressedKey,
+                                                       new Image(display, skinPath + File.separator + keyPressedImage));
+
+                                       break;
+                               }
+                       }
+
+                       image = skinImageMap.get(makeKey(id, imageType));
+               }
+
+               return image;
+       }
+
+       public void dispose() {
+               if (null != skinImageMap) {
+                       Image image = null;
+
+                       Collection<Image>  images = skinImageMap.values();
+                       Iterator<Image> imageIterator = images.iterator();
+
+                       while (imageIterator.hasNext()) {
+                               image = imageIterator.next();
+                               image.dispose();
+                       }
+               }
+       }
+}
index 8d49ae2..98fdf6c 100644 (file)
@@ -54,7 +54,6 @@ import org.tizen.emulator.skin.config.EmulatorConfig.SkinPropertiesConstants;
 import org.tizen.emulator.skin.custom.ColorTag;
 import org.tizen.emulator.skin.custom.CustomButton;
 import org.tizen.emulator.skin.custom.CustomProgressBar;
-import org.tizen.emulator.skin.image.ImageRegistry;
 import org.tizen.emulator.skin.image.ImageRegistry.IconName;
 import org.tizen.emulator.skin.log.SkinLogger;
 import org.tizen.emulator.skin.menu.PopupMenu;
@@ -82,7 +81,6 @@ public class GeneralPurposeSkinComposer implements ISkinComposer {
        private CustomButton toggleButton;
        private EmulatorSkinState currentState;
 
-       private ImageRegistry imageRegistry;
        private SkinPatches frameMaker;
 
        private PaintListener shellPaintListener;
@@ -92,14 +90,13 @@ public class GeneralPurposeSkinComposer implements ISkinComposer {
        private boolean isGrabbedShell;
        private Point grabPosition;
 
-       public GeneralPurposeSkinComposer(EmulatorConfig config, EmulatorSkin skin,
-                       Shell shell, EmulatorSkinState currentState,
-                       ImageRegistry imageRegistry) {
+       public GeneralPurposeSkinComposer(
+                       EmulatorConfig config, EmulatorSkin skin) {
                this.config = config;
                this.skin = skin;
-               this.shell = shell;
-               this.currentState = currentState;
-               this.imageRegistry = imageRegistry;
+               this.shell = skin.getShell();
+               this.currentState = skin.getEmulatorSkinState();
+
                this.isGrabbedShell= false;
                this.grabPosition = new Point(0, 0);
 
@@ -133,8 +130,6 @@ public class GeneralPurposeSkinComposer implements ISkinComposer {
        @Override
        public void composeInternal(Canvas displayCanvas,
                        final int x, final int y, int scale, short rotationId) {
-
-               //shell.setBackground(shell.getDisplay().getSystemColor(SWT.COLOR_BLACK));
                shell.setLocation(x, y);
 
                /* This string must match the definition of Emulator-Manager */
@@ -145,9 +140,11 @@ public class GeneralPurposeSkinComposer implements ISkinComposer {
                                shell.getDisplay().getSystemColor(SWT.COLOR_BLACK));
 
                if (SwtUtil.isWindowsPlatform()) {
-                       shell.setImage(imageRegistry.getIcon(IconName.EMULATOR_TITLE_ICO));
+                       shell.setImage(skin.getImageRegistry()
+                                       .getIcon(IconName.EMULATOR_TITLE_ICO));
                } else {
-                       shell.setImage(imageRegistry.getIcon(IconName.EMULATOR_TITLE));
+                       shell.setImage(skin.getImageRegistry()
+                                       .getIcon(IconName.EMULATOR_TITLE));
                }
 
                /* load image for toggle button of key window */
index 0465d38..51afcc3 100644 (file)
@@ -60,9 +60,9 @@ import org.tizen.emulator.skin.custom.CustomProgressBar;
 import org.tizen.emulator.skin.dbi.DisplayType;
 import org.tizen.emulator.skin.dbi.RegionType;
 import org.tizen.emulator.skin.dbi.RotationType;
-import org.tizen.emulator.skin.image.ImageRegistry;
 import org.tizen.emulator.skin.image.ImageRegistry.IconName;
-import org.tizen.emulator.skin.image.ImageRegistry.ImageType;
+import org.tizen.emulator.skin.image.ProfileSkinImageRegistry;
+import org.tizen.emulator.skin.image.ProfileSkinImageRegistry.SkinImageType;
 import org.tizen.emulator.skin.log.SkinLogger;
 import org.tizen.emulator.skin.menu.PopupMenu;
 import org.tizen.emulator.skin.util.SkinRotation;
@@ -78,7 +78,6 @@ public class ProfileSpecificSkinComposer implements ISkinComposer {
        private Shell shell;
        private Canvas lcdCanvas;
        private EmulatorSkinState currentState;
-       private ImageRegistry imageRegistry;
        private SocketCommunicator communicator;
 
        private PaintListener shellPaintListener;
@@ -86,20 +85,23 @@ public class ProfileSpecificSkinComposer implements ISkinComposer {
        private MouseMoveListener shellMouseMoveListener;
        private MouseListener shellMouseListener;
 
+       private ProfileSkinImageRegistry imageRegistry;
        private boolean isGrabbedShell;
        private Point grabPosition;
 
-       public ProfileSpecificSkinComposer(EmulatorConfig config, EmulatorSkin skin,
-                       Shell shell, EmulatorSkinState currentState,
-                       ImageRegistry imageRegistry, SocketCommunicator communicator) {
+       public ProfileSpecificSkinComposer(
+                       EmulatorConfig config, EmulatorSkin skin) {
                this.config = config;
                this.skin = skin;
-               this.shell = shell;
-               this.currentState = currentState;
-               this.imageRegistry = imageRegistry;
-               this.communicator = communicator;
+               this.shell = skin.getShell();
+               this.currentState = skin.getEmulatorSkinState();
+               this.communicator = skin.communicator;
+
                this.isGrabbedShell= false;
                this.grabPosition = new Point(0, 0);
+
+               this.imageRegistry = new ProfileSkinImageRegistry(
+                               config, shell.getDisplay(), skin.skinInfo.getSkinPath());
        }
 
        @Override
@@ -126,20 +128,21 @@ public class ProfileSpecificSkinComposer implements ISkinComposer {
        @Override
        public void composeInternal(Canvas lcdCanvas,
                        int x, int y, int scale, short rotationId) {
-
-               //shell.setBackground(shell.getDisplay().getSystemColor(SWT.COLOR_BLACK));
                shell.setLocation(x, y);
 
                /* This string must match the definition of Emulator-Manager */
                String emulatorName = SkinUtil.makeEmulatorName(config);
                shell.setText("Emulator - " + emulatorName);
 
-               lcdCanvas.setBackground(shell.getDisplay().getSystemColor(SWT.COLOR_BLACK));
+               lcdCanvas.setBackground(
+                               shell.getDisplay().getSystemColor(SWT.COLOR_BLACK));
 
                if (SwtUtil.isWindowsPlatform()) {
-                       shell.setImage(imageRegistry.getIcon(IconName.EMULATOR_TITLE_ICO));
+                       shell.setImage(skin.getImageRegistry()
+                                       .getIcon(IconName.EMULATOR_TITLE_ICO));
                } else {
-                       shell.setImage(imageRegistry.getIcon(IconName.EMULATOR_TITLE));
+                       shell.setImage(skin.getImageRegistry()
+                                       .getIcon(IconName.EMULATOR_TITLE));
                }
 
                /* create a progress bar for booting status */
@@ -213,9 +216,13 @@ public class ProfileSpecificSkinComposer implements ISkinComposer {
                }
 
                currentState.setCurrentImage(SkinUtil.createScaledImage(
-                               imageRegistry, shell, rotationId, scale, ImageType.IMG_TYPE_MAIN));
+                               shell.getDisplay(), imageRegistry,
+                               SkinImageType.PROFILE_IMAGE_TYPE_NORMAL,
+                               rotationId, scale));
                currentState.setCurrentKeyPressedImage(SkinUtil.createScaledImage(
-                               imageRegistry, shell, rotationId, scale, ImageType.IMG_TYPE_PRESSED));
+                               shell.getDisplay(), imageRegistry,
+                               SkinImageType.PROFILE_IMAGE_TYPE_PRESSED,
+                               rotationId, scale));
 
                if (tempImage != null) {
                        tempImage.dispose();
@@ -531,5 +538,7 @@ public class ProfileSpecificSkinComposer implements ISkinComposer {
                if (null != shellMouseListener) {
                        shell.removeMouseListener(shellMouseListener);
                }
+
+               imageRegistry.dispose();
        }
 }
index 113ccce..7ca7c88 100644 (file)
@@ -94,8 +94,7 @@ public class KeyWindowKeeper {
                                return;
                        }
 
-                       keyWindow = new GeneralKeyWindow(
-                                       skin, skin.getShell(), skin.communicator, keyMapList);
+                       keyWindow = new GeneralKeyWindow(skin, keyMapList);
                } else {
                        // TODO:
                        String layoutName =
index 4d82eb4..e040f3c 100644 (file)
@@ -1,7 +1,7 @@
 /**
- * 
+ * Skin Utilities
  *
- * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Contact:
  * GiWoong Kim <giwoong.kim@samsung.com>
@@ -43,6 +43,7 @@ import org.eclipse.swt.graphics.ImageData;
 import org.eclipse.swt.graphics.Point;
 import org.eclipse.swt.graphics.Rectangle;
 import org.eclipse.swt.graphics.Region;
+import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.MessageBox;
 import org.eclipse.swt.widgets.Shell;
 import org.tizen.emulator.skin.comm.ICommunicator.RotationInfo;
@@ -55,8 +56,8 @@ import org.tizen.emulator.skin.dbi.KeyMapListType;
 import org.tizen.emulator.skin.dbi.KeyMapType;
 import org.tizen.emulator.skin.dbi.RegionType;
 import org.tizen.emulator.skin.dbi.RotationType;
-import org.tizen.emulator.skin.image.ImageRegistry;
-import org.tizen.emulator.skin.image.ImageRegistry.ImageType;
+import org.tizen.emulator.skin.image.ProfileSkinImageRegistry;
+import org.tizen.emulator.skin.image.ProfileSkinImageRegistry.SkinImageType;
 import org.tizen.emulator.skin.layout.HWKey;
 import org.tizen.emulator.skin.log.SkinLogger;
 
@@ -281,9 +282,9 @@ public class SkinUtil {
 
        }
 
-       public static Image createScaledImage(ImageRegistry imageRegistry,
-                       Shell shell, short rotationId, int scale, ImageType type) {
-
+       public static Image createScaledImage(Display display,
+                       ProfileSkinImageRegistry imageRegistry, SkinImageType type,
+                       short rotationId, int scale) {
                Image imageOrigin = imageRegistry.getSkinImage(rotationId, type);
                if (imageOrigin == null) {
                        return null;
@@ -298,7 +299,7 @@ public class SkinUtil {
                int height = (int) (imageDataSrc.height * convertedScale);
                imageDataDst = imageDataDst.scaledTo(width, height);
 
-               return new Image(shell.getDisplay(), imageDataDst);
+               return new Image(display, imageDataDst);
        }
 
        public static float convertScale(int scale) {