summaryrefslogtreecommitdiff
path: root/src/cairo-xlib-render-compositor.c
Commit message (Collapse)AuthorAgeFilesLines
* Support color fonts that use the foreground colorAdrian Johnson2021-08-281-0/+2
| | | | | | | | | | | | | COLR fonts can have a layer with the same color as the current text color. This change passes the current color (if solid) through to the font backend where it can be used to render color fonts. scaled_glyph_lookup checks if the foreground color has changed (for glyph that require it) and requests a new color surface if required. This also fixes a bug where scaled_glyph_lookup would always request a color surface for glyphs for glyphs in color fonts that do not have color.
* Minor correctionsHeiko Lewin2021-04-111-1/+1
|
* Fix undefined left-shiftsHeiko Lewin2021-03-311-1/+1
|
* xlib compositor: Support subpixel positioningMatthias Clasen2019-07-181-5/+13
| | | | | As for the image compository, support a 4x4 subpixel grid.
* Use _cairo_malloc instead of mallocAdrian Johnson2018-05-071-4/+4
| | | | | | | | | | _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>
* bfo#91271 - Fix access of uninitialized memoryMassimo2018-03-081-0/+3
| | | | | | | | | | | | | | | Valgrind reports that xlib-render-compositor's composite_traps() accesses uninitialized memory when traps->num_traps == 0. This happens in the line that says if (xtraps[0].left.p1.y < xtraps[0].left.p2.y) { after the 'for' loop. We can actually return early if there are no trapezoids to render. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=91271 Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
* Surround initialisations with atomic critical sectionMikhail Fludkov2017-10-151-2/+8
| | | | | | | | | | | | | | | Fixes the race condition when one thread uses cairo_mask_compositor_t pointer returned by _cairo_image_mask_compositor_get, while another one started but has not finished it's initialisation yet Usage: static cairo_atomic_once_t once = CAIRO_ATOMIC_ONCE_INIT; if (_cairo_atomic_init_once_enter(&once)) { /* Initialization code */ _cairo_atomic_init_once_leave(&once); } https://bugs.freedesktop.org/show_bug.cgi?id=103037
* xlib: Avoid using uninitialised variable on impossible error pathChris Wilson2015-07-061-2/+2
| | | | | | | | | | | | | In commit f6843d5cbb79c35f7b331ac31c4a55c9574928fc Author: Arpit Jain <jain.arpit@samsung.com> Date: Mon Jul 6 14:13:06 2015 -0700 xlib: Fix deferencing of uninitialised 'display' the common error + clenaup path was clumsily fixed to use the right variable after the error didn't set the local display variable. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* Revert "xlib: Fix deferencing of uninitialised 'display'"Chris Wilson2015-07-061-6/+2
| | | | This reverts commit f6843d5cbb79c35f7b331ac31c4a55c9574928fc.
* xlib: Fix deferencing of uninitialised 'display'Arpit Jain2015-07-061-2/+6
| | | | | | | | | | Initialising 'display' to NULL and checking before deferencing during display->base. This patch will check the deferencing of uninitialised 'display' in case, _cairo_xlib_display_acquire does not return CAIRO_STATUS_SUCCESS. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=87893 Signed-off-by: Arpit Jain <jain.arpit@samsung.com> Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
* xlib: Don't crash when swapping a 0-sized glyphAdam Jackson2014-11-061-0/+6
| | | | | | | | | | malloc(0) needn't return NULL, and on glibc, doesn't. Then we encounter a loop of the form do { ... } while (--c), which doesn't do quite what you were hoping for when c is initially 0. Since there's nothing to swap in this case, just bomb out. Signed-off-by: Adam Jackson <ajax@redhat.com>
* Correct usage of CAIRO_STACK_ARRAY_LENGTHUli Schlachter2013-11-161-1/+1
| | | | | | | This macro wants the array type as its argument and calls sizeof() on it internally. Signed-off-by: Uli Schlachter <psychon@znc.in>
* Provide backwards compatibilty with old pixmanChris Wilson2013-08-231-0/+1
| | | | | | | The goal is to allow compilation against older pixman to ease regression testing. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* xlib: Only apply the dst offset to the glyph strings onceChris Wilson2013-02-081-6/+6
| | | | | | | | | | The elts offset is a delta from the previous glyph coordinate. So by subtracting the dst origin everytime, we were accumulating a glyph position error. Instead we just want to offset the starting coordinate and then always use relative positions. Reported-by: Theo Veenker <T.J.G.Veenker@uu.nl> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* xlib/shm: Appease the compiler for a 'maybe used uninitialised' variableChris Wilson2013-01-291-2/+1
| | | | | | | Initialise shm during its declaration so that it is indeed initialised for the cleanup after every path. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* xlib/shm: Simplify uploading of SHM image dataChris Wilson2013-01-291-10/+12
| | | | | | | Make sure that we simply copy from the SHM segment into the target drawable, and not inadvertently stage it through another SHM buffer. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* xlib/shm: Skip creating new SHM segments if the data is already in the xserverChris Wilson2013-01-291-0/+4
| | | | | | | | If the image is already inside a SHM segment, but the image format does not match the surface, fallback to the XRender paths in order to perform colorspace conversion on the data already inside the Xserver. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* xlib/shm: Tighten mark-active to the actual CopyArea on the ShmPixmapChris Wilson2013-01-291-1/+2
| | | | | | | | Along the draw_image_boxes() upload path, we were actually marking the ShmPixmap as still active for the subsequent drawing operation - which could in theory never be submitted... Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* xlib: Handle lack of XRenderFillRectanglesChris Wilson2013-01-131-6/+24
| | | | | | | | Remember to check for a supported render version before making a FillRectangle request, and fallback to the core protocol where possible instead. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* xlib: Only fallback through the mask intermediate if we can composite the maskChris Wilson2013-01-111-12/+12
| | | | | | | | Before rendering into the mask, we should first check whether the subsequent call to composite the mask will trigger a fallback. In that case, we should fallback earlier and do the operation in place. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* xlib/shm: Rate-limit events and only use as necessaryChris Wilson2012-12-291-2/+2
| | | | Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* [Minor] Improve loggingBehdad Esfahbod2012-12-211-0/+2
|
* xlib: Apply the image offsets to the destination rather the sourceChris Wilson2012-10-301-12/+10
| | | | | | | | | | | | | | | | | So that we can specify the entire source surface as the region to copy and not introduce clipping errors. Fixes regression from commit c068691ff57c2f6cd750a54db17393c0e132cb00 Author: Chris Wilson <chris@chris-wilson.co.uk> Date: Fri Aug 17 21:33:54 2012 +0100 xlib/shm: Use an impromptu upload ShmSegment Reported-by: John Lindgren <john.lindgren@aol.com> Reported-by: Kalev Lember <kalevlember@gmail.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=56547 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* xlib: Drop the false optimisation of using a potentially busy shm upload pixmapChris Wilson2012-08-181-2/+0
| | | | Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* xlib: Only use CopyArea if the ShmPixmap and destination are the same depthChris Wilson2012-08-181-1/+5
| | | | Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* xlib/shm: Use an impromptu upload ShmSegmentChris Wilson2012-08-171-3/+62
| | | | | | | | Reduce the number of copies required for uploading large image data. Ultimately we want the client to allocate the similar-image itself to acheive zero copy, this is just an intermediate step for legacy clients. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* xlib/shm: Limit use of the impromptu fallback pixmap for uploadsChris Wilson2012-08-171-1/+27
| | | | | | | We want to avoid unnecessary readback and so only want to use the ShmPixmap when uploading the complete surface. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* xlib: Implement SHM fallbacks and fast upload pathsChris Wilson2012-08-171-9/+146
| | | | Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* 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: Apply the glyph offsetChris Wilson2012-03-061-5/+5
| | | | | | | | | | The (dst_x, dst_y) parameters passed to the XRenderCompositeText are misleading and do not perform any adjustment, so we have to do it ourselves. Fixes clip-operator Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* xlib: Handle window-to-window copies by avoiding the use of a clip regionChris Wilson2012-02-231-42/+54
| | | | | | | | Rather than compress the copies into a clip + copy, iterate over and perform each copy separately so as to avoid the confusion for window-to-window copies and the solitary GC->pCompositeClip. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* xlib: Hook up copy_boxes for the mask compositorChris Wilson2012-02-221-0/+1
| | | | Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* xlib: Set IncludeInferiors when using CopyAreaChris Wilson2012-02-021-0/+26
| | | | | | | | | | | | | | | | | | | cairo-xlib semantics state that we copy the contents of a Window's children when we use a Window as a source in a cairo operation. This requires that we set the IncludeInferiors SubwindowMode on the GC. However, we can only set one SubwindowMode for an operation and our semantics are that drawing performed by cairo onto a Window are clipped by its children (the ClipByChildren SubwindowMode). Therefore if we have to copy between two Window, we can not use CopyArea. Furthermore, we cannot tell if an external Drawable is a Window or a Pixmap, therefore we treat all foriegn Drawables as Window. Failure here means falling back to a render path, where we can independently control the subwindow mode on the source and destination, or to a GetImage/PutImage if the xserver does not support render. Reported-by: Benjamin Otte <otte@redhat.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* Clip rectangles are not necessarily YSortedKeith Packard2011-12-061-1/+1
| | | | | | | | | | | | | None of the cairo clipping computations guarantee that the resulting list of rectangles are constructed in any particular order. Promising that they are results in an X error (BadMatch) which generally causes applications to crash. I suspect this may well be implicated in many (many) bug reports about applications which use cairo. Signed-off-by: Keith Packard <keithp@keithp.com> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* gl: Prevent the traps compositor from explodingChris Wilson2011-11-241-1/+12
| | | | Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* xlib: ADD only reduces to SOURCE for alpha-only targetsChris Wilson2011-11-231-2/+6
| | | | | | Fixes operator. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* xlib: Reduce the composite traps operator for when the dest is clearChris Wilson2011-10-141-0/+6
| | | | Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* xlib-xcb: Make this compile againUli Schlachter2011-09-141-0/+4
| | | | Signed-off-by: Uli Schlachter <psychon@znc.in>
* Introduce a new compositor architectureChris Wilson2011-09-121-0/+1685
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. :)