[Pkg-javascript-commits] [pdf.js] 36/207: evaluator.js minor optimizations

David Prévot taffit at moszumanska.debian.org
Mon Jul 28 15:36:27 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository pdf.js.

commit d4a01f603429d255c0b1c294f8edbe5be2fd2800
Author: p01 <p01 at opera.com>
Date:   Mon Jun 2 12:43:20 2014 +0200

    evaluator.js minor optimizations
---
 src/core/evaluator.js | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/core/evaluator.js b/src/core/evaluator.js
index ccfa138..c6ca1c3 100644
--- a/src/core/evaluator.js
+++ b/src/core/evaluator.js
@@ -569,11 +569,11 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
         var dict = (isStream(pattern) ? pattern.dict : pattern);
         var typeNum = dict.get('PatternType');
 
-        if (typeNum == TILING_PATTERN) {
+        if (typeNum === TILING_PATTERN) {
           var color = cs.base ? cs.base.getRgb(args, 0) : null;
           return this.handleTilingType(fn, color, resources, pattern,
                                        dict, operatorList);
-        } else if (typeNum == SHADING_PATTERN) {
+        } else if (typeNum === SHADING_PATTERN) {
           var shading = dict.get('Shading');
           var matrix = dict.get('Matrix');
           pattern = Pattern.parseShading(shading, matrix, xref, resources);
@@ -947,7 +947,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
           }
 
           var glyphUnicode = glyph.unicode;
-          if (glyphUnicode in NormalizedUnicodes) {
+          if (NormalizedUnicodes[glyphUnicode] !== undefined) {
             glyphUnicode = NormalizedUnicodes[glyphUnicode];
           }
           glyphUnicode = reverseIfRtl(glyphUnicode);
@@ -1479,7 +1479,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
 
       var composite = false;
       var uint8array;
-      if (type.name == 'Type0') {
+      if (type.name === 'Type0') {
         // If font is a composite
         //  - get the descendant font
         //  - set the type according to the descendant font
@@ -1545,7 +1545,7 @@ var PartialEvaluator = (function PartialEvaluatorClosure() {
       var properties;
 
       if (!descriptor) {
-        if (type.name == 'Type3') {
+        if (type.name === 'Type3') {
           // FontDescriptor is only required for Type3 fonts when the document
           // is a tagged pdf. Create a barbebones one to get by.
           descriptor = new Dict(null);
@@ -2074,7 +2074,7 @@ var EvaluatorPreprocessor = (function EvaluatorPreprocessorClosure() {
         }
         if (!isCmd(obj)) {
           // argument
-          if (obj !== null && obj !== undefined) {
+          if (obj != null) {
             args.push((obj instanceof Dict ? obj.getAll() : obj));
             assert(args.length <= 33, 'Too many arguments');
           }
@@ -2165,9 +2165,9 @@ var QueueOptimizer = (function QueueOptimizerClosure() {
     // have been found at index.
     for (var i = 0; i < count; i++) {
       var arg = argsArray[index + 4 * i + 2];
-      var imageMask = arg.length == 1 && arg[0];
-      if (imageMask && imageMask.width == 1 && imageMask.height == 1 &&
-          (!imageMask.data.length || (imageMask.data.length == 1 &&
+      var imageMask = arg.length === 1 && arg[0];
+      if (imageMask && imageMask.width === 1 && imageMask.height === 1 &&
+          (!imageMask.data.length || (imageMask.data.length === 1 &&
                                       imageMask.data[0] === 0))) {
         fnArray[index + 4 * i + 2] = OPS.paintSolidColorImageMask;
         continue;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git



More information about the Pkg-javascript-commits mailing list