Firefox throwing a exception with HTML Canvas putImageData

前端 未结 7 1000
Happy的楠姐
Happy的楠姐 2021-01-04 09:12

So I was working on this little javascript experiment and I needed a widget to track the FPS of it. I ported a widget I\'ve been using with Actionscript 3 to Javascript and

7条回答
  •  南笙
    南笙 (楼主)
    2021-01-04 09:48

    Yeah, this error seems to happen when using (get|put)ImageData off the edges of the canvas.

    For my encounter with this problem, I simply added some clipping logic that checks the edges of the region to be drawn against the edges of the canvas, and clips it where necessary, only drawing the visible region. It seems to have fixed the problem.

提交回复
热议问题