David 'Digit' Turner | c5b1270 | 2009-06-19 00:36:12 +0200 | [diff] [blame] | 1 | /* Copyright (C) 2009 The Android Open Source Project |
| 2 | ** |
| 3 | ** This software is licensed under the terms of the GNU General Public |
| 4 | ** License version 2, as published by the Free Software Foundation, and |
| 5 | ** may be copied, distributed, and modified under those terms. |
| 6 | ** |
| 7 | ** This program is distributed in the hope that it will be useful, |
| 8 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | ** GNU General Public License for more details. |
| 11 | */ |
| 12 | #include "android/hw-lcd.h" |
| 13 | #include "android/boot-properties.h" |
| 14 | #include <stdio.h> |
| 15 | |
| 16 | void |
| 17 | hwLcd_setBootProperty(int density) |
| 18 | { |
| 19 | char temp[8]; |
| 20 | |
| 21 | /* map density to one of our three values for now */ |
Xavier Ducrohet | cdca5ef | 2011-05-17 10:59:24 -0700 | [diff] [blame] | 22 | if (density < (LCD_DENSITY_LDPI + LCD_DENSITY_MDPI)/2) |
| 23 | density = LCD_DENSITY_LDPI; |
| 24 | else if (density < (LCD_DENSITY_MDPI + LCD_DENSITY_HDPI)/2) |
| 25 | density = LCD_DENSITY_MDPI; |
| 26 | else if (density < (LCD_DENSITY_HDPI + LCD_DENSITY_XHDPI)/2) |
| 27 | density = LCD_DENSITY_HDPI; |
David 'Digit' Turner | c5b1270 | 2009-06-19 00:36:12 +0200 | [diff] [blame] | 28 | else |
Xavier Ducrohet | cdca5ef | 2011-05-17 10:59:24 -0700 | [diff] [blame] | 29 | density = LCD_DENSITY_XHDPI; |
David 'Digit' Turner | c5b1270 | 2009-06-19 00:36:12 +0200 | [diff] [blame] | 30 | |
| 31 | snprintf(temp, sizeof temp, "%d", density); |
| 32 | boot_property_add("qemu.sf.lcd_density", temp); |
| 33 | } |
| 34 | |