Commit graph

3988 commits

Author SHA1 Message Date
Behdad Esfahbod
7ccae2de6d [perf] Make cairo-perf-diff build cairo-perf-diff-files 2007-08-28 13:46:28 -04:00
Adrian Johnson
766346aa5c PDF: Remove unused code 2007-08-28 20:35:49 +09:30
Adrian Johnson
ad43b7fe6b PDF: Clean up comments 2007-08-28 20:35:23 +09:30
Adrian Johnson
a60beb2eef Fix PDF regression with multipage documents 2007-08-28 20:34:55 +09:30
Carl Worth
1a6b62e599 Disable 7 cairo-pdf tests due to poppler knockout-group bug
The following 7 tests currently fail with poppler due to:

	Poppler does not correctly handle knockout groups
	https://bugs.freedesktop.org/show_bug.cgi?id=12185

and we've verified with acroread that the cairo-pdf output
does render as intended there. The disabled tests are
clip-operator, operator-clear, operator-source, over-above-source,
over-around-source, over-below-source, and over-between-source.
2007-08-27 14:45:51 -07:00
Adrian Johnson
1cdd11873b Add finer-grained fallback support to the PDF surface
The stream handling has been changed to support writing the content to
one or more group objects. Each page has a top level knockout
group. The first operation in the knockout group paints another group
containing the content. Fallback images are painted from the knockout
group. This ensures that fallback images do not composite with any
content under the image.
2007-08-27 14:21:36 -07:00
Carl Worth
1e8446609b Add explanation of pdf_ignored_tests with links to upstream poppler bug reports 2007-08-27 14:02:55 -07:00
Carl Worth
463493af73 Remove svg2pdf and pdf2svg programs from test directory
These are useful programs, but they don't belong in test/.
They are never used in the test suite at all. Instead, these
should exist in some demo package, or as applications in their
own right.

(The motivation for the removal is that someone just encountered
a build error with one of these. And I'm not interested in debugging
build errors for unused components.)
2007-08-27 10:40:06 -07:00
Carl Worth
495c9d19bf One more PS-specific reference image (for over-between-source)
A pixman bug had kept this from being correct earlier. It
works now as long as pixman includes the following fix:

	8ff7213f39edc1b2b8b60d6b0cc5d5f14ca1928d
	rasterize traps that extend outside of the image bounds correctly
2007-08-25 23:39:28 -07:00
Carl Worth
a3c3fe2296 Modify ps-specific reference images for ft-text-vertical tests
I've been seeing failures with the PS backend for these tests
for a while. This is in spite of the face that we've had a PS-
specific reference image for each of these tests. I'm not sure
what the difference is between my current system and the
system used to generate the original ps-specific reference
images.

One thing we definitely need to do is to bundle fonts with the
test suite to avoid problems like this. Another is to start
documenting the systems used to generate reference images.
I get very confused with ghostscript versioning, but I can
at least say that "gs --version" reports 8.15.3 here, (though
the package appears to have an 8.56 version).
2007-08-25 19:24:07 -07:00
Carl Worth
71cc245d5a Add PS-specific reference images for 4 tests
The following 4 tests recently started drawing with native operations
in the place of image fallbacks, so we need ps-specific reference images
to account for minor rasterization differences: over-above-source,
over-around-source, over-below-source, and trap-clip.
2007-08-25 19:24:07 -07:00
Carl Worth
ae185f803a Add four new test to exercise interactions of native and fallback objects
The new tests are: over-above-source, over-around-source, over-below-source,
and over-between-source
2007-08-25 19:24:07 -07:00
Emmanuel Pacaud
5929a1defb [SVG] Suppress code duplication by using _cairo_svg_surface_emit_stroke_style
from _cairo_svg_surface_stroke.
2007-08-25 21:28:33 +02:00
Emmanuel Pacaud
726ed30401 [SVG] Don't emit transform property when matrix is identity. 2007-08-25 20:50:36 +02:00
Emmanuel Pacaud
89881187f2 [SVG] Implement fill_stroke method. 2007-08-25 20:50:20 +02:00
Emmanuel Pacaud
ac51fff0db Add a new fill_stroke surface backend method.
This method is for use in vector backends, where fill immediatly followed by
stroke command with the same path can be emited in the same backend command.
This commit also factorize the detection of such cases in the meta surface
backend and automatically call the fill_stroke method on replay.
2007-08-25 20:49:50 +02:00
Emmanuel Pacaud
43d35e0110 [SVG] fix modeline for vim. 2007-08-25 20:45:16 +02:00
Carl Worth
3ceaa6e74e Merge branch 'cairo-origin' into cairo 2007-08-24 08:03:44 -07:00
Carl Worth
e3b5a65021 Remove build-breaking debugging helper.
Sorry! Totally my fault on this one.
2007-08-24 08:03:03 -07:00
Chris Wilson
24075f1bdd [cairo-perf] Blacklist xlib-fallback.
Do not try and create non-Render xlib surfaces as they explicitly do
not support performance testing.
2007-08-24 14:30:19 +01:00
Chris Wilson
8894894d9d [cairo-boilerplate-xlib] Check that the surface will fit in the screen.
Whilst testing the fallback surface, the resultant image was being
clipped to the screen size. Be conservative and refuse to create
windows (for CAIRO_CONTENT_COLOR surfaces) that are larger than the
 screen.
