Hi Björn,
>
> How do you define the values of the constants SCREEN_DENSITY and
> DENSITY_MEDIUM? Are they predefined bt PhoneGap API?
>
I've modified Phonegap to pass some system info as URL parameters.
Then, from javascript, I read and store them as constants.
Also, I've defined the screen density constants (DENSITY_LOW,
DENSITY_MEDIUM and DENSITY_HIGH) as 120, 160 and 240 respectively, so
I can make some math against the screen density.
I override drawImage only under Android 2.0 and 2.1. I think these are
the only Android versions wich come with this nasty bug. Maybe I write
some code to test the bug on the fly, but for now it works as I want.
>
> Do you always apply this code, regardless of android version, or do
> you do user agent detection?
>
I can't tell you how much this will affect performance on a real
device, as my test device is a HTC Magic with a medium density display
and a "slow" 500Mhz CPU. In the emulator, the code seems to work
reasonably well. At least on my crappy laptop I can't tell the
difference between native and modified drawImage (and my app draws on
the canvas intensively)
>
> Do you always apply this code, regardless of android version, or do
> you do user agent detection?
>
I think this must perform well, as devices with high density displays
all come with fast CPUs (more than 500Mhz if I'm not wrong), but I
have to test in a friend's Nexus One to be sure.
Anyone interested in testing my code in a real phone with a high
density display, please? :)
--
Luis Medel