Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
399 views
in Technique[技术] by (71.8m points)

android - 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 example like this: http://android-coding.blogspot.com/2011/05/drawing-on-surfaceview.html Or this one: http://jmsliu.com/199/android-canvas-example.html

I even modified them to not have any canvas calls inside the draw loop thinking that I might have got in some unsupported HW accel operations for certain drawing calls. I checked this list under "Unsupported Drawing Operations" developer.android.com/guide/topics/graphics/hardware-accel.html but I'm not doing any of that.

I am using the Force GPU rendering flag inside the Developer Options together with inside the manifests, also I'm specifying minSDK/targetSDK >= 14.

The View.isHardwareAccelerated will return TRUE, while the Canvas.isHardwareAccelerated will return always FALSE.

I've seen that Canvas.java has hard-codeded return false for isHardwareAccelerated(), while HardwareCanvas.java has return true. I guess for some reasons I'm not getting the HW path, why?

Can a Canvas inside a SurfaceView be HW accelerated?

Thanks

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...