skin: function call re-ordering in arrangeSkin() & etc 72/11072/1
authorGiWoong Kim <giwoong.kim@samsung.com>
Thu, 17 Oct 2013 09:07:20 +0000 (18:07 +0900)
committerGiWoong Kim <giwoong.kim@samsung.com>
Thu, 17 Oct 2013 09:07:20 +0000 (18:07 +0900)
Change-Id: Ib3f26f7ca8b7759fc5998b67ed07d38ac41cb05c
Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com>
tizen/src/skin/client/src/org/tizen/emulator/skin/custom/SpecialKeyWindow.java
tizen/src/skin/client/src/org/tizen/emulator/skin/layout/GeneralPurposeSkinComposer.java
tizen/src/skin/client/src/org/tizen/emulator/skin/layout/ISkinComposer.java
tizen/src/skin/client/src/org/tizen/emulator/skin/layout/ProfileSpecificSkinComposer.java
tizen/src/skin/client/src/org/tizen/emulator/skin/util/KeyWindowRotation.java [deleted file]
tizen/src/skin/client/src/org/tizen/emulator/skin/util/SkinUtil.java

index c7c2e1e07fbfb4c77dab7afc313be68d5260868e..58cff1f5186f640b62612360fa4d800059f9152c 100644 (file)
@@ -123,10 +123,10 @@ public class SpecialKeyWindow extends SkinWindow {
 
                /* get keywindow image */
                //TODO: null
-               keyWindowImage = imageRegistry.getKeyWindowImage(
+               this.keyWindowImage = imageRegistry.getKeyWindowImage(
                                EmulatorConfig.DEFAULT_WINDOW_ROTATION,
                                SpecailKeyWindowImageType.SPECIAL_IMAGE_TYPE_NORMAL);
-               keyWindowPressedImage = imageRegistry.getKeyWindowImage(
+               this.keyWindowPressedImage = imageRegistry.getKeyWindowImage(
                                EmulatorConfig.DEFAULT_WINDOW_ROTATION,
                                SpecailKeyWindowImageType.SPECIAL_IMAGE_TYPE_PRESSED);
 
@@ -136,7 +136,7 @@ public class SpecialKeyWindow extends SkinWindow {
                                keyWindowImage.getImageData().height);
 
                /* custom window shape */
-               SkinUtil.trimShell(shell, keyWindowImage);
+               shell.setRegion(SkinUtil.getTrimmingRegion(keyWindowImage));
 
                addKeyWindowListener();
        }
index 73c6e6b6fb1ee4266fc421f780a386b63c2f7c40..f524d31489709d2de5c09605a9e049e1a5c484f3 100644 (file)
@@ -44,6 +44,7 @@ import org.eclipse.swt.graphics.RGB;
 import org.eclipse.swt.graphics.Rectangle;
 import org.eclipse.swt.graphics.Region;
 import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Shell;
 import org.tizen.emulator.skin.EmulatorSkin;
 import org.tizen.emulator.skin.EmulatorSkinState;
@@ -143,7 +144,7 @@ public class GeneralPurposeSkinComposer implements ISkinComposer {
 
                /* This string must match the definition of Emulator-Manager */
                String emulatorName = SkinUtil.makeEmulatorName(config);
-               shell.setText("Emulator - " + emulatorName);
+               shell.setText(SkinUtil.EMULATOR_PREFIX + " - " + emulatorName);
 
                displayCanvas.setBackground(
                                shell.getDisplay().getSystemColor(SWT.COLOR_BLACK));
@@ -217,8 +218,7 @@ public class GeneralPurposeSkinComposer implements ISkinComposer {
                                                skin.getKeyWindowKeeper().openKeyWindow(
                                                                SWT.RIGHT | SWT.CENTER, false);
                                        } else {
-                                               skin.getKeyWindowKeeper().openKeyWindow(
-                                                               dockValue, false);
+                                               skin.getKeyWindowKeeper().openKeyWindow(dockValue, false);
                                        }
                                }
                        });
