skin: do not load lcd size from dbi file on general skin mode
authorgiwoong.kim <giwoong.kim@samsung.com>
Wed, 24 Oct 2012 10:25:51 +0000 (19:25 +0900)
committergiwoong.kim <giwoong.kim@samsung.com>
Wed, 24 Oct 2012 10:38:31 +0000 (19:38 +0900)
In general skin mode, emulator lcd size is base on the resolution value.

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/EmulatorSkinMain.java
tizen/src/skin/client/src/org/tizen/emulator/skin/util/SkinUtil.java

index 585e4c6..b3fc36e 100644 (file)
@@ -218,24 +218,28 @@ public class EmulatorSkin {
        public long compose() {
                this.lcdCanvas = new Canvas( shell, SWT.EMBEDDED );
 
-               int x = config.getSkinPropertyInt( SkinPropertiesConstants.WINDOW_X, EmulatorConfig.DEFAULT_WINDOW_X );
-               int y = config.getSkinPropertyInt( SkinPropertiesConstants.WINDOW_Y, EmulatorConfig.DEFAULT_WINDOW_Y );
-               int lcdWidth = config.getArgInt( ArgsConstants.RESOLUTION_WIDTH );
-               int lcdHeight = config.getArgInt( ArgsConstants.RESOLUTION_HEIGHT );
-               int scale = SkinUtil.getValidScale( config );
+               int x = config.getSkinPropertyInt(SkinPropertiesConstants.WINDOW_X,
+                               EmulatorConfig.DEFAULT_WINDOW_X);
+               int y = config.getSkinPropertyInt(SkinPropertiesConstants.WINDOW_Y,
+                               EmulatorConfig.DEFAULT_WINDOW_Y);
+
+               int resolutionW = config.getArgInt(ArgsConstants.RESOLUTION_WIDTH);
+               int resolutionH = config.getArgInt(ArgsConstants.RESOLUTION_HEIGHT);
+               int scale = SkinUtil.getValidScale(config);
 //             int rotationId = config.getPropertyShort( PropertiesConstants.WINDOW_ROTATION,
 //                             EmulatorConfig.DEFAULT_WINDOW_ROTATION );
                // has to be portrait mode at first booting time
                short rotationId = EmulatorConfig.DEFAULT_WINDOW_ROTATION;
                
-               composeInternal( lcdCanvas, x, y, lcdWidth, lcdHeight, scale, rotationId, false );
-               logger.info("lcdWidth : " + lcdWidth + ", lcdHeight : " + lcdHeight + ", scale : " + scale);
+               composeInternal(lcdCanvas, x, y, resolutionW, resolutionH, scale, rotationId, false);
+               logger.info("resolution : " + resolutionW + "x" + resolutionH + ", scale : " + scale);
 
                return 0;
        }
 
-       private void composeInternal( Canvas lcdCanvas, int x, int y, int lcdWidth, int lcdHeight, int scale,
-                       short rotationId, boolean isOnUsbKbd ) {
+       private void composeInternal(Canvas lcdCanvas,
+                       int x, int y, int resolutionW, int resolutionH,
+                       int scale, short rotationId, boolean isOnUsbKbd) {
 
                lcdCanvas.setBackground( shell.getDisplay().getSystemColor( SWT.COLOR_BLACK ) );
 
@@ -254,7 +258,7 @@ public class EmulatorSkin {
                        shell.setImage( imageRegistry.getIcon( IconName.EMULATOR_TITLE ) );
                }
 
-               arrangeSkin(lcdWidth, lcdHeight, scale, rotationId);
+               arrangeSkin(resolutionW, resolutionH, scale, rotationId);
 
                if (skinMode != SkinMode.GENERAL && null == currentImage) {
                        logger.severe("Failed to load initial skin image file. Kill this skin process.");
@@ -368,10 +372,10 @@ public class EmulatorSkin {
 
        }
 
-       private void arrangeSkin( int lcdWidth, int lcdHeight, int scale, short rotationId ) {
+       private void arrangeSkin(int resolutionW, int resolutionH, int scale, short rotationId) {
 
-               this.currentLcdWidth = lcdWidth;
-               this.currentLcdHeight = lcdHeight;
+               this.currentLcdWidth = resolutionW;
+               this.currentLcdHeight = resolutionH;
                this.currentScale = scale;
                this.currentRotationId = rotationId;
                this.currentAngle = SkinRotation.getAngle( rotationId );
@@ -404,7 +408,8 @@ public class EmulatorSkin {
                }
 
                /* not using a layout */
-               SkinUtil.adjustLcdGeometry(lcdCanvas, scale, rotationId, skinMode);
+               SkinUtil.adjustLcdGeometry(lcdCanvas, currentLcdWidth, currentLcdHeight,
+                               scale, rotationId, skinMode);
 
                /* set window size */
                if (null != currentImage) {
index 839472a..b4c3a7b 100644 (file)
@@ -132,11 +132,15 @@ public class EmulatorSkinMain {
                        EmulatorConfig.validateSkinProperties( skinProperties );
                        EmulatorConfig.validateSkinConfigProperties( configProperties );
 
-                       int lcdWidth = Integer.parseInt( argsMap.get( ArgsConstants.RESOLUTION_WIDTH ) );
-                       int lcdHeight = Integer.parseInt( argsMap.get( ArgsConstants.RESOLUTION_HEIGHT ) );
-                       String argSkinPath = (String) argsMap.get( ArgsConstants.SKIN_PATH );
+                       int resolutionW = Integer.parseInt(
+                                       argsMap.get(ArgsConstants.RESOLUTION_WIDTH));
+                       int resolutionH = Integer.parseInt(
+                                       argsMap.get(ArgsConstants.RESOLUTION_HEIGHT));
 
-                       EmulatorUI dbiContents = loadDbi( argSkinPath, lcdWidth, lcdHeight );
+                       String argSkinPath = (String) argsMap.get(ArgsConstants.SKIN_PATH);
+
+                       /* load dbi file */
+                       EmulatorUI dbiContents = loadDbi(argSkinPath, resolutionW, resolutionH);
                        if ( null == dbiContents ) {
                                logger.severe( "Fail to load dbi file." );
 
@@ -337,9 +341,10 @@ public class EmulatorSkinMain {
 
        }
 
-       private static EmulatorUI loadDbi( String argSkinPath, int lcdWidth, int lcdHeight ) {
-
-               String skinPath = ImageRegistry.getSkinPath( argSkinPath, lcdWidth, lcdHeight ) + File.separator + DBI_FILE_NAME;
+       private static EmulatorUI loadDbi(String argSkinPath, int resolutionW, int resolutionH) {
+               String skinPath =
+                               ImageRegistry.getSkinPath(argSkinPath, resolutionW, resolutionH) +
+                               File.separator + DBI_FILE_NAME;
 
                FileInputStream fis = null;
                EmulatorUI emulatorUI = null;
index d481916..6fad927 100644 (file)
@@ -110,20 +110,27 @@ public class SkinUtil {
        }
 
        public static void adjustLcdGeometry(
-                       Canvas lcdCanvas, int scale, short rotationId, SkinMode mode) {
+                       Canvas lcdCanvas, int resolutionW, int resolutionH,
+                       int scale, short rotationId, SkinMode mode) {
 
                RotationType rotation = SkinRotation.getRotation(rotationId);
+               float convertedScale = convertScale(scale);
+
+               if (mode == SkinMode.GENERAL) {
+                       lcdCanvas.setBounds(0, 0,
+                                       (int)(resolutionW * convertedScale),
+                                       (int)(resolutionH * convertedScale));
+                       return;
+               }
 
                LcdType lcd = rotation.getLcd();
                RegionType region = lcd.getRegion();
 
-               Integer left = (mode != SkinMode.GENERAL) ? region.getLeft() : 0;
-               Integer top = (mode != SkinMode.GENERAL) ? region.getTop() : 0;
+               Integer left = region.getLeft();
+               Integer top = region.getTop();
                Integer width = region.getWidth();
                Integer height = region.getHeight();
 
-               float convertedScale = convertScale(scale);
-
                int l = (int) (left * convertedScale);
                int t = (int) (top * convertedScale);
                int w = (int) (width * convertedScale);