Commit graph

5499 commits

Author SHA1 Message Date
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
Andrea Canciani
5054727927 quartz: Remove linear gradient fallback
Degenerate linear gradients are reduced to solid gradients in
gstate, so backends do not need to handle them.
2010-10-12 20:19:39 +02:00
Adrian Johnson
f96187e31e Rewrite pdf-operators word wrapping
to fix some bugs
2010-10-08 23:17:27 +10:30
Adrian Johnson
a0b208fc71 Don't put Type3 glyphs in latin subsets
it is not yet implemented
2010-10-08 23:01:12 +10:30
Andrea Canciani
5500d072e0 quartz: Handle failures in _cairo_quartz_setup_fallback_source
If the fallback surface creation or painting fail, the fallback
surface needs to be destroyed.
2010-10-07 20:44:50 +02:00
Andrea Canciani
17bb0f8b1f quartz: Improve _cg function types 2010-10-07 20:44:50 +02:00
Andrea Canciani
3b4f7c3662 quartz: Improve handling of surface creation failure
Don't paint on a surface whose status is not SUCCESS.
2010-10-07 20:44:50 +02:00
Andrea Canciani
b13a8035c1 quartz: Remove useless code
The condition is always true (since surface creation returns non-NULL
even upon failure).
2010-10-07 20:44:50 +02:00
Andrea Canciani
f156f89db0 quartz: Simplify cairo_quartz_surface_create_for_cg_context
Only retaining the context when the surface cration is successful
avoids needless retaining and simplifies the code.
2010-10-07 20:44:50 +02:00
Andrea Canciani
c5fc8fa62f quartz: Use NOTHING_TO_DO instead of SUCCESS where appropriate
Returning CAIRO_INT_STATUS_NOTHING_TO_DO removes some code that
specifically handles it to convert to CAIRO_STATUS_SUCCESS. This
is already performed out of the backend, in the upper layers, so
it is not needed here.
2010-10-07 20:44:50 +02:00
Andrea Canciani
eae5fafc89 quartz: Beautify code
Remove redundant parentheses and reference/dereferences.
2010-10-07 20:44:50 +02:00
Andrea Canciani
f93603fda0 quartz: Whitespace cleanup 2010-10-07 20:44:50 +02:00
Andrea Canciani
6ff5cbd8a9 quartz: Mark failures as unlikely 2010-10-07 20:44:50 +02:00
Andrea Canciani
2f4a47c6bf quartz: Fix function call coding style
Cairo coding style specifies a single space between the function
name and the parentheses.
2010-10-07 20:44:49 +02:00
Andrea Canciani
692f20a859 quartz: Don't typecast surfaces
Casting to (cairo_surface_t *) is considered bad practice. The
correct way to get a reference to the generic surface information
is &(surface->base)
2010-10-07 20:44:49 +02:00
Andrea Canciani
b922477e4e quartz: Check for valid patterns
The pattern handling code ensures that 0 stops patterns are reduced
to clear solid patterns before being passed down to the backend.
An assertion is used to make sure that the assumption actually holds,
removing the duplication of the reduce-to-solid-clear logic.
2010-10-07 20:44:49 +02:00
Andrea Canciani
c9aa393a4d quartz: Assert upon invalid enum values
Invalid enum values were being ignored (and replaced by a default
value). This behavior is not desirable on development builds,
because an explicit failure is much easier to track.
Assertions allow release builds to keep on with the old behaviour,
while development builds fail as soon as the invalid operaiton is
performed.
2010-10-07 20:44:49 +02:00
Andrea Canciani
9c22f97ebd quartz: Remove unused argument from _cairo_surface_to_cgimage 2010-10-07 20:44:49 +02:00
Adrian Johnson
ef60650bd6 Fix bug in subsetting check for winansi characters 2010-10-07 23:09:52 +10:30
Adrian Johnson
390a6aa997 remove unused variable 2010-10-06 22:43:36 +10:30
Adrian Johnson
ea45bc1b4b PS: Allow %%BoundingBox and %%PageBoundingBox to be overriden using DSC comments 2010-10-06 22:38:57 +10:30
Adrian Johnson
b950212a2a CFF subset: add support for latin subsets 2010-10-06 22:34:57 +10:30
Andrea Canciani
f20814e07e xcb: Do not return value in void function
Sun Studio Compiler complains:
"cairo-xcb-surface.c", line 585: void function cannot return value
even if the returned value is void.
Some minor code restructuring removes the issue.
2010-10-05 10:36:38 +02:00
Chris Wilson
e675660ca7 xcb: Correct a minor typo prevent an assert from firing
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-10-04 22:08:33 +01:00
Uli Schlachter
b6f830bab0 xcb: Correctly clear the composite surface
Calling _cairo_xcb_surface_render_paint() with CAIRO_OPERATOR_CLEAR and no clip
just results in the surface's deferred_clear flag to be set to TRUE. Fix this by
calling _cairo_xcb_surface_clear() directly instead.

This half-fixes the clip-shape test in the test-suite. The difference to the
reference image becomes much smaller at least. :(

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-04 18:16:57 +02:00
Uli Schlachter
0a651b93a4 xcb: Fix compiler warning about unused result
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-04 12:48:23 +02:00
Uli Schlachter
be50c32ed5 xcb: Fix CAIRO_OPERATOR_IN
The if that is being removed here resulted in no drawing done at all when it
skipped the call to _render_fill_boxes(). This is obviously not what
CAIRO_OPERATOR_IN wants.

This fixes the "operator" test in the test suite.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-04 12:46:32 +02:00
Uli Schlachter
c200560929 XCB: Fix some weird code
In the XCB backend, drawing a surface pattern always caused an extend of
CAIRO_EXTEND_NONE to be used. This caused e.g. all the
surface-pattern-scale-down-extend-* tests in the test suite to fail.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-04 12:46:32 +02:00
Adrian Johnson
7d2979e446 Don't embed cmap in TrueType fonts embedded in PostScript
it doesn't print on a LaserJet 4050
2010-10-02 20:07:34 +09:30
Adrian Johnson
cd74f5edab pdf-operators: word wrap latin text strings 2010-10-02 18:13:49 +09:30
Adrian Johnson
165a14b564 pdf-operators: fix bug that was causing unnecessary repositioning of text
This optimizes the output to increase the maximum amount of text that
is emitted with a single Tj operator.
2010-10-01 19:18:28 +09:30
Adrian Johnson
af3b550bc1 PDF: Add support for latin subsets
Add support for Type 1 and TrueType latin subsets.

CFF latin subsets are not yet implemented.
2010-10-01 19:15:31 +09:30
Adrian Johnson
85c25d79f7 TrueType subsetting: embed a cmap for latin subsets
To support latin subsets in PDF, TrueType fonts require a cmap to map
unicode to glyph indices for all characters in the winansi encoding.
2010-10-01 19:15:30 +09:30
Adrian Johnson
7c268bc838 PS: Enable support for latin subsets
Make PS TrueType embedding use the winansi glyph mapping for latin subsets.

Enable use of latin subsets in PS.
2010-10-01 19:15:30 +09:30
Adrian Johnson
52f3db92a7 Type 1 fallback: add support for latin subsets
For latin subsets the /Encoding array maps the latin encoding to the
font glyphs.
2010-10-01 19:15:30 +09:30