Commit graph

9472 commits

Author SHA1 Message Date
Chris Wilson
abd8fcc833 test: Expand partial-clip-text
Test partial clipping along each edge.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-23 14:42:17 +01:00
Adrian Johnson
abf97c8874 Check glyph_index range in _index_to_glyph_name
A broken font such as the PDF file at
https://bugzilla.gnome.org/show_bug.cgi?id=638011 can mean there are
less glyph names in the array than there should be.
2011-07-22 21:53:33 +09:30
Andrea Canciani
aa646e47f3 Use new pixman formats
b132fae5e8 introduced the usage of two
new pixman formats. This requires pixman 0.22, but makes it possible
to fix some TODO's left behind in gl and vg.
2011-07-21 20:15:50 +02:00
Uli Schlachter
b60694cbc7 xcb: Work around wrong extent computation in the X server
This is basically the same fix as e6c3efdd65. However, this was lost in
b132fae5e8 and thus had to be fixed again.

Fixes: clip-fill-eo-unbounded clip-fill-nz-unbounded

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-07-21 19:39:25 +02:00
Uli Schlachter
e2150185fc xcb: Unset the deferred_clear flag on fallback
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-07-21 19:24:38 +02:00
Uli Schlachter
de686f1938 xcb: Handle deferred_clear in _get_image
Fixes: arc-infinite-loop clip-all clip-empty-group clip-fill-no-op
pattern-getters

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-07-21 19:24:38 +02:00
Uli Schlachter
adf026fffe xcb: Fix a NULL dereference
This fixes a crash in the hatchings test case.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-07-21 19:24:37 +02:00
Andrea Canciani
1aa077e129 xcb,xlib: Cleanup GC cache handling
Device mutexes guarantee the consistency between multiple threads,
hence GC cache does not rely anymore on atomic operations.

This makes it possible to avoid bit twiddling and to use a simple
array.
2011-07-21 19:16:42 +02:00
Chris Wilson
5eb8eacde0 xcb: Always send a clip region along with clipped glyphs
As we do not control the geometry used for the individual glyphs, we
must always send a clip-region so that X can trim the glyph
appropriately. However, in order to avoid sending unnecessary data we
only do so if the clip extents is less than the ink extents of the
glyphs.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-21 18:07:17 +01:00
Uli Schlachter
93ab2171d0 xcb: Parse $CAIRO_DEBUG just like cairo-xlib does
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-07-21 16:51:26 +02:00
Uli Schlachter
0858533419 Xlib,xcb: Make *_debug_[sg]et_precision() more robust
This adds checks for NULL pointers, devices in an error state and devices which
aren't owned by the right backend.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-07-21 16:51:26 +02:00
Uli Schlachter
7c2ccef3eb xcb: Make it possible to undo _cairo_xcb_device_debug_cap_*
We now remember the original flags before any call to
cairo_xcb_device_debug_cap_xshm_version() or
cairo_xcb_device_debug_cap_xrender_version() was done and re-set these flags on
any new call to these functions. This makes it possible to raise e.g. the used
RENDER version again.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-07-21 16:51:26 +02:00
Uli Schlachter
83df0ab2b6 XCB: Store the flags per-connection only
Every xcb surface had its own copy of the flags from the time that it was
created. This means that, if you want to make use of
cairo_xcb_device_debug_cap_xrender_version() and
cairo_xcb_device_debug_cap_xshm_version(), you first had to create a dummy xcb
surface, use that to get access to the cairo_device_t so that you can use these
functions and only then create your real surface, because the change only
affected new surfaces.

This commit changes everything to use the connection's flag and removes the
per-surface flags. This avoids the dummy surfaces completely.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-07-21 16:51:26 +02:00
Chris Wilson
99628d06cd gstate: Handle NULL clip for in_clip()
A NULL clip implies no clipping at all, and therefore every point is
inside.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-21 15:38:12 +01:00
Chris Wilson
69cc802e61 Fix proxying of ->context_create()
Adrian Johnson found that I had broken show_page() and pinpointed the
cause to being that cairo_show_page() was being called on the recording
surface and not the pagination surface after my overhaul for
cairo_backend_t. In fact, the problem was far more severe as the mistake
caused the created context to point to the wrong surface entirely,
bypassing the surface proxy.

What is desired is for the proxy's target surface to choose what manner
of context is should use, but for all calls into the surface backend to
go through the proxy surface.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-21 13:45:58 +01:00
Adrian Johnson
8938f58e70 type1-subset: Subset the subroutines 2011-07-21 21:50:29 +09:30
Adrian Johnson
f6043b06d6 Add support for subsetting bare CFF fonts
This avoids fallback when using poppler cairo for printing PDFs with
CFF fonts.

