This commit is contained in:
Artur Adib 2011-10-25 09:10:56 -07:00
parent 889de3fc4d
commit 8fbb05613e
19 changed files with 48 additions and 82 deletions

View File

@ -41,6 +41,15 @@ PDF_WORKER_FILES = \
worker/processor_handler.js \
$(NULL)
# make server
#
# This target starts a local web server at localhost:8888. This can be
# used for testing all browsers.
server:
@cd test; python test.py --port=8888;
test: pdfjs shell-test browser-test
#
# Bundle pdf.js
#
@ -53,22 +62,6 @@ pdfjs:
rm -f all_files.tmp; \
cd ..
#
# Watch for file changes, regenerate pdf.js if change found
#
watch:
@echo "Watching for file changes in src/"
@python watch.py src/*.js - 'make pdfjs'
# make server
#
# This target starts a local web server at localhost:8888. This can be
# used for testing all browsers.
server:
@cd test; python test.py --port=8888;
test: shell-test browser-test
# make browser-test
#
# This target runs in-browser tests using two primary arguments: a
@ -240,5 +233,12 @@ clean:
help:
@echo "Read the comments in the Makefile for guidance.";
.PHONY:: all test browser-test font-test shell-test \
#
# Watch for file changes, regenerate pdf.js if change found
#
watch:
@echo "Watching for file changes in src/"
@python watch.py src/*.js - 'make pdfjs'
.PHONY:: all pdfjs watch test browser-test font-test shell-test \
shell-msg lint clean web compiler help server

View File

@ -558,7 +558,7 @@ var CanvasGraphics = (function canvasGraphics() {
color = base.getRgb(color);
}
var pattern = new TilingPattern(IR, color, this.ctx, this.objs);
} else if (IR[0] == 'RadialAxialShading' || IR[0] == 'DummyShading') {
} else if (IR[0] == 'RadialAxial' || IR[0] == 'Dummy') {
var pattern = Pattern.shadingFromIR(this.ctx, IR);
} else {
throw 'Unkown IR type';

View File

@ -1,8 +1,6 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
'use strict';
var ISOAdobeCharset = [
'.notdef', 'space', 'exclam', 'quotedbl', 'numbersign', 'dollar',
'percent', 'ampersand', 'quoteright', 'parenleft', 'parenright',

View File

@ -1,8 +1,6 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
'use strict';
var CIDToUnicodeMaps = {
'Adobe-Japan1': [[32, 160], {f: 12, c: 33}, [45, 8209], {f: 46, c: 46}, 165,
{f: 2, c: 93}, [95, 818], [96, 768], {f: 27, c: 97}, 166, 125, [732, 771],

View File

@ -1,8 +1,6 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
'use strict';
var ERRORS = 0, WARNINGS = 1, TODOS = 5;
var verbosity = WARNINGS;

View File

@ -1,8 +1,6 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
'use strict';
var ARCFourCipher = (function arcFourCipher() {
function constructor(key) {
this.a = 0;

View File

@ -1,7 +1,6 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
'use strict';
var isWorker = (typeof window == 'undefined');
/**

View File

@ -1,8 +1,6 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
'use strict';
var GlyphsUnicode = {
A: 0x0041,
AE: 0x00C6,

View File

@ -1,8 +1,6 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
'use strict';
var Metrics = {
'Courier': 600,
'Courier-Bold': 600,

View File

@ -13,8 +13,7 @@ var Pattern = (function patternPattern() {
};
constructor.shadingFromIR = function pattern_shadingFromIR(ctx, raw) {
var obj = window[raw[0]];
return obj.fromIR(ctx, raw);
return Shadings[raw[0]].fromIR(ctx, raw);
}
constructor.parseShading = function pattern_shading(shading, matrix,
@ -27,34 +26,19 @@ var Pattern = (function patternPattern() {
case 2:
case 3:
// both radial and axial shadings are handled by RadialAxial shading
return new RadialAxialShading(dict, matrix, xref, res, ctx);
return new Shadings.RadialAxial(dict, matrix, xref, res, ctx);
default:
return new DummyShading();
return new Shadings.Dummy();
}
};
return constructor;
})();
var DummyShading = (function dummyShading() {
function constructor() {
this.type = 'Pattern';
}
constructor.fromIR = function() {
return 'hotpink';
}
constructor.prototype = {
getIR: function dummpy_getir() {
return ['DummyShading'];
}
};
return constructor;
})();
var Shadings = {};
// Radial and axial shading have very similar implementations
// If needed, the implementations can be broken into two classes
var RadialAxialShading = (function radialAxialShading() {
Shadings.RadialAxial = (function radialAxialShading() {
function constructor(dict, matrix, xref, res, ctx) {
this.matrix = matrix;
this.coordsArr = dict.get('Coords');
@ -163,13 +147,30 @@ var RadialAxialShading = (function radialAxialShading() {
p1 = Util.applyTransform(p1, matrix);
}
return ['RadialAxialShading', type, this.colorStops, p0, p1, r0, r1];
return ['RadialAxial', type, this.colorStops, p0, p1, r0, r1];
}
};
return constructor;
})();
Shadings.Dummy = (function dummyShading() {
function constructor() {
this.type = 'Pattern';
}
constructor.fromIR = function() {
return 'hotpink';
}
constructor.prototype = {
getIR: function dummpy_getir() {
return ['Dummy'];
}
};
return constructor;
})();
var TilingPattern = (function tilingPattern() {
var PAINT_TYPE_COLORED = 1, PAINT_TYPE_UNCOLORED = 2;

View File

@ -4,18 +4,15 @@
// // TODO: Global namespace
// var PDF = {};
// Stay away from global
(function(){
// Use strict in our context only - users might not want it
'use strict';
// All files will be inserted below this point
// INSERT_POINT
// Files are inserted below - see Makefile
/* INSERT_POINT */
//
// Expose API in global object
//
window.PDFDoc = PDFDoc;
window.getPdf = getPdf;
})(); // self-executing function
})();

