Commit graph

39 commits

Author SHA1 Message Date
Adrian Johnson
9fbf427548 Use uintptr_t for all casts between pointer and integer
On 64-bit windows, long is 32-bit. When compiling there are a large
number of warnings about mismatched sizes when casting long to/from a
pointer.

Use the (u)intptr_t type for any integer that will have a pointer stored
in it. Use a (u)intptr_t cast when integers are stored in pointers to
silence warnings.

Fixes #263
2021-07-25 11:01:20 +09:30
Chris Wilson
1ba9fb6fad Mark _cairo_path_is_simple_quad as private
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-01-27 16:29:41 +00:00
Martin Robinson
cfe0e59663 gl/msaa: Add a fast path for fills that are simple quads
Instead of invoking Bentley-Ottman for fills that are simple
quadrilaterals, just pass the geometry straight to OpenGL.
2013-01-25 16:30:11 -08:00
Chris Wilson
af9fbd176b Introduce a new compositor architecture
Having spent the last dev cycle looking at how we could specialize the
compositors for various backends, we once again look for the
commonalities in order to reduce the duplication. In part this is
motivated by the idea that spans is a good interface for both the
existent GL backend and pixman, and so they deserve a dedicated
compositor. xcb/xlib target an identical rendering system and so they
should be using the same compositor, and it should be possible to run
that same compositor locally against pixman to generate reference tests.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

P.S. This brings massive upheaval (read breakage) I've tried delaying in
order to fix as many things as possible but now this one patch does far,
far, far too much. Apologies in advance for breaking your favourite
backend, but trust me in that the end result will be much better. :)
2011-09-12 08:29:48 +01:00
Andrea Canciani
a8ae8759f5 path: Always interpret in forward direction
Path are always interpreted in forward direction, so the ability of
interpreting in the opposite direction (which is very unlikely to be
useful at all) can be removed.
2010-12-10 10:58:51 +01:00
Andrea Canciani
22ea4609be path: Solve co-dependency problem
FALSE and TRUE are defined in cairoint.h, but cairoint.h depends on
cairo-path-fixed-private.h, so just use 0/1 to avoid the depencency
loop.

Fixes a number of errors reported by 'make check'.
2010-10-30 13:36:18 +02:00
Andrea Canciani
e8e614db92 path: Rename fill optimization flags
Rename fill optimization flags making fill_ their common prefix.
2010-10-29 17:31:23 +02:00
Andrea Canciani
e48cb95493 path: Add stroke_is_rectilinear flag
Stroke and fill rectilinearity cannot be represented by a single flag
without missing the opportunity of considering some strokes
rectilinear.
2010-10-29 17:31:22 +02:00
Andrea Canciani
166453c1ab path: New path construction logic
Now move_to's are actually added to the path when followed by a
drawing operation (line_to, curve_to or close_path).

This is implemented by updating the current_point and setting the
needs_move_to when a move_to operation is requested.

Whenever a drawing operation is requested and the needs_move_to flag
is set, a move_to is added before the drawing operation.
2010-10-29 17:31:22 +02:00
Andrea Canciani
e9c1fc3188 path: Do not access flags directly
Use inline accessors to hide the flags in the code.

This ensures that flags that need additional computations (example:
is_rectilinear for the fill case) are always used correctly.
2010-10-29 17:31:21 +02:00
Chris Wilson
eeafeebd2e path: Exponentially grow buffer based on populated points and ops.
Instead of simply doubling the buffer size every time we overflow a point
or an op, enlarge the buffer to fit twice the number of used points and
ops.  We expect paths to be fairly consistent in the mix of operations,
and this allows the buffer size to tune itself to actual usage and reduce
wastage.
2010-06-11 09:06:20 +01:00
Andrea Canciani
b8a7f8621a Update FSF address
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
2010-04-27 11:13:38 +02:00
Chris Wilson
6b77567b6e path: Compute coarse bounds upon construction.
Frequently we only need the coarse path bounds, so avoid walking over
the list of points once more as we can cheaply track the extents during
construction.
2010-01-22 23:01:52 +00:00
Chris Wilson
e7a118d3f8 [path] Standalone header-compilation
Hmm, TRUE/FALSE apparently weren't defined before use. Odd.
2009-09-01 14:31:38 +01:00
Chris Wilson
f22045bb4b [fallback] Include implicit closes in the check for rectilinear paths
Fixes test/implicit-close

