[GUI] Replace dual Cairo+Recorder command stream architecture with direct SKSurface/SKCanvas backing in Cairo wrapper
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
- Issue type
- Refactor
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- csharp
- Domain
- computer-graphics, desktop
Research direction
Start by reading the Cairo wrapper in sources/Cairo/wrapper/, especially the Cairo.ImageSurface and Cairo.Context implementations, along with the existing SurfaceRecorder and managed graphics state code. Trace how drawing calls reach the native Cairo surface and the recorder, then compare that flow with the proposed SKSurface and SKCanvas backing. Done means drawing is forwarded through SkiaSharp and the recorder, managed state, and pixel-emulation layers are removed.
Written by the indexing model from the issue text.
Description
Problem
The current SkiaSharp GUI implementation (sources/Cairo/wrapper/, +20,777 lines across 30 files) keeps native libcairo-2 surfaces alive alongside a custom command recorder (SurfaceRecorder, ManagedGraphicsState, RecordedGuiDrawing, RecordedPreparationCache):
- Every
Cairo.Contextcall records intermediate command objects and clones clip/path/paint state intoSurfaceRecorder, while also maintaining fallback paths to materialize commands back onto a nativelibcairo-2surface. - Keeping both
libcairo-2andSkiaSharpactive duplicates graphics state tracking, inflates memory allocations duringGuiComposer.Compose(), and prevents removing the nativelibcairo-2dependency.
Proposed Fix
- Back
Cairo.ImageSurfacedirectly with anSKSurface(GPU-backed when on the render thread with an activeGRContext, or rasterSKSurfacewhen accessed from CPU pixel APIs such asDataPtr). - Make
Cairo.Contexta thin translation wrapper (~1,000 lines) that forwards drawing calls (MoveTo,LineTo,Arc,Rectangle,Fill,Stroke,Clip,ShowText,SetSource*) directly to the underlyingSKCanvas,SKPath,SKPaint, andSKFont. - Eliminate
SurfaceRecorder,ManagedGraphicsState, and the Cairo pixel-emulation layers once directSKCanvasbacking is in place.
- Dominant language
- C#
- Stars
- 22
- Forks
- 4
- Avg merge
- 1h 11m
- Merged PRs (30d)
- 40
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from StratumServer/Optimum
-
complexity: easy performance rendering
Difficulty 4/5 3-5 days Newbie friendliness 52/100
StratumServer/Optimum#228 ·
Maintainers usually reply within 1 day
-
complexity: medium performance rendering
Difficulty 5/5 Over a week Newbie friendliness 32/100
StratumServer/Optimum#227 ·
Maintainers usually reply within 1 day
-
complexity: medium enhancement rendering
Difficulty 5/5 Over a week Newbie friendliness 24/100
StratumServer/Optimum#226 ·
Maintainers usually reply within 1 day
-
complexity: hard performance rendering
Difficulty 5/5 Over a week Newbie friendliness 35/100
StratumServer/Optimum#225 ·
Maintainers usually reply within 1 day
-
[GUI] Avoid per-command clip array cloning and redundant SKPath allocations in SurfaceRecorderPossibly taken @Zaldaryon claimed this today. Opencomplexity: medium performance rendering
Difficulty 4/5 3-5 days Newbie friendliness 35/100
StratumServer/Optimum#224 ·
Maintainers usually reply within 1 day
All issues in StratumServer/Optimum
Similar issues
-
needs-triage
Difficulty 1/5 1-3 hours Newbie friendliness 76/100
Azure/azure-sdk-for-net#64658 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
dotnet/aspnetcore#70370 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
NethermindEth/nethermind#15684 ·
Maintainers usually reply within 1 day
-
area/ai-assistant squad/flyt
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
Altinn/altinn-studio#21798 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
SubtitleEdit/subtitleedit#16699 ·
Maintainers usually reply within 1 day