HTML5画布效率

时间:2015-06-13 08:17:59

标签: html5 html5-canvas game-engine

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.svg3.svg的部分内容,或者我们有责任剪辑/在tile引擎中跳过这些?

0 个答案:

没有答案