summaryrefslogtreecommitdiff
path: root/src/cairo-xcb-surface-render.c
Commit message (Collapse)AuthorAgeFilesLines
* Make cairo_tag_begin/end work correctly in groupsAdrian Johnson2023-04-181-2/+1
| | | | Fixes #508
* Drop cairo-glEmmanuele Bassi2023-01-271-6/+0
| | | | | | | | | The GL support in Cairo has always been a prototype, and nothing happened in the past 10+ years to make it work as it was meant to. GL support is not enabled by any downstream packagers of Cairo, so nobody should notice its absence.
* Merge branch 'fix-shared-recording-surface' into 'master'Adrian Johnson2023-01-161-1/+2
|\ | | | | | | | | Fix shared use of recording surfaces See merge request cairo/cairo!391
| * Fix shared use of recording surface with paginated targetsAdrian Johnson2023-01-151-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The problem is _cairo_recording_surface_replay_and_create_regions() stores the cairo_recording_region_type_t in the same structure as the recording commands. This does not work well when the recording surface is used as source by multiple surfaces Fix this by moving the cairo_recording_region_type_t into a separate struct cairo_recording_regions_array_t. This struct is stored in a list that allows multiple create regions results to be store in the surface. The new function _cairo_recording_surface_region_array_attach() is used to create a new cairo_recording_regions_array_t, attach it to the recording surface and return a unique region id. The _cairo_recording_surface_replay_and_create_regions() and _cairo_recording_surface_replay_region() functions use this region id to identify the cairo_recording_regions_array_t. To handle nested recording surfaces, when replaying a recording, the region id is passed to the target as an extra parameter in the surface pattern. The wrapper surface makes a temporary copy of the pattern to ensure the snapshot pattern in the recording surface is not modified. cairo_recording_regions_array_t has a reference count so the target can hold on to the cairo_recording_regions_array_t after the paginated surface has called _cairo_recording_surface_region_array_remove().
* | Add array bounds check for xrender format lookupManuel Stoeckl2023-01-111-1/+2
|/ | | | | | | Before this change, images with RGB30, RGB96F, and RGBA128F formats would have been given garbage xrender formats; now such images use the fallback path and are converted to formats with an xrender equivalent.
* Support color fonts that use the foreground colorAdrian Johnson2021-08-281-0/+3
| | | | | | | | | | | | | 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.
* xcb: remove free pixmap/gc wrappersUli Schlachter2021-05-021-2/+2
| | | | | | | With the last commit, these became pointless. Just switch the code to call the underlying function directly. Signed-off-by: Uli Schlachter <psychon@znc.in>
* xcb: Remove free XID cacheUli Schlachter2021-05-021-3/+3
| | | | | | | | | | | | | | cairo-xcb kept a cache of free xid to avoid calling xcb_generate_id() later. However, this is unsafe: When libxcb runs out of ids, it asks the X11 server for an empty range of ids to use. The X11 server of course does not know about cairo's cache and could hand out an id that cairo will use again later. This would then result in BadIdChoice errors later. Fix this by simply removing the whole cache. Fixes: https://gitlab.freedesktop.org/cairo/cairo/-/issues/434 Signed-off-by: Uli Schlachter <psychon@znc.in>
* Fix undefined left-shiftsHeiko Lewin2021-03-311-1/+1
|
* Fix a leak in cairo-xcb's render compositorUli Schlachter2020-12-051-2/+1
| | | | | | | | | | | | | | | | | | | The code here temporary replaces extents->clip with another clip to call a function. Afterwards, it restores the previous copy. The temporary clip is only freed when it still is pointed to by extents->clip. This logic is wrong. It is indeed possible that the clip is simplified and changes. In this case, the original clip is also correctly freed. However, this still means that we have to clean up and destroy the new clip. The previous code just leaked it. This was originally identified by Massimo in [1]. I am just committing his patch. [1]: https://bugs.freedesktop.org/show_bug.cgi?id=91267 Fixes: https://gitlab.freedesktop.org/cairo/cairo/-/issues/24 Signed-off-by: Uli Schlachter <psychon@znc.in>
* Use _cairo_malloc instead of mallocAdrian Johnson2018-05-071-7/+7
| | | | | | | | | | _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>
* cairo-xcb: Remove a wrong optimisationUli Schlachter2016-07-211-2/+0
| | | | | | | | | | | | | | | When doing a "complicated" mask operation, we draw the clip to a surface and use this as a mask in later operations. The code assumes that this operation draws to the whole target surface and thus a deferred clear may be skipped. However, this requires that the extents of the trapezoids that will be drawn and the extents of the surface are the same. This assumption is wrong, as can be seen e.g. by the bug report that this commit fixes. The fix is just not to skip the deferred clear. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=84330 Signed-off-by: Uli Schlachter <psychon@znc.in>
* 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
* XCB: Don't attach uploaded surfaces as snapshotsUli Schlachter2015-06-201-0/+3
| | | | | | | | | | | | When you draw (part of) a surface to an XCB surface, the XCB backend will safe the uploaded part as a snapshot to the input surface. This allows to re-use this picture in case the same surface is later used again as a source. However, other backends do not do this and this has caused and/or highlighted numerous bugs. Just skipping the snapshot fixes or hides these bugs. Papers-over: https://bugs.freedesktop.org/show_bug.cgi?id=67505 Signed-off-by: Uli Schlachter <psychon@znc.in>
* xcb: 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>
* xcb: Use image fallback for GOOD/BEST filtersBill Spitzak2014-10-101-18/+16
| | | | | | | | | | | It will not use the fallback if the symbols in the previous patch are turned on. Also some code rearrangement to make this resemble the xlib version more and to remove some suspect bugs. In particular meshes should not work just because the translation is an integer. Reviewed-by: Bryce Harrington <b.harrington@samsung.com>
* traps,xcb: Set the box count after filteringChris Wilson2014-08-251-2/+3
| | | | | | | | After converting, the number of boxes should only count the number of non-zero boxes and forget about the zero-sized boxes we skipped over. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=81699 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* traps,xcb: Prefilter zero-area boxes when converting trapsChris Wilson2014-08-231-11/+18
| | | | | | | | | | | | | | | | | | | | | | The rectangular tesselation routines rely on the presuming that all the boxes it has to handle are already filtered to remove empty boxes. << /width 800 /height 600 >> surface context 0.0848671 0 0 0.0848671 39.907812 5.608896 matrix transform 8 0 m 12.417969 0 16 3.582031 16 8 c 16 12.417969 12.417969 16 8 16 c 3.582031 16 0 12.417969 0 8 c 0 3.582031 3.582031 0 8 0 c h clip 16 0 m 8 8 l 16 16 l h clip 0 0 16 16 rectangle fill Triggers the error given a traps tesselator like cairo-xlib. Reported-by: Henrique Lengler <henriqueleng@openmailbox.org> Analyzed-by: Massimo <sixtysix@inwind.it> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=81699 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* xcb: Correctly check for image surface for inplace uploadUli Schlachter2014-08-231-1/+2
| | | | | Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82987 Signed-off-by: Uli Schlachter <psychon@znc.in>
* V5: Use NEAREST filter when possibleBill Spitzak2014-08-141-5/+2
| | | | | | | | | | | | | | (changed to use determinant funciton and remove debug printf) Modifies _cairo_matrix_has_unity_scale to return true for 90 degree rotations by allowing error caused by inaccuracy in trig functions. This fails after 14 additions of M_PI_2 to itself as a float argument to cairo_rotate, but the failure is in the detection of the integer translate, not in the trig components. I believe this is due to the matrix inversion, which may need similar rounding. Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
* xcb: make use of _cairo_surface_is_xcb to check for surface typeRavi Nanjundappa2014-07-071-1/+1
| | | | | | | | Introduced a new inline function _cairo_surface_is_xcb() as similar to _cairo_surface_is_image() and used the same to check for xcb surface type Signed-off-by: Ravi Nanjundappa <nravi.n@samsung.com>
* Fix segfault in firefox when scrolling on certain pagesBryce Harrington2014-05-061-0/+3
| | | | | | Bug discovered by thorsten <fly_a320@gmx.de> Patch from Chris Wilson <chris@chris-wilson.co.uk>
* 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>
* surface: Merge scratch construction into _cairo_surface_create_scratchAlexander Larsson2013-09-051-10/+10
| | | | | | | | | | | 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.
* xcb: Fix some uninitialized variable warningsUli Schlachter2013-07-041-3/+3
| | | | Signed-off-by: Uli Schlachter <psychon@znc.in>
* xcb: Clear temporary replay image in recording playbackUli Schlachter2013-03-221-4/+5
| | | | | | | | | This gets rid of random noise that we got from the X11 server due to uninitialized memory. Fixes: pdf-surface-source, ps-surface-source, svg-surface-source Signed-off-by: Uli Schlachter <psychon@znc.in>
* xcb: _cairo_scaled_font_reset_cache does it own lockingChris Wilson2013-01-091-2/+0
| | | | | | So we can drop ours. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* xcb: Clear the result of create_similar_imageUli Schlachter2012-10-061-14/+0
| | | | | | | | | | | | | | | | | | The documentation of cairo_surface_create_similar_image() states that the image's contents are initially all 0. However, the implementation didn't live up to the documentation. This was found via the corresponding assert in cairo_surface_create_similar_image(). There are some cairo-xcb-internal users of this function which cleared the image right after creating it. Obviously, this isn't needed anymore. Fixes: Nothing. The existing call in the testsuite to cairo_surface_create_similar_image() doesn't hit this issue, since it creates a too small image to hit the SHM-case. Signed-off-by: Uli Schlachter <psychon@znc.in>
* xcb: Add a missing check for FillRectanglesUli Schlachter2012-09-251-4/+9
| | | | | | | Fixes: big-empty-box big-little-box operator operator-alpha surface-pattern-operator unbounded-operator Signed-off-by: Uli Schlachter <psychon@znc.in>
* xcb: Check if traps are supported before using themUli Schlachter2012-09-251-1/+2
| | | | | | | | | | | | | This code tried to optimize the clip away by intersecting the boxes with the clip polygon. However, it also did so when the server didn't support traps. Fixes: clip-stroke-unbounded clip-fill-nz-unbounded clip-fill-eo-unbounded clip-fill clip-fill-rule a1-clip-fill-rule clip-group-shapes-circles clip-intersect clip-nesting clip-operator clip-push-group clip-polygons clip-shape clip-text clip-twice inverted-clip mask random-clip rotate-clip-image-surface-paint trap-clip unantialiased-shapes Signed-off-by: Uli Schlachter <psychon@znc.in>
* xcb: Check the right flag for FillRectanglesUli Schlachter2012-09-251-1/+1
| | | | | | Fixes: operator-source Signed-off-by: Uli Schlachter <psychon@znc.in>
* xcb: Switch to compositor architectureUli Schlachter2012-09-241-35/+40
| | | | | | | | This commit removes the hand-written code in cairo-xcb-surface.c and instead makes use of cairo_compositor_t. Surprisingly, this doesn't break a single test case. :-) Signed-off-by: Uli Schlachter <psychon@znc.in>
* xcb: Correctly handle a recording surface's extentsUli Schlachter2012-06-251-11/+37
| | | | | | | | | | | | | The size of the target area doesn't really have much to do with the size of the recording surface that we are painting from. Thus, let's use the recording surface's size instead. Since we apply the transformation before replaying the recording surface, we need to transform the recording surface's size via the inverse of our pattern matrix to get the size in the target surface. This makes this a little more complex. Signed-off-by: Uli Schlachter <psychon@znc.in>
* xcb: Handle recording surfaces differentlyUli Schlachter2012-06-251-7/+3
| | | | | | | | | | | | | | | | | | | | | | | Let's say we are painting recording surface 'source' to xcb surface 'target' by replaying the source to a temporary surface 'tmp'. Previously, the xcb backend replayed the recording surface to tmp with just a translation and then used that as its source surface with the pattern's transformation. That means 'tmp' used the same coordinate system as 'source'. This patch changes this so that the transformation is applied during the replay and painting from 'tmp' to 'target' is just a simple translation, so 'tmp' now uses the same coordinate system as 'target'. This should produce way less better results, because transforming a recording surface should have less artifacts than transforming a raster surface. Fixes: record1414x-* record2x-* record90-* ps-surface-source Breaks (or rather, "exposes unrelated bug that I have not yet figured out in"): record-extend-*-similar Signed-off-by: Uli Schlachter <psychon@znc.in>
* 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>
* Split cairo-recording-surface-private into struct+inlinesChris Wilson2012-04-191-2/+2
| | | | | References: https://bugs.freedesktop.org/show_bug.cgi?id=48577 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* Split cairo-clip-privates 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>
* doc: no separate cairo-xcb-xrender sectionNis Martensen2012-04-121-13/+0
| | | | | | | | There is already a cairo-xcb section and there are no symbols that should be documented in an extra -xrender section. It is not mentioned in cairo-sections.txt either. So simply delete it. Signed-off-by: Uli Schlachter <psychon@znc.in>
* doc: Make documentation comments symmetricAndrea Canciani2012-03-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Documentation comments should always start with "/**" and end with "**/". This is not required by gtk-doc, but it makes the documentations formatting more consistent and simplifies the checking of documentation comments. The following Python script tries to enforce this. from sys import argv from sre import search for filename in argv[1:]: in_doc = False lines = open(filename, "r").read().split("\n") for i in range(len(lines)): ls = lines[i].strip() if ls == "/**": in_doc = True elif in_doc and ls == "*/": lines[i] = " **/" if ls.endswith("*/"): in_doc = False out = open(filename, "w") out.write("\n".join(lines)) out.close() This fixes most 'documentation comment not closed with **/' warnings by check-doc-syntax.awk.
* xcb: Add a special case for recording surfaceUli Schlachter2011-12-111-0/+70
| | | | | | | | An unbounded recording surface will complain loudly when you call acquire_source_image on it and thus we need a special case which draws the recording surface to a temporary surface and then proceeds with that. Signed-off-by: Uli Schlachter <psychon@znc.in>
* xcb: Move the surface picture setup into its own functionUli Schlachter2011-12-111-22/+30
| | | | Signed-off-by: Uli Schlachter <psychon@znc.in>
* xcb: Silence compiler warnings about ignored return valuesUli Schlachter2011-12-111-0/+1
| | | | Signed-off-by: Uli Schlachter <psychon@znc.in>
* xcb: Silence a compiler warning for mixing type and internal type enumsUli Schlachter2011-12-111-1/+1
| | | | | | | cairo-xcb-surface-render.c:1134:35: warning: comparison between 'cairo_surface_type_t' and 'enum _cairo_internal_surface_type' [-Wenum-compare] Signed-off-by: Uli Schlachter <psychon@znc.in>
* xcb: Fix invalid casts from cairo_content_t to cairo_format_tUli Schlachter2011-12-081-4/+4
| | | | | | | This was introduced in a69335a84e when the second argument of _cairo_xcb_surface_create_similar_image was changed from content to format. Signed-off-by: Uli Schlachter <psychon@znc.in>
* Convert cairo_mime_surface_t to cairo_raster_source_pattern_tChris Wilson2011-11-251-1/+2
| | | | | | | | | | As discussed, overloading the cairo_surface_t semantics to include sources (i.e. read-only surfaces) was duplicating the definition of cairo_pattern_t. So rather than introduce a new surface type with pattern semantics, start along the thorny road of extensible pattern types. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* xcb: Fix some invalid castsUli Schlachter2011-11-151-9/+11
| | | | | | | | | | | | | | | | | cairo-xcb was deciding which type to cast a surface to based on its "type" member. This is wrong, it should use "backend->type". This bug was hit via xlib-xcb. This was painting a subsurface of a xlib-xcb surface to an xcb surface. Because surface->type said "xlib", the code was trying to check if the xcb surface had a fallback. However, this was done on the subsurface. The end result was dereferencing a pointer to 0x28. This was noticed while looking into https://bugs.freedesktop.org/show_bug.cgi?id=42889 No test for this bug since I didn't manage to come up with one. Signed-off-by: Uli Schlachter <psychon@znc.in>
* xcb: Re-enable glyph renderingChris Wilson2011-10-111-1/+1
| | | | | | | I lost the '&& 0' I put in to disable the glyph rendering until I had the glyph cache integration working again. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* xcb: Honor clips for defer clearUli Schlachter2011-09-221-1/+2
| | | | | | This bug was accidentally introduced in fd613cb9f94daff0c8d4fdb27ff89894d41682a. Signed-off-by: Uli Schlachter <psychon@znc.in>
* xcb: track fallback damageChris Wilson2011-09-191-89/+33
| | | | | | | | And only upload the parts of the image that are modified during the fallback. I have to keep reminding myself that the goal is always to reduce the amount of fallbacks required... Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* xcb: Remove an unused variableUli Schlachter2011-09-181-6/+0
| | | | Signed-off-by: Uli Schlachter <psychon@znc.in>