View File

@ -1,8 +1,6 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
'use strict';
var CFFEncodingMap = {
'0': '-reserved-',
'1': 'hstem',

View File

@ -1,8 +1,6 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
'use strict';
/*
* The Type2 reader code below is only used for debugging purpose since Type2
* is only a CharString format and is never used directly as a Font file.

View File

@ -1,8 +1,6 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
'use strict';
var consoleTimer = {};
var console = {
log: function log() {

View File

@ -1,9 +1,6 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- /
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
'use strict';
function MessageHandler(name, comObj) {
this.name = name;
this.comObj = comObj;

View File

@ -1,8 +1,6 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- /
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
'use strict';
var WorkerProcessorHandler = {
setup: function(handler) {
var pdfDoc = null;

View File

@ -318,7 +318,7 @@ def downloadLinkedPDFs(manifestList):
def setUp(options):
# Only serve files from a pdf.js clone
assert not ANAL or os.path.isfile('../pdf.js') and os.path.isdir('../.git')
assert not ANAL or os.path.isfile('../build/pdf.js') and os.path.isdir('../.git')
if options.masterMode and os.path.isdir(TMPDIR):
print 'Temporary snapshot dir tmp/ is still around.'

View File

@ -3,16 +3,8 @@
<head>
<title>pdf.js test slave</title>
<style type="text/css"></style>
<script type="text/javascript" src="/pdf.js"></script>
<script type="text/javascript" src="/fonts.js"></script>
<script type="text/javascript" src="/crypto.js"></script>
<script type="text/javascript" src="/glyphlist.js"></script>
<script type="text/javascript" src="/metrics.js"></script>
<script type="text/javascript" src="/charsets.js"></script>
<script type="text/javascript" src="/cidmaps.js"></script>
<script type="text/javascript" src="/build/pdf.js"></script>
<script type="text/javascript" src="driver.js"></script>
<script type="text/javascript" src="../worker/message_handler.js"></script>
<script type="text/javascript" src="../worker/processor_handler.js"></script>
</head>
<body>

View File

@ -6,7 +6,7 @@
<script type="text/javascript" src="compatibility.js"></script>
<script type="text/javascript" src="viewer.js"></script>
<script type="text/javascript" src="../pdf.js"></script>
<script type="text/javascript" src="../build/pdf.js"></script>
</head>
<body>