summaryrefslogtreecommitdiff
path: root/src/cairo-spans-compositor.c
Commit message (Collapse)AuthorAgeFilesLines
* Make cairo_tag_begin/end work correctly in groupsAdrian Johnson2023-04-181-1/+1
| | | | Fixes #508
* Fix shared use of recording surface with paginated targetsAdrian Johnson2023-01-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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().
* Avoid a use-after-scopeUli Schlachter2021-03-091-1/+1
| | | | | | | | This is the same fix as commit b345be5afee, but in a different place in the same file. Fixes: https://gitlab.freedesktop.org/cairo/cairo/-/issues/453 Signed-off-by: Uli Schlachter <psychon@znc.in>
* Avoid a use-after-freeMatthias Clasen2021-01-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | asan was complaining that the limits struct goes out of scope before it is used via the pointer in the polygon struct, and it is right: ==386746==ERROR: AddressSanitizer: stack-use-after-scope on address 0x7ffd3ccebdfc at pc 0x7f783d5eaaee bp 0x7ffd3cceba80 sp 0x7ffd3cceba70 READ of size 4 at 0x7ffd3ccebdfc thread T0 #0 0x7f783d5eaaed in _add_clipped_edge ../src/cairo-polygon.c:351 #1 0x7f783d5ebba3 in _cairo_polygon_add_edge ../src/cairo-polygon.c:520 #2 0x7f783d5ebc82 in _cairo_polygon_add_external_edge ../src/cairo-polygon.c:530 #3 0x7f783d582149 in _cairo_filler_line_to ../src/cairo-path-fill.c:63 #4 0x7f783d588d9c in _cairo_path_fixed_interpret ../src/cairo-path-fixed.c:831 #5 0x7f783d582a44 in _cairo_path_fixed_fill_to_polygon ../src/cairo-path-fill.c:147 #6 0x7f783d6204fe in _cairo_spans_compositor_fill ../src/cairo-spans-compositor.c:1151 #7 0x7f783d5126de in _cairo_compositor_fill ../src/cairo-compositor.c:203 #8 0x7f783d5571f9 in _cairo_image_surface_fill ../src/cairo-image-surface.c:1003 #9 0x7f783d647f2f in _cairo_surface_fill ../src/cairo-surface.c:2424 #10 0x7f783d52ebea in _cairo_gstate_fill ../src/cairo-gstate.c:1312 #11 0x7f783d51cca4 in _cairo_default_context_fill ../src/cairo-default-context.c:1057 #12 0x7f783d6812d6 in cairo_fill ../src/cairo.c:2421
* surface: Merge scratch construction into _cairo_surface_create_scratchAlexander Larsson2013-09-051-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.
* spans,traps: Undo device transform from source matrix for recording replaysChris Wilson2013-09-051-2/+11
| | | | | | | | | | As the replay of the recording surface applies the device_transform of the matrix once again to all its operations, we end up with a repeated transform through the source matrix of the recording surface. We need to remove one of these, and the easiest way to do that appears to be to undo the application to the source matrix. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* spans: Mark the surface as cleared in preparing for recording surface playbackChris Wilson2013-02-121-1/+6
| | | | Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* spans: Do not assume that we manage to perform the clip geometricallyChris Wilson2012-11-011-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Even for bounded masks, we may fail to perform the clipping geometrically for a variety of reasons, the prime one being that the clip has a mixture of antialias settings. So when compositing the polygon, we need to check whether a clip path still remains and so requires a clipmask. Fixes regression from commit cd1004ce19c7ea28c7fedb6464562a08416586c0 Author: Chris Wilson <chris@chris-wilson.co.uk> Date: Fri May 11 21:20:35 2012 +0100 traps,spans-compositor: Avoid mistreating unaligned clips as aligned and commit 4ea3ace6c810ba090464e48795fac5456f6cdc24 Author: Chris Wilson <chris@chris-wilson.co.uk> Date: Fri May 11 21:51:44 2012 +0100 spans: Only fallback for a clipmask if unbounded Reported-by: Dominik Röttsches <dominik.rottsches@intel.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=56574 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* image: Add a couple of tracepoints for spans fallbacksChris Wilson2012-10-311-3/+10
| | | | | References: https://bugs.freedesktop.org/show_bug.cgi?id=56574 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* spans-compositor: Remove polygon limits after constructionChris Wilson2012-09-271-3/+7
| | | | Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* spans-compositor: Use the tight clip-boxes for polygon constructionChris Wilson2012-09-271-10/+19
| | | | | | | If we will be reducing the clip intersection to a single clip box check during construction, it helps if we use the tight clip box. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* spans-compositor: After polygon intersection the fill rule is always non-zeroChris Wilson2012-06-081-0/+2
| | | | | | | | As it turns out due to the rules of polygon intersection, there is never any overlapping spans so the choice is arbitrary. However, lets be consistent with the rest of the code. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* spans: Debug input paths and polygonsChris Wilson2012-05-141-0/+3
| | | | Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* spans: Only fallback for a clipmask if unboundedChris Wilson2012-05-111-1/+2
| | | | | | | For a bounded operation with a clip we will already have performed the clip geometrically. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* traps,spans-compositor: Avoid mistreating unaligned clips as alignedChris Wilson2012-05-111-2/+22
| | | | | | | An unaligned clip requires careful handling, and so exclude processing along the fast paths. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* spans-compositor: Add tracepoints for debuggingChris Wilson2012-05-111-1/+21
| | | | Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* spans-compositor: Handle unaligned unbounded boxesChris Wilson2012-05-111-16/+51
| | | | Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* Split cairo-pattern-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>
* 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>
* 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>
* spans-compositor: Only destroy the clip if we made the copyChris Wilson2012-03-131-2/+2
| | | | | | | | | | The extents->clip may be replaced elsewhere and so we cannot assume that simply because it changed from the stashed value, that it was us that made that copy. So becareful to only free our copy. Fixes a double-free of a clip after a complex fallback operation. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* spans: Handle fallbacks from upload-boxes by reverting to the normal compositeChris Wilson2012-03-051-1/+3
| | | | Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* spans,image,gl: Add fast-path for simple copiesChris Wilson2012-03-041-3/+44
| | | | Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* spans: Reduce composite_aligned_boxes with over to source for opaque patternsChris Wilson2012-03-041-3/+8
| | | | Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* spans: Retrim extents to clipped polygonChris Wilson2012-03-041-0/+4
| | | | | | | After combining the mask polygon with the clip polygon, recompute the extents of the operation. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* spans: Pass antialiasing hint down to the backendsChris Wilson2012-03-041-2/+4
| | | | | | | The actual span rasterisers may be able to specialise if they know that the spans will be pixel aligned. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* spans,traps-compositor: Check for all-clipped after intersecting clip with boxesChris Wilson2012-02-291-0/+3
| | | | | | | If the mask does not intersect the clip, then there is no drawing to be performed and we can report NOTHING_TO_DO. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* gl: Various fixes for glyphsChris Wilson2012-02-291-0/+13
| | | | | | | | Not 100% improvement, there are still a variety of failures with GLXWindows, but getting there. At least it fixes more things than its breaks... Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* spans+image: Fix clipping with polygons and spansChris Wilson2012-02-281-12/+37
| | | | | Fixes: clip-source, random-clip Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* spans: Pass unbounded operations to the spans compositorsChris Wilson2012-02-091-11/+5
| | | | | | | Only bail if we need to combine clipping with the spans (either for a bounded or unbounded operation). Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* Replace the ad-hoc surface unwrappers with a function pointerChris Wilson2012-02-091-12/+6
| | | | Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* rectangle: Implement _cairo_rectangle_contains_rectangle()Andrea Canciani2012-01-151-9/+1
| | | | And reuse it.
* spans: Refresh polygon limits after trimming the composite extentsChris Wilson2011-10-121-0/+3
| | | | | | | | | Trimming the composite extents may result in the clip being reconstructed, but we the polygon continued to hold a reference into the freed clip's array of boxes. So if we intend to reuse the polygon limits after performing the clip we need to refresh them. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* spans: Propagate internal status when retrieving the clip surfaceChris Wilson2011-10-121-2/+6
| | | | | | | Including the information that there is nothing to do due to being all-clipped-out. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* image: Enable use of LERP_SRC for masked source compositionChris Wilson2011-09-301-11/+6
| | | | Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* spans: Fix empty polygon unbounded fixupChris Wilson2011-09-231-9/+6
| | | | | | | | | | There is a subtle flaw in the current querying of polygon extents; it simply returns the limits and not the point extremeties and certainly not the tessellation extents. Computing that is likely to take long than rendering the polygon. This does mean that we need to also fixup the extents prior to performing the empty unbounded fast path. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* Introduce a new compositor architectureChris Wilson2011-09-121-0/+1007
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. :)