Commit graph

3632 commits

Author SHA1 Message Date
Chris Wilson
35be087155 [Makefile.am] Only rerun headers-standalone if a header file has changed
Use a stamp to mark the time that the headers were last checked and only
rerun the test if any have been modified since.
2008-09-30 11:11:47 +01:00
Chris Wilson
6da8d8ea62 [pattern] Fix up OBO introduced to cloned area
In the midst of porting 5eec3e378a I failed
to include the pad in the floor() and ceil() which introduces two
potential off-by-one errors into each dimension of the region of interest
of the source surface.
2008-09-29 18:00:57 +01:00
Behdad Esfahbod
e3f9e40df7 Fix residues of the Makefile.*.config Makefile.*.features renaming
They just don't seem to want to die...
2008-09-29 11:49:50 -04:00
Chris Wilson
d703f964aa Clean up compile warnings.
A couple of unchecked status returns (which should always be
CAIRO_STATUS_SUCCESS) and an unused variable.
2008-09-29 16:40:28 +01:00
Behdad Esfahbod
1310df44ed [text_to_glyphs] Further enhance the docs
The most complex public cairo API deserves more doc love...
2008-09-29 11:34:19 -04:00
Chris Wilson
63ee963c63 [user-font] Rewrite text_to_glyphs allocation instructions.
Resolve the seemingly conflicting two paragraphs that instruct the writer
of a user-font on when to allocate the glyphs array during text_to_glyphs,
so that it is consistent with itself and the code. In particular, I could
find no indication in the code that num_glyphs is preset to -1 (it should
be a user parameter reflecting the number of entries in the supplied glyph
buffer) and the callback must allocate the array using
cairo_glyph_allocate().
2008-09-29 15:18:29 +01:00
Owen W. Taylor
5eec3e378a [pattern] Improve handling of filter radius and optimize when possible.
Factor out common filter analysis code from _cairo_pattern_get_extents()
so that we can share it with _cairo_pattern_acquire_surface_for_surface()
as well. During the analysis of the filter determine whether the pattern
matrix maps source pixels exactly onto destination pixels and if so convert
the filter to NEAREST - generalising the existing conversion to NEAREST.

(Patch ported to master by Chris Wilson, all bugs are his.)
2008-09-29 09:46:50 +01:00
Carl Worth
7d7057cf88 _cairo_pattern_get_extents: Fix to allow for expansion based on filter
This fixes the filter-bilinear-extents test case and the
related bug entry:

	bad clipping with EXTEND_NONE
	http://bugs.freedesktop.org/show_bug.cgi?id=15349

Though there are still differences in the PDF and PostScript
backends, (primarily because we can't capture cairo's filter
modes in those file formats).
2008-09-29 09:46:49 +01:00
Owen W. Taylor
6ef4bd4ecf [pattern] Fix acquiring outside of source bounds
Restrict the area we acquire from the source image to the bounds of
the source image, even when we have an identity matrix. This handles
circumstances where the pattern extents may be enlarged due to
filtering, for example when applying a bilinear filter.

This patch replaces the open-coded rectangle intersection which has
already proven itself to be a source of bugs.

(Patch ported to master by Chris Wilson, all bugs are his.)
2008-09-29 09:46:49 +01:00
Owen W. Taylor
6d0f2c4421 [pattern] Remove the hack to support cloning surface patterns.
Remove instances (abuses) of calling _cairo_pattern_acquire_surface() on
a known-surface-pattern with a hack to say "give me the entire surface".
If you know you just want the entire surface as an image surface, that
can be done more simply.

(Split from original patch on
https://bugs.freedesktop.org/attachment.cgi?id=15703, by Chris Wilson -
as usual all bugs are his.)
2008-09-29 09:46:49 +01:00
Chris Wilson
24b22f0d21 [glitz] Compile fix for typo.
I wonder whether merely fixing a compile error in glitz will do anything
towards its utility... Anyway fix the missing comma as reported by
Shunichi Fuji and correct the asserts.
2008-09-29 08:30:25 +01:00
Karl Tomlinson
d52b55cb1b [xlib] _surfaces_compatible() can return true for different picture formats
_surfaces_compatible in cairo-xlib-surface returns true for surfaces with
different xrender_format when each has the same depth and no (NULL)
visual.

Common picture formats will not have the same depth, but
it is possible to create a surface with a non-standard xrender_format
having the same depth as another xrender_format with
cairo_xlib_surface_create_with_xrender_format.

Both cairo_xlib_surface_create_with_xrender_format and
_cairo_xlib_surface_create_similar_with_format create surfaces with no
visual.

The same issue exists in the xcb backend.

