Commit graph

2986 commits

Author SHA1 Message Date
Chris Wilson
f676f18050 [cairo] Fixup make check.
make check demands that all function references in the docs are suffixed
with ().
2008-03-26 13:13:20 +00:00
Chris Wilson
452a1de2a0 [cairo-gstate] Remove dead code.
Eliminate _cairo_gstate_recursive_apply_clip_path, as its last caller
was removed over 2 years ago.
2008-03-26 13:13:19 +00:00
Adrian Johnson
ed42916028 Win32: Fix bug in cairo_win32_font_face_create_for_hfont()
Use GetObjectW for LOGFONTW.
2008-03-26 23:04:35 +10:30
Carl Worth
6dc75ab0f8 Quiet compiler warnings about unhandled PIXMAN_yuy2 and PIXMAN_yv12
We still don't handle these format codes of course, (they're meaningless
for the context in which they're used here).

Note that we previously avoided adding these to avoid people being forced
to upgrade pixman just to get two enum values that cairo doesn't really
care about. But now we're depending on a new pixman anyway, (for the
pixman_format_code_to_masks function), so we'll go ahead and do this now.
2008-03-25 16:46:02 -07:00
Carl Worth
1675713aff Depend on pixman 0.9.7 for new pixman_format_supported_destination function
This allows us to do a much more general and complete implementation of
_pixman_format_from_masks and _pixman_format_to_masks so that we'll
even pick up new pixman formats as they get added.
2008-03-25 16:45:21 -07:00
Carl Worth
d7e5f6b6a0 Rename _popcount to _cairo_popcount and make it available for internal use
Both cairo-image-surface.c and cairo-xlib-surface.c want to
use this function now.
2008-03-25 16:32:24 -07:00
Carl Worth
90cf7c2faf Quiet warning about signed vs. unsigned comparison 2008-03-25 13:17:49 -07:00
Carl Worth
770633c05a Quiet warnings about unhandled enum values in _cairo_surface_create_in_error 2008-03-25 13:17:49 -07:00
Carl Worth
d15c7c94bd Document performance advantage of cairo_path_extents
The cairo_path_extents function can perform better than either
cairo_stroke_extents or cairo_fill_extents, so provide that
pointer from the documentation of the other two functions.
2008-03-25 13:17:49 -07:00
Vladimir Vukicevic
8aba5b8029 [win32] Prevent crash in create_similar if win32_surface_create fails 2008-03-25 11:53:52 -07:00
Vladimir Vukicevic
ae143d779b [quartz] When stroking with an image source, use the right CTM for the image
Since the CTM was modified for the stroke transform, we need to reset
it before calling ConcatCTM for the source transform.
2008-03-25 11:17:57 -07:00
Adrian Johnson
e9906ae202 Win32-Printing: Fix fallback resolution when DC ctm is not identity
And also move the _cairo_surface_set_resolution() into
_cairo_win32_printing_surface_start_page as the DC ctm may be changed
between pages.

This bug was found in Inkscape now that they are using the cairo
win32-printing surface for printing on Windows.
2008-03-25 21:56:19 +10:30
Adrian Johnson
ae9635bf33 Fix assertion in PS/PDF/Win32-print when fallback image is off the page
If during analysis the bounding box of an operation or the number of
traps is 0, the operation is marked as natively supported. The problem
here is if the operation is unsupported by the backend, we get an
assertion when the operation is replayed during
CAIRO_PAGINATED_MODE_RENDER.

This bug was found in Inkscape when printing to the
win32_printing_surface a page that has been layed out as landscape but
landscape paper had not been selected in the print dialog.

Fix this by being careful not to mark unsupported operations as
supported during analysis even they may not be visible on the page.
2008-03-24 12:16:20 +10:30
Benjamin Otte
9a1f7bbc35 [API] unbreak CAIRO_FONT_TYPE_ATSUI
commit 9d61f7db80 broke API by making the
CAIRO_FONT_TYPE_ATSUI symbol not work anymore. However, this symbol was part of
Cairo's public API and should continue working this way.
2008-03-23 15:31:24 +01:00
Chris Wilson
104c2825ea [cairo-png] Set bKGD gray value.
For PNG_COLOR_TYPE_GRAY images the bKGD value is read from white.gray
which was uninitialized, triggering the "PNG warning = Ignoring attempt
to write bKGD chunk out-of-range for bit_depth" reported by Emmanuel
Pacaud. This patch sets the background gray value to white, the same as
for RGB images.
2008-03-21 09:15:42 +00:00
Adrian Johnson
4f56a6324f Finish the PDF text operator decimal reduction commit
Commit 158b32b60b reduced excess
decimals emitted for the TJ operator. However it only fixed the first
of the two locations in pdf-operators where the TJ position
adjustments are emitted.
2008-03-21 16:30:53 +10:30
Adrian Johnson
13e05bffd5 Fix PS glyph positioning bug in PDF operator emulation
The emulation of the PDF 'TJ' operator in the PS prolog was
incorrectly updating the glyph position between strings. The glyph
position values are a negative x offset that are in 1/1000 unit of
text space. We were incorrectly multiplying the number by -0.0001
instead of -0.001. We also need to transform this to device space
before calling rmoveto.
2008-03-21 16:15:57 +10:30
Carl Worth
4ad5937648 Enable PLT avoidance for cairo_image_surface_get_data/stride 2008-03-20 15:55:28 -07:00
Carl Worth
5d9eefccd6 Disable enum_regexp test in check-doc-syntax.h
It's returning false positives on non-gtk-doc comments with non-public
enum values. Ick.
2008-03-20 15:37:04 -07:00
Carl Worth
0c17ca52aa Mark new cairo_xlib_visual_info functions as private. 2008-03-20 15:33:37 -07:00
Carl Worth
e96f382549 Add support for 8-bit PseudoColor visuals
This support involves allocating a 16-bit grayscale ramp as well
as a 5x5x5 RGB color cube. Afterwards, the 256 colors are queried
and an array is generated mapping from r3g3b3 colors to the closest
available color. Both the queried colors and the reverse mapping
are stored in a new visual-specific cairo_xlib_visual_info_t
structure which hangs off of the cairo_xlib_screen_info_t.

