Commit graph

5533 commits

Author SHA1 Message Date
Andrea Canciani
929571b4b5 path: Cleanup _cairo_path_fixed_transform
Clean up the code and make sure that _cairo_path_fixed_translate is
used whenever the _cairo_fixed_to_double rounding would result in the
matrix being approximated with a translation.
2010-10-29 17:31:23 +02:00
Andrea Canciani
34f1db13a1 path: Log flags
When logging path operations, also log computed flags.
2010-10-29 17:31:23 +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
a2ac91eb5f path: Drop degenerate line_to in _cairo_path_fixed_curve_to
When a degenerate line_to is followed by a curve_to operation, the
line_to can be safely dropped, just like for degenerate line_to
followed by line_to.
2010-10-29 17:31:22 +02:00
Andrea Canciani
2352b48f9e path: Move _cairo_path_fixed_add at the end of line_to and curve_to 2010-10-29 17:31:22 +02:00
Andrea Canciani
d6c3451ee2 box: Add _cairo_box_add_curve_to
Add a function to extend a box with the extents of a curve_to
operation.
2010-10-29 17:31:22 +02:00
Andrea Canciani
46584e01a8 box: Add box header
Add a new header implementing very simple box functions:
 - initialization with the two extrema
 - extension with a point
 - in/out test
2010-10-29 17:31:22 +02:00
Andrea Canciani
65d57313f0 path: Cleanup _cairo_path_fixed_line_to
The low-level line_to optimizations can be implemented in a more
abstract way using _cairo_path_fixed_penultimate_point and
_cairo_path_fixed_drop_line_to.
2010-10-29 17:31:22 +02:00
Andrea Canciani
f3e7677109 path: Simplify close_path
Instead of explicitly computing the flag in close_path, manually close
the path with a line_to, then drop the last operation if it is a
line_to (it might be another operation if the line_to was ignored
because it would have been degenerate).
2010-10-29 17:31:22 +02:00
Andrea Canciani
641d314b9a path: Add utility functions
Add a function to get the penultimate point and another one to drop
the last operation (assuming it is a line_to).

This allows some more abstraction in the line_to and close_path code.
2010-10-29 17:31:22 +02:00
Andrea Canciani
4075ed9686 path: Rename _cairo_path_last_op to _cairo_path_fixed_last_op
Aestetical change, to make the naming consistent with that of the
other functions.
2010-10-29 17:31:22 +02:00
Andrea Canciani
a8763d8fde path: Make path equality independent of flags
Flags for the same path can be different depending on its "history"
(in particular if it was constructed and transformed they might be
different from what they would be if each point was transformed and
then the path constructed).
2010-10-29 17:31:21 +02:00
Andrea Canciani
f4b2ce1c78 path: Improve hashing
Make the hash independent of buf bucketing, extents and flags.

This makes the hash depend only on the actual content of the path, not
on how it is stored or on any computed property.
2010-10-29 17:31:21 +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
Andrea Canciani
14cc9846b3 path: Replace _cairo_path_fixed_is_equal with _cairo_path_fixed_equal
Remove _cairo_path_fixed_is_equal and use _cairo_path_fixed_equal
instead.
The latter function can recognize that two paths are equal even if the
drawing commands have been partitioned in a different way in the buf
list.
2010-10-29 17:31:21 +02:00
Adrian Johnson
e23bcfd430 PDF: Don't use the currently set color after a 'Q' operator
https://bugs.freedesktop.org/show_bug.cgi?id=31140
2010-10-28 21:21:00 +10:30
Adrian Johnson
6dc0b19adb Type 1 subset: Fix glyph advance
https://bugs.freedesktop.org/show_bug.cgi?id=31062
2010-10-24 11:32:41 +10:30
Uli Schlachter
cee1dadc66 Other backends: Set round_glyph_positions to OFF
This sets CAIRO_ROUND_GLYPH_POS_OFF in all surface backends that didn't use
CAIRO_ROUND_GLYPH_POS_ON.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-21 22:20:31 +02:00
Uli Schlachter
d24e9881de raster backends: Set round_glpyh_positions to ON
This fixes "text-rotate" in the test suite for the image backend and
"overlapping-glyphs" for the xcb backend.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-21 22:20:31 +02:00
Uli Schlachter
b514863a0e Actually implement round_glpyh_positions
The previous commit only added this option and made sure it gets set, but it
didn't actually have any effect. This commit now implements this option.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-21 22:20:31 +02:00
Uli Schlachter
6bfe71124b font options: Add private round_glpyh_positions field
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-21 22:20:12 +02:00
Uli Schlachter
fae88051c1 XCB: Use consistent rounding modes for a1 rasterisation.
This ports commits 36b4b0631 and 7ab9ce1b9 from the image backend to xcb. Look
there for an explanation of why this is correct, I only copied this over and the
test suite said it was good. :-)