The current CFF subsetting only works with Opentype/CFF fonts. CFF
fonts inside PDF files are usually embedded as a bare CFF font without
the Opentype wrapper.

Making the CFF subset work with bare CFF fonts requires doing a bit of
extra work to extract the fontname, font bbox, and glyph widths from
the CFF data instead of using the Opentype tables.
2011-07-21 21:17:18 +09:30
Chris Wilson
6b3e5cd39c xcb: Reduce one pass for masking, now just 2 passes required!
Another 10% off fishbowl for both snb and pnv.

[Note this exposes the bugs in the polygon clipper; naive *and* broken.]

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-20 19:56:27 +01:00
Chris Wilson
a585a092ee xcb: squash initial ChangePicture request for precision
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-20 19:53:12 +01:00
Chris Wilson
d5d4a0f240 xcb: Take advantage of clip-boxes
A demonstration of step 2, improves performance for selected benchmarks
on selected GPUs by up to 30%.

firefox-fishbowl on snb {i5-2520m): 42s -> 29s.
firefox-talos-gfx on snb: 7.6 -> 5.2s.
firefox-fishbowl on pnv (n450): 380 -> 360s.

Whist this looks like it is getting close to as good as we can achieve,
we are constrained by both our API and Xrender and fishbowl is about 50%
slower than peak performance (on snb).

And it fixes the older performance regression in firefox-planet-gnome.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-20 13:19:38 +01:00
Chris Wilson
b419fdcacd clip-boxes: Intersection with 0 boxes means clip-all
Fixes clip-fill-no-op

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-20 10:58:37 +01:00
Chris Wilson
41190afacf win32: Fixup clip-mask fallback after API changes
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-20 10:58:37 +01:00
Adrian Johnson
3d1ee0e22d analysis: CAIRO_INT_STATUS_NOTHING_TO_DO should not cause fallback 2011-07-20 19:08:38 +09:30
Adrian Johnson
12b27778e2 ps: Don't return CAIRO_INT_STATUS_NOTHING_TO_DO for empty glyphs 2011-07-20 19:05:33 +09:30
Adrian Johnson
aaa1ed81c2 win32: Fix build breakage 2011-07-20 18:39:53 +09:30
Uli Schlachter
73ff0de345 xlib-xcb: Fix 'incompatible pointer type' warnings
This was introduced in b132fae5e8.

Fixes warnings of the following kind:

cairo-xlib-xcb-surface.c:261:5: warning: initialization from incompatible
pointer type
cairo-xlib-xcb-surface.c:261:5: warning: (near initialization for
'_cairo_xlib_xcb_surface_backend.paint')

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-07-20 10:55:32 +02:00
Uli Schlachter
ac9482bdf0 xcb: Fix a GC leak when a screen is finished
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-07-20 10:53:46 +02:00
Uli Schlachter
c28196d945 xcb: Fix _set_clip_region for many rectangles
Fixes a failed assert in the hatchings test.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-07-20 10:53:46 +02:00
Adrian Johnson
4fd20fe903 Remove HAS_FT_FONT from cairo-scaled-font-subsets-private.h
Should have been removed when the FT dependency was removed from type 1.
2011-07-20 08:37:03 +09:30
Chris Wilson
b132fae5e8 clip: Rudimentary support for clip-polygon extraction
Step 1, fix the failings sighted recently by tracking clip-boxes as an
explicit property of the clipping and of composition.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-19 21:14:34 +01:00
Chris Wilson
f58ade7bac ps: Add HAS_FT_FONT guards for type1
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-19 21:14:34 +01:00
Andrea Canciani
29d19c683b build: Fix compilation
83bfd85a13 and
2458120dee did not update some backends
properly, breaking their compilation.
2011-07-19 08:10:21 +02:00
Andrea Canciani
e5dfac245f build: Fix automake error
b8f43617a9 regressed the generation of
Makefiles. automake 1.10 fails when executed during ./autogen.sh:

