Jonas Jenwald
982b6aa65b
Convert the files in the /src/core
folder to ES6 modules
...
Please note that the `glyphlist.js` and `unicode.js` files are converted to CommonJS modules instead, since Babel cannot handle files that large and they are thus excluded from transpilation.
2017-05-30 22:06:21 +02:00
Jonas Jenwald
afc74b0178
Enable the object-shorthand
ESLint rule in src/shared
...
Please see http://eslint.org/docs/rules/object-shorthand .
For the most part, these changes are of the search-and-replace kind, and the previously enabled `no-undef` rule should complement the tests in helping ensure that no stupid errors crept into to the patch.
2017-04-27 17:29:40 +02:00
Jonas Jenwald
4046d67fde
Enable the no-else-return
ESLint rule
...
Using `else` after `return` is not necessary, and can often lead to unnecessarily cluttered code. By using the `no-else-return` rule in ESLint we can avoid this pattern, see http://eslint.org/docs/rules/no-else-return .
2017-01-09 20:27:39 +01:00
klemens
6f03f62327
trivial spelling fixes
2016-07-17 14:33:41 +02:00
Jonas Jenwald
6111c17c8a
Use Dict_getArray
in more places in src/core/
to avoid issues when Arrays contain indirect objects
...
As evident from e.g. PRs 6485 and 7118, some bad PDF generators unfortunately create Arrays where *some* elements are indirect objects (i.e. `Ref`s). This seems to mostly affect Arrays that contain numbers, such as e.g. `Matrix/FontMatrix/BBox/FontBBox/Rect/Color/...`, and has manifested itself in PDF files that fail to render correctly (some elements are missing).
The problem in both the cases above, besides broken rendering, was that there were *no* errors/warnings that indicated what the problem was, making it difficult to pinpoint the issue.
Hence this patch, where I've audited all usages of `Dict_get` in `src/core/` files, and replaced it with `Dict_getArray` where appropriate to try and prevent unnecessary future bugs.
2016-05-05 19:42:57 +02:00
Jonas Jenwald
19e0599f74
Split the two paths in PDFImage.resize
into separate helper functions, placed in colorspace.js and image.js
...
Re: issue 6777.
2016-04-17 10:24:36 +02:00
Yury Delendik
35cbf74b12
Refactors to remove stream.js dependency on colorspace.js
2016-04-01 07:36:16 -05:00
Yury Delendik
bda5e6235e
Removes global PDFJS usage from the src/core/.
2016-03-23 19:24:37 -05:00
Jeff Walden
4691a4a1e4
Adjust a comment discussing transferred ArrayBuffers to refer to those buffers being detached, not neutered. This change makes the comment consistent with terminology used in the ECMAScript specification.
2016-01-28 14:52:07 -08:00
Yury Delendik
6b60c8f4db
Adds UMD headers to core, display and shared files.
2015-12-15 13:24:39 -06:00
Manas
a2ba1b8189
Uses editorconfig to maintain consistent coding styles
...
Removes the following as they unnecessary
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
2015-11-14 07:32:18 +05:30
Jonas Jenwald
50a70429ec
Ignore the /Mask entry in images unless its /ImageMask entry is explicitly set to true
(issue 6621)
...
Fixes 6621.
2015-11-12 22:49:26 +01:00
Jonas Jenwald
3fa5f6cc3b
Only take the fast-path in PDFImage_createImageData
for un-masked JPEG images with "standard" colour spaces (issue 6364)
...
Fixes 6364.
2015-08-18 22:25:37 +02:00
Nicholas Nethercote
48de7651ce
Apply the GRAYSCALE_1BPP optimization when needsDecode
is set.
...
The scanned, black-and-white document at
https://bugzilla.mozilla.org/show_bug.cgi?id=835380 doesn't benefit from
the critical GRAYSCALE_1BPP optimization because the optimization is
skipped if `needsDecode` is set.
This change addresses that, and reduces both rendering time and memory
usage for that document by almost 10x.
2014-08-18 16:45:19 -07:00
Tim van der Meij
160c7cab33
Use strict equalities in src/core/image.js
2014-08-01 23:02:55 +02:00
Nicholas Nethercote
7923eb7edb
Fix mishandling of incomplete, inverted masks.
2014-06-13 06:14:52 -07:00
Yury Delendik
6b411b559d
Fixes masked JPEG image
2014-06-04 15:53:46 -05:00
Yury Delendik
2008f74185
Refactors MessageHandler.send to remove callbacks
2014-05-07 18:15:25 -05:00
p01
27d532efeb
Optimized PDFImage_undoPreblend
2014-05-05 14:36:45 +02:00
Thorben Bochenek
e8f0700bfa
Move the colour conversion to jpg.js
...
Benchmarking shows that this improves performance for the invitation document
from https://github.com/mozilla/pdf.js/issues/3809 by 35%
2014-04-24 15:07:12 +02:00
Thorben Bochenek
e7fe45a5c4
Refactor jpg.js and include forceRGBoutput, correct style of image.js
...
This refactors getData to be more readable and extracts all the color
conversion algorithms to their own functions. The resulting code was then
cleaned up.
This also introduces a flag `forceRGBoutput` to getData, that allows to always
get the data as a `width * height * 3` bytes long RGB buffer
2014-04-24 12:55:37 +02:00
p01
8f9bd33a57
PDFImage_resize: copy in place with alpha and ~5x speed up
2014-04-23 17:27:02 +02:00
fkaelberer
11f565547c
Fix corrupted images #4649
2014-04-19 19:34:42 +02:00
fkaelberer
04602c8a5e
Less copying in the JPX coder, merged and rebased
2014-04-16 10:40:04 +02: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
a00f854848
Refactors buildImage to use Promise; don't draw bad images
2014-04-14 15:22:35 -05:00
Tim van der Meij
df91acf239
Fixes lint warning W004 in src/core
2014-04-11 00:41:08 +02:00
fkaelberer
2982de8f33
Use Stream instead of byte array access
2014-04-06 13:40:27 +02:00
fkaelberer
1ccc8a64b7
Read color info from JPX stream
...
Fix colors problem #4540 + minor cleanup
fix lint warnings
2014-04-05 18:02:58 +02:00
Tim van der Meij
284288f1d0
Making src/core/{image,obj,parser}.js adhere to the style guide
2014-03-20 20:28:22 +01: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
Brendan Dahl
72a9c7810b
Merge pull request #4246 from pnml/hiresmask
...
Support for the image mask in higher resolution than the image itself
2014-03-10 10:34:49 -07:00
Nicholas Nethercote
00c1cff405
Transfer image masks when when possible, instead of copying.
2014-03-08 04:25:00 -08:00
Nicholas Nethercote
cb5bb0cec7
Fix mask handling when some bytes are missing.
2014-03-06 21:11:21 -08:00
Basil A. Zabairatsky
555d33ffc7
Support for the image mask in higher resolution than the image itself
2014-03-07 02:16:39 +06:00
Yury Delendik
ff5ccdeb07
Merge pull request #4383 from nnethercote/more-rgb24
...
Use RGB_24BPP form for all images lacking alpha data.
2014-03-05 07:03:16 -06:00
fkaelberer
eef5ed5c11
Optimizations for 1bpc images
2014-03-05 09:42:16 +01:00
Nicholas Nethercote
a2fe30ff38
Use RGB_24BPP form for all images lacking alpha data.
2014-03-03 20:58:35 -08:00
Nicholas Nethercote
f30babde58
Transfer GRAYSCALE_1BPP and RGB_24BPP arrays when possible.
2014-03-03 18:17:17 -08: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
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
4e1f92a893
Clean up putBinaryImageData().
2014-02-25 15:14:11 -08:00
Nicholas Nethercote
f62c1c469f
Special-case 24-bit RGB image-handling.
2014-02-25 15:14:04 -08:00
Nicholas Nethercote
a966909754
Reduce memory consumption of simple black and white images.
2014-01-28 14:36:47 -08:00
Nicholas Nethercote
0685214a77
Don't create the RGB buffer for images that don't need resizing.
2014-01-19 14:21:36 -08:00
Nicholas Nethercote
c044652320
Remove unneeded srcOffset arguments from createRgbBuffer.
2014-01-16 20:15:37 -08:00
Nicholas Nethercote
3de5d6ad0c
Don't create the opacity buffer for images that lack a mask.
2014-01-16 20:15:37 -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
5bf3e44e30
Introduces LegacyPromise; polyfills DOM Promise
2014-01-03 18:17:05 -06:00