Will rendering images outside an HTML5 canvas hurt performance?

后端 未结 1 1374
心在旅途
心在旅途 2021-01-28 16:08

I\'m building a 2D platformer game and I\'ll have a bunch of the level off the screen. Will it hurt performance to render these, or should I develop some form of 2D occlusion cu

1条回答
  •  北海茫月
    2021-01-28 16:23

    The rendering engine should throw out render calls to areas outside the canvas, but I would still recommend not trying to draw to those areas to begin with just to reduce the overall overhead of performing unnecessary logic. That said, the major cost would be if repaints were triggered, which in this case would not likely happen.

    Here is a WebKit bug report (FIXED) from 2010 that addresses an issue where the browser was accidentally drawing things outside the canvas:

    https://bugs.webkit.org/show_bug.cgi?id=45792

    0 讨论(0)
提交回复
热议问题