Rename createData

This commit is contained in:
Luke Page 2015-08-07 07:31:14 +01:00
parent 2fbf81e598
commit 119d403098
3 changed files with 6 additions and 8 deletions

View file

@ -18,7 +18,7 @@ var ParserAsync = module.exports = function(options) {
gamma: this.emit.bind(this, 'gamma'), gamma: this.emit.bind(this, 'gamma'),
finished: this._finished.bind(this), finished: this._finished.bind(this),
inflateData: this._inflateData.bind(this), inflateData: this._inflateData.bind(this),
createData: this._createData.bind(this) bitmapInfo: this._handleBitmapInfo.bind(this)
}); });
this._options = options; this._options = options;
this.writable = true; this.writable = true;
@ -55,7 +55,7 @@ ParserAsync.prototype._inflateData = function(data) {
this._inflate.write(data); this._inflate.write(data);
}; };
ParserAsync.prototype._createData = function(width, height, bpp, depth, interlace) { ParserAsync.prototype._handleBitmapInfo = function(width, height, bpp, depth, interlace) {
this._bpp = bpp; this._bpp = bpp;
this._depth = depth; this._depth = depth;

View file

@ -17,7 +17,7 @@ module.exports = function(buffer, options) {
} }
var data, bpp, width, height, depth, interlace; var data, bpp, width, height, depth, interlace;
function createData(_width_, _height_, _bpp_, _depth_, _interlace_) { function handleBitmapInfo(_width_, _height_, _bpp_, _depth_, _interlace_) {
bpp = _bpp_; bpp = _bpp_;
width = _width_; width = _width_;
@ -26,8 +26,6 @@ module.exports = function(buffer, options) {
interlace = _interlace_; interlace = _interlace_;
data = new Buffer(width * height * 4); data = new Buffer(width * height * 4);
return data; // todo do not return
} }
var metaData; var metaData;
@ -53,7 +51,7 @@ module.exports = function(buffer, options) {
metadata: handleMetaData, metadata: handleMetaData,
gamma: handleGamma, gamma: handleGamma,
inflateData: handleInflateData, inflateData: handleInflateData,
createData: createData bitmapInfo: handleBitmapInfo
}); });
parser.start(); parser.start();

View file

@ -29,7 +29,7 @@ var Parser = module.exports = function(options, dependencies) {
this.metadata = dependencies.metadata; this.metadata = dependencies.metadata;
this.gamma = dependencies.gamma; this.gamma = dependencies.gamma;
this.parsed = dependencies.parsed; this.parsed = dependencies.parsed;
this.createData = dependencies.createData; this.bitmapInfo = dependencies.bitmapInfo;
this.inflateData = dependencies.inflateData; this.inflateData = dependencies.inflateData;
this.finished = dependencies.finished; this.finished = dependencies.finished;
}; };
@ -168,7 +168,7 @@ Parser.prototype._parseIHDR = function(data) {
this._colorType = colorType; this._colorType = colorType;
var bpp = colorTypeToBppMap[this._colorType]; var bpp = colorTypeToBppMap[this._colorType];
this.createData(width, height, bpp, depth, interlace); this.bitmapInfo(width, height, bpp, depth, interlace, colorType);
this._hasIHDR = true; this._hasIHDR = true;