Age | Commit message (Collapse) | Author |
|
The cluster testing of MuPDF repeatedly crashes on
pdf/PDF_1.7_FTS/fts_20_2008.pdf. Investigation shows this is because
we fail to write the newly allocated mask back to the graphics
state stack when starting a clip_stroke_text drawing operation.
This causes later pops to fall over.
Simple fix.
|
|
Modified version of Sumatras patch. Thanks for this.
|
|
The ARM optimised code relied on the size of the weights structure
which was changed by the addition of a new member as part of the
patch scaling changes. Fix the code here, and add a note to the
structure in the hopes that this will avoid such breakages happening
in future.
|
|
Both Zeniko and Malc have said that this causes problems.
Following a hint from malc, the following command causes the
assert to trigger:
win32/Debug/pdfdraw.exe -r0.3 -o out.png ../MyTests/pdf_reference17.pdf 1143
I suspect it's because of the extreme resolution, and the round_rect
call. At any rate, disabling the assert is of no real import.
|
|
|
|
|
|
When scaling a bitmap, currently we always scale the entire bitmap,
even if we only need a small section of the result.
This patch changes the code to take an optional 'clip' bbox, and
only scales as many pixels as are required to generate the required
output region.
|
|
This way both pixmaps for rendering and image data are top-down.
|
|
This reverts commit 08e84b18e5c1dbe8f3d32dd0aeb4b4c43debce9f.
|
|
When scaling a bitmap, currently we always scale the entire bitmap,
even if we only need a small section of the result.
This patch changes the code to take an optional 'clip' bbox, and
only scales as much of the input as as required for this output
region.
|
|
When we moved over to a context based system, we laid the foundation
for a thread-safe mupdf. This commit should complete that process.
Firstly, fz_clone_context is properly implemented so that it
makes a new context, but shares certain sections (currently
just the allocator, and the store).
Secondly, we add locking (to parts of the code that have
previously just had placeholder LOCK/UNLOCK comments). Functions
to lock and unlock a mutex are added to the allocator structure;
omit these (as is the case today) and no multithreading is
(safely) possible. The context will refuse to clone if these are
not provided.
Finally we flesh out the LOCK/UNLOCK comments to be real calls of
the functions - unfortunately this requires us to plumb fz_context
into the fz_keep_storable function (and all the fz_keep_xxx
functions that call it). This is the largest section of the patch.
No changes expected to any test files.
|
|
XPS differs from PS/PDF/etc in the way it handles miters; rather than
simply converting a miter that's overly long to a bevel, it truncates
it at the miter limit. As such it needs to be handled correctly.
For clarity, expose new enumerated types for linejoins and linecaps,
and use these throughout code.
When we upgrade our freetype, we can move to using proper xps mitering
in that too.
Add new fz_matrix_max_expansion function to return a safer expansion
value that works in the case where we scale up in one direction and
down in another.
In the xps path drawing code, avoid generating unnecessary linetos.
Thanks to Zeniko for spotting these and providing implementations.
|
|
|
|
|
|
|
|
Inspired by Sumatras gdi devices need for such a function expose
the blending functions. Note that we produce unsigned char's
where Zenikos original produces ints, but it's otherwise
identical.
This requires us to make various knockon changes throughout the code
from int to unsigned char, none of which should make any difference
at all - I hope!
We reserve the right to change/amend this function in future to
operate on blocks of pixels (or pixels in different colorspaces)
(or anything else we think of) in future.
|
|
|
|
Take on a modified version of Zenikos patch; only take the quick
exit if the whole dash length is small, or if the dash_length
scaled up by the maximum possible scale in the ctm is less than
1/2 a pixel.
|
|
Various fixes to avoid overflow problems, division by zeros, use
of uninitialised variables etc. All from/suggested by Zenikos patch.
|
|
Thanks to Zeniko for pointing this out.
|
|
Only create a shape if we need to.
Correctly cleanup, thus avoiding a double free of mask later on.
Thanks to Zeniko for spotting these.
|
|
As we create clips/transparency groups etc, we maintain a stack of
draw device states.
Here we change this from having a 'current' state, and storing changes
on the stack to always keeping the complete current state on the head
of the stack. This should make error cleanup easier, as well as being
conceptually easier to follow (for me at least).
|
|
When starting to tile, create a shape plane if one exists.
When finishing tiling, plot the shape plane back too.
This solves the SEGVs. Something isn't quite right with the blending
colours on part of this file though.
|
|
Testsseem to indicate that this works, and gives noticable
improvements. Enabling by default.
|
|
The shape plane was being incorrectly offset from the dest plane.
This could have caused SEGVs or incorrect results when blending
back.
This solves the hivemind.pdf iphone being clipped on the right hand
side.
|
|
More work on MuPDFs blending support. This seems to get l16.pdf
working pretty well. Fuller testing required to know if we get
everything right, but the maths now makes as much sense as it
ever has to me, and seems to track what gs does (more or less,
in that we don't use group alpha and gs does).
|
|
As Zeniko correctly points out in bug 692593, I had incorrectly
used hp[n1] when I should be using hp[0] at various points.
Hopefully that bug should be solved in it's entirety now with
the previous commit.
|
|
Restrict images to the size of the shape when blending back.
This seems to solve the problem; leaving code disabled until full
tests complete.
|
|
|
|
|
|
|
|
|
|
The new fz_malloc_struct(A,B) macro allocates sizeof(B) bytes using
fz_malloc, and then passes the resultant pointer to Memento_label
to label it with "B".
This costs nothing in non-memento builds, but gives much nicer
listings of leaked blocks when memento is enabled.
|
|
Fixes for leaks (and SEGVs, division by zeros etc) seen when
Memsqueezing.
|
|
Also: use 'cannot' instead of 'failed to' in error messages.
|
|
The code attempts to spot cases where a pattern tile is so large that
only 1 repeat is visible. Due to rounding errors, this test could
sometimes fail, and (on badly formed files) we'd attempt to allocate
huge pixmaps.
The fix is to allow for rounding errors.
|
|
In builds that support configurable layers of antialiasing, move
the variables that control this into the context. This makes it
possible to safely use different levels of antialiasing in different
threads.
|
|
|
|
Previously, we had a hardwired 96 element stack for clipping/group
nesting etc. If this was exceeeded during rendering we would give
an error.
Now we allow for that stack to be extended dynamically at runtime.
If the stack extension fails, we will give an error and die.
|
|
Mostly redoing the xps_context to xps_document change and adding
contexts to newly written code.
Conflicts:
apps/pdfapp.c
apps/pdfapp.h
apps/x11_main.c
apps/xpsdraw.c
draw/draw_device.c
draw/draw_scale.c
fitz/base_object.c
fitz/fitz.h
pdf/mupdf.h
pdf/pdf_interpret.c
pdf/pdf_outline.c
pdf/pdf_page.c
xps/muxps.h
xps/xps_doc.c
xps/xps_xml.c
|
|
Extract the grid fitting code from the scaling code and the affine image
drawing code into it's own separate function. This reduces code
duplication. It also allows us to make better allowance for rounding
errors.
Add a voodoo offset in the draw_affine.c code for painting interpolated
images. This gives us the best possible match between all the different
combinations of scaled/unscaled and interpolated/uninterpolated images.
|
|
draw_simple_scale.c is a cut down version of draw_scale.c, that only
uses filter functions that return values strictly in the 0 to 1 range.
Because of that, we can use bytes rather than ints as intermediate
storage, and have no clipping to do.
|
|
Kammerer reports 90%+ of CPU time is spent in the image scaling code
for his documents on Android.
In this commit we provide ARM optimised cores for the common scaling
routines (1/2/4 components). Tests indicate this doubles the speed of
rendering for a bitmap heavy PDF file on an HTC desire.
This code is included if ARCH_ARM is defined. If ARCH_THUMB is defined
then extra instructions are added to ensure correct interworking.
We also update the Android jni makefiles to set these defines.
We update the ReadMe.txt with more explicit instructions and update with
more modern ndk/sdk versions.
We update build.xml in line with new sdk releases.
|
|
|
|
|
|
Huge pervasive change to lots of files, adding a context for exception
handling and allocation.
In time we'll move more statics into there.
Also fix some for(i = 0; i < function(...); i++) calls.
|
|
Until such time as the knockout and isolated group support is known to
work properly, leave it disabled so we behave the same as we have until
now.
|
|
|
|
|
|
|