From 10b447cb1dce5368beb233d7cd673ba9567bcbcc Mon Sep 17 00:00:00 2001 From: "giwoong.kim" Date: Wed, 24 Oct 2012 19:25:51 +0900 Subject: [PATCH] skin: do not load lcd size from dbi file on general skin mode In general skin mode, emulator lcd size is base on the resolution value. Signed-off-by: GiWoong Kim --- .../src/org/tizen/emulator/skin/EmulatorSkin.java | 33 +++++++++++++--------- .../org/tizen/emulator/skin/EmulatorSkinMain.java | 19 ++++++++----- .../src/org/tizen/emulator/skin/util/SkinUtil.java | 17 +++++++---- 3 files changed, 43 insertions(+), 26 deletions(-) diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java index 585e4c6..b3fc36e 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java @@ -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) { diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkinMain.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkinMain.java index 839472a..b4c3a7b 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkinMain.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkinMain.java @@ -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; diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/util/SkinUtil.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/util/SkinUtil.java index d481916..6fad927 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/util/SkinUtil.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/util/SkinUtil.java @@ -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); -- 2.7.4