Commit graph

4277 commits

Author SHA1 Message Date
Chris Wilson
62dc0ae46c [cairo] Offset the current path when pushing/popping groups.
We need to translate the path in order to compensate for the device offset
applied to the group surface when pushing and popping. (The path is
transformed to device space on creation, and so needs recomputing for the
new device.)
2009-06-19 19:08:34 +01:00
Chris Wilson
cec8579348 [xlib] Remove redundant code to query a xrender_format from a visual
We always query an xrender_format for a Visual upon surface creation, so
checking again in create_similar() is redundant. (It also interferes with
disabling XRender...)
2009-06-19 19:06:17 +01:00
Chris Wilson
d3330d7beb [ft] Substitute twin if there are no fonts
Fixes bug 22356 -- Spurious "out of memory" error on system without fonts
https://bugs.freedesktop.org/show_bug.cgi?id=22356

If FcFontMatch() fails, then it means that there are no fonts available on
the system (or it may have been a malloc error, we have no way of telling).
Instead of report NO_MEMORY and disabling all drawing, one of the
rationales for including a builtin font was so that we could continue even
in the face of this error and show *something* to the user. (This being a
last resort (and especially important for demos!) and hopefully easier to
diagnose than no output at all.)
2009-06-19 11:20:48 +01:00
M Joonas Pihlaja
6d8b353658 [spans] Squash a compiler warning when creating error objects.
Handle the new CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED status code
in the switch/case of the ..._create_in_error() functions for
creating span renderers or scan converters.
2009-06-19 02:45:39 +03:00
Chris Wilson
c12533b135 [pattern] Add _cairo_pattern_fini_snapshot
Symmetric operation to _cairo_pattern_init_snapshot() this exists simply
to break the circular reference between the meta-surface and snapshot-cow.
2009-06-19 00:29:00 +01:00
Chris Wilson
2213c44737 [svg] Break circular snapshot reference by explicit finish
The svg backend snapshots the meta surface which because of snapshot-cow
creates a circular reference back to the creator. So in order to break the
circular reference when we have finished with the snapshot, we need to
call cairo_surface_finish() in addition to simply destroying the surface.
2009-06-19 00:29:00 +01:00
Chris Wilson
cd9eef1aad [scaled-font] Check the MRU font before resolving the implementor
This should hide most of the overhead of resolving a frequently used toy font.
2009-06-19 00:29:00 +01:00
Chris Wilson
3063f0f44c [scaled-font-subset] Check for matching font-face implementors
Catch toy and user fonts which may have different font-faces for their
implementation than the original ones they were created with.
2009-06-19 00:28:59 +01:00
Chris Wilson
3da32e35af [analysis] Restore nops for the analysis null surface
Joonas reported that adding the extra routines to the null-surface as used
by the analysis surface broke user-fonts. So create a separate null
backend to be exported via the test-null surface.
2009-06-19 00:28:58 +01:00
Chris Wilson
c0e01d9cd7 [xlib] Improve GC caching efficacy
Shrink the overall size of the per-screen GC cache, but allow multiple GCs
per depth, as it quite common to need up to two temporary GCs along some
drawing paths. Decrease the number of GCs we obtain in total by returning
clean (i.e. a GC without a clip set) back to the screen pool after use.
Compensate for the increased number of put/get by performing the query
using atomic operations where available. So overall we see a dramatic
reduction on the numbers of XCreateGC and XFreeGC, of even greater benefit
for RENDER-less servers.
2009-06-19 00:28:57 +01:00
Jeff Muizelaar
7f238f5424 Use the scanline rasterizer in the win32 backend.
Brings http://people.mozilla.com/~jmuizelaar/world-map.html from 8fps to 13fps
in Vista on a Mac Mini
2009-06-18 17:13:13 -04:00
Jeff Muizelaar
d066154e62 Factor out _cairo_image_surface_span_render_row()
This allows other backends use the same function for rendering rows.
More specifically, I intend to use this with the win32-backend.
2009-06-18 19:29:12 +03:00
M Joonas Pihlaja
46eb56a99f [cairo-surface] Handle the all clipped out case for regions.
Explicitly handle a region clip which represents that the
entire surface is clipped out by passing in a temporary
empty region to the backend set_clip_region() method.
Previously the passed in region may have been NULL even
when clip->all_clipped = TRUE.

