diff --git a/lib/parser-async.js b/lib/parser-async.js index abdceda..9da03dc 100644 --- a/lib/parser-async.js +++ b/lib/parser-async.js @@ -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; diff --git a/lib/parser-sync.js b/lib/parser-sync.js index 54113af..2220105 100644 --- a/lib/parser-sync.js +++ b/lib/parser-sync.js @@ -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(); diff --git a/lib/parser.js b/lib/parser.js index 2d49dc8..845ee2c 100644 --- a/lib/parser.js +++ b/lib/parser.js @@ -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;