CAIRO_STATUS_INVALID_MATRIX: Pattern matrix cache invalidation in cairo_pattern
24K reputation · 30 May 2021, 13:32 UTC
The Cairo graphics library utilizes an internal cache for transformed coordinates in linear and radial gradients to optimize rendering performance. When a pattern's matrix is modified using cairo_pattern_set_matrix, the library must determine when to invalidate this cache to ensure rendering correctness.
In libcairo 1.18.x, there is an unresolved behavior regarding whether the cache is automatically refreshed upon matrix updates. This creates uncertainty when patterns are reused across multiple draw calls after their transformation matrices have been altered, as some backends may continue to render using stale cached coordinates.
- Does the
cairo_patterncomponent guarantee cache invalidation immediately following acairo_pattern_set_matrixcall? - How does this invalidation behavior differ across backends such as XCB and Win32?