This fixes unantialiased-shapes, a1-rasterisation-rectangles and
a1-rasterisation-triangles.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-21 12:18:27 +01:00
Uli Schlachter
b80bcf66b2 XCB: Fix for all unbounded operators
_cairo_xcb_surface_fixup_unbounded_boxes() calculated a list of boxes that it
has to clear to make an unbounded operator work correctly. Then it cleared the
boxes that were drawn instead of clearing the list of boxes that it has to
clear.

The reason that this wasn't noticed before is that there is an optimization in
case we have only one box instead of a whole list of boxes. This hid the bug.

This fixes the "unbounded-operator" test case.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-21 12:18:27 +01:00
Uli Schlachter
4465ff779a XCB: Move the assert from 5a0f8f7320
Calling _cairo_xcb_surface_ensure_picture() on a XCB surface whose fallback
member is non-null is always an error. It's possible that the surface first gets
a picture assigned and later it's fallback member is set. In this situation,
it's still wrong to use the surface's picture for any drawing-

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-21 12:18:27 +01:00
Chris Wilson
0d93468efc xcb: Pass clip to composite_glyphs_via_mask
Spotted by Uli Schlachter.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-10-15 10:40:53 +01:00
Chris Wilson
42ecc427f3 xcb,image: Fix a missing clip fini
Spotted by Uli Schlachter when I copied the image glyphs clipping to
xcb.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-10-15 10:40:53 +01:00
Adrian Johnson
22cdb7041f PS: Remove radial gradient fallback
when one circle not inside the other. Pixman now follows the PDF
specification.
2010-10-15 15:26:39 +10:30
Adrian Johnson
d3655e04b2 PDF: Remove radial gradient fallback
when one circle not inside the other. Pixman now follows the PDF
specification.
2010-10-15 15:26:39 +10:30
Adrian Johnson
34d9299624 PS: Remove redundant code
The test for zero stops is now in gstate.
2010-10-15 15:26:39 +10:30
Adrian Johnson
7a17ef3176 PDF: Fix regression in EXTEND_NONE gradients
The test for opaque gradients in _cairo_pdf_surface_add_pdf_pattern()
must be identical to the test in
_cairo_pdf_surface_emit_pattern_stops() other wise the PDF file will
reference a smask that does not exist.

The _cairo_pattern_is_opaque() test is too strict for PDF as PDF can
draw EXTEND_NONE gradients with opaque color stops without requiring a
smask.
2010-10-15 15:26:39 +10:30
Uli Schlachter
6fecbb000d XCB: Remove an incorrect clipping optimizations
It seems like the idea here was to optimize for the special case of a
rectangular clip, where the region operation could be replace by
direction operation on the draw extents. However, we cannot modify the
geometry for all operations, and in particular the glyphs. So remove
this from the common compositing path.

This fixes partial-clip-text in the test suite.

Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-10-14 15:09:13 +01:00
Chris Wilson
8b6e080995 xcb: Fix reduction of clipping for bounded glyphs.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-10-14 14:21:40 +01:00
Uli Schlachter
e6ce65fb82 xcb: Correctly handle ARGB visuals
We want surface->depth to end up as "32", so we have to invent an alpha mask.
This mask is not used anyway (only its popcount), but still this should get a
less ugly fix.

This was found because "assert (reply->depth == surface->depth);" in
_get_image() failed.

Original-patch-by: Ross Alexander <Ross.Alexander@EU.NEC.COM>
Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-10-13 12:47:09 +01:00
Uli Schlachter
da62cc21da _cairo_xcb_surface_picture: Check for fallback
If a cairo surface's fallback member is set, the current content of that surface
is in-memory and the X server has an outdated version of stuff. Our
optimizations for doing in-server copies are wrong in this case and we should do
stuff in cairo instead of the X server.

Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-10-13 12:29:44 +01:00
Uli Schlachter
5a0f8f7320 _cairo_xcb_surface_ensure_picture: Check fallback
When an XCB surface's fallback member is not NULL, we did some rendering that
the X server couldn't do for us and thus did that internally in cairo instead.
This means the X drawable's content is out of date and should not be used for
drawing anything.