@@ -227,13 +227,13 @@ public class GeneralPurposeSkinComposer implements ISkinComposer {
 
        @Override
        public void arrangeSkin(int scale, short rotationId) {
-               currentState.setCurrentScale(scale);
-               currentState.setCurrentRotationId(rotationId);
+               //TODO: eject the calculation from UI thread
 
-               /* arrange the display */
-               Rectangle displayBounds = adjustLcdGeometry(displayCanvas,
+               /* calculate display bounds */
+               Rectangle displayBounds = adjustDisplayGeometry(displayCanvas,
                                currentState.getCurrentResolutionWidth(),
-                               currentState.getCurrentResolutionHeight(), scale, rotationId);
+                               currentState.getCurrentResolutionHeight(),
+                               scale, rotationId);
 
                if (displayBounds == null) {
                        logger.severe("Failed to read display information for skin.");
@@ -245,23 +245,31 @@ public class GeneralPurposeSkinComposer implements ISkinComposer {
                }
                logger.info("display bounds : " + displayBounds);
 
+               /* make general skin */
+               Image generalSkin =
+                               frameMaker.getPatchedImage(displayBounds.width, displayBounds.height);
+
+               /* make window region */
+               Region region = getTrimmingRegion(shell.getDisplay(), generalSkin);
+
+               /* update the skin state information */
+               currentState.setCurrentScale(scale);
+               currentState.setCurrentRotationId(rotationId);
                currentState.setDisplayBounds(displayBounds);
-               displayCanvas.setBounds(displayBounds);
 
-               /* arrange the skin image */
                Image tempImage = null;
-
                if (currentState.getCurrentImage() != null) {
                        tempImage = currentState.getCurrentImage();
                }
-
-               currentState.setCurrentImage(
-                               frameMaker.getPatchedImage(displayBounds.width, displayBounds.height));
+               currentState.setCurrentImage(generalSkin);
 
                if (tempImage != null) {
                        tempImage.dispose();
                }
 
+               /* arrange the display */
+               displayCanvas.setBounds(displayBounds);
+
                /* arrange the toggle button of key window */
                toggleButton.setBounds(displayBounds.x + displayBounds.width + 4,
                                displayBounds.y + ((displayBounds.height - toggleButton.getImageSize().y) / 2),
@@ -280,22 +288,21 @@ public class GeneralPurposeSkinComposer implements ISkinComposer {
                }
 
                /* arrange the pair tag */
-               int rotationType = currentState.getCurrentRotationId();
-               if (rotationType == RotationInfo.PORTRAIT.id()) {
+               if (rotationId == RotationInfo.PORTRAIT.id()) {
                        skin.pairTag.setBounds(
                                        PAIR_TAG_POSITION_X, PAIR_TAG_POSITION_Y,
                                        skin.pairTag.getWidth(), skin.pairTag.getHeight());
-               } else if (rotationType == RotationInfo.LANDSCAPE.id()) {
+               } else if (rotationId == RotationInfo.LANDSCAPE.id()) {
                        skin.pairTag.setBounds(
                                        PAIR_TAG_POSITION_Y,
                                        shell.getSize().y - PAIR_TAG_POSITION_X - skin.pairTag.getHeight(),
                                        skin.pairTag.getWidth(), skin.pairTag.getHeight());
-               } else if (rotationType == RotationInfo.REVERSE_PORTRAIT.id()) {
+               } else if (rotationId == RotationInfo.REVERSE_PORTRAIT.id()) {
                        skin.pairTag.setBounds(
                                        shell.getSize().x - PAIR_TAG_POSITION_X - skin.pairTag.getWidth(),
                                        shell.getSize().y - PAIR_TAG_POSITION_Y - skin.pairTag.getHeight(),
                                        skin.pairTag.getWidth(), skin.pairTag.getHeight());
-               } else if (rotationType == RotationInfo.REVERSE_LANDSCAPE.id()) {
+               } else if (rotationId == RotationInfo.REVERSE_LANDSCAPE.id()) {
                        skin.pairTag.setBounds(
                                        shell.getSize().x - PAIR_TAG_POSITION_Y - skin.pairTag.getWidth(),
                                        PAIR_TAG_POSITION_X,
@@ -303,51 +310,53 @@ public class GeneralPurposeSkinComposer implements ISkinComposer {
                }
 
                /* custom window shape */
-               trimPatchedShell(shell, currentState.getCurrentImage());
+               if (region != null) {
+                       shell.setRegion(region);
+               }
 
                currentState.setNeedToUpdateDisplay(true);
                shell.redraw();
        }
 
        @Override
-       public Rectangle adjustLcdGeometry(
+       public Rectangle adjustDisplayGeometry(
                        Canvas displayCanvas, int resolutionW, int resolutionH,
                        int scale, short rotationId) {
 
-               Rectangle lcdBounds = new Rectangle(
+               Rectangle displayBounds = new Rectangle(
                                frameMaker.getPatchWidth(), frameMaker.getPatchHeight(), 0, 0);
 
                float convertedScale = SkinUtil.convertScale(scale);
                RotationInfo rotation = RotationInfo.getValue(rotationId);
 
-               /* resoultion, that is lcd size in general skin mode */
+               /* resoultion, that is display size in general skin mode */
                if (RotationInfo.LANDSCAPE == rotation ||
                                RotationInfo.REVERSE_LANDSCAPE == rotation) {
-                       lcdBounds.width = (int)(resolutionH * convertedScale);
-                       lcdBounds.height = (int)(resolutionW * convertedScale);
+                       displayBounds.width = (int)(resolutionH * convertedScale);
+                       displayBounds.height = (int)(resolutionW * convertedScale);
                } else {
-                       lcdBounds.width = (int)(resolutionW * convertedScale);
-                       lcdBounds.height = (int)(resolutionH * convertedScale);
+                       displayBounds.width = (int)(resolutionW * convertedScale);
+                       displayBounds.height = (int)(resolutionH * convertedScale);
                }
 
-               return lcdBounds;
+               return displayBounds;
        }
 
-       public static void trimPatchedShell(Shell shell, Image image) {
+       public static Region getTrimmingRegion(Display display, Image image) {
                if (null == image) {
-                       return;
+                       return null;
                }
-               ImageData imageData = image.getImageData();
 
+               ImageData imageData = image.getImageData();
                int width = imageData.width;
                int height = imageData.height;
 
                Region region = new Region();
                region.add(new Rectangle(0, 0, width, height));
 
-               int r = shell.getDisplay().getSystemColor(SWT.COLOR_MAGENTA).getRed();
-               int g = shell.getDisplay().getSystemColor(SWT.COLOR_MAGENTA).getGreen();
-               int b = shell.getDisplay().getSystemColor(SWT.COLOR_MAGENTA).getBlue();
+               int r = display.getSystemColor(SWT.COLOR_MAGENTA).getRed();
+               int g = display.getSystemColor(SWT.COLOR_MAGENTA).getGreen();
+               int b = display.getSystemColor(SWT.COLOR_MAGENTA).getBlue();
                int colorKey = 0;
 
                if (SwtUtil.isWindowsPlatform()) {
@@ -356,8 +365,9 @@ public class GeneralPurposeSkinComposer implements ISkinComposer {
                        colorKey = r << 16 | g << 8 | b;
                }
 
+               int j = 0;
                for (int i = 0; i < width; i++) {
-                       for (int j = 0; j < height; j++) {
+                       for (j = 0; j < height; j++) {
                                int colorPixel = imageData.getPixel(i, j);
                                if (colorPixel == colorKey /* magenta */) {
                                        region.subtract(i, j, 1, 1);
@@ -365,7 +375,7 @@ public class GeneralPurposeSkinComposer implements ISkinComposer {
                        }
                }
 
-               shell.setRegion(region);
+               return region;
        }
 
        public void addGeneralPurposeListener(final Shell shell) {
index 34aee84730b1799570acbea13f046d31fc6952a5..eed873e464c215626ed82937b55c903c87697393 100644 (file)
@@ -1,7 +1,7 @@
 /**
- * 
+ * Skin Composer Interface
  *
- * 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>
@@ -39,8 +39,8 @@ public interface ISkinComposer {
 
        public abstract void arrangeSkin(int scale, short rotationId);
 
-       public abstract Rectangle adjustLcdGeometry(
-                       Canvas lcdCanvas, int resolutionW, int resolutionH,
+       public abstract Rectangle adjustDisplayGeometry(
+                       Canvas displayCanvas, int resolutionW, int resolutionH,
                        int scale, short rotationId);
 
        public abstract void composerFinalize();
index 74dee615ef9a1ac2702b24e37528212f85a6ab4d..78ea4ea5837570c894f0e6e3c7a0f86215caf3cf 100644 (file)
@@ -45,6 +45,7 @@ import org.eclipse.swt.graphics.ImageData;
 import org.eclipse.swt.graphics.Point;
 import org.eclipse.swt.graphics.RGB;
 import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.graphics.Region;
 import org.eclipse.swt.widgets.Canvas;
 import org.eclipse.swt.widgets.Shell;
 import org.tizen.emulator.skin.EmulatorSkin;
@@ -134,7 +135,7 @@ public class ProfileSpecificSkinComposer implements ISkinComposer {
 
                /* This string must match the definition of Emulator-Manager */
                String emulatorName = SkinUtil.makeEmulatorName(config);
-               shell.setText("Emulator - " + emulatorName);
+               shell.setText(SkinUtil.EMULATOR_PREFIX + " - " + emulatorName);
 
                lcdCanvas.setBackground(
                                shell.getDisplay().getSystemColor(SWT.COLOR_BLACK));
@@ -185,15 +186,14 @@ public class ProfileSpecificSkinComposer implements ISkinComposer {
 
        @Override
        public void arrangeSkin(int scale, short rotationId) {
-               currentState.setCurrentScale(scale);
-               currentState.setCurrentRotationId(rotationId);
+               //TODO: eject the calculation from UI thread
 
-               /* arrange the display */
-               Rectangle lcdBounds = adjustLcdGeometry(lcdCanvas,
+               /* calculate display bounds */
+               Rectangle displayBounds = adjustDisplayGeometry(lcdCanvas,
                                currentState.getCurrentResolutionWidth(),
                                currentState.getCurrentResolutionHeight(), scale, rotationId);
 
-               if (lcdBounds == null) {
+               if (displayBounds == null) {
                        logger.severe("Failed to read display information for skin.");
                        SkinUtil.openMessage(shell, null,
                                        "Failed to read display information for skin.\n" +
@@ -201,11 +201,27 @@ public class ProfileSpecificSkinComposer implements ISkinComposer {
                                        SWT.ICON_ERROR, config);
                        System.exit(-1);
                }
-               logger.info("display bounds : " + lcdBounds);
+               logger.info("display bounds : " + displayBounds);
+
+               /* make profile skin */
+               Image originSkin = imageRegistry.getSkinImage(
+                               rotationId, SkinImageType.PROFILE_IMAGE_TYPE_NORMAL);
+               Image profileSkin = SkinUtil.createScaledImage(
+                               shell.getDisplay(), originSkin, rotationId, scale);
+
+               Image originSkinKeyPressed = imageRegistry.getSkinImage(
+                               rotationId, SkinImageType.PROFILE_IMAGE_TYPE_PRESSED);
+               Image profileSkinKeyPressed = SkinUtil.createScaledImage(
+                               shell.getDisplay(), originSkinKeyPressed, rotationId, scale);
 
-               currentState.setDisplayBounds(lcdBounds);
+               /* make window region */
+               Region region = SkinUtil.getTrimmingRegion(profileSkin);
+
+               /* update the skin state information */
+               currentState.setCurrentScale(scale);
+               currentState.setCurrentRotationId(rotationId);
+               currentState.setDisplayBounds(displayBounds);
 
-               /* arrange the skin image */
                Image tempImage = null;
                Image tempKeyPressedImage = null;
 
@@ -216,14 +232,8 @@ public class ProfileSpecificSkinComposer implements ISkinComposer {
                        tempKeyPressedImage = currentState.getCurrentKeyPressedImage();
                }
 
-               currentState.setCurrentImage(SkinUtil.createScaledImage(
-                               shell.getDisplay(), imageRegistry,
-                               SkinImageType.PROFILE_IMAGE_TYPE_NORMAL,
-                               rotationId, scale));
-               currentState.setCurrentKeyPressedImage(SkinUtil.createScaledImage(
-                               shell.getDisplay(), imageRegistry,
-                               SkinImageType.PROFILE_IMAGE_TYPE_PRESSED,
-                               rotationId, scale));
+               currentState.setCurrentImage(profileSkin);
+               currentState.setCurrentKeyPressedImage(profileSkinKeyPressed);
 
                if (tempImage != null) {
                        tempImage.dispose();
@@ -232,14 +242,15 @@ public class ProfileSpecificSkinComposer implements ISkinComposer {
                        tempKeyPressedImage.dispose();
                }
 
+               /* arrange the display */
                if (SwtUtil.isMacPlatform() == true) {
                        lcdCanvas.setBounds(currentState.getDisplayBounds());
                }
 
                /* arrange the progress bar */
                if (skin.bootingProgress != null) {
-                       skin.bootingProgress.setBounds(lcdBounds.x,
-                                       lcdBounds.y + lcdBounds.height + 1, lcdBounds.width, 2);
+                       skin.bootingProgress.setBounds(displayBounds.x,
+                                       displayBounds.y + displayBounds.height + 1, displayBounds.width, 2);
                }
 
                /* set window size */
@@ -249,27 +260,29 @@ public class ProfileSpecificSkinComposer implements ISkinComposer {
                }
 
                /* custom window shape */
-               SkinUtil.trimShell(shell, currentState.getCurrentImage());
+               if (region != null) {
+                       shell.setRegion(region);
+               }
 
                currentState.setNeedToUpdateDisplay(true);
                shell.redraw();
        }
 
        @Override
-       public Rectangle adjustLcdGeometry(
-                       Canvas lcdCanvas, int resolutionW, int resolutionH,
+       public Rectangle adjustDisplayGeometry(
+                       Canvas displayCanvas, int resolutionW, int resolutionH,
                        int scale, short rotationId) {
-               Rectangle lcdBounds = new Rectangle(0, 0, 0, 0);
+               Rectangle displayBounds = new Rectangle(0, 0, 0, 0);
 
                float convertedScale = SkinUtil.convertScale(scale);
                RotationType rotation = SkinRotation.getRotation(rotationId);
 
-               DisplayType lcd = rotation.getDisplay(); /* from dbi */
-               if (lcd == null) {
+               DisplayType display = rotation.getDisplay(); /* from dbi */
+               if (display == null) {
                        return null;
                }
 
-               RegionType region = lcd.getRegion();
+               RegionType region = display.getRegion();
                if (region == null) {
                        return null;
                }
@@ -279,12 +292,12 @@ public class ProfileSpecificSkinComposer implements ISkinComposer {
                Integer width = region.getWidth();
                Integer height = region.getHeight();
 
-               lcdBounds.x = (int) (left * convertedScale);
-               lcdBounds.y = (int) (top * convertedScale);
-               lcdBounds.width = (int) (width * convertedScale);
-               lcdBounds.height = (int) (height * convertedScale);
+               displayBounds.x = (int) (left * convertedScale);
+               displayBounds.y = (int) (top * convertedScale);
+               displayBounds.width = (int) (width * convertedScale);
+               displayBounds.height = (int) (height * convertedScale);
 
-               return lcdBounds;
+               return displayBounds;
        }
 
        public void addProfileSpecificListener(final Shell shell) {
diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/util/KeyWindowRotation.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/util/KeyWindowRotation.java
deleted file mode 100644 (file)
index d66c0a4..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-/**
- * 
- *
- * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * GiWoong Kim <giwoong.kim@samsung.com>
- * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
- * HyunJun Son
- * Hyunjin Lee <hyunjin816.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.util;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.tizen.emulator.skin.comm.ICommunicator.RotationInfo;
-import org.tizen.emulator.skin.dbi.RotationType;
-
-
-/**
- * 
- *
- */
-public class KeyWindowRotation {
-       
-       private static Map<Short, RotationType> rotationMap;
-       private static Map<Short, RotationInfo> angleMap;
-       
-       private KeyWindowRotation(){}
-       
-       static {
-               rotationMap = new LinkedHashMap<Short, RotationType>();
-               angleMap = new HashMap<Short, RotationInfo>();
-       }
-       
-       public static void clear() {
-               if (!rotationMap.isEmpty())
-                       rotationMap.clear();
-               if (!angleMap.isEmpty())
-                       angleMap.clear();
-       }
-       
-       public static void put(RotationType rotation ) {
-
-               if ( RotationInfo.PORTRAIT.value().equalsIgnoreCase( rotation.getName().value() ) ) {
-                       rotationMap.put( RotationInfo.PORTRAIT.id(), rotation );
-                       angleMap.put( RotationInfo.PORTRAIT.id(), RotationInfo.PORTRAIT );
-               } else if ( RotationInfo.LANDSCAPE.value().equalsIgnoreCase( rotation.getName().value() ) ) {
-                       rotationMap.put( RotationInfo.LANDSCAPE.id(), rotation );
-                       angleMap.put( RotationInfo.LANDSCAPE.id(), RotationInfo.LANDSCAPE );
-               } else if ( RotationInfo.REVERSE_PORTRAIT.value().equalsIgnoreCase( rotation.getName().value() ) ) {
-                       rotationMap.put( RotationInfo.REVERSE_PORTRAIT.id(), rotation );
-                       angleMap.put( RotationInfo.REVERSE_PORTRAIT.id(), RotationInfo.REVERSE_PORTRAIT );
-               } else if ( RotationInfo.REVERSE_LANDSCAPE.value().equalsIgnoreCase( rotation.getName().value() ) ) {
-                       rotationMap.put( RotationInfo.REVERSE_LANDSCAPE.id(), rotation );
-                       angleMap.put( RotationInfo.REVERSE_LANDSCAPE.id(), RotationInfo.REVERSE_LANDSCAPE );
-               }
-
-       }
-
-       public static int getAngle( Short rotationId ) {
-               RotationInfo rotationInfo = angleMap.get(rotationId);
-               if( null != rotationInfo ) {
-                       return rotationInfo.angle();
-               }else {
-                       return 0;
-               }
-       }
-
-       public static RotationType getRotation( Short rotationId ) {
-               return rotationMap.get(rotationId);
-       }
-
-       public static Iterator<Entry<Short, RotationType>>getRotationIterator() {
-               return rotationMap.entrySet().iterator();
-       }
-       
-}
index 46f02fffe83de500e63c99ac6d18d65a5e23455f..101dc639dbeb6267a63d03e8f0cdf81cf0c56593 100644 (file)
@@ -56,8 +56,6 @@ 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.ProfileSkinImageRegistry;
-import org.tizen.emulator.skin.image.ProfileSkinImageRegistry.SkinImageType;
 import org.tizen.emulator.skin.layout.HWKey;
 import org.tizen.emulator.skin.log.SkinLogger;
 
@@ -73,7 +71,7 @@ public class SkinUtil {
 
        public static final int UNKNOWN_KEYCODE = -1;
        public static final int SCALE_CONVERTER = 100;
-       public static final String EMULATOR_PREFIX = "emulator";
+       public static final String EMULATOR_PREFIX = "Emulator";
 
        private static Logger logger =
                        SkinLogger.getSkinLogger(SkinUtil.class).getLogger();
@@ -199,31 +197,28 @@ public class SkinUtil {
                return false;
        }
 
-       public static void trimShell(Shell shell, Image image) {
-               /* trim transparent pixels in image.
-                * especially, corner round areas. */
+       public static Region getTrimmingRegion(Image image) {
                if (null == image) {
-                       return;
+                       return null;
                }
 
                ImageData imageData = image.getImageData();
-
                int width = imageData.width;
                int height = imageData.height;
 
                Region region = new Region();
                region.add(new Rectangle(0, 0, width, height));
 
+               int j = 0;
                for (int i = 0; i < width; i++) {
-                       for (int j = 0; j < height; j++) {
-                               int alpha = imageData.getAlpha(i, j);
-                               if (0 == alpha) {
+                       for (j = 0; j < height; j++) {
+                               if (0 == imageData.getAlpha(i, j)) {
                                        region.subtract(i, j, 1, 1);
                                }
                        }
                }
 
-               shell.setRegion(region);
+               return region;
        }
 
        public static void trimShell(Shell shell, Image image,
@@ -233,7 +228,6 @@ public class SkinUtil {
                }
 
                ImageData imageData = image.getImageData();
-
                int right = left + width;
                int bottom = top + height;
 
@@ -242,10 +236,10 @@ public class SkinUtil {
                        return;
                }
 
+               int j = 0;
                for (int i = left; i < right; i++) {
-                       for (int j = top; j < bottom; j++) {
-                               int alpha = imageData.getAlpha(i, j);
-                               if (0 == alpha) {
+                       for (j = top; j < bottom; j++) {
+                               if (0 == imageData.getAlpha(i, j)) {
                                        region.subtract(i, j, 1, 1);
                                } else {
                                        region.add(i, j, 1, 1);
@@ -282,9 +276,7 @@ public class SkinUtil {
        }
 
        public static Image createScaledImage(Display display,
-                       ProfileSkinImageRegistry imageRegistry, SkinImageType type,
-                       short rotationId, int scale) {
-               Image imageOrigin = imageRegistry.getSkinImage(rotationId, type);
+                       Image imageOrigin, short rotationId, int scale) {
                if (imageOrigin == null) {
                        return null;
                }