Both the color-cube allocation and the distance metric could be
improved by someone sufficiently motivated, (for example, allocating
and matching in a perceptually linear color space rather than just
in RGB space). Also, making this work well in the face of a changing
color map, or in the case of GrayScale, StaticGray, or DirectColor
visuals are left entirely as exercises for the reader. StaticColor
support should be fine as is, but is entirely untested.
2008-03-20 11:51:57 -07:00
Carl Worth
d413c5ab21 xlib: Add support for arbitrary TrueColor visuals
This fixes the following bugs:

	cairo doesn't support 8-bit truecolor visuals
	https://bugs.freedesktop.org/show_bug.cgi?id=7735

	cairo doesn't support 655 xlib format
	https://bugs.freedesktop.org/show_bug.cgi?id=9719
2008-03-20 11:51:57 -07:00
Emmanuel Pacaud
aeaec94fd0 [SVG] Replace the color property by stroke.
Color property doesn't support URL as value. This pacth fixes
http://bugs.freedesktop.org/show_bug.cgi?id=14556 .
2008-03-20 16:05:34 +01:00
Adrian Johnson
158b32b60b PDF: Reduce excess decimals in text position offsets
The numbers output in the TJ array for adjusting the horizontal
position of the next glyph are in 1/1000 of the text space
units. Rounding these numbers to an integer should still provide
sufficient precision.

We use the rounded numbers to update the text position in
pdf-operators so subsequent numbers in the TJ array will compensate
for the rounding error.
2008-03-20 18:15:10 +10:30
Adrian Johnson
222041530c Use %g for printing path coordinates in pdf-operators
to eliminate unnecessary decimal places in the output.
2008-03-20 18:15:10 +10:30
Adrian Johnson
d78013470b Add %g conversion specifer to output-stream for limited precision
The %g conversion specifier is for printing numbers that were at some
time stored in a cairo_fixed_t type and as a result have their
precision limited by the size of CAIRO_FIXED_FRAC_BITS.

Using %g will limit the number of digits after the decimal point to
the minimum required to preserve the available precision.
2008-03-20 18:15:10 +10:30
Adrian Johnson
f3734085a1 Make _cairo_dtostr() static
It is only used in cairo-output-stream.c
2008-03-20 18:15:09 +10:30
Adrian Johnson
4d9e5b51aa Rescale CTM used for PS/PDF stroking to reduce rounding error
The PS/PDF CTM is transformed to the user space CTM when emitting
paths to be stroked to ensure the correct pen shape used. However this
can result in rounding errors.

For example the device space point (1.234, 3.142) when transformed to
a user space CTM of [100 0 0 100 0 0] will be emitted as
(0.012, 0.031).

