3

I needed days to figure out why invalidate(Rect dirty) doesn't set the correct clip on newer devices.

The problem is that hardwareAccelerated="true" is set by default.
When I set this hardwareAccelerated="false",
I get my right clip in my onDraw.

Now my question is:
What is better for performance:
Use hardwareAccelerated="false" and draw only the part of my view which is dirty and run only the code in my onDraw that is needed for this
OR
allow hardwareAcceleration and let android draw my entire view over and over again?

I guess this question may be answered for every application individually so I add a screenshot of my app.

enter image description here

As you can see I draw a calendar and each time a user clicks a entry this should get a red border.

Can you give me any suggestions whats best for this requirement?

Cheers, Stefan

Pararth
  • 8,114
  • 4
  • 34
  • 51
stefan
  • 1,336
  • 3
  • 21
  • 46
  • did you try to measure onDraw() time ? – pskink Feb 15 '14 at 12:37
  • I don't have this implementaion yet so I can't measure. I tried to gather some recommendations before I start a massive refactoring... But this seems to be a good resource: http://developer.android.com/guide/topics/graphics/hardware-accel.html#determining – stefan Feb 15 '14 at 12:58
  • 1
    this post http://stackoverflow.com/questions/7233830/partial-invalidation-in-custom-android-view-with-hardware-acceleration seems to suggest that you can have both hwd accel and partial redraws – pskink Feb 15 '14 at 13:57

0 Answers0