Fixes a bug tickled by the clip-all test case which was
brought to light by 394e139213.
2009-06-18 16:42:53 +03:00
Chris Wilson
002264d572 [clip] Missing {} (coding style)
Carl spotted that I'd slipped in a little CODING_STYLE violation.
2009-06-17 17:15:26 +01:00
Nis Martensen
bc87074185 [path] Fix missing implicit move-to
When cairo_curve_to happens to start a new subpath (e.g., after a call
to cairo_new_sub_path()), it also needs to update the last_move_point.
Otherwise the new current point after a close_path() will be at an
unexpected position.

Therefore, call _cairo_path_fixed_move_to() explicitly.
2009-06-17 16:39:56 +01:00
Chris Wilson
394e139213 [clip] During _clip() limit the extracted traps to the current clip extents
By applying a tight _cairo_traps_limit() we can reduce the amount of work
we need to do when tessellating the path and extracting the trapezoids.
2009-06-17 16:20:07 +01:00
Chris Wilson
650b85ec77 [clip] Avoid copying region within _cairo_clip_intersect_region()
Within _cairo_clip_intersect_region() we can simply assign the freshly
extracted traps-region if we previously had no region set.
2009-06-17 14:19:19 +01:00
Chris Wilson
116c93cb7f [cairo] Remove instance of 'return free()'
Gah! This is a GCC-ism, so therefore it has to go.
2009-06-16 11:36:36 +01:00
Vladimir Vukicevic
22587f57bd Import Qt backend by Mozilla
Written by Vladimir Vukicevic to enable integration with Qt embedded
devices, this backend allows cairo code to target QPainter, and use
it as a source for other cairo backends.

This imports the sources from mozilla-central:
http://mxr.mozilla.org/mozilla-central/find?text=&kind=text&string=cairo-qpainter
renames them from cairo-qpainter to cairo-qt, and integrates the patch
by Oleg Romashin:
https://bugs.freedesktop.org/attachment.cgi?id=18953

And then attempts to restore 'make check' to full functionality.

However:
 - C++ does not play well with the PLT symbol hiding, and leaks into the
   global namespace. 'make check' fails at check-plt.sh

 - Qt embeds a GUI into QApplication which it requires to construct any
   QPainter drawable, i.e. used by the boilerplate to create a cairo-qt
   surface, and this leaks fonts (cairo-ft-fonts no less) causing assertion
   failures that all cairo objects are accounted for upon destruction.

[Updated by Chris Wilson]
Acked-by: Jeff Muizelaar <jeff@infidigm.net>
Acked-by: Carl Worth <cworth@cworth.org>
2009-06-16 11:03:46 +01:00
Chris Wilson
bab8af62e7 [region] Add PLT entry for cairo_region_create_rectangles() 2009-06-15 15:04:13 +01:00
Chris Wilson
6da9c410d4 Missing header file for cairo-test-null-surface. 2009-06-15 12:14:51 +01:00
Chris Wilson
e5727e20f5 Expose _cairo_null_surface_create() via a test surface
Using a null surface is a convenient method to measure the overhead of the
performance testing framework, so export it although as a test-surface so
that it will only be available in development builds and not pollute
distributed libraries.
2009-06-15 12:03:37 +01:00
Søren Sandmann Pedersen
5d57aeaa23 Reinstate cairo_region_create_rectangles()
cairo_region_union_rectangle() is linear in the number of rectangles
in the region. There is no way to make it significantly faster without
losing the ability to return errors synchronously, so a
cairo_region_create_rectangles() is needed to avoid a large
performance regression.
2009-06-15 05:48:51 -04:00
Chris Wilson
0eca1b17b1 [surface] Give ownership of the snapshot to the snapshotter.
Previously the reference to the newly created snapshot was owned by the
containing pattern. The consequence of this was that when the pattern was
destroyed the snapshot was cleaned up which prevent reuse of the snapshot
across multiple pages. Transferring ownership upon attachment of the
snapshot to the target means that the snapshot stays in existence until
the target itself is destroyed or modified *and* the containing pattern
is consumed. Obvious in hindsight.
2009-06-13 17:16:20 +01:00
Chris Wilson
a1b3392e60 [surface] Mark cairo_surface_show_page() with begin-modification
cairo_surface_show_page() clears the surface after presentation, so we
need to discard the snapshots here.
2009-06-13 16:45:27 +01:00
Adrian Johnson
1798bdd322 Fix PDF pattern embedding
The PDF snapshot cow patch was reusing a previously emitted surface
pattern if the surface unique id matched the current surface. This
resulted in incorrect output as the new pattern may have a different
pattern matrix.