This adds an assert which checks for that situation.

Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-10-13 12:29:38 +01:00
Andrea Canciani
35b1688c92 quartz: Remove unused imageSurface field
imageSurface was used to store a reference to the fallback image
generated by during fallbacks for gradients. The fallback code
has been removed as it is not needed anymore, thus this field can
be removed as well.
2010-10-13 00:27:01 +02:00
Andrea Canciani
ce455994a3 quartz: Cleanup gradient setup functions
Gradient setup does not depend anymore on the surface on which the
gradient will be composited.
2010-10-13 00:27:01 +02:00
Andrea Canciani
1061c80d79 quartz: Move drawing state out of surface
Some pattern types (gradients, surface patterns) require some
temporary information to be stored as "graphic state", because it
doesn't belong to CGContext. Previously all of this data was stored
inside the surface during the drawing operations, now it's in a
stack-allocated structure (of type cairo_quartz_drawing_state_t).
Based on a patch by Robert O'Callahan <robert@ocallahan.org>.
See https://bugzilla.mozilla.org/show_bug.cgi?id=522859
2010-10-13 00:27:01 +02:00
Andrea Canciani
bbaca95982 quartz: Unify DO_SHADING, DO_IMAGE and DO_TILED_IMAGE
DO_SHADING, DO_IMAGE and DO_TILED_IMAGE sources all require the source
to be painted over the whole surface (inside the clip region), thus can
share the same code path in drawing functions.
2010-10-13 00:27:01 +02:00
Andrea Canciani
51a6ae9d71 quartz: Unify DO_SOLID and DO_PATTERN
Both DO_SOLID and DO_PATTERN setup the underlying CGContext to directly
use the chosen color/pattern when filling and stroking, thus require no
additional drawing operations and can share the same drawing code.
2010-10-13 00:27:01 +02:00
Andrea Canciani
c22e75e9f6 quartz: Set operator when setting up source
Share some code between the drawing functions by saving the state
and setting the operator when setting up the source and by restoring
the state during teardown.
Based on a patch by Robert O'Callahan <robert@ocallahan.org>.
See https://bugzilla.mozilla.org/show_bug.cgi?id=522859
2010-10-13 00:27:01 +02:00
Andrea Canciani
6bc1376cf5 quartz: Remove DO_NOTHING and DO_UNSUPPORTED actions
DO_NOTHING and DO_UNSUPPORTED are not actual actions and are better
handled by returning an appropriate cairo_int_status_t (and falling
back, if needed).
2010-10-13 00:26:57 +02:00
Andrea Canciani
08c59c6bf3 quartz: Improve gradient quality
Instead of extending the range of the interpolation parameter to make
sure that pixels exactly on the edge get drawn, we are now asking
quartz to extend the gradient.
2010-10-12 23:18:13 +02:00
Andrea Canciani
620c43f50c quartz: Fix EXTEND_PAD gradients
Make PAD extended gardients more robust, by computing the color
explicitly like for REPEAT and REFLECT extend modes.
This removes a hack introducing a small but non-0 negative value
that ensured that the gradient started with the correct color (but
not that it ended with the correct one, too).

Fixes linear-gradient-large.
2010-10-12 23:18:13 +02:00
Andrea Canciani
2af3ae92eb quartz: Improve gradient consistency
By keeping "virtual extents", quartz surfaces now keep track of
the extents where they want the gradients to be consistent.
This works across various API for surface creation and editing:
 - cairo_surface_create_for_rectangle
 - cairo_surface_create_similar + cairo_surface_set_device_offset
 - cairo_push_group/cairo_pop_group

This method does not use clip extents, so it also makes gradient
rasterization independent of clip/path extents.
2010-10-12 23:18:13 +02:00
Andrea Canciani
d21b4f3166 Add _cairo_rectangle_union
Implement _cairo_rectangle_union(), a function to compute a rectangle
containing two input rectangles.
2010-10-12 23:18:13 +02:00
Andrea Canciani
1c36766d27 quartz: Remove unused code
The gradient fallback path is not used anymore.
2010-10-12 20:19:39 +02:00
Andrea Canciani
2cea2bb085 quartz: Make radial gradients follow PDF specification
Pixman master (soon to become pixman 0.20) implements radial
gradients based on the PDF specification (section 8.7.4.5.4).
Quartz natively implements them, so falling back is not needed
anymore.
2010-10-12 20:19:39 +02:00