模拟器运行的,GL calls423,这个就是DrawCall吧?按理说一个Graphics不应该就是1吗 再加个背景纯色sprite,应该是2吧?
整个场景就两个节点 一个白色的bg ,一个qrcode,挂载了Graphics,通过Graphics画二维码,画的代码:
var ctx = this.node.getComponent(cc.Graphics);
// compute tileW/tileH based on node width and height
var tileW = this.node.width / qrcode.getModuleCount();
var tileH = this.node.height / qrcode.getModuleCount();
// draw in the Graphics
for (var row = 0; row < qrcode.getModuleCount(); row++) {
for (var col = 0; col < qrcode.getModuleCount(); col++) {
if (qrcode.isDark(row, col)) {
ctx.fillColor = cc.Color.BLACK;
} else {
ctx.fillColor = cc.Color.WHITE;
}
var w = (Math.ceil((col + 1) * tileW) - Math.floor(col * tileW));
var h = (Math.ceil((row + 1) * tileW) - Math.floor(row * tileW));
ctx.rect(Math.round(col * tileW), Math.round(row * tileH), w, h);
ctx.fill();
}
}
不过帧数倒一直是60,貌似也没什么影响。。。嗯。。就好奇