This patch fixes the PDF backend to always emit a new pattern but
re-use previously emitted image or metasurface XObjects.
2009-06-14 00:43:41 +09:30
Jeff Muizelaar
13b56c42bf Fix compilation on OS X when compiling for 64 bit
OS X doesn't support ATSUI in 64 bit so don't include the cairo ATSUI
API in that case.
2009-06-11 17:32:23 -04:00
Chris Wilson
614bfdc084 [xcb] Trivial compile fix.
Update show_glyphs() interface.
2009-06-11 15:35:05 +01:00
Chris Wilson
610da573e9 [win32-font] Non-fatal error from GetGlyphOutlineW(GGO_METRICS)
If GetGlyphOutlineW(GGO_METRICS) fails to retreive the metrics for the
specified glyph it returns GDI_ERROR. Like ft, do not interpret this as a
fatal error but just mark the glyph as empty.

Fixes http://bugs.freedesktop.org/show_bug.cgi?id=20255
Bug 20255 -- cairo_scaled_font_glyph_extents breaks with invalid glyph id
2009-06-10 13:02:43 +01:00
Chris Wilson
25c3750939 [scaled-font] Report the original-font-face
When queried with cairo_scaled_font_get_font_face() return the original
font-face which matches the one supplied by the user, rather than the
implementation derived face.

