Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions cocos2d/textures/CCTextureCache.js
Original file line number Diff line number Diff line change
Expand Up @@ -494,18 +494,21 @@ cc.TextureCache = cc.Class.extend(/** @lends cc.TextureCache# */{
cc.log("cocos2d: '" + key + "' id=" + selTexture.getHtmlElementObj().src + " " + selTexture.getPixelsWide() + " x " + selTexture.getPixelsHigh());
else {
cc.log("cocos2d: '" + key + "' id= HTMLCanvasElement " + selTexture.getPixelsWide() + " x " + selTexture.getPixelsHigh());
totalBytes += selTexture.getPixelsWide() * selTexture.getPixelsHigh() * 4;
}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HTMLCanvasElement should be calculate

totalBytes += selTexture.getPixelsWide() * selTexture.getPixelsHigh() * 4;
}

var locTextureColorsCache = this._textureColorsCache;
for (key in locTextureColorsCache) {
var selCanvas = locTextureColorsCache[key];
count++;
cc.log("cocos2d: '" + key + "' id= HTMLCanvasElement " + selCanvas.getPixelsWide() + " x " + selCanvas.getPixelsHigh());
totalBytes += selCanvas.getPixelsWide() * selCanvas.getPixelsHigh() * 4;
}
var selCanvasColorsArr = locTextureColorsCache[key];
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

selCanvas is a Array ( not a Texture2D )

for (var selCanvasKey in selCanvasColorsArr){
var selCanvas = selCanvasColorsArr[selCanvasKey];
count++;
cc.log("cocos2d: '" + key + "' id= HTMLCanvasElement " + selCanvas.width + " x " + selCanvas.height);
totalBytes += selCanvas.width * selCanvas.height * 4;
}

}
cc.log("cocos2d: TextureCache dumpDebugInfo: " + count + " textures, HTMLCanvasElement for "
+ (totalBytes / 1024) + " KB (" + (totalBytes / (1024.0 * 1024.0)).toFixed(2) + " MB)");
}
Expand Down