| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Fixes #508
|
|
|
|
|
|
|
|
|
| |
This implements Type 3 color fonts for PDF for any font with a
CAIRO_SCALED_GLYPH_INFO_RECORDING_SURFACE. This includes user-fonts,
SVG fonts, and COLR fonts.
Glyphs with foreground colors are not yet implemented as Type 3 glyphs
and will be rendered as images by cairo-surface.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The problem is _cairo_recording_surface_replay_and_create_regions()
stores the cairo_recording_region_type_t in the same structure as the
recording commands. This does not work well when the recording surface
is used as source by multiple surfaces
Fix this by moving the cairo_recording_region_type_t into a separate
struct cairo_recording_regions_array_t. This struct is stored in a
list that allows multiple create regions results to be store in the
surface.
The new function _cairo_recording_surface_region_array_attach() is
used to create a new cairo_recording_regions_array_t, attach it to the
recording surface and return a unique region id.
The _cairo_recording_surface_replay_and_create_regions() and
_cairo_recording_surface_replay_region() functions use this region id
to identify the cairo_recording_regions_array_t.
To handle nested recording surfaces, when replaying a recording, the
region id is passed to the target as an extra parameter in the surface
pattern. The wrapper surface makes a temporary copy of the pattern to
ensure the snapshot pattern in the recording surface is not modified.
cairo_recording_regions_array_t has a reference count so the target
can hold on to the cairo_recording_regions_array_t after the paginated
surface has called _cairo_recording_surface_region_array_remove().
|
|\
| |
| |
| |
| | |
Add cairo_pdf_surface_set_custom_metadata()
See merge request cairo/cairo!240
|
| | |
|
|/ |
|
| |
|
|
|
|
|
|
|
|
| |
This allows all objects that were previously emitted uncompressed to
be compressed into a an object stream.
Currently only /Page, /Pages, and /Catalog have been converted to use
object streams.
|
|
|
|
| |
This reduces the output size and is required for object streams.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously, forward references were required to use named destinations.
This patch is based on the patch in #336 by Guillaume Ayoub <guillaume.ayoub@kozea.fr>
that converted all links to indirect objects written at the end of the document.
I have reworked the patch so that only forward references to future page numbers are
written as indirect objects. Backward references and named destinations remain as they
are. This is to minimize the number of objects written to the PDF file.
Fixes #336
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
cairo-pdf was silently ignoring write errors in
_cairo_pdf_surface_finish(). Any write errors that happened here ended
up setting a "status" variable, but the value in this variable was then
unused.
This commit fixes this bug by passing this error on to the caller.
Additionally, this also adds a test case for this behaviour based on
writing to /dev/full. This file is non-standard and thus the test first
checks that this file exists and is writable before trying to write to
it.
This bug was found based on a report from Knut Petersen [0].
[0]: https://lists.cairographics.org/archives/cairo/2021-July/029281.html
Signed-off-by: Uli Schlachter <psychon@znc.in>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Found using `codespell -q 3 -I cairo-whitelist.txt`
whereby whitelist contained:
```
amin
iff
lod
writen
```
Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
|
|
|
|
|
|
|
|
|
| |
- each annotation was emitted on every page instead of just the page
that contains the annotation
- the document structure did not correctly link to annotation objects
- fix some annotation related memory leaks
|
|
|
|
|
|
| |
PDF XObjects need to specify the bounding box. Emit unbounded surfaces
when finishing as at this point the extents of all uses of the
unbounded surface are known.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
This completes the full set of PDF/PS image filters allowing image
data to be passed though without decompressing then recompresssing in
a less efficient format.
The difficulty with CCITT_FAX is it needs some decoding parameters
that are not stored inside the image data. This is achieved by using
an additional mime type CCITT_FAX_PARAMS that contains the params in
key=value format.
|
| |
|
|
|
|
|
| |
In PDF outline targets are specified the same way as link targets so
there is no need to restrict the target to dest names.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Converting the link position from cairo to pdf coordinates requires
the page height. Since the link may point to a different page, build
an array of the height of each page and use the target page height for
the conversion.
Don't default to a [0,0] position if "pos" is not specified. PDF
allows a null destination position to be specified which means don't
change the position if the page is already displayed or show top left
if switching to a different page. This is more useful default
particularly for external files where the coordinates (which must be
in PDF coordinates as we don't know the page height) of the top left
corner may not be known.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
Modify PDF surface to allow surface extents to have negative x, y.
When emitting recording surfaces, set the surface extents to the
recording extents.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When an unbounded recording surface is used multiple times with
different extents for each operation we need the XObject containing
the recording surface to have the same origin for each operation. This
is not possible when the recording surface is converted to PDF
coordinates because each operation has different extents resulting in
a different origin when the Y-axis is flipped (since the flip matrix
depends on the recording surface height which for unbounded surfaces
depends on the extents of the operation that paints the recording
surface).
Switching to cairo coordinates by emitting a Y-axis flip matrix as the
first object of each page allows the recording surface to be emitted
in cairo coordinates. This results in the same origin for all
operations using the recording surface XObject.
|
|
|
|
|
|
|
|
|
|
|
| |
Since PDF stores the alpha component of images in a separate stream
which can have a different resolution and encoding to the color
components we can optimize the case where the source and mask are both images.
If the source and mask are both images with the same extents and the
source is opaque, combine the images into a single PDF image (ie the
source is written the the image stream and the mask is written to the
smask stream).
|
|
|
|
|
|
|
|
|
|
| |
JBIG2 images may have shared global data that is stored in a separate
stream in PDF. The CAIRO_MIME_TYPE_JBIG2 mime type is for the JBIG2
data for each image. All images that use global data must also set
CAIRO_MIME_TYPE_JBIG2_GLOBAL_ID to a unique identifier. One of the
images must also set CAIRO_MIME_TYPE_JBIG2_GLOBAL to the global
data. The global data will be shared by all JBIG2 images with the same
CAIRO_MIME_TYPE_JBIG2_GLOBAL_ID.
|
|
|
|
|
|
|
| |
If the group contains only a combination of clear and opaque alpha and
only OPERATOR_OVER is used in the group and to paint the group, a
transparency group is not required. This allows the pdf viewer to
replay the group in place.
|
|
|
|
| |
Bug 50598
|
| |
|
|
|
|
|
| |
Patterns are slower and use more memory to print. For painting and
filling we can use the shading operator to draw gradients.
|
|
|
|
|
|
|
|
| |
Now that _emit_smask() can generate A1 masks, the _emit_imagemask()
code can be removed and emit_smask() used instead. An additional
benefit is stencil masks can be generated from ARGB32 and A8 images as
well as A1 providing that the analysis of the transparency shows that
the image is opaque or has bilevel alpha.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
There are some inkscape bugs reporting very slow rendering of inkscape
generated PDFs (inkscape uses cairo for PDF output). These bugs are
caused by cairo specifying a page sized bounding box in XObjects and
Patterns. PDF renderers usually use the BBox as the image size when
compositing. As PDFs generated from SVG tends to use a lot of XObjects
and Patterns this can lead to very long rendering times.
These three patches tighten up all the BBoxes in PDF output.
|
|
|
|
|
|
|
|
|
|
|
|
| |
In https://bugs.launchpad.net/ubuntu/+source/libcairo/+bug/680628 a
65K PDF printed to PDF using poppler-cairo turns into an 8MB PDF. The
original PDF contains a very large number of stencil mask images (an
A1 image used as a mask for the current color). The PDF surface was
not optimized for this particular case. It was drawing a solid color
in a group and then using an smask with the image in another group.
Fix this by checking for source = solid and mask = A1 image and
emitting a stencil mask image.
|
|
|
|
|
|
|
|
|
|
|
| |
The compiler complains about a const pointer being free'd and memcpy'd
to:
cairo-pdf-surface.c: In function ‘_cairo_pdf_surface_add_source_surface’:
cairo-pdf-surface.c:1208: warning: passing argument 1 of ‘__builtin___memcpy_chk’ discards qualifiers from pointer target type
cairo-pdf-surface.c:1208: warning: passing argument 1 of ‘__inline_memcpy_chk’ discards qualifiers from pointer target type
cairo-pdf-surface.c: In function ‘_cairo_pdf_source_surface_entry_pluck’:
cairo-pdf-surface.c:1666: warning: passing argument 1 of ‘free’ discards qualifiers from pointer target type
|
|
|
|
|
| |
to ensure surfaces with the same unique_id mime type are not embedded
more than once in PDF files.
|
|
|
|
|
|
|
|
|
|
|
| |
I updated the Free Software Foundation address using the following script.
for i in $(git grep Temple | cut -d: -f1 )
do
sed -e 's/59 Temple Place[, -]* Suite 330, Boston, MA *02111-1307[, ]* USA/51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA/' -i "$i"
done
Fixes http://bugs.freedesktop.org/show_bug.cgi?id=21356
|
|
|
|
|
|
| |
As a simple step to ensure that we do not inadvertently modify (or at least
generate compiler warns if we try) user data, mark the incoming style
and matrices as constant.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Handling clip as part of the surface state, as opposed to being part of
the operation state, is cumbersome and a hindrance to providing true proxy
surface support. For example, the clip must be copied from the surface
onto the fallback image, but this was forgotten causing undue hassle in
each backend. Another example is the contortion the meta surface
endures to ensure the clip is correctly recorded. By contrast passing the
clip along with the operation is quite simple and enables us to write
generic handlers for providing surface wrappers. (And in the future, we
should be able to write more esoteric wrappers, e.g. automatic 2x FSAA,
trivially.)
In brief, instead of the surface automatically applying the clip before
calling the backend, the backend can call into a generic helper to apply
clipping. For raster surfaces, clip regions are handled automatically as
part of the composite interface. For vector surfaces, a clip helper is
introduced to replay and callback into an intersect_clip_path() function
as necessary.
Whilst this is not primarily a performance related change (the change
should just move the computation of the clip from the moment it is applied
by the user to the moment it is required by the backend), it is important
to track any potential regression:
ppc:
Speedups
========
image-rgba evolution-20090607-0 1026085.22 0.18% -> 672972.07 0.77%: 1.52x speedup
▌
image-rgba evolution-20090618-0 680579.98 0.12% -> 573237.66 0.16%: 1.19x speedup
▎
image-rgba swfdec-fill-rate-4xaa-0 460296.92 0.36% -> 407464.63 0.42%: 1.13x speedup
▏
image-rgba swfdec-fill-rate-2xaa-0 128431.95 0.47% -> 115051.86 0.42%: 1.12x speedup
▏
Slowdowns
=========
image-rgba firefox-periodic-table-0 56837.61 0.78% -> 66055.17 3.20%: 1.09x slowdown
▏
|
|
|
|
| |
HSL modes support added by Benjamin Otte <otte@gnome.org>
|
|
|
|
|
|
|
|
|
|
| |
The PDF snapshot cow patch was reusing a previously emitted surface
pattern if the surface unique id matched the current surface. This
resulted in incorrect output as the new pattern may have a different
pattern matrix.
This patch fixes the PDF backend to always emit a new pattern but
re-use previously emitted image or metasurface XObjects.
|
|
|
|
|
|
| |
The PDF surface now keeps track of all the patterns it is embedding in
a hash table keyed by the unique_id returned by the
_cairo_surface_get_unique_id().
|
|
|
|
|
| |
Now that we are using PDF 1.5 features, add an api to select between
version 1.4 or 1.5.
|
|
|
|
|
|
| |
The extents will be used by EXTEND_PAD patterns as well as any other
pattern that can benefit from knowing the extents of the operation it
will be used with.
|
|
|
|
|
|
|
|
|
|
| |
Chris rightfully complained that having a boolean function argument is
new in cairo_show_text_glyphs, and indeed avoiding them has been one
of the API design criteria for cairo. Trying to come up with alternatives,
Owen suggested using a flag type which nicely solves the problem AND
future-proofs such a complex API.
Please welcome _flags_t APIs to cairo.h
|
| |
|