2007-08-24 14:14:10 +01:00
Chris Wilson
a29544a0b6 [cairo-boilerplate-xlib] Clear Render data for the non-Render fallback.
As well as marking the XRender extension unavailable in
_cairo_boiler_player_xlib_disable_render(), we need to clear any
XRender derived information stored during the surface creation.
2007-08-24 12:27:15 +01:00
Carl Worth
177a3b8a32 Remove include of cairoint.h from *-private.h header files.
These were recently added, (as part of sparse integration?), but they
break boilerplate which reaches into at least cairo-types-private.h
and cairo-scaled-font-private.h. But boilerplate cannot see cairoint.h
or else it gets the internal sybol renaming, (with the INT_ prefix),
and then all the test suite tests refuse to link.

If this change reverts some recently-added functionality, (or
cleanliness), then we'll just need to find some other way to add that
back again without the breakage.
2007-08-23 16:13:04 -07:00
Behdad Esfahbod
fa41ebfb7c Fix header inclusion order
Enough for now, until I figure out the right way to break cairoint.h.
2007-08-23 14:00:12 -04:00
Behdad Esfahbod
d66f1ee82a [boilerplate] Build libcairoboilerplate.la in make check and make test 2007-08-23 14:00:12 -04:00
Behdad Esfahbod
5594f8b035 [Makefile.am] Run sparse and splint once per source file
Also skip .h files for splint as it causes lots of unused-function warnings.
2007-08-23 14:00:12 -04:00
Chris Wilson
503ab85e44 Fix inadvertent executable mode flip.
Clear the executable bit for cairo-scaled-font.c
2007-08-23 15:01:02 +01:00
Behdad Esfahbod
735757a17a [Makefile.am] Add target sparse to run sparse static source code analyzer
There are still some bits not quite working.
2007-08-22 02:58:37 -04:00
Behdad Esfahbod
bfdc3b6642 [Makefile.am] Move -DHAVE_CONFIG_H to the right place 2007-08-22 01:16:50 -04:00
Behdad Esfahbod
af6a123e95 [Makefile.am] Inhibit unrecognized options to splint 2007-08-22 01:09:21 -04:00
Behdad Esfahbod
e9d709b5ca [cairo-image-surface] Fix comment syntax
Found by splint.
2007-08-22 01:07:59 -04:00
Behdad Esfahbod
ef878345c8 [Makefile.am] Add target splint to run splint static source code analyzer 2007-08-22 01:07:38 -04:00
Behdad Esfahbod
f015091bb5 [Makefile.am] Use libcairo_la_CFLAGS instead of INCLUDES
for clarity.
2007-08-22 01:03:50 -04:00
Behdad Esfahbod
3e5859c58f [ROADMAP] Mark fine-grained fallbacks done 2007-08-21 23:02:03 -04:00
Carl Worth
333b96f0e0 Add support for image fallbacks for X servers with 555 visuals
This fixes bugzilla #9993:

	Cairo fails with 555 X server visual
	https://bugs.freedesktop.org/show_bug.cgi?id=9993