Fixes bug https://bugs.freedesktop.org/show_bug.cgi?id=16564.
2008-09-28 17:51:23 +01:00
Chris Wilson
b6b54e2f27 [svg] Compile fix for last commit.
Sorry - badly merged patch (missed a chunk).
2008-09-28 17:13:11 +01:00
Chris Wilson
cff3bcba68 [svg] Check that the mask is supported.
During the analyze phase we also need to check whether we can emit the mask
without requiring fallbacks.
2008-09-28 17:06:32 +01:00
Chris Wilson
8ad3031359 [svg] Enable the assertion that paint() is supported.
The XXX comment before the disabled assert is misleading as the final
fallback image paint operation should never trigger UNSUPPORTED.
2008-09-28 17:04:15 +01:00
Chris Wilson
95e637f9ac [paginated] Set paginated mode before every replay.
Previously we were replaying full page fallbacks without updating the
mode - this was upsetting SVG.
2008-09-28 16:57:42 +01:00
Chris Wilson
36b9858991 [svg] Kill _cairo_svg_surface_force_fallbacks.
It is not used, but refuses to die!
2008-09-28 16:24:40 +01:00
Benjamin Otte
57851464f9 [SVG] make backend handle new operators gracefully
Previously, the SVG backend would rash when new operators were added to
cairo.h, now it returns UNSUPPORTED.
Also unsupported operators can now be set as NULL, so image fallbacks can
be used properly.
Should use fallbacks instead of color-dodge for CAIRO_OPERATOR_STURATE?
2008-09-28 17:10:22 +02:00
Benjamin Otte
fda80cc852 [SVG] use _cairo_operator_bounded_by_source()
previously, the code was duplicating its functionality
2008-09-28 17:10:22 +02:00
Chris Wilson
3c18d95b29 Compute device_transform_inverse.
Because we can independently set either the device scale or the device
offset, we need to be careful and recompute the inverse rather than simply
assuming that the original contents of the device transform is identity.

Fixes regression https://bugs.launchpad.net/inkscape/+bug/234546.
2008-09-28 16:08:18 +01:00
Chris Wilson
9841d9d58e Automate error checking for fallback-resolution.
For this we extend the boilerplate get_image() routines to extract a
single page out of a paginated document and then proceed to manually
check each page of the fallback-resolution test.

(Well that's the theory, in practice SVG doesn't support multiple pages
and so we just generate a new surface for each resolution. But the
infrastructure is in place so that we can automate other tests,
e.g. test/multi-pages.)
2008-09-28 14:57:12 +01:00
Chris Wilson
871f683367 clone_similar(): s/device_offset/clone_offset/
A little bit of sleep and reflection suggested that the use of
device_offset_[xy] was confusing and clone_offset_[xy] more consistent
with the function naming.
2008-09-27 17:27:21 +01:00
Chris Wilson
95c3c06932 [surface] Only return early for no traps if the operator is bounded by a mask.
If the operator is unbounded, then its area of effect extends beyond
the definition of the mask by the trapezoids and so we must always perform
the image composition.

Fixes test/operator*.
2008-09-27 17:17:58 +01:00
Emmanuel Pacaud
922a580116 Merge branch 'master' of git+ssh://emmanuel@git.cairographics.org/git/cairo 2008-09-27 11:55:50 +02:00
Emmanuel Pacaud
0c4317085e [svg] Fix comp-op for paint, mask and show_glyphs operations.
In paint and show_glyphs, the compositing operator was not emitted at all.
In mask, the operator was also emitted for the mask itself, which is
wrong.

SVG clear and source differ from cairo as it also affects the
destination if the source pixel are completely transparent. We need to emit
an additional clip-to-self property.

Librsvg does not support clip-to-self, so it renders the SVG
test outputs incorrectly.

This patch also remove a lot of useless spaces in the style property
strings (I know, this should go in another commit).
2008-09-27 11:47:32 +02:00
Chris Wilson
5b97ee6525 Allow cloning sub-regions of similar surfaces.
Previously the rule for clone_similar() was that the returned surface
had exactly the same size as the original, but only the contents within
the region of interest needed to be copied. This caused failures for very
large images in the xlib-backend (see test/large-source).

The obvious solution to allow cloning only the region of interest seemed
to be to simply set the device offset on the cloned surface. However, this
fails as a) nothing respects the device offset on the surface at that
layer in the compositing stack and b) possibly returning references to the
original source surface provides further confusion by mixing in another
source of device offset.

