如何执行昂贵的渲染 [英] How to perform Expensive Rendering

查看:94
本文介绍了如何执行昂贵的渲染的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在许多情况下,渲染需要大量的计算能力。因此,可能会发生由于UI需要等待渲染完成而跳过帧的情况。

Rendering takes a lot of computational power in many cases. Thus, it can happen that frames are being skipped as the UI needs to wait for the rendering to finish.

我想知道如何实现渲染或绘画异步,即孤立。

I was wondering how I could implement rendering or painting asynchronously, i.e. isolated.

类似于 compute 不是一个选择,因为 SendPort 仅适用于原始类型,绘画需要 PaintingContext 画布

Functions like compute are not an option because SendPort only works with primitive types and painting will require a PaintingContext or Canvas.

有些Flutter插件需要大量渲染。因此,我认为我可以在 video_player 插件,但它使用 Texture ,即不在Dart中渲染

There are Flutter plugins that require heavy rendering. Hence, I thought that I could find answers in the video_player plugin, but it uses Texture, i.e. does not render in Dart.

我想知道是否有任何成语或示例

I am wondering if there are any idioms or example implementations regarding this.

我想知道如何实现渲染,可以看看 FlareActor 。原来他们像我一样处理绘画。现在我想知道为什么我遇到瓶颈而Flare却没有。有优化绘画的指南吗?

I you are wondering how I implement rendering, you can take a look at FlareActor. It turns out that they handle painting exactly like I do. Now I am wondering why I am running into bottlenecks and Flare is not. Are there any guides on optimizing painting?

推荐答案

我通过将所有需要的像素写入来解决了问题BMP 文件格式,然后使用 Canvas.drawImage 代替,因为Flutter画布无法处理许多 Canvas 操作: https://stackoverflow.com/a/55855735/6509751

I solved it by writing all my required pixels to the BMP file format and then using Canvas.drawImage instead as the Flutter canvas cannot handle many Canvas operations: https://stackoverflow.com/a/55855735/6509751

这篇关于如何执行昂贵的渲染的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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