summaryrefslogtreecommitdiff
path: root/draw
AgeCommit message (Collapse)Author
2012-01-24Solve (some) SEGVS in cluster tests.Robin Watts
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.
2012-01-23Do XPS mitering properly.Robin Watts
Modified version of Sumatras patch. Thanks for this.
2012-01-23Update ARM optimised scaling code in line with recent changes.Robin Watts
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.
2012-01-23Remove assert in tiling code.Robin Watts
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.
2012-01-21Update image scaling subpixel offset calculations for top-down images.Tor Andersson
2012-01-21Clean up some stray mixed tabs and spaces.Tor Andersson
2012-01-20Bitmap 'patch' scaling - second attempt.Robin Watts
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.
2012-01-20Flip images the right side up in the PDF interpreter.Tor Andersson
This way both pixmaps for rendering and image data are top-down.
2012-01-20Revert "Bitmap 'patch' scaling."Tor Andersson
This reverts commit 08e84b18e5c1dbe8f3d32dd0aeb4b4c43debce9f.
2012-01-19Bitmap 'patch' scaling.Robin Watts
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.
2012-01-19Multi-threading support for MuPDFRobin Watts
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.
2012-01-12Support proper XPS mitering. (And stroke fixes).Robin Watts
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.
2012-01-11Hide glyph cache in context.Tor Andersson
2012-01-11Stylistic comment and whitespace fixes.Tor Andersson
2012-01-11Calculate accurate per-glyph bounding boxes for fz_bound_text.Tor Andersson
2012-01-10Add fz_blend_pixel_function.Robin Watts
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.
2012-01-10Fix many spelling errors.Sebastian Rasmussen
2012-01-09Fix Bug 692356 (comment #2)Robin Watts
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.
2012-01-06Various fixes to avoid arithmetic problems.Robin Watts
Various fixes to avoid overflow problems, division by zeros, use of uninitialised variables etc. All from/suggested by Zenikos patch.
2012-01-06Clamp pixel values after applying Decode array to images.Robin Watts
Thanks to Zeniko for pointing this out.
2012-01-06draw_device; device state stack handling fixes.Robin Watts
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.
2012-01-03Rework draw device stack handling.Robin Watts
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).
2012-01-02Fix bug 692593 - solve crash due to inappropriately sized shape plane.Robin Watts
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.
2011-12-30Enable knockout and non-isolated group support.Robin Watts
Testsseem to indicate that this works, and gives noticable improvements. Enabling by default.
2011-12-30Fix typo in draw/draw_affine.c causing offsetting of shape planeRobin Watts
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.
2011-12-30Blending improvementsRobin Watts
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).
2011-12-24Fix (part of) bug 69293 - typos in draw_affine for shape code.Robin Watts
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.
2011-12-24Bug 692489 - fix SEGV in non-isolated/knockout blendingRobin Watts
Restrict images to the size of the shape when blending back. This seems to solve the problem; leaving code disabled until full tests complete.
2011-12-21Fix whitespace.Tor Andersson
2011-12-19More memsqueezing fixes.Robin Watts
2011-12-19More Memory squeezing fixesRobin Watts
2011-12-17More Memory Squeezing fixes.Robin Watts
2011-12-16Add fz_malloc_struct, and make code use it.Robin Watts
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.
2011-12-15Various Memsqueezing fixes.Robin Watts
Fixes for leaks (and SEGVs, division by zeros etc) seen when Memsqueezing.
2011-12-08Stylistic changes when testing pointer values for NULL.Tor Andersson
Also: use 'cannot' instead of 'failed to' in error messages.
2011-12-07Fix tile coverage calculations.Robin Watts
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.
2011-12-06Move antialias levels into context.Robin Watts
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.
2011-11-25Merge branch 'master' into contextRobin Watts
2011-11-15Allow draw device to use a dynamic stack.Robin Watts
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.
2011-11-15Merge branch 'master' into contextRobin Watts
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
2011-11-14Grid fitting tweaks.Robin Watts
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.
2011-11-14Add 'simple scale' variant of scaling routines.Robin Watts
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.
2011-11-14ARM opts in draw_scale.c; updated android build opts.Robin Watts
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.
2011-09-21Add warning context.Tor Andersson
2011-09-21Rename malloc functions for arrays (fz_calloc and fz_realloc).Tor Andersson
2011-09-15Add context to mupdf.Robin Watts
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.
2011-09-03Introduce ATTEMPT_KNOCKOUT_AND_ISOLATED define (off by default).Robin Watts
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.
2011-09-02Fix bug 692356: use stricter limit for dash pattern lengths.Tor Andersson
2011-09-02Fix minor regression in fix for zero-length line segment dots.Tor Andersson
2011-09-01Only draw dots for zero-length line segments with round line caps.Tor Andersson