summaryrefslogtreecommitdiff
path: root/src/cairo-debug.c
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-debug.c
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-debug.c')
-rw-r--r--src/cairo-debug.c98
1 files changed, 98 insertions, 0 deletions
diff --git a/src/cairo-debug.c b/src/cairo-debug.c
index a314eefbf..c83df3f47 100644
--- a/src/cairo-debug.c
+++ b/src/cairo-debug.c
@@ -319,3 +319,101 @@ _cairo_debug_print_rect (FILE *file, const cairo_rectangle_int_t *rect)
rect->x, rect->y,
rect->width, rect->height);
}
+
+const char *
+_cairo_debug_operator_to_string (cairo_operator_t op)
+{
+ switch (op) {
+ case CAIRO_OPERATOR_CLEAR: return "CLEAR";
+ case CAIRO_OPERATOR_SOURCE: return "SOURCE";
+ case CAIRO_OPERATOR_OVER: return "OVER";
+ case CAIRO_OPERATOR_IN: return "IN";
+ case CAIRO_OPERATOR_OUT: return "OUT";
+ case CAIRO_OPERATOR_ATOP: return "ATOP";
+ case CAIRO_OPERATOR_DEST: return "DEST";
+ case CAIRO_OPERATOR_DEST_OVER: return "DEST_OVER";
+ case CAIRO_OPERATOR_DEST_IN: return "DEST_IN";
+ case CAIRO_OPERATOR_DEST_OUT: return "DEST_OUT";
+ case CAIRO_OPERATOR_DEST_ATOP: return "DEST_ATOP";
+ case CAIRO_OPERATOR_XOR: return "XOR";
+ case CAIRO_OPERATOR_ADD: return "ADD";
+ case CAIRO_OPERATOR_SATURATE: return "SATURATE";
+ case CAIRO_OPERATOR_MULTIPLY: return "MULTIPLY";
+ case CAIRO_OPERATOR_SCREEN: return "SCREEN";
+ case CAIRO_OPERATOR_OVERLAY: return "OVERLAY";
+ case CAIRO_OPERATOR_DARKEN: return "DARKEN";
+ case CAIRO_OPERATOR_LIGHTEN: return "LIGHTEN";
+ case CAIRO_OPERATOR_COLOR_DODGE: return "COLOR_DODGE";
+ case CAIRO_OPERATOR_COLOR_BURN: return "COLOR_BURN";
+ case CAIRO_OPERATOR_HARD_LIGHT: return "HARD_LIGHT";
+ case CAIRO_OPERATOR_SOFT_LIGHT: return "SOFT_LIGHT";
+ case CAIRO_OPERATOR_DIFFERENCE: return "DIFFERENCE";
+ case CAIRO_OPERATOR_EXCLUSION: return "EXCLUSION";
+ case CAIRO_OPERATOR_HSL_HUE: return "HSL_HUE";
+ case CAIRO_OPERATOR_HSL_SATURATION: return "HSL_SATURATION";
+ case CAIRO_OPERATOR_HSL_COLOR: return "HSL_COLOR";
+ case CAIRO_OPERATOR_HSL_LUMINOSITY: return "HSL_LUMINOSITY";
+ }
+ return "UNKNOWN";
+}
+
+const char *
+_cairo_debug_status_to_string (cairo_int_status_t status)
+{
+ switch (status) {
+ case CAIRO_INT_STATUS_SUCCESS: return "SUCCESS";
+ case CAIRO_INT_STATUS_NO_MEMORY: return "NO_MEMORY";
+ case CAIRO_INT_STATUS_INVALID_RESTORE: return "INVALID_RESTORE";
+ case CAIRO_INT_STATUS_INVALID_POP_GROUP: return "INVALID_POP_GROUP";
+ case CAIRO_INT_STATUS_NO_CURRENT_POINT: return "NO_CURRENT_POINT";
+ case CAIRO_INT_STATUS_INVALID_MATRIX: return "INVALID_MATRIX";
+ case CAIRO_INT_STATUS_INVALID_STATUS: return "INVALID_STATUS";
+ case CAIRO_INT_STATUS_NULL_POINTER: return "NULL_POINTER";
+ case CAIRO_INT_STATUS_INVALID_STRING: return "INVALID_STRING";
+ case CAIRO_INT_STATUS_INVALID_PATH_DATA: return "INVALID_PATH_DATA";
+ case CAIRO_INT_STATUS_READ_ERROR: return "READ_ERROR";
+ case CAIRO_INT_STATUS_WRITE_ERROR: return "WRITE_ERROR";
+ case CAIRO_INT_STATUS_SURFACE_FINISHED: return "SURFACE_FINISHED";
+ case CAIRO_INT_STATUS_SURFACE_TYPE_MISMATCH: return "SURFACE_TYPE_MISMATCH";
+ case CAIRO_INT_STATUS_PATTERN_TYPE_MISMATCH: return "PATTERN_TYPE_MISMATCH";
+ case CAIRO_INT_STATUS_INVALID_CONTENT: return "INVALID_CONTENT";
+ case CAIRO_INT_STATUS_INVALID_FORMAT: return "INVALID_FORMAT";
+ case CAIRO_INT_STATUS_INVALID_VISUAL: return "INVALID_VISUAL";
+ case CAIRO_INT_STATUS_FILE_NOT_FOUND: return "FILE_NOT_FOUND";
+ case CAIRO_INT_STATUS_INVALID_DASH: return "INVALID_DASH";
+ case CAIRO_INT_STATUS_INVALID_DSC_COMMENT: return "INVALID_DSC_COMMENT";
+ case CAIRO_INT_STATUS_INVALID_INDEX: return "INVALID_INDEX";
+ case CAIRO_INT_STATUS_CLIP_NOT_REPRESENTABLE: return "CLIP_NOT_REPRESENTABLE";
+ case CAIRO_INT_STATUS_TEMP_FILE_ERROR: return "TEMP_FILE_ERROR";
+ case CAIRO_INT_STATUS_INVALID_STRIDE: return "INVALID_STRIDE";
+ case CAIRO_INT_STATUS_FONT_TYPE_MISMATCH: return "FONT_TYPE_MISMATCH";
+ case CAIRO_INT_STATUS_USER_FONT_IMMUTABLE: return "USER_FONT_IMMUTABLE";
+ case CAIRO_INT_STATUS_USER_FONT_ERROR: return "USER_FONT_ERROR";
+ case CAIRO_INT_STATUS_NEGATIVE_COUNT: return "NEGATIVE_COUNT";
+ case CAIRO_INT_STATUS_INVALID_CLUSTERS: return "INVALID_CLUSTERS";
+ case CAIRO_INT_STATUS_INVALID_SLANT: return "INVALID_SLANT";
+ case CAIRO_INT_STATUS_INVALID_WEIGHT: return "INVALID_WEIGHT";
+ case CAIRO_INT_STATUS_INVALID_SIZE: return "INVALID_SIZE";
+ case CAIRO_INT_STATUS_USER_FONT_NOT_IMPLEMENTED: return "USER_FONT_NOT_IMPLEMENTED";
+ case CAIRO_INT_STATUS_DEVICE_TYPE_MISMATCH: return "DEVICE_TYPE_MISMATCH";
+ case CAIRO_INT_STATUS_DEVICE_ERROR: return "DEVICE_ERROR";
+ case CAIRO_INT_STATUS_INVALID_MESH_CONSTRUCTION: return "INVALID_MESH_CONSTRUCTION";
+ case CAIRO_INT_STATUS_DEVICE_FINISHED: return "DEVICE_FINISHED";
+ case CAIRO_INT_STATUS_JBIG2_GLOBAL_MISSING: return "JBIG2_GLOBAL_MISSING";
+ case CAIRO_INT_STATUS_PNG_ERROR: return "PNG_ERROR";
+ case CAIRO_INT_STATUS_FREETYPE_ERROR: return "FREETYPE_ERROR";
+ case CAIRO_INT_STATUS_WIN32_GDI_ERROR: return "WIN32_GDI_ERROR";
+ case CAIRO_INT_STATUS_TAG_ERROR: return "TAG_ERROR";
+ case CAIRO_INT_STATUS_DWRITE_ERROR: return "DWRITE_ERROR";
+
+ case CAIRO_INT_STATUS_LAST_STATUS: return "LAST_STATUS";
+
+ case CAIRO_INT_STATUS_UNSUPPORTED: return "UNSUPPORTED";
+ case CAIRO_INT_STATUS_DEGENERATE: return "DEGENERATE";
+ case CAIRO_INT_STATUS_NOTHING_TO_DO: return "NOTHING_TO_DO";
+ case CAIRO_INT_STATUS_FLATTEN_TRANSPARENCY: return "FLATTEN_TRANSPARENCY";
+ case CAIRO_INT_STATUS_IMAGE_FALLBACK: return "IMAGE_FALLBACK";
+ case CAIRO_INT_STATUS_ANALYZE_RECORDING_SURFACE_PATTERN: return "ANALYZE_RECORDING_SURFACE_PATTERN";
+ }
+ return "UNKNOWN";
+}