2007-08-21 17:10:49 -07:00
Carl Worth
f00fb10f87 Add support for image fallbacks for X servers with 565 visuals
This fixes bugzilla #10461:

	Cairo doesn't support 565 xlib visual
	https://bugs.freedesktop.org/show_bug.cgi?id=1046
2007-08-21 17:10:49 -07:00
Carl Worth
ddb78df4c9 Restore the error message for unsupported X server visuals
Apparently, our much-beloved error message, (just look at how many people
love to quote it in bugzilla entries), was removed during the switch to
the new pixman. It was replaced with an obscure failure of a nil surface
being returned, (leading to obscure failures or false "out of memory"
errors).

So we're putting this back now, (even though we _really_ want to ensure
that this message never gets printed in practice).
2007-08-21 17:10:49 -07:00
Carl Worth
72fab3675c Use a pixman_format_code to describe the image surface used for xlib fallbacks
Previously, the code was just using cairo_format_t which is much more limited
than the formats supported by pixman, (so many "odd" X server visuals would
just fall over).
2007-08-21 17:10:49 -07:00
Carl Worth
a9662d0aae Eliminate fragile cairo_internal_format_t
Instead we take advantage of the pixman_format_code_t
that now exists in the public interface of the new, external
pixman library.
2007-08-21 17:10:49 -07:00
Carl Worth
9f4e643649 Ensure the Render extension is initialized before calling XESetCloseDisplay
This avoids a potential crash from the Render extension being cleaned
up during XCloseDisplay before the cairo CloseDisplay hook goes on to
call into XRenderFreePicture.
2007-08-21 16:46:58 -07:00
Carl Worth
d05593a5fb Add a new xlib-fallback target to test xlib using image fallbacks instead of the Render extension 2007-08-21 16:46:40 -07:00
Adrian Johnson
590717f03b PS: Remove debug info from PS output
The debug code is now conditionally compiled.
2007-08-22 07:58:14 +09:30
Carl Worth
e66b2b68ab Use 8-bit math to flatten color when emitting a solid pattern to PostScript
This isn't necessarily more correct than the old code using the doubles,
but it does result in bit-for-bit color equivalence when comparing the
results against the image backend. So that's both good consistency, and
more ease is using the test suite to verify things.
2007-08-21 14:52:54 -07:00
Adrian Johnson
bf92255edd PS: Add finer-grained image fallback support
The analysis surface now keeps track of two regions: supported
operations, and unsupported operations. If the target surface returns
CAIRO_INT_STATUS_FLATTEN_TRANSPARENCY, the analysis surface will check
if any previous operation intersects with this operation. If there is
nothing previously drawn under the operation, the status is changed to
supported.

The meta surface has two new functions:
        _cairo_meta_surface_replay_region()
        _cairo_meta_surface_replay_and_create_regions()

During the analysis stage, the paginated surface replays the meta
surface using _cairo_meta_surface_replay_and_create_regions(). The
return status from each analyzed operation is saved in the meta
surface. The _cairo_meta_surface_replay_region() function allows only
operations from either the supported or unsupported region to be
replayed. This allows the paginated surface to replay only the
supported operations before emitting a fallback image for each
rectangle in the unsupported region.
2007-08-21 22:27:57 +09:30
Behdad Esfahbod
bf4bdbb607 [cairo-scaled-font] Document how glyph surfaces use device offsets 2007-08-20 21:01:55 -04:00
Behdad Esfahbod
31f5aafa36 Fix device_offset misuse in all glyph surface uses
Seems like all over the code, we have been using negated device_offset
values for glyph surfaces.  Here is all the math(!):

A device_transform converts from device space (a conceptual space) to
surface space.  For simple cases of translation only, it's called a
device_offset and is public API (cairo_surface_[gs]et_device_offset).
A possibly better name for those functions could have been
cairo_surface_[gs]et_origing.  So, that's what they do: they set where
the device-space origin (0,0) is in the surface.  If the origin is inside
the surface, device_offset values are positive.  It may look like this:

Device space:
      (-x,-y) <-- negative numbers
         +----------------+
         |      .         |
         |      .         |
         |......(0,0) <---|-- device-space origin
         |                |
         |                |
         +----------------+
                  (width-x,height-y)

Surface space:
       (0,0) <-- surface-space origin
         +---------------+
         |      .        |
         |      .        |
         |......(x,y) <--|-- device_offset
         |               |
         |               |
         +---------------+
                   (width,height)

In other words: device_offset is the coordinates of the device-space
origin relative to the top-left of the surface.

We use device offsets in a couple of places:

  - Public API: To let toolkits like Gtk+ give user a surface that
    only represents part of the final destination (say, the expose
    area), but has the same device space as the destination.  In these
    cases device_offset is typically negative.  Example:

         application window
         +---------------+
         |      .        |
         | (x,y).        |
         |......+---+    |
         |      |   | <--|-- expose area
         |      +---+    |
         +---------------+

    In this case, the user of cairo API can set the device_space on
    the expose area to (-x,-y) to move the device space origin to that
    of the application window, such that drawing in the expose area
    surface and painting it in the application window has the same
    effect as drawing in the application window directly.  Gtk+ has
    been using this feature.

  - Glyph surfaces: In most font rendering systems, glyph surfaces
    have an origin at (0,0) and a bounding box that is typically
    represented as (x_bearing,y_bearing,width,height).  Depending on
    which way y progresses in the system, y_bearing may typically be
    negative (for systems similar to cairo, with origin at top left),
    or be positive (in systems like PDF with origin at bottom left).
    No matter which is the case, it is important to note that
    (x_bearing,y_bearing) is the coordinates of top-left of the glyph
    relative to the glyph origin.  That is, for example:

    Scaled-glyph space:

      (x_bearing,y_bearing) <-- negative numbers
         +----------------+
         |      .         |
         |      .         |
         |......(0,0) <---|-- glyph origin
         |                |
         |                |
         +----------------+
                  (width+x_bearing,height+y_bearing)

    Note the similarity of the origin to the device space.  That is
    exactly how we use the device_offset to represent scaled glyphs:
    to use the device-space origin as the glyph origin.

Now compare the scaled-glyph space to device-space and surface-space
and convince yourself that:

	(x_bearing,y_bearing) = (-x,-y) = - device_offset

That's right.  If you are not convinced yet, contrast the definition
of the two:

	"(x_bearing,y_bearing) is the coordinates of top-left of the
	 glyph relative to the glyph origin."

	"In other words: device_offset is the coordinates of the
	 device-space origin relative to the top-left of the surface."

and note that glyph origin = device-space origin.

So, that was the bug.  Fixing it removed lots of wonders and magic
negation signs.

The way I discovered the bug was that in the user-font API, to make
rendering the glyph from meta-surface to an image-surface work I had
to do:

	cairo_surface_set_device_offset (surface, -x_bearing, -y_bearing);
	_cairo_meta_surface_replay (meta_surface, surface);
	cairo_surface_set_device_offset (surface, x_bearing, y_bearing);

This suggested that the use of device_offset for glyph origin is
different from its use for rendering with meta-surface.  This reminded
me of the large comment in the xlib backend blaming XRender for having
weird glyph space, and of a similar problem I had in the PS backend
for bitmap glyph positioning (see d47388ad75)

...those are all fixed now.
2007-08-20 21:01:55 -04:00
Behdad Esfahbod
d55da1aa62 [scaled-font] Really ignore ctm translation
Previously we were ignoring ctm translation in scaled fonts when hashing, but
still storing it into the scaled font.  Now we zero the translation components
when storing.
2007-08-20 21:01:55 -04:00
Behdad Esfahbod
a394e5870e [cairo-image-surface] Simplify device-offset usage 2007-08-20 21:01:55 -04:00
Behdad Esfahbod
61f736d0d1 [cairo-paginated-surface] Add XXX mark to integer width,height arguments 2007-08-20 21:01:55 -04:00
Vladimir Vukicevic
f97bb5613a Fix path_fixed_offset_and_scale to apply scale and offset in right order 2007-08-20 17:32:05 -07:00