By forgetting the implicit-close when checking for rectilinear paths, we
tried to feed the triangle (and other diagclose) into the specialised
rectilinear tesselators which completely mishandled that final edge.
2009-08-29 17:07:38 +01:00
Chris Wilson
71f5649846 [path] Fix iter to handle circular list of buffers
When switching the path over to use the circularly linked list, 73f801,
I missed updating the path iterator.
2009-07-29 16:17:12 +01:00
Chris Wilson
bed2701e1c Remove clip handling from generic surface layer.
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
▏
2009-07-23 15:32:14 +01:00
Chris Wilson
73f8019fd2 [path] Use cairo_list_t instead of open-coding its own
Use the cairo_list_t and its style of iterators to improve the readability
of the cairo_path_buf_t management. Note the complications that arise from
the embedding of the initial buf -- however the macros do help make the
unusual manipulations more identifiable.
2009-07-05 15:01:03 +01:00
Chris Wilson
a04e372664 [path] Add path watch debugging
Simple debug macro to print the path to stderr during construction.
2009-07-05 10:34:33 +01:00
Chris Wilson
1645352bfb [path] Evaluate is_box && is_region during construction
Whilst constructing the path, if the operations continue to be
axis-aligned lines, allow the is_box and is_region flags to persist. These
are set to false as soon as a curve-to is added, a diagonal or in the case
of is_region a non-integer point.
2009-07-05 09:30:02 +01:00
Chris Wilson
f2982e103c [fill] Allow rectangles to be implicitly closed.
Also scan for appendages of simple rectangles.
2008-11-29 10:14:26 +00:00
Chris Wilson
d2bcf1d76d [path] Carefully check for no more points.
As the empty path points to an embedded buf, we cannot rely on the buf
pointer being NULL to mark end-of-path.
2008-11-29 10:14:26 +00:00
Chris Wilson
4ac38f7c2b [fill] Emit rectangles for GdkRegion
Scan the path for a series of consistently wound rectangles.
2008-11-25 12:54:58 +00:00
Chris Wilson
a856371bef Add CairoScript backend.
A new meta-surface backend for serialising drawing operations to a
CairoScript file. The principal use (as currently envisaged) is to provide
a round-trip testing mechanism for CairoScript - i.e. we can generate
script files for every test in the suite and check that we can replay them
with perfect fidelity. (Obviously this does not provide complete coverage
of CairoScript's syntax, but should give reasonable coverage over the
operators.)
2008-11-13 11:36:54 +00:00
Behdad Esfahbod
5926257770 Revamp the build system.
Quick summary of changes:

  - Move list of cairo source files out of src/Makefile.am and into
    src/Sources.mk,

  - Generate files src/Config.mk and src/Config.mk.win32 that choose
    the right set of source files and headers based on configured
    backends and features.  This drastically simplifies building
    using other build systems.  The src/Makefile.win32 file needs
    to be updated to reflect these changes.

  - Add README files to various directories,

  - Add toplevel HACKING file.
2008-09-02 20:24:08 -04:00
Behdad Esfahbod
f0633f4449 [doc] Make sure all function names in docs are followed by () 2008-01-28 21:49:57 -05:00
Chris Wilson
901b0c9752 [cairo-path-fixed] Exponentially enlarge cairo_path_buf_t.
Allocate subsequent path bufs twice as large as the previous buf,
whilst still embedding a small initial buf into cairo_path_fixed_t
that handles the most frequent usage.
2007-11-05 08:51:06 +00:00
Behdad Esfahbod
62377cbac1 [cairo-path-fixed] Remove leftover typedef keyword
Oops!
2007-08-30 19:45:44 -04:00
Behdad Esfahbod
dd406b1ffa [cairo-path-fixed] typedef char cairo_path_fixed_op_t
So it consumes one byte only, instead of the previous enum with
the __attribute__((packed)) that didn't do anything on non-gcc systems.
2007-08-30 18:45:47 -04: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
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
85aff353ca [cairo-path-fixed] Fine-tune size of buffer
such that cairo_path_fixed_t fits in 512 bytes.
2007-03-13 05:14:18 -04:00
Behdad Esfahbod
1bd073a1a2 [cairo-path-fixed] Merge op and arg bufs
This means, we have to malloc only one buffer, not two.  Worst case
is that one always draws curves, which fills the arg (point) buffer
six times faster than op buffer.  But that's not a big deal since
each op takes 1 byte, while each point takes 8 bytes.  So op space
is cheap to spare, so to speak (about 10% memory waste at worst).
2007-03-13 05:14:18 -04:00
Behdad Esfahbod
5750d669af [cairo-path-fixed] Avoid malloc for small paths
We do this by including an initial op and arg buf in cairo_path_fixed_t,
so for small paths we don't have to alloc those buffers.

The way this is done is a bit unusual.  Specifically, using an array of
length one instead of a normal member:

-    cairo_path_op_buf_t *op_buf_head;
+    cairo_path_op_buf_t  op_buf_head[1];

Has the advantage that read-only use of the buffers does not need any
change as arrays act like pointers syntactically.  All manipulation code
however needs to be updates, which the patch supposed does.  Still, there
seems to be bugs remaining as cairo-perf quits with a Bad X Request error
with this patch.
2007-03-13 05:14:18 -04:00
Carl Worth
ba531642f7 Add optimization for rectilinear stroke
This custom stroking code allows backends to use optimized region-based
drawing operations for rectilinear strokes. This results in a 5-25x
performance improvement when drawing rectilinear shapes:

image-rgb          box-outline-stroke-100 0.18 -> 0.01: 25.58x speedup
████████████████████████▋
image-rgba         box-outline-stroke-100 0.18 -> 0.01: 25.57x speedup
████████████████████████▋
 xlib-rgb          box-outline-stroke-100 0.49 -> 0.06:  8.67x speedup
███████▋
 xlib-rgba         box-outline-stroke-100 0.22 -> 0.04:  5.39x speedup
████▍

In other words, using cairo_stroke instead of cairo_fill to draw the
same shape was 5-15x slower before, but is 1.2-2x faster now.
2006-12-22 17:59:20 -08:00
Carl Worth
7b1509f4f3 Reimplement path.has_current point as a 1-bit bitfield 2006-12-22 17:59:20 -08:00
Carl Worth
410e3ae8f2 Clean up names of cairo_path internals. 2005-03-23 14:36:29 +00:00
Carl Worth
f218c14b9d Rename cairo_path_real_t to cairo_path_fixed_t and fix all _cairo_path functions to be named as _cairo_path_fixed functions.
Track name change of cairo_path_real_t and _cairo_path_fixed functions.
2005-03-23 13:52:54 +00:00
Carl Worth
cb5bbd0aa7 Begin the process of breaking up cairoint.h, moving structure definitions of cairo_t, cairo_gstate_t, and cairo_path_real_t into their own header files.
Track changes to header files, reaching into the new private headers where necessary.
2005-03-23 13:50:51 +00:00