summaryrefslogtreecommitdiff
path: root/src/cairo-xlib-xcb-surface.c
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* Fix cairo-xlib-xcb compilationUli Schlachter2015-11-061-1/+2
| | | | | | | | | | | | | | | | This is broken since: commit b1192beac7c5b56a8ff356d20af5ebfb65404109 Author: Adrian Johnson <ajohnson@redneon.com> Date: Mon Sep 21 21:35:05 2015 +0930 Don't cull very thin lines on vector surfaces On vector surfaces, use a minimum line width when calculating extents. Bug 77298 Signed-off-by: Uli Schlachter <psychon@znc.in>
* xlib-xcb: Don't be lazy and use the real xcb_screen_tUli Schlachter2015-01-171-15/+18
| | | | Signed-off-by: Uli Schlachter <psychon@znc.in>
* xlib: Implement SHM fallbacks and fast upload pathsChris Wilson2012-08-171-3/+2
| | | | Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* surface: Make backend-specific map/unmap functions symmetricAndrea Canciani2012-05-261-8/+2
| | | | Map allocates a surface. Symmetrically, unmap should destroy it.
* surface: Make map_to_image return cairo_image_surface_t*Andrea Canciani2012-05-261-1/+1
| | | | | This makes it easier to check that the funciton is returning the correct type of surfaces.
* Split cairo-list into struct+inlinesChris Wilson2012-04-191-0/+1
| | | | | References: https://bugs.freedesktop.org/show_bug.cgi?id=48577 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* xlib-xcb: Wrap cairo_xlib_device_debug_cap_xrender_versionChris Wilson2012-02-221-0/+16
| | | | Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* xlib-xcb: Make this compile againUli Schlachter2012-02-101-1/+1
| | | | | | There was a typo in commit 2061cd81f26. Signed-off-by: Uli Schlachter <psychon@znc.in>
* 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>
* xlib-xcb: Implement surface_set_drawableUli Schlachter2011-12-051-1/+5
| | | | Signed-off-by: Uli Schlachter <psychon@znc.in>
* xlib-xcb: Make this compile againUli Schlachter2011-09-141-20/+6
| | | | Signed-off-by: Uli Schlachter <psychon@znc.in>
* image: move surface definition to new header for subclassingChris Wilson2011-08-131-0/+1
| | | | Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* xlib-xcb: Fix a double free in surface_unmapUli Schlachter2011-08-081-0/+4
| | | | | | | | | | | | | | | | | | | cairo_surface_unmap_image() destroys the image that was passed to it. Since xlib-xcb calls cairo_surface_unmap_image() again for the underlying xcb surface, the surface was destroyed twice. Work around this problem by incrementing the image's reference count via cairo_surface_reference(). No idea why I didn't catch this problem when implementing these functions, I'm sure I ran the relevant tests. :-( lt-cairo-test-suite: cairo-surface.c:853: cairo_surface_destroy: Assertion `((*&(&surface->ref_count)->ref_count) > 0)' failed. Fixes: map-to-image-fill map-bit-to-image map-all-to-image Signed-off-by: Uli Schlachter <psychon@znc.in>
* xlib-xcb: Implement the new backend functionsUli Schlachter2011-08-041-3/+38
| | | | | | This implements create_similar_image, map_to_image and unmap. Signed-off-by: Uli Schlachter <psychon@znc.in>
* Fix surface backend structuresAndrea Canciani2011-07-261-1/+6
| | | | | | a69335a84eb9225b477cc8c753470eb3805b852c introduced some new members in the backend structure, but quartz, qt and xlib-xcb were not updated.
* Xlib,xcb: Make *_debug_[sg]et_precision() more robustUli Schlachter2011-07-211-0/+22
| | | | | | | 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>
* xlib-xcb: Fix 'incompatible pointer type' warningsUli Schlachter2011-07-201-7/+7
| | | | | | | | | | | | | This was introduced in b132fae5e843c329d14. 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>
* xlib-xcb: Fix an "extension leak"Uli Schlachter2011-07-181-0/+9
| | | | | | | | | | | | | | | | | | | | | | 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>
* Implement cairo_backend_tChris Wilson2011-07-151-1/+5
| | | | | | | | | | 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>
* xlib-xcb: Register a XCloseDisplay hookUli Schlachter2011-07-091-3/+142
| | | | | | | | | | | | | | | | | | | | This commits makes the xlib-xcb backend produce its own cairo_device_t. This per-Display* device is used to manage the registration of a XCloseDisplay hook via XAddExtension/XESetCloseDisplay in the same way that the xlib backend does this. The device is necessary to see if we already registered an extension. This fixes weird errors when running cairo-test-suite with -a -s. They were caused because the backend didn't see the XCloseDisplay and the next XOpenDisplay happened to create a xcb_connection_t with the same address as the last display. This caused the xcb backend to assume lots of wrongness. This commit makes use of _cairo_xlib_display_mutex which is otherwise compiled in but not used anywhere when xlib-xcb is enabled. Patch v2: Fixed the xcb_device == NULL case and made sure the xcb_device is only finished on XCloseDisplay, not when all xlib-xcb surfaces are destroyed. Signed-off-by: Uli Schlachter <psychon@znc.in>
* xlib-xcb: Don't call directly into the xcb backendUli Schlachter2011-07-021-15/+18
| | | | | | | | Instead, this now uses the surface wrapper functions for this job. These functions make sure that e.g. snapshots are detached and that is_clear is reset correctly. Signed-off-by: Uli Schlachter <psychon@znc.in>
* xlib-xcb: Fix some use-after-freeUli Schlachter2011-07-021-0/+17
| | | | | | | | | | | Also, this now sets surface->xcb to NULL after the dereference. Segfaults are way more prominent anyway. :-) All the backend callbacks shouldn't need any checks since the public entry point already checks for finished surfaces. Only the public functions in xlib-xcb need to do checks for finished surfaces. Signed-off-by: Uli Schlachter <psychon@znc.in>
* xlib-xcb: Fix cairo_surface_flush()Uli Schlachter2011-07-011-1/+3
| | | | | | | | | | | | This function called directly into the xcb's surface flush function. This means that snapshots for that surface weren't detached since that's normally done in cairo_surface_flush() before calling into the backend. Fix this by using surface_flush() instead of calling into the backend directly. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=31931 Signed-off-by: Uli Schlachter <psychon@znc.in>
* xlib-xcb: Verify we really have an xcb surfaceUli Schlachter2011-07-011-0/+24
| | | | | | | | | | | | If the X11 server doesn't have the RENDER extension, the xcb backend falls back to the image backend in some cases (e.g. create_similar). xlib-xcb didn't handle this properly which means it used the result like a xcb surface. Found while debugging https://bugs.freedesktop.org/show_bug.cgi?id=31931, firefox died from a BadDrawable error when it tried to use the (bogous) result from cairo_xlib_surface_get_drawable(). Signed-off-by: Uli Schlachter <psychon@znc.in>
* xlib-xcb: Fix api-special-cases testUli Schlachter2011-07-011-0/+14
| | | | | | | The functions cairo_xlib_surface_set_size and cairo_xlib_surface_set_drawable didn't set the expected error when called with a finished surface. Signed-off-by: Uli Schlachter <psychon@znc.in>
* xlib-xcb: Implement cairo_xlib_device_debug_{g,s}et_precisionAndrea Canciani2011-06-161-0/+13
| | | | | | | | | | | | 63bdae27a83381fb8c3786c2d7a6c2592e388ee9 introduced a new public API cairo_xlib_device_debug_set_precision(), exported by cairo-xlib. cairo-xlib-xcb must implement it as well, because it must provide the same public API. Fixes the compilation of cairo-sphinx with --enable-tee --enable-xlib-xcb --enable-script. Reported-by: James Cloos <cloos@jhcloos.com>
* Remove if's from Makefile.sourcesAndrea Canciani2011-06-141-0/+4
| | | | | | | | | | | make on win32 complains that: make[1]: Entering directory `/home/ranma42/Code/fdo/cairo/src' ../src/Makefile.sources:220: *** missing separator. Stop. Makefile.sources should not contain if's, which are aoutomake-only conditionals. The correct way to conditionally include files is to enable/disable them using C preprocessor macros.
* xcb: trivial memfault fixes.Chris Wilson2010-05-101-1/+0
| | | | | The first fixes required to kick-start memfault testing of the xcb backend.
* xcb: Find the correct xcb_screen_t for faking ScreenChris Wilson2010-05-081-2/+21
| | | | | | | When choosing the xcb_screen_t to use for the xlib-xcb backing surface, it helps if it matches the screen used to generate similar surfaces and snapshots - otherwise we end up pulling the image back from the XServer every time we want to use the Picture.
* 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
* xlib: Don't operate on an error object inside setters.Chris Wilson2010-04-141-0/+6
| | | | | | | | Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=599574 The backend API manipulated the surface prior to checking whether it was an inert error surface - and in the event of an error surface, tried to overwrite it's error status.
* xcb: Refresh.Chris Wilson2010-01-221-0/+515
Still an experimental backend, it's now a little too late to stabilise for 1.10, but this should represent a major step forward in its feature set and an attempt to catch up with all the bug fixes that have been performed on xlib. Notably not tested yet (and expected to be broken) are mixed-endian connections and low bitdepth servers (the dithering support has not been copied over for instance). However, it seems robust enough for daily use... Of particular note in this update is that the xcb surface is now capable of subverting the xlib surface through the ./configure --enable-xlib-xcb option. This replaces the xlib surface with a proxy that forwards all operations to an equivalent xcb surface whilst preserving the cairo-xlib API that is required for compatibility with the existing applications, for instance GTK+ and Mozilla. Also you can experiment with enabling a DRM bypass, though you need to be extremely foolhardy to do so.