summaryrefslogtreecommitdiff
path: root/src/cairo-pattern-private.h
diff options
context:
space:
mode:
authorAdrian Johnson <ajohnson@redneon.com>2023-01-01 15:14:08 +1030
committerAdrian Johnson <ajohnson@redneon.com>2023-01-15 19:29:28 +1030
commit7146358250975ec0f29b8ba80e80a26c52526bdc (patch)
treee37c45b2f6c4523aab202b331a4094949b189040 /src/cairo-pattern-private.h
parenta2b376ed787fc35270421730863411a0c047f564 (diff)
downloadcairo-7146358250975ec0f29b8ba80e80a26c52526bdc.tar.gz
Fix shared use of recording surface with paginated targets
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().
Diffstat (limited to 'src/cairo-pattern-private.h')
-rw-r--r--src/cairo-pattern-private.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/cairo-pattern-private.h b/src/cairo-pattern-private.h
index f6138fb70..0a5e41e8b 100644
--- a/src/cairo-pattern-private.h
+++ b/src/cairo-pattern-private.h
@@ -87,6 +87,12 @@ typedef struct _cairo_surface_pattern {
cairo_pattern_t base;
cairo_surface_t *surface;
+
+ /* This field is only used by the wrapper surface for retreiving
+ * the region id from the target during create regions and passing
+ * the region id to the target surface during playback.
+ */
+ unsigned int region_array_id;
} cairo_surface_pattern_t;
typedef struct _cairo_gradient_stop {