summaryrefslogtreecommitdiff
path: root/src/cairo-default-context.c
AgeCommit message (Collapse)AuthorFilesLines
2019-01-31Misc. typosluz.paz1-1/+1
Found via `codespell -i 3 -w -I ../cairo-word-whitelist.txt -L tim,ned,uint` Follow up of 12cb59be7da Reviewed-by: Bryce Harrington <bryce@bryceharrington.org>
2018-05-07Use _cairo_malloc instead of mallocAdrian Johnson1-1/+1
_cairo_malloc(0) always returns NULL, but has not been used consistently. This patch replaces many calls to malloc() with _cairo_malloc(). Fixes: fdo# 101547 CVE: CVE-2017-9814 Heap buffer overflow at cairo-truetype-subset.c:1299 Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
2016-10-01Add tag functions to cairo_t and cairo_surface_tAdrian Johnson1-0/+21
The cairo_tag_begin/cairo_tag_end API is for supporting hyperlinks and creating tagged PDF files. The source, ctm, and stroke style are passed to the backend to allow these parameters to be used to specify hyperlink border attributes.
2013-09-05surface: Merge scratch construction into _cairo_surface_create_scratchAlexander Larsson1-5/+5
We merge _cairo_surface_create_similar_scratch and _cairo_surface_create_similar_solid into a single function named _cairo_surface_create_scratch, to avoid confusion with cairo_surface_create_similar which now will have a different behaviour wrt the sizes and the device-scale. _create_scratch assumes the width and height are in backend coordinates, while create_similar does not.
2013-09-05surface: expose the device scaleAlexander Larsson1-3/+3
This adds the new public functions cairo_surface_set_device_scale and cairo_surface_get_device_scale and updates old users of the internal functions.
2013-09-05gstate: Handle device scale on surface as sourceAlexander Larsson1-15/+8
When creating a transformed pattern we must apply the device transform *before* the transform set on the pattern itself, otherwise e.g. its translation will not be affected by the device scale. We also fix up the device_transform related handling in _cairo_default_context_pop_group(). With a device scale we can no longer just use the device_transform_inverse to unset the device offset for the extents, so we make that a simple translate instead. We also remove some weird code that tries to handle the device transform but seems unnecessary (maybe a workaround for applying the device transform in the wrong order?). With that code removed things work fine, but with it things get translated wrongly when there is a scale.
2013-09-05default-context: Inherit device scale in push_group surfaceAlexander Larsson1-0/+4
Without this we will only render to part of the newly created surface and then copy+scale that part back, which causes fuzziness.
2013-08-13push_group: Refuse working with unusable surfaceUli Schlachter1-0/+5
Make cairo_push_group() fail when the context's target surface is finished. This fixes the api-special-cases for the xcb backend: Detected error during xcb run: error=9, seqno=0x13c, major=53, minor=0 The problem was that the Pixmap for the cairo surface was already freed and cairo still tried to use it again as the drawable in a CreatePixmap request. Signed-off-by: Uli Schlachter <psychon@znc.in> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-12-17context: Use recording surfaces for unbounded groupsUli Schlachter1-9/+14
The old code uses an uninitialized variable for the extents of the group that is created. This patch makes it use an unbounded recording surface instead. This has the implicit assumption that everything that is unbounded smells like a recording surface. Let's see when this assumption breaks. :-) http://lists.cairographics.org/archives/cairo/2012-October/023585.html Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-09-10context: Add missing functions to transform between user and backend coordinatesChris Wilson1-0/+44
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-09-04default-context: Convert the relative path segments into the backend coordinatesChris Wilson1-5/+5
When transforming the incoming paths, the goal is to transform them from user space onto the target coordinate system. Currently for relative paths we used user_to_device_distance as we presumed that there was no backend scale factor. However, Alex Larsson noticed that these then broke when playing around with such a device transform... Reported-by: Alexander Larsson <alexl@redhat.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2012-04-19Split cairo-clip-privates into struct+inlinesChris Wilson1-0/+1
References: https://bugs.freedesktop.org/show_bug.cgi?id=48577 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-10-11backends: Adds a new Cogl based backendRobert Bragg1-12/+24
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-09-12Introduce a new compositor architectureChris Wilson1-2/+1
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-08-12default-context: Tidy push-groupChris Wilson1-7/+8
Fix a couple of instances of the older style clipping code. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-30default-context: Do not allow restoring pushed gstatesAndrea Canciani1-0/+3
The brackets defined by push/pop and save/restore are independent ad should match properly. This means that cairo_push()-ed gstates cannot be cairo_restore()-d and cairo_save()-d gstates cannot be cairo_pop()-ed. Fixes group-state.
2011-07-19clip: Rudimentary support for clip-polygon extractionChris Wilson1-2/+3
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-15pattern: Add observer hooksChris Wilson1-0/+1
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-0/+1406
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>