Fixes test/font-face-get-type.
2009-06-07 19:49:05 +01:00
Chris Wilson
6d693f6bd7 [ft] Support font_face->get_implementation
The lazy resolution of patterns was defeating the scaled_font cache as
ft-fonts that resolved to the same unscaled font were being given different
font-faces upon creation. We can keep the lazy resolution by simply asking
the ft backend to create a fully resolved ft-font-face when we need to
create a scaled-font. This font is then keyed by the resolved font-face
and so will match all future lazily resolved identical patterns.
2009-06-07 19:49:00 +01:00
Chris Wilson
a29426f4bf [ft] Assert that we create an unscaled font for the resolved pattern 2009-06-07 19:48:59 +01:00
Chris Wilson
7d8a0a1cdd [cairo] Keep a small stash of cairo contexts
A cairo context is meant to be extremely cheap to create such that it can
be used in transient expose events. Thus these are allocated reasonably
frequently and show up malloc profiles.
2009-06-07 19:48:59 +01:00
Chris Wilson
24e51dd2ee [atomic] Hide compiler warnings
Add uint variants of _cairo_atomic_int_*() to hide the compiler warnings
about sign conversions.
2009-06-05 18:35:52 +01:00
Chris Wilson
4ae5e2d445 [atomic] Provide mutex-based ptr cmpxchg
To handle those CPUs where we do not have an atomic cmpxchg.
2009-06-05 18:29:40 +01:00
Thomas Jaeger
a1d0a06b62 xlib, xcb: Hand off EXTEND_PAD/EXTEND_REFLECT to Render
Most drivers and the X server used to have incorrect RepeatPad/RepeatReflect
implementations, forcing cairo to fall back to client-side software rendering,
which is painfully slow due to pixmaps being transfered over the wire.  These
issues are mostly fixed in the drivers (with the exception of radeonhd, whose
developers didn't respond) and the RepeatPad software fallback is implemented
correctly as of pixman-0.15.0, so this patch will hand off composite operations
with EXTEND_PAD/EXTEND_REFLECT source patterns to XRender.

There is no way to detect whether the X server or the drivers use a
broken Render implementation, we make a guess based on the server
version:  It's probably safe to assume that 1.7 X servers will use
fixed drivers and a recent enough version of pixman.
2009-06-05 17:26:09 +01:00
Chris Wilson
9d7a7e76b8 [scaled-font] Close race from 16d128
Whilst waiting for the fontmap lock on destruction another thread may not
only have resurrected the font but also destroyed it acquired the lock
first and inserted into the holdovers before the first thread resumes. So
check that the font is not already in the holdovers array before
inserting.
2009-06-05 07:32:44 +01:00
Chris Wilson
f4d9a4482f [pattern] Generalise the freed pattern pool
Also cache recently freed surface and gradient patterns. With thanks to
Jonathan Morton for the inspiration and initial pointer pool code for
pixman.
2009-06-05 07:32:07 +01:00
Chris Wilson
132f44dce1 valgrindify init/fini routines
Annotate object init/fini routines to detect use-after-free for
on-stack/embedded objects.
2009-06-04 14:17:43 +01:00
Chris Wilson
e89828c533 [freelist] valgrindify freed blocks
Mark freed blocks as unaccessible upon free() and then as undefined
on alloc().
2009-06-04 12:50:39 +01:00
Chris Wilson
1b92ea250f [ft] Don't call FT_Done_Face() on a face we do not own
_font_map_release_face_lock_held() was being called unconditionally during
_cairo_ft_font_reset_static_data(). This presents two problems. The first
is that we call FT_Done_Face() on an object not owned by cairo, and the
second is that the bookkeeping is then incorrect which will trigger an
assert later.
2009-06-03 20:34:01 +01:00
Chris Wilson
8e5295979f [pattern] Typo in document
Remove extraneous markup from program-listing.

https://bugs.freedesktop.org/show_bug.cgi?id=20441
2009-06-03 20:17:59 +01:00
Chris Wilson
c988dc3719 [cairo] Doc typo.
Fix conflicting sentence as pointed out by
https://bugs.freedesktop.org/show_bug.cgi?id=20183
2009-06-03 10:51:23 +01:00
Chris Wilson
35d0dd00c9 [image] Doc typo.
Correct parameter reference as pointed out by
https://bugs.freedesktop.org/show_bug.cgi?id=20182
2009-06-03 10:49:16 +01:00
Chris Wilson
58459ac643 [font-options] Doc typo
Remove duplicate 'with' as pointed out by
https://bugs.freedesktop.org/show_bug.cgi?id=20180
2009-06-03 10:45:51 +01:00
Chris Wilson
8d39dee8e2 [cairo] Update documentation for bug 20154
Several typographical errors were pointed out in
https://bugs.freedesktop.org/show_bug.cgi?id=20154
2009-06-03 10:40:38 +01:00
Chris Wilson
73469e693c [cairo] Tweak error strings.
Rewrite a few error strings so that they more closer match the
documentation. Where they differ, I believe I have chosen the more
informative combination of the two texts.
2009-06-03 09:51:52 +01:00
Chris Wilson
c9cd2f9ca1 [cairo] PLT symbols for cairo_set_source_rgb
Added a private use in user-font, but forgot to add a hidden symbol.
2009-06-02 18:47:07 +01:00
Chris Wilson
21550a7530 [user-font] Set the initial colour to white
An issue occured when using subpixel antialiasing with user-fonts and
XRender - the glyphs were transparent, as demonstrated by the font-view
example.

The problem lies in that enabling subpixel antialiasing triggers use of an
ARGB32 image surface for rendering the glyph, but the default colour is
black (so the only information is in the alpha-channel). Given an ARGB32
glyph XRender treats it as a per-channel mask, but since the R,G,B
channels were uniformly zero, the glyph is rendered as transparent.

Fix this by setting the initial colour to white before rendering the image
surface for a user-font glyph, which generates the appropiate gray-level
mask by default.
2009-06-02 18:16:52 +01:00
Chris Wilson
b5799e073e [xlib] Use bswap_32
Byteswap the ARGB32 glyphs using bswap_32 instead of open-coding.
2009-06-02 18:16:52 +01:00