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 ) );
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.");
}
- 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 );
}
/* not using a layout */
- SkinUtil.adjustLcdGeometry(lcdCanvas, scale, rotationId, skinMode);
+ SkinUtil.adjustLcdGeometry(lcdCanvas, currentLcdWidth, currentLcdHeight,
+ scale, rotationId, skinMode);
/* set window size */
if (null != currentImage) {
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." );
}
- 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;
}
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);