automake: cairo_test_suite_OBJECTS should not be defined
test/Makefile.am:76:   while processing program `cairo-test-suite'
2011-07-19 07:26:59 +02:00
Chris Wilson
9ab9ecfdbd test,perf: Another hatching!
This one illustrates the quadratic explosion lurking in the clipping
code.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-19 00:32:45 +01:00
Adrian Johnson
bf5892e2a6 Add win32 font backend functions for Type 1 subsetting
Native Type 1 font subsetting now works on Windows.
2011-07-18 22:31:34 +09:30
Adrian Johnson
068df654da type1-subset: Remove FT dependency part 6
Remove all remaining FT dependencies from the Type1 subsetting.
2011-07-18 22:26:43 +09:30
Adrian Johnson
895dfc628a type1-subset: Remove FT dependency part 5
Add a font backend function, load_type1_data, for loading Type 1 font
data. Replace the FT code for loading the font with a call
load_type1_data.
2011-07-18 22:23:21 +09:30
Adrian Johnson
a94644f177 type1-subset: Remove FT dependency part 4
Remove the dependency on FT for getting the font name.

The font name is obtained directly from the font.
2011-07-18 22:20:07 +09:30
Adrian Johnson
549acc4beb type1-subset: Remove FT dependency part 3
Remove the dependency on FT for getting the bbox and EM size.

The FontBBox and FontMatrix in the font file are parsed to obtain this data.
2011-07-18 22:16:07 +09:30
Adrian Johnson
b83fcf7d52 type1-subset: Remove FT dependency part 2
Remove the dependency on getting the number of glyphs in the font from
FT. The number of glyphs is instead obtained by counting the
charstrings.

Some fixed size malloced data is replaced with cairo_array_t so they
can be populated before we know the number of glyphs.
2011-07-18 22:12:06 +09:30
Adrian Johnson
d46df1dffb type1-subset: Remove FT dependency part 1
Remove cairo_type1_font_subset_get_glyph_names_and_widths().

The glyph names are read from the font file instead of via FT. The
charstrings are parsed to extract the glyph widths.

A new font backend function, index_to_glyph_name, has been added for
obtaining the glyph name for a given glyph index. This function is
supplied with the array of glyph names and a glyph index and is
required to return the array index of the glyph name corresponding to
the glyph index.

The reason for passing in the array of glyph names is that:

1) On windows there is no API for accessing glyph names so we will
use knowledge of how the glyphs in a Type 1 font are numbered to
perform name lookup.

2) We can also use knowledge of how FT assigns the glyph numbers in a
Type 1 font to optimize the name lookup.
2011-07-18 21:55:37 +09:30
Adrian Johnson
9fc3f1086c cff-subset: Fix /guillemotright SID encoding 2011-07-18 21:47:16 +09:30
Adrian Johnson
722e976044 png: fix type1 encoding bugs
glyphs outside of the StandardEncoding were not being displayed by acroread
2011-07-18 21:44:18 +09:30
Chris Wilson
3a29365713 tests,perf: Add a hatchings clip-test
A benchmark to test how close we get to reducing paint+clip to an ordinary
fill, and to check correctness.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-18 10:31:25 +01:00
Chris Wilson
2786864306 gl: Compile fix, missing include cairo-pattern-private.h
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-18 10:31:25 +01:00
Uli Schlachter
43b57d59a1 cairo-xcb: Drop some unused definitions/file
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-07-18 10:29:15 +02:00
Uli Schlachter
2e264e73df xlib-xcb: Fix an "extension leak"
When the xlib-xcb backend created a new cairo_device_t for a Display*, it called
XAddExtension to get a callback on XCloseDisplay(). However, when the last
surface using this device is destroyed, this extension isn't unregistered
because there is no API for this.

I noticed that gvim was quite slow after a while with xlib-xcb. The reason is
that xlib has a linked list of registered extensions that it has to walk through
for various callbacks. Since xlib-xcb caused lots of "dead" extension, this got
quite slow when there were about 20k entries in this list.

The fix is to make sure that the cairo_device_t isn't finished/destroyed when
the last surface using it is destroyed. For this, we keep an internal reference
which is only dropped when the device is finished. This happens when someone
explicitly calls cairo_device_finish or when our XCloseDisplay hook runs.

The same thing is done by cairo-xlib. I didn't port this over to xlib-xcb
because at that time I didn't understand why it was needed.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-07-18 10:29:08 +02:00
Uli Schlachter
0dc63f5bb4 cairo-trace: Fix mark-dirty with xcb backend
cairo-xcb's acquire_source_image implementation will attach the image it returns
as a snapshot to the xcb surface. cairo_surface_mark_dirty_rectangle asserts
that the surface doesn't have any snapshots attached. cairo-trace will emit the
surface to the trace when it was marked dirty by drawing it to an image surface.

The combination of these three things caused a failed assertion when cairo-trace
was used on something which uses xcb/Xlib and which uses mark_dirty.
I found this with firefox and xlib-xcb.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-07-17 17:53:23 +02:00
Chris Wilson
27692ca759 test: Add random-clips to stress test clipping
Not sure what the right results are, so refs will come later. The output
looks superficially right, but the *code* is known to be buggy...

(And hopefully this has captured a few of those bugs.)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-16 20:45:43 +01:00
Chris Wilson
b8f43617a9 test: Always compile cairo-test-suite
I'm tired of having to explicitly type make cairo-test-suite.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-16 20:45:03 +01:00