Take a look at the system property ro.sf.lcd_density. For a QVGA screen, you want to set it as

ro.sf.lcd_density = 120

to get the proper scaling. IMHO, the density should not be necessary and scaling could be done via the dpi. But for some reason it isn't done.

Sean

On 9/14/2010 4:54 PM, James Adams wrote:
I'm porting Android onto some hardware with a 240x320 (portrait) display.

My quesion is, does Android base all of its icon / widget scaling
based on the 'width' and 'height' (in mm) parameters returned from the
frame buffer driver?

I expect it should, but it seems not to - what I want to do is get the
screen on my device to draw exactly the same as the emulator but it
doesn't....

If I set up the emulator to be a 240x320 device I get:

...
I/gralloc (   52): using (fd=22)
I/gralloc (   52): id           =
I/gralloc (   52): xres         = 240 px
I/gralloc (   52): yres         = 320 px
I/gralloc (   52): xres_virtual = 240 px
I/gralloc (   52): yres_virtual = 640 px
I/gralloc (   52): bpp          = 16
I/gralloc (   52): r            = 11:5
I/gralloc (   52): g            =  5:6
I/gralloc (   52): b            =  0:5
I/gralloc (   52): width        = 37 mm (164.756760 dpi)
I/gralloc (   52): height       = 49 mm (165.877548 dpi)
I/gralloc (   52): refresh rate = 60.00 Hz
D/libEGL  (   52): egl.cfg not found, using default config
...

My screen driver doesn't report the physical dimensions so for now
until I;ve fixed it I have edited
hardware/libhardware/modules/gralloc/framebuffer.cpp to make the
'width' and 'height' the same asthe emulator (and gralloc reports
info.width/height are set correctly):
(line 241...)
     if (int(info.width)<= 0 || int(info.height)<= 0) {
         // the driver doesn't return that information
         // default to 160 dpi
         LOGI("Driver doesn't report width/height - setting default...");
         //info.width  = ((info.xres * 25.4f)/160.0f + 0.5f);
         //info.height = ((info.yres * 25.4f)/160.0f + 0.5f);
         info.width  = 37; // JRA same as emulator...
         info.height = 49;
     }

BUT the screen icons on my device are still a different size to the
emulator - the emulator they are a bit smaller and fit much more
nicely, so what could be going wrong? Can anyone point me int he right
direction?

NB I'm using 2.1 Eclair.

Thanks,

James.


--
unsubscribe: [email protected]
website: http://groups.google.com/group/android-porting

Reply via email to