Commit graph

9759 commits

Author SHA1 Message Date
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
Chris Wilson
54ae2e1619 xcb: Remove more bits of drm integration
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-15 11:05:19 +01:00
Chris Wilson
2458120dee pattern: Add observer hooks
In order for custom context to automatically track when a pattern is
modify after being set on the context (and before it is used in an
operator), we need for there to be a callback when the pattern is
modified.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-15 11:05:19 +01:00
Chris Wilson
83bfd85a13 Implement cairo_backend_t
Allow a backend to completely reimplement the Cairo API as it wants. The
goal is to pass operations to the native backends such as Quartz,
Direct2D, Qt, Skia, OpenVG with no overhead. And to permit complete
logging contexts, and whatever else the imagination holds. Perhaps to
experiment with double-paths?

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-15 11:05:19 +01:00
Chris Wilson
2055732ffc tests: Add paint-clip-fill
A false reduction bug found by Taekyun Kim.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-15 11:05:19 +01:00
Chris Wilson
524809759b tests: Add clip-complex-shape
Contributed by Taekyun Kim to exercise a major bug he found in the
treatment of complex clips.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-15 11:05:19 +01:00
Chris Wilson
41b5469b95 image: Only discard the outer boxes
This is necessary as the callers do not propagate the clip extents after
finding the singular clip path. *sigh*

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-14 17:34:51 +01:00
Chris Wilson
ebe665867c scaled-font: Fix assertions for original font-face vs font-face
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-14 17:00:48 +01:00
Chris Wilson
507b8abcf6 Excise xcb-drm
The experiment was at best a pyrrhic victory. Whilst it did show that
you could successfully subvert cairo_xcb_surface_t and provide the
rendering locally faster (than the xlib driver at that time), any
performance benefits were lost in the synchronisation overheads and
server-side buffer allocation.

Once cairo-gl is mature, we need to look at how we can overcome these to
improve client-side rendering

In the meantime, cairo-xcb is no longer my playground for
experimentation and is shaping up to become a stable backend...

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-14 12:46:26 +01:00
Chris Wilson
5d9da3decf Excise DRM-Xr
I've since incorporated (nearly) all the features from cairo-drm into
xf86-video-intel, making this experiment defunct.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-14 12:35:19 +01:00
Chris Wilson
cd4b2d843b scaled-font: Key the cache on the orignal font_face
We check the incoming scaled font using the original font fce, so we
need to also store it in the cache using the same face, and not the
resolved font_face (which will remain the same unless the fontconfig
configuration is updated).

Hides the quadratic behaviour of font retrieval in recent cairo-traces.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-13 12:35:51 +01:00
Chris Wilson
84c66589bc ft-font: If the pattern is already resolved, use it immediately
This skips an relatively expensive search for the a good match if the
pattern already contains a face or a filename.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-13 12:35:51 +01:00
Chris Wilson
727a0092d1 test: Test a1 clipping semantics
If I've written the tests correctly, these should produce identical
images as the a1 rasterisation tests.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-13 12:35:51 +01:00
Chris Wilson
af71e7717e png: Fix support of depth-30 images
Rename the variable depth to bpc to prevent future confusion.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-13 12:35:50 +01:00