Using drawImage with Canvas is very slow on Chrome

前端 未结 1 491
眼角桃花
眼角桃花 2021-02-08 14:05

I\'ve been trying to draw a large number of instances of an SVG file to a canvas using drawImage. By creating a single image element using the SVG as the source, then using dra

相关标签:
1条回答
  • 2021-02-08 14:29

    Slowdown 1: Occurs when either the source or destination canvas is in RAM and the other canvas is on GPU.

    Slowdown 2: Occurs when src and dest canvases are different sizes


    Relevant bug: http://code.google.com/p/chromium/issues/detail?id=170021

    I have noticed the same issue, and simplified the case to drawing one blank canvas to another. It doesn't seem to be an issue when the canvases are the same size, but at a certain point performance takes a nose dive. Here is the jspref, and my results:

    jspref chrome results

    Notice the difference in 255x255 to 100x100 and 260x260 to 100x100.

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