summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2011-08-06Allocate a re-entrant safe buffer for interpreting content streams.Tor Andersson
Fix bug 692282.
2011-08-06Move Dynalab tricky font check to cover simple fonts as well.Tor Andersson
Fix bug 692325.
2011-08-05More changes to blending of groups.Robin Watts
In an effort to solve bug 692377, examine what ghostscript does, and move mupdf into line with it. Firstly, it seems that rather than collecting a pure 'shape' plane ghostscript keeps a 'shape-with-alpha' plane. Only a tiny change is required to move mupdf to the do the same thing, so done here. Secondly, it seems that ghostscript 'uncomposites' the result of non-isolated groups, before applying the blend mode. It's not clear to me that this is entirely correct; this 'uncomposite' operation assumes that all compositing has been done internally with the 'normal' blend mode. Nonetheless, I do the same here, and it seems to work. This 'uncomposite' operation may yet turn out to be a source of bugs if I have muddled the use of premultiplied and non-premultiplied components, but it seems to work on the testfiles I have.
2011-08-04Fix part of bug 692377: "hivemind" PDF regressionRobin Watts
Comment #3 on bug 692377 notes that the "Hivemind" pdf (from bug 692203) has regressed; this is due to the new shape code not working quite right with mask groups. Fixed here. It also showed up a bug in the shape code with filled paths at non full alpha. Also fixed. In tracking this down, I've extended the DUMP_GROUP_BLENDS debugging code to give more readable output. Also committed here. This still leaves a regression in l16.pdf which the bug was originally reopened about, but that's a much more minor one.
2011-08-03Fix bug 692388; colored type3 fonts drawn incorrectly.Robin Watts
All glyphs in type3 colored fonts were drawn mirrored in y due to an incorrectly setup transformation matrix. The bug was reported by Zeniko, with a helpful example file that showed the problem. Until then I'd been working using only fts_23_2303.pdf as an example, which uses geometric shapes, so isn't obvious that it's wrong. Also my copy of acrobat fails to render them.
2011-08-03Tweak to list playback code to pass flags as 0 or 1.Robin Watts
When playing back from a list, previously flags would just be 0 or non-zero. This makes no real difference, but looks odd when traced.
2011-08-03Add (disabled by default) debug code for group blends.Robin Watts
Some code that I find useful for debugging the group blending code.
2011-08-02Squash some compiler type warnings.Robin Watts
unsigned char * is not the same as char *.
2011-08-02Another attempt to fix bug 691629.Robin Watts
To solve bug 691629 we need to ensure that the scaling weights for every pixel in a gridfitted image sum to 256. I had attempted to do that by enabling the 'WRAP' code, but this has the effect of adding too much bias to the outlying source pixels, resulting in thickened serifs etc. A better fix is to extend the code that is already present to check the weights for validity. If an image pixel is completely covered, then force the weights to 256 by adjusting the largest weight. This still skews the output slightly but it's a much less visible result.
2011-08-01Fix bug 692377: Incorrect rendering of blending groups.Robin Watts
A combination of constant alpha and non-zero blending modes resulted in incorrect rendering. Various fixes seem to have made it work: * Allow for non-full alpha when blending non-isolated groups back. * Clamp blended pixels to allow for overflow. * Allow for alpha in the shape blending.
2011-08-01Fix bug 691629; avoid aa'd edge pixels due to bad weight calcs.Robin Watts
When we calculate weights for scaling, 'wrap' weight calculations slightly to avoid getting antialiased edge pixels in grid fitted images. Seems to solve bug 691629 as much as it's possible to.
2011-08-01Add support for colored Type3 glyphs (ones that use d0).Robin Watts
Detect the d0 or d1 operators by writing a bit to the new device flags word. This can then be checked by the Type3 code to create the appropriate backing pixmap. In order to know what the appropriate backing pixmap is, we pass an additional colorspace into the glyph rendering code.
2011-07-29Bug 692382: Fix typo that broke encryption support.Robin Watts
Not quite sure how this one slipped through - must add encrypted documents to the mupdf test suite.
2011-07-26Fix bug 692354: Horizontal white lines in images.Robin Watts
The problem is due to abutting images showing gaps between them. These gaps are due to a combination of rounding errors, and anti-aliasing effects on the edge of images. The solution is to selectively 'grid fit' images. If an image is part of a type 3 font, we do NOT want to grid fit it, as this is where the sub pixel positioning makes a huge difference. If an image is displayed with alpha, then we don't want to grid fit it (as grid fitting will tend to make the edges of images overlap by 1 pixel, and will hence produce nasty effects). Otherwise, we will grid fit; Grid fit in this sense is where we expand an image to completely fill the pixel grid that it touches (i.e. the extents for the image are expanded to pixel boundaries; no half full pixels are left around the edges). The only real change of note here is in how we detect that we are in a type 3 charproc; we add a new draw device creation function that we call in the type3 charproc case that sets a flag that the drawing functions can check.
2011-07-14Add Knockout group support.Robin Watts
While in a knockout group, we create a new group around every single object drawn. These groups are either isolated or non-isolated as required (but non-isolated ones seed their background from two backgrounds up the stack, not one).
2011-07-13Non-isolated group support, and fix Bug 692336.Robin Watts
Firstly, this takes on some of Zenikos patch to correct the clip stack handling that was broken by the fix to bug 692287 (in commit 2c3bbbf). This bug should now be solved. We add a new 'shape' field to the draw device structure (and clip stack). When we are inside non-isolated groups, this is set to be a pixmap where we accumulate the 'shape' of the objects drawn. When we come to blend back, if we are blending a non-isolated group back, we have to use a different blending function that takes account of the shape. Various internal groups (the page group, and groups used to force blending) are set to be isolated to avoid carrying shape planes around when this is not required. All our rendering code now has to know how to maintain the shape plane as well as doing the basic rendering.
2011-07-08Clip area optimisations for displaylist case:Robin Watts
First, we add clipping rects to clipping functions. Various functions (the ones that handle clipping) are now additionally passed a rectangle that represents an additional bound for this clip in device space (i.e. it has already been mapped through the current ctm). Next, when constructing the displaylist, keep track of the bounding box for the contents of each clip. While writing the list, on every node we add, we add the bbox for that node to the enclosing clips content bbox (if there is an enclosing clip). When we pop a clip, write back to the corresponding push to update the bbox. This means if we get large clip regions, with only small areas used within them, we will only do the slow blending for those small areas. Finally, we fix a calculation in fz_bound_path which was incorrectly accounting for mitrelimits. This was showing up in testing on page 630 of the PDF reference v1.7.
2011-07-06Tweak mupdf clip path handling.Robin Watts
In the existing mupdf clip path code, it would be possible for us to render incorrectly; consider the following fragment of a content stream: 0 0 100 100 re W 50 50 100 100 re f That should set the clip path to the (0, 0) -> (100, 100) rectangle, and then attempt to fill both the (0,0) -> (100,100) rectangle and the (50,50) -> (150,150) rectangle, resulting in just the (0,0) -> (100,100) rectangle being filled. In the existing mupdf code, it would actually fill both rectangles as the path after the W operation (the addition of the second rectangle) would also affect the stored clip path. We solve this by doing the clip operation on the W operator, rather than deferred to when the path is actually disposed of.
2011-07-05Fix bug 692276. Android not displaying pdf contents.Robin Watts
The calculation of the translation due to the mediabox/cropbox was wrong on android, causing nothing to be rendered.
2011-07-04Android build lifecycle tweaks; fix leaking.Robin Watts
If the app was hidden, and then restarted, it would leak lots of memory due to onCreate not only being called on create. To fix this, we armour the app a bit aginst such problems, including adding code to destroy the core when the app really is destroyed.
2011-07-04Update android documentation to be clearer.Robin Watts
In particular say where to get thirdparty and how to generate generated. Also note that ndk-build should be run in android, NOT in andoid/jni.
2011-06-14Fix Bug 692277: PDF file won't open.Robin Watts
Acrobat (and gs, see bug 690478) will open a file without a CF dictionary by assuming that the encryption type is RC4. Mirror this in mupdf.
2011-06-01Add 2 missing header files to VS solution.Robin Watts
pdf/data_encodings.h and pdf/data_glyphlist.h were added without adding them to the solution.
2011-06-01Fix android build; bug 692222.Robin Watts
Bring the MuPDF android build up to date with the latest source changes. Many thanks to Dominic Battre for his helpful report in bug 692222.
2011-05-31Use fz_atof in XPS interpreter.Tor Andersson
2011-05-31Fix assert in scale: see Bug 692245.Robin Watts
Bug 692245 gives a file that produces a runtime assert in mupdf due to an extremely large ctm offset (unrepresentable in a float). We fix our code here so that such floats are always read as 1.0. In this particular case, the exact value read doesn't seem to matter. We match acrobat. We pick 1.0 rather than 0.0 as this is less likely to provoke division by 0 errors later on.
2011-05-26Flip pages when panning beyond threshhold.Cedric Sodhi
Added BEYOND_TRESHHOLD for pdfapp and code which flips to next/previous page if one pans beyond the page end plus that threshhold.
2011-05-19Fix Bug 692196: segv in scale_single_row.Robin Watts
Thanks to Zeniko for finding/reporting/patching the problem. Due to a pointer miscalculation we were overwriting memory. Simple fix.
2011-05-02pdf_repair.c: Skip first comment after version marker.Tor Andersson
Some particularly broken generators forget to terminate the comment with a newline. Skip the comment character so we'll get some garbage tokens that we can ignore, rather than consuming the innocent objects that follow on the same line as the %.
2011-04-29Makefile: Fix dependencies for 'install' target.Tor Andersson
2011-04-29Add xpsdraw to windows project.Tor Andersson
2011-04-29Don't use RegDeleteTree; it's only supported in Vista and up.Tor Andersson
2011-04-25Add libs target, and webos OS settings.Robin Watts
Add libs (to allow for building of libraries without apps, such as will be required for the WebOS bindings). Add 2 webos OS setups to the Makerules file to match the 2 default webos configurations used in the PDK.
2011-04-25Check AES encrypted string length and padding values.Tor Andersson
2011-04-25Always call glyph index "gid"; not "cid" as in some places.Tor Andersson
2011-04-25Add 'generate' make target to make font/cmap headers.Robin Watts
Simple tweak to aid cross compiling.
2011-04-25Makefile tweaks for cross compiling, plus example cross compile target.Robin Watts
Add 2 new makefile options to Mupdf. If CROSSCOMPILE is defined, then we avoid performing tasks during the build that require a binary to be built and then executed as part of the build. Currently this is just the cmap and font dumping steps. If NOX11 is defined, then we avoid building the X11 app. Finally, in Makerules, we have a new section to show how to encapsulate the changes for a given cross compile target. If OS is defined to be "beagle-cross" then we build using given compilers/options.
2011-04-20Revert part of "Tweak hinting flags to freetype."Tor Andersson
FT_LOAD_TARGET_LIGHT implies the autohinter, which causes spectacular failures on DynaLab fonts. The stripped down freetype we compile with using the "thirdparty" package does not have the autohinter, which is how this bug slipped through the regression testing.
2011-04-15Tweak hinting flags to freetype.Tor Andersson
2011-04-15Use artificial italics and emboldening for substitute font.Tor Andersson
2011-04-15Use DroidSans.ttf as substitute font.Tor Andersson
2011-04-14Import pristine base-14 fonts from URW.Tor Andersson
These are the original Type1 fonts, without modifications. They have been converted to CFF format, with preserved hints, by FontForge.
2011-04-14Fix regression introduced by bug fix for #692153Tor Andersson
2011-04-14pdf_cmap.c: Fix off-by-one error and check for integer overflow.Tor Andersson
2011-04-14Fix bug #692153: skip PDF version marker when repairing.Tor Andersson
The file in question is missing newlines, causing the first two objects to be hidden because we treat the %PDF-1.3 version marker as a comment.
2011-04-14Expose informational encryption details.Tor Andersson
2011-04-14Add fallback case for links accessed by button annotations.Tor Andersson
2011-04-12Avoid conflict with compiler builtin definitions of tolower.Tor Andersson
2011-04-12Fix serious bug in cmap compacting -- we forgot to set the new length.Tor Andersson
This bug fix shaves another 650K off the compiled in cmaps! Also fix the detection for when the cmap table is full, and ignore surrogate pair mappings (since we can't do anything useful with them at the moment).
2011-04-11Add triangle caps; separate start, dash and end cap styles for XPS.Tor Andersson