diff options
author | David 'Digit' Turner <digit@google.com> | 2009-06-19 00:36:12 +0200 |
---|---|---|
committer | David 'Digit' Turner <digit@google.com> | 2009-06-19 00:36:12 +0200 |
commit | c5b127050f2dbed015d6b01703a33062d6910d4a (patch) | |
tree | 03c81fd16aae63ceca713515a565c702aee35d60 /android/hw-lcd.c | |
parent | 5998b8947d8c2788b62d38afdd571ddff78648a5 (diff) | |
download | external_qemu-c5b127050f2dbed015d6b01703a33062d6910d4a.zip external_qemu-c5b127050f2dbed015d6b01703a33062d6910d4a.tar.gz external_qemu-c5b127050f2dbed015d6b01703a33062d6910d4a.tar.bz2 |
Add a new hw.lcd.density hardware property to AVD configuration files.
This value can be overriden with the already existing -dpi-device <value> option.
The value is mapped to one of 120,160 and 240, then set to the boot-time property
named qemu.sf.lcd_density used by the framework to properly select assets and/or
resize them at runtime.
This means that "emulator -dpi-device 130" will select 120 lcd_density, or
"emulator -dpi-device 220" will select a 240 one.
Diffstat (limited to 'android/hw-lcd.c')
-rw-r--r-- | android/hw-lcd.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/android/hw-lcd.c b/android/hw-lcd.c new file mode 100644 index 0000000..2c06d69 --- /dev/null +++ b/android/hw-lcd.c @@ -0,0 +1,32 @@ +/* Copyright (C) 2009 The Android Open Source Project +** +** This software is licensed under the terms of the GNU General Public +** License version 2, as published by the Free Software Foundation, and +** may be copied, distributed, and modified under those terms. +** +** 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. +*/ +#include "android/hw-lcd.h" +#include "android/boot-properties.h" +#include <stdio.h> + +void +hwLcd_setBootProperty(int density) +{ + char temp[8]; + + /* map density to one of our three values for now */ + if (density < (LCD_DENSITY_MIN + LCD_DENSITY_DEFAULT)/2) + density = LCD_DENSITY_MIN; + else if (density < (LCD_DENSITY_DEFAULT + LCD_DENSITY_MAX)/2) + density = LCD_DENSITY_DEFAULT; + else + density = LCD_DENSITY_MAX; + + snprintf(temp, sizeof temp, "%d", density); + boot_property_add("qemu.sf.lcd_density", temp); +} + |