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'),
finished: this._finished.bind(this),
inflateData: this._inflateData.bind(this),
createData: this._createData.bind(this)
bitmapInfo: this._handleBitmapInfo.bind(this)
});
this._options = options;
this.writable = true;
@ -55,7 +55,7 @@ ParserAsync.prototype._inflateData = function(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._depth = depth;

View file

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

View file

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