Age | Commit message (Collapse) | Author |
|
|
|
In preparation for work on progressive loading, update the exception
handling scheme slightly.
Until now, exceptions (as thrown with fz_throw, and caught with
fz_try/fz_catch) have merely had an informative string. They have
never had anything that can be compared to see if an error is of
a particular type.
We now introduce error codes; when we fz_throw, we now always
give an error code, and can optionally (using fz_throw_message)
give both an error code and an informative string.
When we fz_rethrow from within a fz_catch, both the error code and
the error message is maintained. Using fz_rethrow_message we can
'improve' the error message, but the code is maintained.
The error message can be read out using fz_caught_message() and the
error code can be read as fz_caught().
Currently we only define a 'generic' error. This will expand in future
versions to include other error types that may be tested for.
|
|
Remove fz_free_display_list from the API; instead use fz_drop_display_list.
|
|
|
|
|
|
|
|
* pdfapp_save in pdfapp.c contains unreachable code (and could be
simplified by inverting most of the checked conditions)
* RegSetValueExA expects a const BYTE pointer instead of a char
pointer (warns about signedness mismatch)
* same for SendMessageA where -1 is signed even though WPARAM isn't
Also, there's no need to include mupdf.h, muxps.h, etc. at the top of
applications which only use the fz_* API (fitz.h comes included with
pdfapp.h).
|
|
|
|
|
|
To prepare for color management, we have to make the device colorspaces
per-context and able to be overridden by users.
|
|
|
|
When I added transition handling to mupdf, I broke the X11
behaviour of coalescing all events and only blitting when
idle.
This commit restores that behaviour, except when transitions
are actually in progress (when it still blits instantly).
|
|
Extract such records as part of the text device.
|
|
Rework the text extraction structures - the broad strokes are similar
but we now hold more information at each stage to enable us to perform
more detailed analysis on the structure of the page.
We now hold:
fz_text_char's (the position, ucs value, and style of each char).
fz_text_span's (sets of chars that share the same baseline/transform,
with no more than an expected amount of whitespace between each char).
fz_text_line's (sets of spans that share the same baseline (more or
less, allowing for super/subscript, but possibly with a larger than
expected amount of whitespace).
fz_text_block's (sets of lines that follow one another)
After fz_text_analysis is called, we hope to have fz_text_blocks split
such that each block is a paragraph.
This new implementation has the same restrictions as the current
implementation it replaces, namely that chars are only considered for
addition onto the most recent span at the moment, but this revised form
is designed to allow more easy extension, and for this restriction to
be lifted.
Also add simple paragraph splitting based on finding the most common
'line distance' in blocks.
When we add spans together to collate them into lines, we record the
'horizontal' and 'vertical' spacing between them. (Not actually
horizontal or vertical, so much as 'in the direction of writing' and
'perpendicular to the direction of writing').
The 'horizontal' value enables us to more correctly output spaces when
converting to (say) html later.
The 'vertical' value enables us to spot subscripts and superscripts etc,
as well as small changes in the baseline due to style changes. We are
careful to base the baseline comparison on the baseline for the line,
not the baseline for the previous span, as otherwise superscripts/
subscripts on the end of the line affect what we match next.
Also, we are less tolerant of vertical shifts after a large gap. This
avoids false positives where different columns just happen to almost
line up.
|
|
Some -Wshadow ones, plus some 'set but not used' ones.
|
|
strncpy is *not* the correct function to use. It does not null terminate,
and it needlessly zeroes past the end. It was designed for fixed length
database records, not strings. Use fz_strlcpy and strlcat instead.
|
|
|
|
|
|
|
|
When we run a display list we pass in an area for fast eliding of
objects. Ensure that the area we pass in is always at least as big
as the bbox with which we create display devices.
|
|
This is faster on ARM in particular. The primary changes involve
fz_matrix, fz_rect and fz_bbox.
Rather than passing 'fz_rect r' into a function, we now consistently
pass 'const fz_rect *r'. Where a rect is passed in and modified, we
miss the 'const' off. Where possible, we return the pointer to the
modified structure to allow 'chaining' of expressions.
The basic upshot of this work is that we do far fewer copies of
rectangle/matrix structures, and all the copies we do are explicit.
This has opened the way to other optimisations, also performed in
this commit.
Rather than using expressions like:
fz_concat(fz_scale(sx, sy), fz_translate(tx, ty))
we now have fz_pre_{scale,translate,rotate} functions. These
can be implemented much more efficiently than doing the fully
fledged matrix multiplication that fz_concat requires.
We add fz_rect_{min,max} functions to return pointers to the
min/max points of a rect. These can be used to in transformations
to directly manipulate values.
With a little casting in the path transformation code we can avoid
more needless copying.
We rename fz_widget_bbox to the more consistent fz_bound_widget.
|
|
|
|
Inside the renderer we often deal with integer sized areas, for
pixmaps and scissoring regions. Use a new fz_irect type in these
places.
|
|
|
|
Since adding transition support any page turn has leaked a bitmap
image. Don't save the old image unless we are really in transition
mode.
|
|
MuPDF needs access to the original file when saving, and in any case
directly overwritting the original file has much more potential for
data loss than use of a temporary file.
|
|
Also update pdf_dict_puts so that passing NULL to val deletes the terminal
key.
Update pdfapp.c to update the screen between passing a mouse event and
invoking a dialog box for value entry
Extend javascript wrapper to handle all color spaces
|
|
|
|
Regenerate dirty appearance streams and report changed annotations since
last call.
Also include a partial revert of changes in 96f335bc, that turn out not
to be necessary.
fz_update_page must now be called between each document-changing event and
the next render. pdfapp.c and the android app have been updated to do so,
but do not yet take advantage of the possibility to render only the updated
areas of the screen.
|
|
|
|
|
|
Only Fade, Wipe and Blinds supported so far.
Hit 'p' in the viewer to go into 'presentation' mode. Page swaps
then transition from page to page. Pages auto advance until key
or mouse is used.
|
|
Add pdf_update_annot, which is called before rendering an annotation, and
checks that the annotation structure has correct information. There are
three reasons the information can be out of date.
Attributes of a field may have been changed such that its appearance
stream needs updating. In this case the field will have have "Dirty"
added to its dictionary
The mouse may have changed state over the field, and a different
appearance stream needs selecting. The annotation structure now records
the mouse states for which the current appearance stream is acceptable.
The field may have changed state as recorded by its "AS" value, and a
different appearance stream needs selecting.
|
|
|
|
|
|
app.execDialog looks very difficult to support. Hopefully we wont have to
|
|
The name of the menu item is passed, so presumably the app could respond
to some of the possibilities.
|
|
|
|
Currently the app windows app responds with a message box explaining that
the MuPDF library passes print requests to the app, but the app does not
implement printing.
|
|
|
|
|
|
Conflicts:
cbz/mucbz.c
pdf/pdf_parse.c
pdf/pdf_form.c
xps/xps_zip.c
|
|
|
|
Previously this triggered an assertion in the cleanup code when
freeing the partially opened document.
|
|
|
|
Conflicts:
Makefile
apps/mudraw.c
pdf/pdf_write.c
win32/libmupdf-v8.vcproj
|
|
Previously fix 13943b92f10796efb175e769afe5b0aea85d879a introduced
continued rendering of further pages for documents where one page
failed to load. However, if the entire page tree was missing from a
PDF document then no display list would be obtained, yet MuPDF tried
to render the display list causing a null pointer dereference. Now,
check for a valid display list before trying to render it.
|
|
|
|
|
|
|