summaryrefslogtreecommitdiff
path: root/src/cairo-surface-snapshot.c
Commit message (Collapse)AuthorAgeFilesLines
* Slightly improve dealing with error snapshotsUli Schlachter2021-01-071-1/+3
| | | | | | | | | | | | | | | An error in _cairo_surface_snapshot_copy_on_write() results in a snapshot in an error state and the snapshot's ->target could now point to a surface from _cairo_surface_create_in_error(). These surfaces e.g. have ->backend == NULL. Thus, anything looking at ->backend->type now explodes. This commit deals with two places which caused segfaults in this situation. There is no test case for this, because _cairo_surface_snapshot_copy_on_write() really is not supposed to fail. Found-while-investigating: https://gitlab.freedesktop.org/cairo/cairo/-/issues/448 Signed-off-by: Uli Schlachter <psychon@znc.in>
* snapshot: Don't use extra after it's been freed (CID #220086)Bryce Harrington2018-06-131-1/+4
| | | | | | | | | Note this changes the semantics of the value of extra_out such that it is set to NULL instead of left undefined in case an error is returned. Coverity ID: 220086 Signed-off-by: Bryce Harrington <bryce@bryceharrington.org> Reviewed-By: Uli Schlachter <psychon@znc.in>
* Use _cairo_malloc instead of mallocAdrian Johnson2018-05-071-2/+2
| | | | | | | | | | _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>
* Don't cull very thin lines on vector surfacesAdrian Johnson2015-10-171-1/+2
| | | | | | On vector surfaces, use a minimum line width when calculating extents. Bug 77298
* xlib: Implement SHM fallbacks and fast upload pathsChris Wilson2012-08-171-3/+2
| | | | Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* snapshot: Hold a reference to target whilst queryingChris Wilson2012-05-011-8/+43
| | | | | | | | Due to race with cow and accessing target from multiple threads, we need to be careful that we always acquire a reference for our access to the snapshot target. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* snapshot: Perform the cow under a mutexChris Wilson2012-04-271-1/+6
| | | | | | | | | | | | In order to prevent a race between concurrent destroy and use in another thread, we need to acquire a reference to the snapshot->target under a mutex. Whilst we hold that reference, it prevents the internal destroy mechanism from freeing the memory we are using (if we have a pointer to the original surface) and the client drops their final reference. Oh boy, talk about opening a can of worms... Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* Split cairo-recording-surface-private into struct+inlinesChris Wilson2012-04-191-1/+1
| | | | | References: https://bugs.freedesktop.org/show_bug.cgi?id=48577 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* doc: Make doc ids more consistent my always putting ':' after themAndrea Canciani2012-03-291-1/+1
| | | | | This makes the documentations comments more consistent and fixes many reports of 'invalid doc id'.
* debug: Add some TRACE statements for recording surfaces and snapshotsChris Wilson2012-02-241-0/+7
| | | | Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* Replace the ad-hoc surface unwrappers with a function pointerChris Wilson2012-02-091-0/+9
| | | | Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* Introduce a new compositor architectureChris Wilson2011-09-121-10/+7
| | | | | | | | | | | | | | | | | | 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. :)
* xlib: Mark surfaces as finished when the Display is finished/destroyed/closed.Chris Wilson2011-08-141-1/+4
| | | | | | Fixes xlib-surface-source with the recording-surface Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* snapshot: Assert that we do not generate a snapshot cloneChris Wilson2011-08-141-1/+2
| | | | Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* subsurface+recording: handle recursionChris Wilson2011-08-141-0/+12
| | | | | | | | Ouch, a nasty bug surfaces after rearranging code to fix the others. Another self-copy loop this time through a subsurface of a recording surface. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* snapshot: Defer acquisitionChris Wilson2011-08-141-56/+17
| | | | | | Fixes 'xlib-expose-event' but triggers an infinite loop in self-copy. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* image: move surface definition to new header for subclassingChris Wilson2011-08-131-0/+1
| | | | Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* API: map-to-image and create-similar-imageChris Wilson2011-07-261-1/+4
| | | | | | | | | | | | | | | | 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>
* Implement cairo_backend_tChris Wilson2011-07-151-0/+1
| | | | | | | | | | 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>
* snapshot: Attach the backend generated snapshot to the targetChris Wilson2010-04-301-1/+20
| | | | | | Cache the result of snapshotting using the backend vfunc in the normal manner by attaching the snapshot to the target. This should reduce resource usage in these cases.
* surface: Convert snapshots from an array to a double-linked list.Chris Wilson2010-04-301-7/+3
| | | | | Saves the memory allocation for the array, and the overhead of maintaining the area for both insertions and more importantly deletes.
* snapshot: The snapshot masquerades as the target surface type.Chris Wilson2010-04-281-0/+2
| | | | | Not wholly convinced this is a good idea, but it matches the behaviour of the other internal surface types.
* snapshot: Simply memcpy if the cloned image matches the original.Chris Wilson2010-04-281-6/+10
|
* snapshot: propagate status on finishChris Wilson2010-04-271-3/+8
|
* Update FSF addressAndrea Canciani2010-04-271-1/+1
| | | | | | | | | | | I updated the Free Software Foundation address using the following script. for i in $(git grep Temple | cut -d: -f1 ) do sed -e 's/59 Temple Place[, -]* Suite 330, Boston, MA *02111-1307[, ]* USA/51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA/' -i "$i" done Fixes http://bugs.freedesktop.org/show_bug.cgi?id=21356
* Use pixman_image_composite32()Benjamin Otte2010-04-151-6/+6
| | | | Replace all occurences of pixman_image_composite()
* snapshot: Finish the clone.Chris Wilson2010-03-241-0/+1
| | | | | Kill ref cycles from snapshots patterns by explicitly calling finish on the cloned surface.
* recording: Cleanup the clip on error.Chris Wilson2010-03-221-0/+2
| | | | | Whilst recording the commands, remember to cleanup the local clip after detecting an error.
* Add cairo_device_tChris Wilson2010-01-221-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The device is a generic method for accessing the underlying interface with the native graphics subsystem, typically the X connection or perhaps the GL context. By exposing a cairo_device_t on a surface and its various methods we enable finer control over interoperability with external interactions of the device by applications. The use case in mind is, for example, a multi-threaded gstreamer which needs to serialise its own direct access to the device along with Cairo's across many threads. Secondly, the cairo_device_t is a unifying API for the mismash of backend specific methods for controlling creation of surfaces with explicit devices and a convenient hook for debugging and introspection. The principal components of the API are the memory management of: cairo_device_reference(), cairo_device_finish() and cairo_device_destroy(); along with a pair of routines for serialising interaction: cairo_device_acquire() and cairo_device_release() and a method to flush any outstanding accesses: cairo_device_flush(). The device for a particular surface may be retrieved using: cairo_surface_get_device(). The device returned is owned by the surface.
* Real zero-copy cow snapshottingChris Wilson2010-01-221-0/+225
The first iteration of COW snapshotting always made an initial copy when the snapshot was requested (and reused that copy until the surface was modified). However, in a few circumstances we can avoid even that copy so long as the surface is still alive and unmodified between the snapshotting and its use. In order to do so, we need a new proxy surface that can automatically perform the copy if the target should disappear prior to use.