Skip to content Skip to sidebar Skip to footer

Canvas In Surfaceview - Hardware Acceleration

I'm developing on ICS and trying to understand why a Canvas.isHardwareAccelerated() will always return FALSE when using a Canvas inside a SurfaceView. I've tried a very basic examp

Solution 1:

A Canvas returned by SurfaceView.lockCanvas() cannot be hardware accelerated at the moment.


Solution 2:

it seems that there is a new hide api method unlockHardwareCanvas in android.view.Surface

and here is the example: http://androidxref.com/5.1.0_r1/xref/frameworks/base/tests/HwAccelerationTest/src/com/android/test/hwui/HardwareCanvasSurfaceViewActivity.java

you can use relfecation in production environments.


Solution 3:

Have you stated in your android manifest, that your app wants to use hw acceleration?

This would be something like <application android:hardwareAccelerated="true" ...>

Depending on what you want to do it might also be useful to only activate acceleration only for an activity or window, see http://developer.android.com/guide/topics/graphics/hardware-accel.html for details.

Rudi


Post a Comment for "Canvas In Surfaceview - Hardware Acceleration"