Browse Source

Merge pull request #4331 from nnethercote/cleanups

Minor clean-ups
Brendan Dahl 11 years ago
parent
commit
d0f87457d7
  1. 2
      src/core/evaluator.js
  2. 24
      src/core/stream.js
  3. 5
      web/text_layer_builder.js

2
src/core/evaluator.js

@ -87,8 +87,6 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
xobj, smask, xobj, smask,
operatorList, operatorList,
state) { state) {
var self = this;
var matrix = xobj.dict.get('Matrix'); var matrix = xobj.dict.get('Matrix');
var bbox = xobj.dict.get('BBox'); var bbox = xobj.dict.get('BBox');
var group = xobj.dict.get('Group'); var group = xobj.dict.get('Group');

24
src/core/stream.js

@ -1688,7 +1688,6 @@ var CCITTFaxStream = (function CCITTFaxStreamClosure() {
this.inputBits = 0; this.inputBits = 0;
this.inputBuf = 0; this.inputBuf = 0;
this.outputBits = 0; this.outputBits = 0;
this.buf = EOF;
var code1; var code1;
while ((code1 = this.lookBits(12)) === 0) { while ((code1 = this.lookBits(12)) === 0) {
@ -1710,7 +1709,6 @@ var CCITTFaxStream = (function CCITTFaxStreamClosure() {
CCITTFaxStream.prototype.readBlock = function CCITTFaxStream_readBlock() { CCITTFaxStream.prototype.readBlock = function CCITTFaxStream_readBlock() {
while (!this.eof) { while (!this.eof) {
var c = this.lookChar(); var c = this.lookChar();
this.buf = EOF;
this.ensureBuffer(this.bufferLength + 1); this.ensureBuffer(this.bufferLength + 1);
this.buffer[this.bufferLength++] = c; this.buffer[this.bufferLength++] = c;
} }
@ -1766,9 +1764,6 @@ var CCITTFaxStream = (function CCITTFaxStreamClosure() {
}; };
CCITTFaxStream.prototype.lookChar = function CCITTFaxStream_lookChar() { CCITTFaxStream.prototype.lookChar = function CCITTFaxStream_lookChar() {
if (this.buf != EOF)
return this.buf;
var refLine = this.refLine; var refLine = this.refLine;
var codingLine = this.codingLine; var codingLine = this.codingLine;
var columns = this.columns; var columns = this.columns;
@ -2014,8 +2009,9 @@ var CCITTFaxStream = (function CCITTFaxStreamClosure() {
this.row++; this.row++;
} }
var c;
if (this.outputBits >= 8) { if (this.outputBits >= 8) {
this.buf = (this.codingPos & 1) ? 0 : 0xFF; c = (this.codingPos & 1) ? 0 : 0xFF;
this.outputBits -= 8; this.outputBits -= 8;
if (this.outputBits === 0 && codingLine[this.codingPos] < columns) { if (this.outputBits === 0 && codingLine[this.codingPos] < columns) {
this.codingPos++; this.codingPos++;
@ -2024,19 +2020,19 @@ var CCITTFaxStream = (function CCITTFaxStreamClosure() {
} }
} else { } else {
var bits = 8; var bits = 8;
this.buf = 0; c = 0;
do { do {
if (this.outputBits > bits) { if (this.outputBits > bits) {
this.buf <<= bits; c <<= bits;
if (!(this.codingPos & 1)) { if (!(this.codingPos & 1)) {
this.buf |= 0xFF >> (8 - bits); c |= 0xFF >> (8 - bits);
} }
this.outputBits -= bits; this.outputBits -= bits;
bits = 0; bits = 0;
} else { } else {
this.buf <<= this.outputBits; c <<= this.outputBits;
if (!(this.codingPos & 1)) { if (!(this.codingPos & 1)) {
this.buf |= 0xFF >> (8 - this.outputBits); c |= 0xFF >> (8 - this.outputBits);
} }
bits -= this.outputBits; bits -= this.outputBits;
this.outputBits = 0; this.outputBits = 0;
@ -2045,16 +2041,16 @@ var CCITTFaxStream = (function CCITTFaxStreamClosure() {
this.outputBits = (codingLine[this.codingPos] - this.outputBits = (codingLine[this.codingPos] -
codingLine[this.codingPos - 1]); codingLine[this.codingPos - 1]);
} else if (bits > 0) { } else if (bits > 0) {
this.buf <<= bits; c <<= bits;
bits = 0; bits = 0;
} }
} }
} while (bits); } while (bits);
} }
if (this.black) { if (this.black) {
this.buf ^= 0xFF; c ^= 0xFF;
} }
return this.buf; return c;
}; };
// This functions returns the code found from the table. // This functions returns the code found from the table.

5
web/text_layer_builder.js

@ -60,10 +60,7 @@ var TextLayerBuilder = function textLayerBuilder(options) {
}; };
this.renderLayer = function textLayerBuilderRenderLayer() { this.renderLayer = function textLayerBuilderRenderLayer() {
var self = this;
var textDivs = this.textDivs; var textDivs = this.textDivs;
var bidiTexts = this.textContent;
var textLayerDiv = this.textLayerDiv;
var canvas = document.createElement('canvas'); var canvas = document.createElement('canvas');
var ctx = canvas.getContext('2d'); var ctx = canvas.getContext('2d');
@ -93,7 +90,7 @@ var TextLayerBuilder = function textLayerBuilder(options) {
} }
} }
textLayerDiv.appendChild(textLayerFrag); this.textLayerDiv.appendChild(textLayerFrag);
this.renderingDone = true; this.renderingDone = true;
this.updateMatches(); this.updateMatches();
}; };

Loading…
Cancel
Save