HTML5 Canvas是否会浪费内存和CPU来渲染窗口外的像素?
假设我们要通过100
画布将{3}图像渲染到100
:
+---------+-------+--------+-------+-------+--------------------+
| image | width | height | X | Y | Remark |
+---------+-------+--------+-------+-------+--------------------+
| 1.svg | 50 | 80 | 10 | 10 | Fits in |
+---------+-------+--------+-------+-------+--------------------+
| 2.svg | 200 | 180 | -30 | 10 | Partially Fits |
+---------+-------+--------+-------+-------+--------------------+
| 3.svg | 300 | 400 | 130 | 200 | Totally off canvas |
+---------+-------+--------+-------+-------+--------------------+
如果我们将所有三个图像绘制到画布上,本机代码是否足够智能,不会浪费资源来绘制2.svg
和3.svg
的部分内容,或者我们有责任剪辑/在tile引擎中跳过这些?