Skip to content
This repository has been archived by the owner on Jul 15, 2019. It is now read-only.

Commit

Permalink
Remove scale file - Implementation now in parser, scaler, and normalizer
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelerz committed May 27, 2015
1 parent d3848f5 commit cc95a55
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 157 deletions.
13 changes: 6 additions & 7 deletions lib/png/chunks/IHDR.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
var colorTypes = require('../utils/constants').colorTypes;

var BufferedStream = require('../utils/bufferedStream');
var scale = require('../utils/scale');

var Compressor = require('../processor/compressor');
var Filter = require('../processor/filter');
Expand Down Expand Up @@ -666,35 +665,35 @@ module.exports = {
// Add alpha channel if needed
if (!this.hasAlphaChannel()) {
withdrawnStream = new BufferedStream(null, null, imageStream.length * 0.75);
scale.withdraw(imageStream, withdrawnStream, 4);
//scale.withdraw(imageStream, withdrawnStream, 4);
} else {
withdrawnStream = imageStream; // Nothing to do
}

// Channel spreading - Grayscale to color
if (!this.isColor()) {
reducedStream = new BufferedStream(null, null, withdrawnStream.length / 3);
scale.reduce(withdrawnStream, reducedStream, 3);
//scale.reduce(withdrawnStream, reducedStream, 3);
} else {
reducedStream = withdrawnStream; // Nothing to do
}

// Do some scaling
if (this.getBitDepth() === 1) {
scaledStream = new BufferedStream(null, null, reducedStream.length / 8);
scale.scale8to1bit(reducedStream, scaledStream);
//scale.scale8to1bit(reducedStream, scaledStream);

} else if (this.getBitDepth() === 2) {
scaledStream = new BufferedStream(null, null, reducedStream.length / 4);
scale.scale8to2bit(reducedStream, scaledStream);
//scale.scale8to2bit(reducedStream, scaledStream);

} else if (this.getBitDepth() === 4) {
scaledStream = new BufferedStream(null, null, reducedStream.length / 2);
scale.scale8to4bit(reducedStream, scaledStream);
//scale.scale8to4bit(reducedStream, scaledStream);

} else if (this.getBitDepth() === 16) {
scaledStream = new BufferedStream(null, null, reducedStream.length * 2);
scale.scale8to16bit(reducedStream, scaledStream);
//scale.scale8to16bit(reducedStream, scaledStream);

} else {
scaledStream = reducedStream; // Nothing to do
Expand Down
150 changes: 0 additions & 150 deletions lib/png/utils/scale.js

This file was deleted.

0 comments on commit cc95a55

Please sign in to comment.