The second method was to add extra out parameters so that the
device offset could be returned separately and, for example, mixed into
the pattern matrix. Not as elegant, a couple of extra warts to the
interface, but it works - one less XFAIL...
2008-09-27 02:20:42 +01:00
Behdad Esfahbod
7f3a48f90b [cairo.h] Don't define cairo_public to __declspec(dllimport) for static build
That define should target win32 DLL builds only.  We can't tell though,
so we require user to define CAIRO_WIN32_STATIC_BUILD to signal that.
2008-09-26 13:27:42 -04:00
Chris Wilson
fc12267405 [scaled-font] Spelling fix.
Arbitrary spelling fix.
2008-09-26 17:26:30 +01:00
Behdad Esfahbod
86e57671dd [check-*.sh] Redirect error reports to stderr 2008-09-26 11:08:22 -04:00
Behdad Esfahbod
096f9def0f Add slim markers to make check-plt.sh happy 2008-09-26 11:07:10 -04:00
Behdad Esfahbod
9662be8ee7 [twin-font] Adjust ascent/descent
The font data uses a 64 int high font space with baseline at 50.
2008-09-26 10:04:36 -04:00
Behdad Esfahbod
3883a371f2 [scaled-font] Use full ctm matrix when comparing scaled-font keys
We use the full matrix in hash computation, but only compare the
non-translation items in equality check.  This is no bug though,
as we set the ctm translation components of a scaled font to zero
explicitly.  But the change makes the hash and equal functions
consistent, which is good.
2008-09-26 10:04:36 -04:00
Chris Wilson
681424cbaf [analysis] Merge two analysis status codes.
Since there is an implicit precedence in the ranking of the analysis
return codes, provide a function to centralize the logic within the
analysis surface and isolate the backends from the complexity.
2008-09-26 13:42:28 +01:00
Chris Wilson
06f0cc81d2 Add a macro to determine whether a status is a fatal error.
In a few places we need to check whether we have a fatal error or an
internal return code, so provide a utility macro to centralise the check.
2008-09-26 13:42:28 +01:00
Chris Wilson
ba18d57339 [pdf] Propagate status
Check and return a few forgotten error codes from static functions.
2008-09-26 13:42:28 +01:00
Adrian Johnson
907f550a1b Fix bitmap-font XFAIL
Images in PDF are scaled to a unit square. In PS we set the
ImageMatrix to do the same. When the image is painted we scale the
graphics state to paint the image at the right size. In the case of
Type 3 fonts consisting of bitmap images we want to paint the images
at their original size so we scale the graphics state by the image
width and height.

The bug was that we were scaling by the width/height in the glyph
metrics. For non rotated fonts this worked. However for rotated fonts
the width/height of the glyph images may be larger than the
width/height in the glyph metrics. This resulted in a Type 3 font
where the glyph images were scaled slightly smaller than they should
have been.
2008-09-26 20:26:55 +09:30
Behdad Esfahbod
f8542dc9dd [twin-font] Clean up font data by joining lines and closing paths
Two changes here:

  * Replace move_to;line_to;move_to;line_to sequences with
    move_to;line_to;line_to when feasible.

  * Close paths for round glyphs.

Both improve the stroke rendering of the joint.

The first change also saves 3 bytes per joint (33 such joints).
Which we have just left unused for now.  To reclaim them one need
to update the charset table.  Something for a lazy Sunday afternoon
scripting task.

