[android-developers] Re: Canvas frame rate very choppy in Live Wallpaper

2011-03-22 Thread Jeffrey
I only have one image rendered (the background image) and I get the exact same results from canvas.translate() vs .drawbitmap. The problem seems to be either the time it takes for it to draw the bitmap, or the time it takes to run through the sin/cos formulas for the placement. The image is only

[android-developers] Re: Canvas frame rate very choppy in Live Wallpaper

2011-03-22 Thread Jeffrey
Also, the entire animation loop is almost instantly, the problem comes from the Handler.postDelayed() not calling on time, no matter what I set the desired FPS at, I can't get above 6 FPS, and I no longer think it has anything to do my drawing code but maybe the way something else is handled. I

[android-developers] Re: Canvas frame rate very choppy in Live Wallpaper

2011-03-22 Thread lbendlin
Instead of int Speed = 50; double speedScale = (float) ((0.001*2*Math.PI)/Speed); double Dist = SystemClock.elapsedRealtime() * speedScale; you can write double Dist = SystemClock.elapsedRealtime() * 0.001256637; There - much quicker. -- You received this

Re: [android-developers] Re: Canvas frame rate very choppy in Live Wallpaper

2011-03-22 Thread Dianne Hackborn
On Tue, Mar 22, 2011 at 6:44 PM, Jeffrey jeffisagen...@gmail.com wrote: Also, the entire animation loop is almost instantly, the problem comes from the Handler.postDelayed() not calling on time, no matter what I set the desired FPS at, I can't get above 6 FPS, and I no longer think it has

Re: [android-developers] Re: Canvas frame rate very choppy in Live Wallpaper

2011-03-22 Thread Dianne Hackborn
Canvas is not hardware accelerated at all prior to 3.0. As of 3.0 hardware acceleration can optionally be turned on. This is not however available currently to live wallpapers. Live wallpapers *really* should use OpenGL. In fact, as of 3.0 they would be even better off using RenderScript,

[android-developers] Re: Canvas frame rate very choppy in Live Wallpaper

2011-03-21 Thread Jeffrey
I am not getting any speed improvements over just changing the top/ left coordinates of the .drawbitmap() command. I'm going to look into using OpenGL as I think part of my problem is the (relatively) low resolution makes even fluid movement seem choppy when it's moving by 1 pixel increments. On

[android-developers] Re: Canvas frame rate very choppy in Live Wallpaper

2011-03-21 Thread Peter Webb
I don't think OpenGL will help. I use canvas.translate and canvas.rotate extensively in my wallpaper, which runs very smoothly. AFAIK these commands just set mostly hardware flags for where to draw, and appear to execute instantaneously. You haven't posted any code, but I would make a bet on why

[android-developers] Re: Canvas frame rate very choppy in Live Wallpaper

2011-03-20 Thread Peter Webb
I think you are possibly doing this the wrong way. There is a canvas.translate() method which moves the canvas itself. This just sets the hardware to look at a translated location, so should be instantaneous plus or minus 1 nanosecond. The downside is that you will need to draw the image to a

[android-developers] Re: Canvas frame rate very choppy in Live Wallpaper

2011-03-20 Thread Riyad Kalla
Jeffrey, To what Peter said, mobile devices are very fill-rate-limited (at least these current gen of phones) so depending on how you are repainting that image over and over and over again to the Canvas, that could explain the speed issue. If you tried a tiny little 16x16 icon and it went much

[android-developers] Re: Canvas frame rate very choppy in Live Wallpaper

2011-03-20 Thread Jeffrey
Is there a way around having to call canvas.drawbitmap() every time? And if I call canvas.translate() after drawing the image doesn't move, it instead moves everything that would draw *after* the call to canvas.translate(). Thank you for your help so far, and I'm hoping you have just a little bit

[android-developers] Re: Canvas frame rate very choppy in Live Wallpaper

2011-03-20 Thread Peter Webb
Call canvas.translate(-x), draw, then call canvas.translate(x) You are moving the location on the canvas underneath where you draw, after you have drawn whatever you need to move the canvas back. On Mar 21, 8:47 am, Jeffrey jeffisagen...@gmail.com wrote: Is there a way around having to call