为什么移动设备上的屏幕绘制被认为“昂贵”?
我总是看到人们在 GoogleIO 或 WWDC 上谈论在移动设备上绘制屏幕(位/像素)的成本如此。谁能解释这是为什么吗?
I always see people talking at GoogleIO or WWDC about how drawing the screen(bits/pixels) on mobile devices is so expensive. Can anyone explain why this is?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
因为像素绘制不使用任何图形加速硬件。例如,Java 中的像素绘制是使用设备的通用指令集执行的。例如,在 Java 中创建我正在逐像素编写的文本会非常慢。相反,图形加速硬件管道允许同时移动许多像素,并且还允许使用移动芯片(例如 Tegra 芯片)上的特殊硬件操作符绘制几何对象。这适用于 Android 和 Apple 设备以及台式计算机上的某些图形框架。
有时您别无选择,但作为经验,请尝试使用更高级别的 API 来绘制到屏幕,因为它们将有机会映射到设备的硬件加速功能。
Because pixel drawing does not make use of any graphic acceleration hardware. For instance, pixel drawing in Java is executed using the general purpose instruction set of the device. For instance, creating the text I'm writing pixel by pixel in Java would be very slow. Instead, the graphics acceleration hardware pipeline allows moving of many pixel at the time and also allows for drawing geometrical objects using special hardware operators on the mobile chip (like for instance the Tegra chip). This goes for Androids and Apple devices as well as for some graphics frameworks on desktop computers.
Sometimes you will have no choice, but as a role of thumb, try to use the higher level API's to draw to the screen as they will have a chance to map to the hardware accelerated capabilities of your device.