C export: fix after review

This commit is contained in:
Clement Leger 2016-04-11 14:33:58 +02:00
parent 4927557c89
commit dfb8fec0c9
2 changed files with 7 additions and 17 deletions

View File

@ -18,7 +18,6 @@
ns.CExportController.prototype.onCDownloadButtonClick_ = function (evt) {
var fileName = this.getPiskelName_() + '.c';
var cName = this.getPiskelName_().replace(' ','_');
var outputCanvas = this.getFramesheetAsCanvas();
var width = this.piskelController.getWidth();
var height = this.piskelController.getHeight();
var frameCount = this.piskelController.getFrameCount();
@ -26,7 +25,6 @@
// Create a background canvas that will be filled with the transparent color before each render.
var background = pskl.utils.CanvasUtils.createCanvas(width, height);
var context = background.getContext('2d');
context.fillStyle = BLACK;
// Useful defines for C routines
var frameStr = '#include <stdint.h>\n\n';
@ -41,8 +39,6 @@
for (var i = 0 ; i < frameCount ; i++) {
var render = this.piskelController.renderFrameAt(i, true);
context.clearRect(0, 0, width, height);
context.fillRect(0, 0, width, height);
context.drawImage(render, 0, 0, width, height);
var imgd = context.getImageData(0, 0, width, height);
var pix = imgd.data;
@ -82,10 +78,4 @@
hexStr += ('00' + r.toString(16)).substr(-2);
return hexStr;
};
ns.CExportController.prototype.getFramesheetAsCanvas = function () {
var renderer = new pskl.rendering.PiskelRenderer(this.piskelController);
return renderer.renderAsCanvas();
};
})();

View File

@ -33,6 +33,13 @@
</div>
<button type="button" class="button button-primary zip-generate-button"/>Download ZIP</button>
</div>
<div class="settings-title">
Export as C File
</div>
<div class="settings-item">
<div class="settings-description">C file with frame rendered as array.</div>
<button type="button" class="button button-primary c-download-button">Download C file</button>
</div>
<div class="settings-title">
Export to Animated GIF
</div>
@ -61,12 +68,5 @@
<div class="gif-upload-status"></div>
</div>
</div>
<div class="settings-title">
Export as C File
</div>
<div class="settings-item">
<div class="settings-description">C file with frame rendered as array.</div>
<button type="button" class="button button-primary c-download-button">Download C file</button>
</div>
</div>
</script>