[英]Performance difference between 'source-over' and 'destination-over' globalCompositeOperation for HTML canvas
Having reviewed the various globalCompositeOperation options for drawing on a 2D canvas, it occurs to me that destination-over
is essentially the same as the default source-over
but with the elements drawn in reverse. 在查看了用于在2D画布上绘制的各种globalCompositeOperation选项之后 ,我发现
destination-over
本质上与默认的source-over
相同,但是元素是相反绘制的。
I was wondering if anyone knows whether there's a performance difference between these two operations when the canvas calculates the composition and draws the pixels. 我想知道是否有人知道画布计算构图并绘制像素时这两个操作之间是否存在性能差异。
In case anyone is interested I did set up a jsPerf to test this. 如果有人感兴趣,我确实设置了jsPerf进行测试。 According to my tests
source-over
is actually faster! 根据我的测试,
source-over
实际上更快!
jsPerf test can be found here: http://jsperf.com/canvas-source-over-vs-destination-over/2 可以在这里找到jsPerf测试: http ://jsperf.com/canvas-source-over-vs-destination-over/2
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.