I explained why you are probably seeing the performance improvement -- because turning on compatibility mode forces the system to give you a surface whose resolution matches an HVGA, meaning you have fewer pixels to draw (and the surface flinger will resize it when compositing, using hardware).
I explained why you don't want to do this -- for example it will also effect ldpi devices where your surface will actually be *larger* than needed and get scaled down during compositing. I explained how you can do this the right way -- don't force the system to use compatibility mode but rather explicitly set the surface view to a fixed size that you find appropriate. I suggest doing that. :) On Wed, Aug 4, 2010 at 1:20 AM, mrqzzz <[email protected]> wrote: > Hi Dianne, thanks for the exhaustive response. > Yes i am using a SurfaceView. > > So far i realized that i get slow-downs only if i declare support for > any density: > <supports-screens android:anyDensity="true"> (<--slows) > > In my game i handle a fake 2D zoom effect with > drawable.setBounds(...) > And than painting on the canvas with: > drawable.draw(canvas) > > > > So far, i find this configuration working smoothly: > > <supports-screens > android:anyDensity="false" > android:normalScreens="true" > android:largeScreens="true" > android:smallScreens="true" > android:resizeable="true"> > </supports-screens> > > > Thank you, > Marcus. > > On Aug 3, 6:30 pm, Dianne Hackborn <[email protected]> wrote: > > Are you using a surface view? Most likely the reason for this is that > when > > in compatibility mode, the system tries to make everything look like > anmdpi > > screen. This with a surface view on non-mdpi screens it will give you a > > surface that is correct size for mdpi, and the surfaceflinger > > > > flinger will scale it > > when compositing to the screen. Thus on am hdpi screen, your surface is > > smaller and scaled up; on a ldpi screen, it is *larger* and scaled down. > > > > For your UI outside of the surface view, the window's surface remains at > the > > actual screen's density, but drawing to it is through an transformation > > matrix to scale it appropriately. This allows text and other vector > drawing > > to remain at the correct resolution (not pixelated), but can cause > artifacts > > because things like font metrics you compute will be in your > compatibility > > density but the font is actually drawn in the screen density and so can > be > > slightly different in size. > > > > You really do not want to do this. > > > > I strongly recommend you figure out which aspect of the compatibility > mode > > is improving your performance, and implementing your app to explicitly > just > > do that when running on a different screen density. For example, if you > are > > using a surface view, you can set it to be a fixed size, which causes the > > surface flinger to scale it during compositing to match the actual size > of > > the view in its window, achieving the same effect there. But you can be > > smart and not do this on an ldpi device. > > > > > > > > > > > > On Tue, Aug 3, 2010 at 8:27 AM, mrqzzz <[email protected]> wrote: > > > The issue was solved setting in Manifest.xml supports-screens > > > anyDensity to false: > > > > > <supports-screens android:anyDensity="false" > > > android:normalScreens="true" android:largeScreens="true" > > > android:smallScreens="true" android:resizeable="true"></supports- > > > screens> > > > > > I don't need that feature since i adapt the size of my objects to the > > > screen myself. > > > > > Thank you Kostya for the helpful tip! > > > > > Marcus. > > > > > On Aug 3, 3:58 pm, mrqzzz <[email protected]> wrote: > > > > Thanks for the fast reply! > > > > That might be the issue... I'll test ASAP. > > > > > > thanks, > > > > Marcus. > > > > > > On Aug 3, 3:27 pm, Kostya Vasilyev <[email protected]> wrote: > > > > > > > Did you declare support for varying screen sizes? > > > > > > >http://developer.android.com/guide/practices/screens_support.html > > > > > > > 03.08.2010 17:19, mrqzzz пишет: > > > > > > > > ...and if i don't specify any min SDK version, it runs smooth. > > > > > > > > I get average 30 fps vs. 12 fps. > > > > > > > > I am using Canvas to render and a JBox jar for physics. > > > > > > > > Tested and re-tested on a Motorola Milestone with Android 2.1 > update > > > > > > 1. > > > > > > Using latest Eclipse ADT. > > > > > > > > Any tips? > > > > > > > > Thanks, > > > > > > Marcus. > > > > > > > -- > > > > > Kostya Vasilev -- WiFi Manager + pretty widget -- > > >http://kmansoft.wordpress.com > > > > > -- > > > You received this message because you are subscribed to the Google > > > Groups "Android Developers" group. > > > To post to this group, send email to > [email protected] > > > To unsubscribe from this group, send email to > > > [email protected]<android-developers%[email protected]><android-developers%2Bunsubs > [email protected]> > > > For more options, visit this group at > > >http://groups.google.com/group/android-developers?hl=en > > > > -- > > Dianne Hackborn > > Android framework engineer > > [email protected] > > > > Note: please don't send private questions to me, as I don't have time to > > provide private support, and so won't reply to such e-mails. All such > > questions should be posted on public forums, where I and others can see > and > > answer them. > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected]<android-developers%[email protected]> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- Dianne Hackborn Android framework engineer [email protected] Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

