summaryrefslogtreecommitdiff
path: root/src/cairoint.h
AgeCommit message (Collapse)AuthorFilesLines
2013-01-03Add missing local slim proto for cairo_recording_surface_createChris Wilson1-0/+1
Dependency introduced in 749ef6be4d11b95d666b0e5fe06df926b828d655 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2013-01-03stroke: Make the incremental trapezoid stroker optionally available againChris Wilson1-1/+20
Whilst it cannot handle self-intersecting strokes (which includes the antialias region of neighbouring lines and joints), it is about 3x faster to use than the more robust algorithm. As some backends delegate the rendering, the quality may still be preserved and so they should be responsible for choosing the appropriate method for generation of the stroke geometry. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-12-21[Minor] Improve loggingBehdad Esfahbod1-1/+1
2012-08-26pen: Use bisection to speed up vertex findingChris Wilson1-0/+12
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-08-26compositor: Skip invisible strokesChris Wilson1-0/+5
If the pen is reduced to a single point, it is effectively invisible when rasterised, so skip the stroke composition. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-08-17xlib: Implement SHM fallbacks and fast upload pathsChris Wilson1-1/+1
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-06-09Use the new pixman_glyph_cache_t API that will be in pixman 0.28.0Søren Sandmann Pedersen1-0/+4
This new pixman API allows glyphs to be cached and composited in one go, which reduces overhead compared to individual calls to pixman_image_composite_region32(). Notes: - There is an explicit call to _cairo_image_scaled_glyph_fini(). This could instead be done with a private, but I chose not to do that since we don't need to store any actual data; we only need notification when the glyph dies. - The slowdown in poppler-reseau is real and stable across runs. I'm not too concerned about it because this benchmark is only one run and so it is dominated by glyph cache setup costs and FreeType rasterizing. Performance results, image backend: Speedups firefox-talos-gfx 5571.55 -> 4265.57: 1.31x speedup gnome-terminal-vim 1875.82 -> 1715.14: 1.09x speedup evolution 1128.24 -> 1047.68: 1.08x speedup xfce4-terminal-a1 1364.38 -> 1277.48: 1.07x speedup Slowdowns poppler-reseau 374.42 -> 394.29: 1.05x slowdown Performance results, image16 backend: Speedups firefox-talos-gfx 5387.25 -> 4065.39: 1.33x speedup gnome-terminal-vim 2116.66 -> 1962.79: 1.08x speedup evolution 987.50 -> 924.27: 1.07x speedup xfce4-terminal-a1 1856.85 -> 1748.25: 1.06x speedup gvim 1484.07 -> 1398.75: 1.06x speedup Slowdowns poppler-reseau 371.37 -> 393.99: 1.06x slowdown Also bump pixman requirement to 0.27.1.
2012-06-04composite-rectangles,scaled-font: Use accurate extents if the font is brokenChris Wilson1-1/+1
If the font metrics appear broken, i.e. key values are being reported as zero, skip approximating the bbox of the glyph string. References: https://bugs.freedesktop.org/show_bug.cgi?id=50688 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-06-01Erradicate internal use of cairo_surface_get_type()Chris Wilson1-1/+0
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-06-01Erradicate internal use of cairo_surface_get_content()Chris Wilson1-1/+0
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-05-31image: silence make checkChris Wilson1-3/+0
The check for standalone headers requires that the cairo-image-surface-inline.h include the cairo-surface-private.h Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-05-26surface: Use the internal map/unmapAndrea Canciani1-2/+0
In many places Cairo maps/unmaps surfaces to perform operations on the raw image, but it doesn't care about the format being invalid. All of these are appropriate users of _cairo_surface_map_to_image().
2012-05-26surface: Define private map/unmap functionsAndrea Canciani1-0/+8
Cairo backends often need to map/unmap to a raster surface but they don't care about the pixel format, as Pixman will be doing the format handling. Cairo users cannot know how to access the raw data if the format is invalid. The two different scenarios call for different guarantees on the returned surface. The private map/unmap functions also makes it possible to simply return the status upon unmapping.
2012-05-14spans: Debug input paths and polygonsChris Wilson1-0/+2
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-04-30Revert "Use pixman glyphs"Søren Sandmann Pedersen1-4/+0
This was pushed accidentally - apologies. This reverts commit 752c3b69e008b7d219da8cc5c657cf995732d3b8.
2012-04-30Use pixman glyphsSøren Sandmann Pedersen1-0/+4
2012-03-29cairoint: Mark PDF surface as requiring the deflate stream outputChris Wilson1-2/+7
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-03-19stroke: Adapt rectilinear stroker to handle separable non-unity scalingChris Wilson1-4/+19
Reported-by: Christos Sotiriou <csotiriou@gmail.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-02-28surface-wrapper: Apply the scaled-font ctm and non-default font-optionsChris Wilson1-0/+5
Improves record*-text-transform. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-02-15win32: Rebase on the new compositor infrastructureChris Wilson1-0/+6
Try and undo all the damage that has acrued over the years by plugging into the compositor pipeline. References: https://bugs.freedesktop.org/show_bug.cgi?id=42739 References: https://bugs.freedesktop.org/show_bug.cgi?id=42821 References: https://bugs.freedesktop.org/show_bug.cgi?id=33081 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-01-19api: add cairo_surface_supports_mime_typeAdrian Johnson1-0/+1
to allow querying if a surface supports a particular mime type.
2012-01-15rectangle: Implement _cairo_rectangle_contains_rectangle()Andrea Canciani1-0/+10
And reuse it.
2011-12-05xcb: Fixup some internal state in set_{drawable,size}Uli Schlachter1-0/+3
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-10-15Merge branch 'master' of git://cairographics.org/git/cairoChris Wilson1-0/+9
2011-10-12spans: Refresh polygon limits after trimming the composite extentsChris Wilson1-0/+9
Trimming the composite extents may result in the clip being reconstructed, but we the polygon continued to hold a reference into the freed clip's array of boxes. So if we intend to reuse the polygon limits after performing the clip we need to refresh them. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-10-11backends: Adds a new Cogl based backendRobert Bragg1-0/+5
This adds a new GPU accelerated backend for Cairo based on the Cogl 3D graphics API. This backend aims to support Cairo in a way that translates as naturally as possible to using a GPU, it does not strive to compete with the anti-aliasing quality of the image backend if it can't be done efficiently using the GPU - raw performance isn't the only metric of concern, so is power usage. As an overview of how the backend works: - fills are handled by tessellating paths into triangles - the backend has an extra fill_rectangle drawing operation so we have a fast-path for drawing rectangles which are so common. - strokes are also tessellated into triangles. - stroke and fill tessellations are cached to avoid the cpu overhead of tessellation and cost of upload given that its common for apps to re-draw the same path multiple times. The tessellations can survive translations and rotations increasing the probability that they can be re-used. - sources and masks are handled using multi-texturing. - clipping is handled with a scissor and the stencil buffer which we're careful to only update when they really change. - linear gradients are rendered to a 1d texture using a triangle strip + interpolating color attributes. All cairo extend modes are handled by corresponding texture sampler wrap modes without needing programmable fragment processing. - antialiasing should be handled using Cogl's multisampling API XXX: This is a work in progress!! TODO: - handle at least basic radial gradients (No need to handle full pdf semantics, since css, svg and canvas only allow radial gradients defined as one circle + a point that must lie within the first circle.) - currently we fall back to pixman for radial gradients. - support glyph rendering with a decent glyph cache design. The current plan is a per scaled-font growable cache texture + a scratch cache for one-shot/short-lived glyphs. - decide how to handle npot textures when lacking hardware support. Current plan is to add a transparent border to npot textures and use CLAMP_TO_EDGE for the default EXTEND_NONE semantics. For anything else we can allocate a shadow npot texture and scale the original to fit that so we can map extend modes to texture sampler modes.
2011-10-11debug-trapsChris Wilson1-0/+3
2011-09-12Introduce a new compositor architectureChris Wilson1-600/+31
Having spent the last dev cycle looking at how we could specialize the compositors for various backends, we once again look for the commonalities in order to reduce the duplication. In part this is motivated by the idea that spans is a good interface for both the existent GL backend and pixman, and so they deserve a dedicated compositor. xcb/xlib target an identical rendering system and so they should be using the same compositor, and it should be possible to run that same compositor locally against pixman to generate reference tests. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> P.S. This brings massive upheaval (read breakage) I've tried delaying in order to fix as many things as possible but now this one patch does far, far, far too much. Apologies in advance for breaking your favourite backend, but trust me in that the end result will be much better. :)
2011-09-05pdf: use ink extents for smask bboxAdrian Johnson1-0/+4
There are some inkscape bugs reporting very slow rendering of inkscape generated PDFs (inkscape uses cairo for PDF output). These bugs are caused by cairo specifying a page sized bounding box in XObjects and Patterns. PDF renderers usually use the BBox as the image size when compositing. As PDFs generated from SVG tends to use a lot of XObjects and Patterns this can lead to very long rendering times. These three patches tighten up all the BBoxes in PDF output.
2011-09-02surface: Fix make checkAndrea Canciani1-0/+2
cairo_surface_map_to_image() and cairo_surface_unmap_image() are called by cairo-surface-observer but they are not slim_hidden: Checking .libs/libcairo.so for local PLT entries 00000000002e27a8 0000019d00000007 R_X86_64_JUMP_SLOT 000000000005df30 cairo_surface_unmap_image + 0 00000000002e2b90 0000026100000007 R_X86_64_JUMP_SLOT 000000000005f5c0 cairo_surface_map_to_image + 0
2011-08-15stroke: Convert the outlines into contour and then into a polygonChris Wilson1-0/+6
In step 1 of speeding up stroking, we introduce contours as a means for tracking the connected edges around the stroke. By keeping track of these chains, we can analyse the edges as we proceed and eliminate redundant vertices speeding up rasterisation. Coincidentally fixes line-width-tolerance (looks like a combination of using spline tangent vectors and tolerance). Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-15stroke: move normal stroker to new fileChris Wilson1-0/+8
Step 1 of enhancing the speed of the stroker is to segregate from the rest of the complex code. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-14record: Offset the clip by the replay transformation as wellChris Wilson1-3/+0
Fixes push-group-offset which reduces to a replay of a recording surface inside a recording surface and forgot to offset the clip imposed by the extents of the first recording surface into device space. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-13stroke: Rely on the tessellator to remove self-intersectionsChris Wilson1-13/+0
As handling joins/caps between line segments shorter than half_line_width is tricky. Rather than also fixing the bug in traps, remove that code. The plan is to avoiding hitting the traps code, short-circuiting several steps along the fast rectangular paths. Fixes line-width-overlap. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-13surface: propagate internal statusesChris Wilson1-2/+2
They are internal and used as such, but we still need to prevent them from escaping into the public domain. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-13skia: Update to use cairo_backend_t interfaceChris Wilson1-0/+1
Still hopelessly broken. Requires compiling cairo to use static linking and then still requires manual linkage to workaround libtool. Lots of functionality is still absent - we need to either find analogues to some Cairo operations or implement fallbacks - but it is sufficient to investigate how Skia functions in direct comparison with Cairo for tessellation/rasterisation. Caveat emptor. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-13image: move surface definition to new header for subclassingChris Wilson1-25/+3
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-08-02pdf: check if images are grayscale or monochrome and encode as suchAdrian Johnson1-0/+4
Printing PDFs with large monochrome or grayscale images would result in the images being blown up to 24-bit color images. Some printers are very slow to print huge color images.
2011-07-31Fix make checkAndrea Canciani1-2/+2
This fixes multiple failures when checking if headers can be used standalone.
2011-07-27win32: ConstifyAndrea Canciani1-1/+1
Silences some compiler warnings.
2011-07-26API: map-to-image and create-similar-imageChris Wilson1-2/+22
A common requirement is the fast upload of pixel data. In order to allocate the most appropriate image buffer, we need knowledge of the destination. The most obvious example is that we could use a shared-memory region for the image to avoid the transfer cost of uploading the pixels to the X server. Similarly, gl, win32, quartz... The other side of the equation is that for manual modification of a remote surface, it would be more efficient if we can create a similar image to reduce the transfer costs. This strategy is already followed for the destination fallbacks and this merely exposes the same capability for the application fallbacks. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-26rectangle: speed up the is-intersecting test.Chris Wilson1-12/+4
cut'n'paste before coffee. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-26record: Check the operation against the target device extents.Chris Wilson1-0/+18
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-26record: Store the untransformed operation extents along with the commandChris Wilson1-0/+2
This allows us to actually clip out the geometry before we record it, as suggested by allowing the user to supply an extents... But it will be advantageous in later patches for reducing the amount of work we need to perform to replay. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-24image: Fix clip-intersectChris Wilson1-0/+8
Explicitly convert the clearing of the unbounded area. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-19clip: Rudimentary support for clip-polygon extractionChris Wilson1-20/+59
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-18type1-subset: Remove FT dependency part 5Adrian Johnson1-0/+20
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-18type1-subset: Remove FT dependency part 1Adrian Johnson1-0/+19
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-15pattern: Add observer hooksChris Wilson1-168/+3
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-15Implement cairo_backend_tChris Wilson1-2/+7
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>