Saturday, August 6, 2011

Re: [android-developers] Re: onDraw() causing "flicker" when drawing new images

Perhaps you can try adding a synchronized lock that protects your data array.
Lock it before going into onDraw() and unlock it when finished, and do
the same when calculating your array data.
Do you have a separate thread that calculates positions?

On Fri, Aug 5, 2011 at 6:23 PM, niko20 <nikolatesla20@yahoo.com> wrote:
> Hm sounds like a refresh rate issue, with Surface view you probably
> can't sync to vertical refresh, so you get "tearing", where you see
> halfway animations for a second as the video buffer changes over to
> the next frame.
>
> -niko
>
> On Aug 5, 1:56 pm, Jeffrey <jeffisagen...@gmail.com> wrote:
>> I'm having an issue with drawing on my surface view. At one point I
>> was just replacing images with new ones in a grid, but the images
>> didn't all draw at the same time. I think that that may have had
>> something to do with modifying the array that it was using to
>> determine what to draw but I couldn't get it resolved even when
>> pausing the drawing. Now I have images that drop down and new ones
>> fall in (think slot machine reels) but the images will occasionally
>> flicker with what the new image is going to be before the old images
>> fall out.
>>
>> Basically I guess I'm asking what is a good way to either pause the
>> onDraw command while I can edit my arrays and get them all in place or
>> what is a good way to sync my array modifications to not take place
>> during an onDraw cycle? Or is onDraw just bad at drawing images
>> simultaneously and I should be using OpenGL or something?
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscribe@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

--
~ Jeremiah:9:23-24
Android 2D MMORPG: http://solrpg.com/http://www.youtube.com/user/revoltingx

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate