Yury Delendik
e53a28c996
Merge pull request #5192 from nnethercote/empty-setGState
...
Ignore setGState no-ops.
2014-08-15 10:20:14 -05:00
Nicholas Nethercote
9674abc542
Ignore setGState no-ops.
...
For the document in #2504 , 11% of the ops are `setGState` with a
`gStateObj` that is an empty array, which is a no-op. This is possible
because we ignore various setGState keys (OP, OPM, BG, etc).
This change prevents these ops from being inserted into the operator
list.
2014-08-14 20:46:28 -07:00
Nicholas Nethercote
7cbd057deb
Avoid unnecessary array allocations in EvaluatorPreprocessor_read().
...
EvaluatorPreprocessor_read() is called in two cases. For the normal
layer, the args array it produces is used beyond the bounds of the loop
in which EvaluatorPreprocessor_read() is called.
But for the text layer, the args array is used in a very short-term
fashion. This change reworks things so that a single array is repeatedly
used for the text layer. This reduces total JS allocations for the
Spoorkaart map by 11%, and has similar effects on many other PDFs.
2014-08-11 16:57:40 -07:00
Yury Delendik
4ce1b1e987
Merge pull request #5150 from nnethercote/toUnicode
...
Fix #4935
2014-08-10 14:07:26 -05:00
Yury Delendik
99b08ed223
Merge pull request #5162 from yurydelendik/pramodhkp-fixupgstate2
...
[SVG] Reduces amount of used memory during PNG creation.
2014-08-09 15:56:11 -05:00
pramodhkp
458b69b649
Adds image and mask features, fixes clippath
2014-08-10 01:06:43 +05:30
Jonas Jenwald
66c56ac546
Fixes a regression from PR 4982
...
After PR 4982, the rendering of the first two pages of http://www.openmagazin.cz/pdf/2011/openMagazin-2011-04.pdf (from issue 215) no longer completes.
The issue is that we cannot have `args === null` in `PartialEvaluator_buildPath`, but *must* use an empty array instead.
In this patch I've also moved the `argsLength` variable definition in `EvaluatorPreprocessor_read`, to make sure that it's always defined.
2014-08-08 13:19:18 +02:00
Nicholas Nethercote
9576047f0d
Add ToUnicodeMap class.
2014-08-07 20:05:24 -07:00
Yury Delendik
2b87ff9286
Merge pull request #5008 from nnethercote/better-QueueOpt
...
Make QueueOptimizer easier to read.
2014-08-05 16:59:26 -05:00
Jonas Jenwald
87038e44cd
Add strict equalities in src/core/evaluator.js
2014-08-01 18:40:10 +02:00
Nicholas Nethercote
b86daed29d
Make CMap.map quasi-private.
...
This makes it easier for the representation to be improved.
2014-07-30 06:26:35 -07:00
Jonas Jenwald
2485f11829
Fix loading of PDF files with invalid or missing Type3 characters (issue 5039)
2014-07-24 15:03:22 +02:00
Nicholas Nethercote
a483c80fc3
Make QueueOptimizer easier to read.
...
QueueOptimizer is really hard to read. Enough so that it's blocking my
efforts to streamline the representation used for operator lists.
This patch improves its readability in the following ways.
- More descriptive variable names make the sequence checking much clearer,
as do additional comments.
- The addState() functions now return the index of the first op past the
sequence, instead of setting context.currentOperation to the last op of
the sequence.
- The loop in optimize() is clearer.
- The array modification in the fourth addState() function is much clearer
-- we're just removing trios of ops.
- All four |addState| functions are now more consistent with each other.
I used some debug printfs to find documents where these optimizations are
used and then checked that the number of optimized ops was the same before
and after my changes.
2014-07-03 19:16:31 -07:00
Jonas Jenwald
04975acceb
Prevent CMapFactory.create from failing by passing the necessary parameters from PartialEvaluator_readToUnicode (issue 5010)
2014-06-27 00:46:16 +02:00
Yury Delendik
6d5a04149b
Merge pull request #4993 from pramodhkp/rectelmnt
...
Combine re element into constructPath
2014-06-24 09:27:21 -05:00
pramodhkp
8407d28c9e
Combine re element into constructPath
2014-06-25 00:27:42 +05:30
Fabian Lange
60f67c3961
Restructured EvaluatorPreprocessor_read to be more natural.
2014-06-23 23:35:25 +02:00
Nicholas Nethercote
081866a184
Use null instead of [] for ops with no args.
...
This reduces peak RSS on one test file from ~600 to ~560 MiB.
2014-06-22 16:03:48 -07:00
Yury Delendik
b557b87fc9
Merge pull request #4972 from nnethercote/preprocessor-read
...
Avoid allocating return object in EvaluatorPreprocessor_read().
2014-06-18 22:00:31 -05:00
Nicholas Nethercote
17170af3c7
Avoid allocating return object in EvaluatorPreprocessor_read().
...
This function can be called 100s of 1000s or even millions of times, and the
allocated return object accounts for 10% of all GC thing allocations for some
documents. It's easy to avoid, which reduces stress on the garbage collector,
and this patch does that.
2014-06-18 16:41:29 -07:00
Nicholas Nethercote
bce7601480
Build up textChunk.str more efficiently.
...
PartialEvaluator.getTextContent() builds up textChunk strings 1 char at a time,
creating many 100s of 1000s of intermediate strings along the way. This patch
make it instead push chars to an array and then join them at the end, as we
have done in numerous other places.
2014-06-18 07:48:22 -07:00
Yury Delendik
5a2e511cbd
Merge pull request #4955 from timvandermeij/rename-concatenate
...
Renames concatenateToArray to appendToArray
2014-06-17 08:21:47 -05:00
Yury Delendik
0cd28ebfa3
Telemetry for used stream and font types
2014-06-16 16:41:04 -05:00
Tim van der Meij
9c072a5d4b
Renames concatenateToArray to appendToArray
2014-06-16 22:10:10 +02:00
Nicholas Nethercote
7923eb7edb
Fix mishandling of incomplete, inverted masks.
2014-06-13 06:14:52 -07:00
Jonas Jenwald
c0250e16e3
Return ErrorFont in loadFont when the fontRef is undefined
2014-06-12 12:46:39 +02:00
Jonas Jenwald
7802a7ab97
Handle cases where the fontName contains non-alphanumeric characters (issue 4909)
2014-06-10 17:25:49 +02:00
Yury Delendik
b2d8e73d54
Merge pull request #4895 from p01/Small_optimizations_1
...
Small optimizations 1
2014-06-10 10:09:12 -05:00
p01
6731de6829
Minor refactoring of EvaluatorPreprocessor_read
2014-06-10 12:37:40 +02:00
p01
d4a01f6034
evaluator.js minor optimizations
2014-06-10 12:37:37 +02:00
Fabian Lange
532d7246ea
add object id to streams to prevent infinite loops.
...
fixes http://bugzil.la/1020858
2014-06-10 11:29:25 +02:00
Yury Delendik
844bc644fb
Merge pull request #4861 from timvandermeij/xobject
...
Fixes unhandled XObject subtype PS error
2014-05-29 08:40:57 -05:00
Jonas Jenwald
7e6cdc74af
Merge pull request #4832 from yurydelendik/showtext
...
Refactors showText: split type3, remove showSpacedText
2014-05-29 12:58:09 +02:00
Tim van der Meij
e128bdc397
Fixes unhandled XObject subtype PS error
2014-05-29 11:53:13 +02:00
Yury Delendik
542c9c4c7a
Moves ColorSpace logic into evaluator
2014-05-23 14:11:47 -05:00
Yury Delendik
d53dc2e7d6
Refactors showText: split type3, remove showSpacedText
2014-05-23 13:36:54 -05:00
Yury Delendik
e5a0d89da9
Refactors loadFont for translateFont be async; fixes type3 dup data
2014-05-19 16:27:54 -05:00
Yury Delendik
88aa396aca
Terminate getOperationList and getTextContent every 20 ms
2014-05-19 16:19:54 -05:00
Yury Delendik
d8eb8b1de1
Adds Promise to the getOperatorList
2014-05-19 16:19:54 -05:00
Christian Krebs
3e7bcaa892
Handle nested post script arguments in the preprocessor
...
Fix for issue #4785
2014-05-15 19:49:43 +02:00
Jonas Jenwald
b907e15a90
Build paths for glyph accents when drawing text as curves
2014-05-14 00:04:44 +02:00
Jonas Jenwald
44cd0f4a76
Merge pull request #4752 from yurydelendik/refmsghdlr
...
Refactors MessageHandler.send to remove callbacks
2014-05-13 22:47:04 +02:00
Yury Delendik
a26d28a393
Merge pull request #4683 from yurydelendik/grouppath
...
Groups path commands into single operation
2014-05-08 22:16:58 -05:00
Yury Delendik
2008f74185
Refactors MessageHandler.send to remove callbacks
2014-05-07 18:15:25 -05:00
Tim van der Meij
3ddc534920
Tiny updates
2014-05-01 21:05:32 +02:00
Yury Delendik
63d5aae3f6
Groups path commands into single command
2014-04-30 09:09:04 -05:00
Yury Delendik
a468f7215d
Fixes spacing in the text layer builder
2014-04-16 11:14:57 -05:00
Rob Wu
2e97c0d085
Remove some unused variables from src/
...
Only obviously useless, local variables have been removed.
2014-04-15 17:10:23 +02:00
Yury Delendik
f954cde8f4
Merge pull request #4581 from Snuffleupagus/issue-4575
...
Check that images have valid dimensions (issue 4575)
2014-04-14 15:23:44 -05:00
Yury Delendik
eb8924a79f
Merge pull request #4613 from yurydelendik/buildImagePromise
...
Refactors buildImage to use Promise; don't draw bad images
2014-04-14 15:23:06 -05:00
Yury Delendik
a00f854848
Refactors buildImage to use Promise; don't draw bad images
2014-04-14 15:22:35 -05:00
Joshua T Kalis
5828b2c687
Refactor - remove redundant function and all references
...
The function `assertWllFormed` was doing nothing different than `assert` which is
available in the same namespace. Removing it will lighten the filesize - albeit
very slightly - and reduce complexity.
2014-04-13 16:18:07 -04:00
Tim van der Meij
f463f96f35
Resolving new lint issues
2014-04-11 00:41:18 +02:00
Tim van der Meij
df91acf239
Fixes lint warning W004 in src/core
2014-04-11 00:41:08 +02:00
Brendan Dahl
5bd8a83c9b
Build the text layer geometry on the worker.
2014-04-09 16:44:07 -07:00
Brendan Dahl
a6e5f31ca1
Merge pull request #4423 from chriskr/font-aliases
...
Treat fonts with the same font descriptor and encoding as aliases
2014-04-09 10:26:09 -07:00
Jonas Jenwald
3a9b5b3951
Check that images have valid dimensions (issue 4575)
2014-04-09 13:04:27 +02:00
Jonas Jenwald
811f1b1d05
Workaround for cases where FontName in the FontDescriptor differs from BaseFont in the Font (bug 847420)
2014-04-09 11:29:33 +02:00
Christian Krebs
79f34b183c
Treat fonts with the same font descriptor, encoding and unicode map as aliases
...
Different fonts can point to the same font descriptor
(see https://github.com/mozilla/pdf.js/issues/4339 for details). With this
commit such fonts are treated as aliases if they have also the same encoding
and the same toUnicode map. The according info is stored on the font descriptor.
This change must also ensure that aliases use always the same font name
because translated fonts can get cleared depending on the CLEANUP_TIMEOUT setting.
2014-04-08 20:45:21 +02:00
Yury Delendik
31f081ae17
Doesn't traverse cyclic references in Dict.getAll; reduces empty-Dict garbage
2014-03-26 09:07:38 -05:00
Tim van der Meij
c6a06c0f16
Making src/core/evaluator.js adhere to the style guide
2014-03-22 19:15:51 +01:00
Yury Delendik
878a123e47
Merge pull request #4478 from nnethercote/plain-fnArray
...
Use a vanilla array for fnArray
2014-03-20 10:30:29 -05:00
Yury Delendik
1801fb2c37
Merge pull request #4474 from chriskr/draw-image-subpixel-support
...
Introduce paintSolidColorImageMask command to handle 1x1 solid image
2014-03-19 14:31:15 -05:00
Christian Krebs
fc9edfcf76
Introduce paintSolidColorImageMask command to handle 1x1 solid image masks
...
See https://github.com/mozilla/pdf.js/issues/4436 for details
2014-03-19 13:27:59 +01:00
Nicholas Nethercote
292b96a0bf
Make fnArray always be a plain array.
...
This makes the code much simpler, and the extra memory use is tiny -- a vanilla
1000 element array is only 4000 bytes larger than a Uint32Array of the same
size.
2014-03-17 17:48:53 -07:00
Nicholas Nethercote
42d175efd4
Fix some indenting within OperatorList.
2014-03-17 17:11:40 -07:00
Brendan Dahl
1802ffffb8
Merge pull request #4447 from nnethercote/object-reduction
...
Allocate fewer objects
2014-03-17 12:50:23 -07:00
Yury Delendik
69efd9cb96
CMaps binary packing
2014-03-14 16:46:35 -05:00
Nicholas Nethercote
3759c11f42
Avoid more allocations in bidi().
2014-03-13 22:15:09 -07:00
Yury Delendik
1aaeec8020
Heuristic to optimize chunking
2014-03-13 11:01:34 -05:00
Yury Delendik
257898b359
Caching inlined mask images
2014-03-13 11:01:34 -05:00
Yury Delendik
f48f57e30a
Caches last parsed resource image, recornizes image repeats
2014-03-13 11:00:10 -05:00
Yury Delendik
2c23be369b
Optimizing pdf when text printed char-by-char
2014-03-13 11:00:10 -05:00
Yury Delendik
dbb3d17d8f
Refactors optimization list
2014-03-13 11:00:10 -05:00
Yury Delendik
1c0e1cc591
Merge pull request #4444 from nnethercote/min-length
...
Estimate the size of decoded streams in advance.
2014-03-13 10:58:31 -05:00
Yury Delendik
03bedaa316
Merge branch 'master' of github.com:mozilla/pdf.js into issue-4370
2014-03-13 10:38:11 -05:00
Jonas Jenwald
b0824e1626
Prevent circular reference when checking for blend modes (issue 4370)
2014-03-13 10:36:49 -05:00
Yury Delendik
7963f22545
Merge pull request #4259 from brendandahl/built-in-cmaps-squash
...
Adds built in CMaps and unifies the glyph mapping.
2014-03-13 10:27:48 -05:00
Nicholas Nethercote
b3024db677
Estimate the size of decoded streams in advance.
...
When decoding a stream, the decode buffer is often grown multiple times, its
byte size increasing like so: 512, 1024, 2048, etc. This patch estimates the
minimum size in advance (using the length of the encoded stream), often
allowing the smaller sizes to be skipped. It also renames numerous |length|
variables as |maybeLength| to make it clear that they can be |null|.
I measured this change on eight documents. This change reduces the cumulative
size of decode buffer allocations by 0--32%, with 10--20% being typical. This
reduces peak RSS by 10 or 20 MiB for several of them.
2014-03-13 02:06:58 -07:00
Brendan Dahl
57e896d29e
Merge pull request #4406 from nnethercote/fix-and-transfer-masks
...
Improve image mask handling again
2014-03-10 16:26:22 -07:00
Nicholas Nethercote
00c1cff405
Transfer image masks when when possible, instead of copying.
2014-03-08 04:25:00 -08:00
Samuel Chantaraud
076b3433b4
Improved annotations' display/behavior.
...
Added an "InteractiveAnnotation" class to homogenize the annotations' structure (highlighting) and user interactions (for now, used for text and link annotations).
Text annotations:
The appearance (AP) has priority over the icon (Name).
The popup extends horizontally (up to a limit) as well as vertically.
Reduced the title's font size.
The annotation's color (C) is used to color the popup's background.
On top of the mouseover show/hide behavior, a click on the icon will lock the annotation open (for mobile purposes). It can be closed with another click on either the icon or the popup.
An annotation printing is conditioned by its "print" bit
Unsupported annotations are not displayed at all.
2014-03-07 10:48:42 -04:00
Yury Delendik
9a918572dd
Merge pull request #4336 from nnethercote/rgb24
...
Special-case 24-bit RGB image-handling
2014-03-02 19:53:42 -06:00
Yury Delendik
ad4eb9a21d
Merge pull request #4354 from nnethercote/Name-cache
...
Use a cache to minimize the number of Name objects.
2014-03-02 18:44:29 -06:00
Mitar
2c82e720b8
Updated to current latest stable version of jshint.
2014-03-01 13:31:25 -08:00
Brendan Dahl
a77efa0587
Remove unused calculation from bad merge.
2014-02-28 09:58:07 -08:00
Nicholas Nethercote
fdb7c218da
Use a cache to minimize the number of Name objects.
2014-02-27 20:41:03 -08:00
Nicholas Nethercote
42cbb5b440
Introduce ImageKind constants.
2014-02-25 15:18:04 -08:00
Nicholas Nethercote
f62c1c469f
Special-case 24-bit RGB image-handling.
2014-02-25 15:14:04 -08:00
Nicholas Nethercote
d4e8b41639
Remove some unnecessary local variables.
2014-02-24 18:25:59 -08:00
Brendan Dahl
b5b94a4af3
Use built in CMaps and unify the glyph mapping.
2014-02-11 10:27:09 -08:00
Brendan Dahl
cda181f061
Merge pull request #4187 from Rob--W/issue-4183
...
Use forEach instead of for-in (was: Replace [] with {} in core/cmap)
2014-01-29 10:54:49 -08:00
Yury Delendik
c5a804c43a
Merge pull request #4181 from nnethercote/compact-images
...
Reduce memory consumption of simple black and white images.
2014-01-28 15:53:46 -08:00
Nicholas Nethercote
a966909754
Reduce memory consumption of simple black and white images.
2014-01-28 14:36:47 -08:00
Yury Delendik
bf432a37bb
Refactors shared/pattern.js into core/ and display/
2014-01-25 12:18:22 -06:00
Rob Wu
2779bab03e
Use [].forEach instead of for-..-in in evaluator
...
To prevent errors whenever the array's prototype is extended.
(cmap is an array)
2014-01-25 18:04:33 +01:00
Tim van der Meij
3c6ac0dad5
Merge pull request #4161 from yurydelendik/smask
...
SMask emulation
2014-01-23 11:49:19 -08:00
Yury Delendik
4054b0c385
SMask emulation
2014-01-23 11:13:32 -06:00
Brendan Dahl
f18e3e9e0f
Merge pull request #4144 from yurydelendik/api-doc
...
Misc fixes for the API docs
2014-01-21 11:31:16 -08:00
Jonas Jenwald
575bdd8863
Fix loading of fonts with invalid encoding name entry (bug 859204 and 878112)
2014-01-21 02:03:28 +01:00
Yury Delendik
96fff4cc74
Refactors getTextContent return value
2014-01-17 13:26:00 -06:00
Yury Delendik
09f8f951c8
Extracts evaluator preprocessor and refactor text extraction
2014-01-17 07:16:52 -06:00
Brendan Dahl
455265474a
Merge pull request #4093 from yurydelendik/issue4068
...
Fixes fips regression from #4068
2014-01-16 13:45:10 -08:00
Brendan Dahl
ff66c23e6e
Merge pull request #4089 from yurydelendik/issue3725
...
Takes ascent/descent in account in the text layer
2014-01-16 13:12:04 -08:00
Nicholas Nethercote
3f533a1cb0
Use a more compact typed array to pass the image mask from the worker to the main thread.
2014-01-13 20:09:05 -06:00
Yury Delendik
96eaa15578
Fixes fips regression from #4068
2014-01-08 16:33:22 -06:00
Yury Delendik
0131101275
Takes ascent/descent in account in the text layer
2014-01-08 13:50:52 -06:00
Brendan Dahl
bac4133f21
Merge pull request #4068 from yurydelendik/bug864847
...
Adjusts heuristic for disabling Symbol encoding
2014-01-08 10:48:18 -08:00
Yury Delendik
5bf3e44e30
Introduces LegacyPromise; polyfills DOM Promise
2014-01-03 18:17:05 -06:00
Brendan Dahl
2228343f77
Only trigger warning bar on certain unsupported features.
2014-01-03 09:34:13 -08:00
Yury Delendik
5973d40afe
Adjusts heuristic for disabling Symbol encoding
2014-01-02 18:44:11 -06:00
Jonas Jenwald
b1c5ef9ccc
Fix loading of fonts that are not referenced by an object identifier
2013-12-17 00:19:31 +01:00
Brendan Dahl
a4f329aa38
Combine if/else block with switch for getOperatorList.
2013-11-18 16:50:58 -08:00
Brendan Dahl
29ee96cc67
Merge pull request #3927 from Snuffleupagus/issue-3925
...
Prevent updating the current transformation matrix when the stateStack is empty
2013-11-18 14:04:56 -08:00
Brendan Dahl
3132c9e7e9
Merge pull request #3911 from yurydelendik/mem-redux2
...
Cleaning up fonts when viewer is idle for some time
2013-11-18 13:01:23 -08:00
Yury Delendik
e712c4136a
Cleaning up fonts when viewer is idle for some time
2013-11-18 13:01:54 -06:00
Jonas Jenwald
564ae6e4f7
Prevent updating the current transformation matrix when the stateStack is empty
2013-11-17 01:54:14 +01:00
Yury Delendik
4ce6cb8b0f
Uses postMessage transfers
2013-11-14 15:21:42 -08:00
Brendan Dahl
f4942b11f8
Reduce the memory usage of the operator list.
2013-11-13 11:43:38 -08:00
Yury Delendik
104d89856d
Renames Symbol encoding name.
2013-10-31 10:33:23 -05:00
Brendan Dahl
f32e65b19f
Read multi-byte character codes based on codespace ranges.
2013-09-25 10:32:04 -07:00
Srishti
3808d02a53
implementing transform matrix to getTextContent
2013-09-20 06:37:08 +05:30
Brendan Dahl
60586e3101
Ensure there's data to build path.
2013-08-22 12:55:43 -07:00
Brendan Dahl
bb2529de03
Move the creation of canvas path fonts to the worker.
2013-08-19 16:33:20 -07:00
Brendan Dahl
5ecce4996b
Split files into worker and main thread pieces.
2013-08-12 10:48:06 -07:00