aboutsummaryrefslogtreecommitdiffstats
path: root/android/hw-lcd.c
blob: f84f66162ff703bbe74c660ca37d8b133850c6c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/* 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_LDPI + LCD_DENSITY_MDPI)/2)
        density = LCD_DENSITY_LDPI;
    else if (density < (LCD_DENSITY_MDPI + LCD_DENSITY_HDPI)/2)
        density = LCD_DENSITY_MDPI;
    else if (density < (LCD_DENSITY_HDPI + LCD_DENSITY_XHDPI)/2)
        density = LCD_DENSITY_HDPI;
    else
        density = LCD_DENSITY_XHDPI;

    snprintf(temp, sizeof temp, "%d", density);
    boot_property_add("qemu.sf.lcd_density", temp);
}