In the saving department, we can save further by:

  - Getting rid of the left/ascent/descent values as we compute
    glyph bounding box automatically.  Then we can liberally use
    the right value to adjust glyph advance width.  Saves three
    bytes per glyph (there's 96 glyphs in the font).

  - First operation is always a move_to.  So we can remove the 'm'
    for that.  Ugly though.

And the charset has zeros for the first 32 entries.  Can get rid of
that too at the expense of handling it in the code...

In total, combining the above we can save some 500 bytes.  The font
currently takes about 3.7kb.
2008-09-25 19:25:11 -04:00
Behdad Esfahbod
d5a998387b Add an internal font face
The font data and rendering is adapted from Keith Packard's Twin
window system.  The hinting stuff is not ported yet, but hey, it renders!

The implementation uses user fonts, and the user font backend is modified
to use this font face (which we call "twin" font face internally) when
a toy font is needed.

The font face layer is then modified to use this font if:

  - The toy font face "cairo" is asked for, or

  - No native font backend is available, or

  - The preferred native font backend fails to return a font with
    STATUS_UNSUPPORTED.  No font backend does this right now but
    the idea is to change FreeType to return it if no fonts found
    on the system.

We also allow building with no font backends now!

The new doc/tutorial/src/twin.c file tests the twin face at various
sizes.
2008-09-25 19:25:11 -04:00
Carl Worth
1d896aa9d8 Actually remove cairo_has_show_text_glyphs
The release notes for 1.7.6 say that we had dropped this
function, but apparently we had only planned to do that
and didn't actually get around to it until now.

Thanks to the RELEASING insctructions which gave a diff
command that pointed out this problem.
2008-09-25 15:56:57 -07:00
Carl Worth
5d887ad5dc Remove all lcd_filter code.
We reverted the public API for setting lcd_filter font options
back in 1b42bc8033 , but we had left the implementation which
would examine fontconfig and Xft properties for the option, and
which would call into freetype for subpixel glyph rasterization.

However, I recently realized, (and the test suite had been trying
to tell me for a while), that this approach would cause a
regression for users who were previously using sub-pixel text,
but without sub-pixel rendering built directly into freetype.
That's not acceptable, so all the code is coming out for now.
2008-09-25 13:31:20 -07:00
Chris Wilson
31ff6c863f [pdf] Explicitly order the sequence of checks when analyzing masks
There is an implicit precedence when analyzing patterns for
compatibilty, in order of descending precedence:
  fatal error
  unsupported
  needs image fallback
  needs meta-surface analysis
  success.

So wehen we have two patterns, we need to check both analysis statuses
simulataneously, in order to correctly report the combined status.
2008-09-25 02:09:44 -07:00
Carl Worth
69635bc054 Fix the analysis of mask operations (fixing mask-transformed-similar test case)
The primary bug here was some missing braces. The code was conditionally
assigning to backend_status, but then unconditionally checking for the
value assigned. The result was the leaking of an internal status value
(CAIRO_INT_STATUS_ANALYZE_META_SURFACE) which finally resulted in
an incomplete PDF file in the mask-transformed-similar test case.

While fixing this, also avoid re-using the backend_status variable so
much so that the code is more readable.
2008-09-25 02:09:40 -07:00
Carl Worth
5599b08dfa Drop _cairo_analysis_surface prefix from some static functions
Since these functions are static we don't really need the full
name. And these two functions were both so long that they were
causing some serious line-wrap issues.
2008-09-25 01:42:03 -07:00
Carl Worth
261dd83b31 Eliminate paranoid check for PNG_INTERLACE_NONE.
Commit 20b1b33c0f added some "paranoid checks" to our png
loading code. One of these was checking that if png_get_IHDR
first reports an interlace value other than PNG_INTERLACE_NONE
that after we call png_set_interlace_handling then we do
get PNG_INTERLACE_NONE from the next call to png_get_IHDR.

However, libpng doesn't seem to actually have that behavior.
When testing cairo_image_surface_create_from_png with an
interlanced PNG file, (which the test suite happens not to
do---even now), the call to png_set_interlace_handling is
doing the trick, but the check for PNG_INTERLACE_NONE is
failing.

So, with the check in place, loading an interlaced PNG image
fails with CAIRO_STATUS_READ_ERROR. By simply removing
that check, an interlaced image loads just fine.
2008-09-24 21:55:53 -07:00
Behdad Esfahbod
e84ef3c54e [.gitignore] Remove Makefile.*.config
I renamed those generated files to Makefile.*.features but forgot to
update ignore lists.  Carl already added the new ones, but didn't
remove the old ones.
2008-09-24 20:00:30 -04:00
Carl Worth
9335ad313f Ignore generated files.
I know that I didn't create these Makefile.win32.features files,
so I assume that they are the result of Behdad's build magic and
that he just forgot to add them to .gitignore.
2008-09-24 16:20:35 -07:00
Chris Wilson
dfe9f7093f Revert "[pdf] Tweak the mask analysis to avoid an assertion failure."
This reverts commit c9ec82f3a8, which
notably caused regresions in the mask and clip-operator tests.

Obviously I'm not smart enough to fix bugs. Since the computer found the
assertion failure, I need to train the computer to fix the bugs as well.
2008-09-24 22:37:08 +01:00
Behdad Esfahbod
5a06ca852c [Makefile.win32] Also report installing cairo-version.h and cairo-features.h
Those two files needs special care and hence are not listed in
enabled_cairo_sources.
2008-09-24 17:23:28 -04:00
Behdad Esfahbod
a91101df31 [Makefile.sources] Remove mention of cairo-features-win32.h
That file is not generated anymore.  Instead, cairo-features.h is
generated from Makefile.win32 on the fly.
2008-09-24 17:23:28 -04:00
Behdad Esfahbod
2fb59b3ebd [Makefile.win32] Report which files to install
The win32 build system has no way to install anything, but it has
full knowledge of what needs to be installed (which headers).  So
we now report files to be installed at the end of the build.
2008-09-24 17:09:54 -04:00