SurfaceView 中的画布 - 硬件加速 [英] Canvas in SurfaceView - hardware acceleration

查看:112
本文介绍了SurfaceView 中的画布 - 硬件加速的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发 ICS 并试图理解为什么Canvas.isHardwareAccelerated() 在使用SurfaceView 内的画布.

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

我尝试了一个非常基本的例子,如下所示:http://android-coding.blogspot.com/2011/05/drawing-on-表面视图.html或者这个:http://jmsliu.com/199/android-canvas-example.html

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

我什至将它们修改为在绘制循环内没有任何画布调用认为我可能参与了一些不受支持的硬件加速操作对于某些绘图调用.我在不支持的绘图操作"下检查了这个列表developer.android.com/guide/topics/graphics/hardware-accel.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.

我在开发者选项中使用了 Force GPU 渲染标志和...一起在清单中,我还指定了 minSDK/targetSDK >= 14.

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

View.isHardwareAccelerated 将返回 TRUE,而Canvas.isHardwareAccelerated 将始终返回 FALSE.

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

我已经看到 Canvas.java 为 isHardwareAccelerated() 硬编码返回 false,而 HardwareCanvas.java 返回 true.我想由于某些原因我没有得到硬件路径,为什么?

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?

SurfaceView 中的 Canvas 可以进行硬件加速吗?

Can a Canvas inside a SurfaceView be HW accelerated?

谢谢

推荐答案

SurfaceView.lockCanvas() 返回的 Canvas 目前无法进行硬件加速.

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

这篇关于SurfaceView 中的画布 - 硬件加速的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