boolean computeAndSetRealScale(boolean redraw) { // compute average dpi of X and Y ConfigurationChooser chooser = mEditor.getConfigurationChooser(); Configuration config = chooser.getConfiguration(); Device device = config.getDevice(); Screen screen = device.getDefaultHardware().getScreen(); double dpi = (screen.getXdpi() + screen.getYdpi()) / 2.; // get the monitor dpi float monitor = AdtPrefs.getPrefs().getMonitorDensity(); if (monitor == 0.f) { ResolutionChooserDialog dialog = new ResolutionChooserDialog(chooser.getShell()); if (dialog.open() == Window.OK) { monitor = dialog.getDensity(); AdtPrefs.getPrefs().setMonitorDensity(monitor); } else { return false; } } mEditor.getCanvasControl().setScale(monitor / dpi, redraw); return true; }