Fix this by rescaling the user space CTM so that the path coordinates
emitted to the PDF file stay within the range the maximizes the
precision. The line width and dashing is also rescaled to be the same
size in the rescaled CTM.
2008-03-20 18:15:09 +10:30
Carl Worth
7f4b967c02 Make CAIRO_FORMAT_STRIDE_FOR_WIDTH_BPP available to the cairo internals. 2008-03-18 17:20:08 -07:00
Carl Worth
eb31c52feb Make _pixman_format_to_masks accept a cairo_format_masks_t structure
This makes it work similarly to _pixman_format_from_masks
2008-03-18 17:20:08 -07:00
Carl Worth
cdb1ae97f2 Move assertion failure for unsupported masks up one level
We're moving the assertion up from inside _pixman_format_to_mask
to its callers. This will allow us to selectively eliminate the
assertion from the supported xlib backend, while leaving it in
the unsupported glitz and xcb backends for now.
2008-03-18 17:20:08 -07:00
Adrian Johnson
b83b8c26f5 Optimize generated PostScript when EXTEND_PAD is used
Allow image patterns with EXTEND_PAD to use the currentfile
optimization.
2008-03-18 21:08:55 +10:30
Vladimir Vukicevic
df5087992b [quartz] Fix bogus CGContextGetType warning that's printed on the console
This is caused by 0x0 surfaces being special, and not having an
associated cgContext.
2008-03-17 17:37:22 -07:00
Vladimir Vukicevic
9d61f7db80 [quartz] Rename ATSUI font to Quartz font 2008-03-17 17:37:19 -07:00
Adrian Johnson
e4f087b8b9 Factor out common stroke code in pdf-operators 2008-03-17 22:04:05 +10:30
Adrian Johnson
344af99d35 Improve the PDF operators word wrapping
to correctly count the columns and avoid breaking hex strings
immediately after the '<' and before any hex digits have been written.
2008-03-15 22:07:01 +10:30
Vladimir Vukicevic
0a8478ca1a [quartz] don't say we forced subpixel AA when we didn't
Whoops.  Net result was that this was disabling subpixel AA on
contexts if CAIRO_ANTIALIAS_DEFAULT was being used.
2008-03-14 23:23:16 -07:00
Vladimir Vukicevic
028d352286 [quartz] compare gradient stops as doubles, not as fixed point
We use the floating-point value later, and we can end up with weirdness
such as negative colors due to the precision mismatch of our fixed
point vs. floating point type.  So just do everything in floating
point.
2008-03-14 23:22:14 -07:00
Adrian Johnson
112bbacea3 Don't use fill-stroke during analysis
Instead ensure the fill and stroke are each analyzed separately.

This fixes a bug in the PS output where if a fill-stroke with a
translucent fill resulted in a fallback image with the stroke clipped
to the fill path.
2008-03-15 00:28:21 +10:30
Adrian Johnson
112b43452d Fix bug in _cairo_path_fixed_is_equal
Ensure the entire path is compared.
2008-03-15 00:18:59 +10:30
Adrian Johnson
7e83d6e6fb Do not use PDF fill-stroke operator with transparent fill
because the PDF rendering does not match cairo. See
PDF Reference 7.6.3.

Bug report at
https://bugs.launchpad.net/inkscape/+bug/202096
2008-03-14 21:37:14 +10:30
Adrian Johnson
0aef7c1a34 PDF/PS: Optimize away the stroke ctm when not required
The PDF/PS backends change the ctm to user space when emitting and
stroking a path. When the user space ctm does not alter the pen shape
we can avoid changing the ctm.

This patch optimizes the most common case where the user ctm is
[1 0 0 -1 0 y] due to conversion from cairo to PDF coordinates.
2008-03-14 19:46:51 +10:30
Vladimir Vukicevic
a33351f9c6 [quartz] remove some compiler warnings 2008-03-13 15:37:57 -07:00
Vladimir Vukicevic
b4f518f917 Correctly pass the device-space vector through to stroker
Part of the earlier optimization caused the wrong slope to be used for
some computations; this passes the correct slope vector down to
_compute_face.
2008-03-13 15:37:57 -07:00
Adrian Johnson
5050c55f93 Use the correct glyph metrics in Type1 fallback
Now that the PS backend is using PDF operators, it uses the glyph
metrics in the font to position each glyph in a string. This exposed a
bug in Type 1 fallback where the glyph width and height was used in
the charstrings instead of x_advance/y_advance. This was causing
strings to print diagonally due to the no zero y_advance.
2008-03-13 21:37:32 +10:30
Vladimir Vukicevic
ed452713cf [win32] Use a DIB when cloning a surface for a WIN32_PRINTING dest
In some cases we were creating a 1bpp temporary surface, losing all
color/grayscale data while printing.

Ref: https://bugzilla.mozilla.org/show_bug.cgi?id=399388
2008-03-12 18:33:21 -07:00
Vladimir Vukicevic
6ac3eb487c [quartz] correctly force subpixel AA on a context, even if defaults say otherwise
In some cases (in my case, having an external monitor attached to my
MBP), Quartz seems to default to grayscale AA even when it should be
using subpixel AA.  CGContextGetAllowsFontSmoothing returns FALSE in
this case (pretty sure this is a Quartz bug).  We can force subpixel
AA in this case by setting CGContextSetAllowsFontSmoothing.
2008-03-12 18:33:21 -07:00
Vladimir Vukicevic
5d11b937f1 [quartz] Apply fixup to unbounded operators to clear area outside of mask 2008-03-12 18:33:21 -07:00
Chris Wilson
c86cbcdd64 [cairoint.h] Mark _cairo_image_analyze_transparency as private.
Add the required cairo_private markup for make check.
2008-03-12 17:55:55 +00:00
Chris Wilson
222eb6f140 Define _BSD_SOURCE to enable prototypes for strdup, snprintf.
strdup() and friends require at least _BSD_SOURCE or
_XOPEN_SOURCE >= 500 to be defined for the prototypes to be included.
For the time being, add the define to each source file that requires one
of the BSD functions.
2008-03-12 17:52:16 +00:00