Add C API for DebugCanvas SKP introspection#174
Draft
mattleibow wants to merge 1 commit into
Draft
Conversation
Add sk_debugger.h/cpp wrapping Skia's DebugCanvas for SKP file introspection. This enables loading .skp files and decomposing them into individual draw commands with full JSON metadata. New C API functions (14 total): - sk_debug_canvas_new/destroy — lifecycle - sk_debug_canvas_load_skp — parse SKP bytes into commands - sk_debug_canvas_get_command_count — query command count - sk_debug_canvas_draw/draw_to — render all or up to index - sk_debug_canvas_get_command_list_json — JSON command list - sk_debug_canvas_get_command_info_json — matrix/clip state - sk_debug_canvas_set_command_visibility — toggle commands - sk_debug_canvas_delete_command — remove commands - sk_debug_canvas_set_overdraw_vis — overdraw visualization - sk_debug_canvas_set_clip_viz_color — clip region color - sk_debug_canvas_set_origin_visible — origin crosshair - sk_debug_canvas_get_bounds — canvas dimensions Build integration: - Gated behind existing skia_build_for_debugger GN flag - BUILD.gn adds debugger sources when flag is true - SkiaKeeper.c references prevent dead-stripping on all platforms Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a C API layer wrapping Skia's
DebugCanvasclass, enabling SKP file introspection from managed code (C#/SkiaSharp). This is the native component needed for the SkiaSharp WASM Debugger.New Files
include/c/sk_debugger.h— 14 C API function declarationssrc/c/sk_debugger.cpp— Implementation wrappingDebugCanvas,DrawCommand,SkJSONWriterModified Files
include/c/sk_types.h— Addedsk_debug_canvas_topaque handlesrc/c/sk_types_priv.h— AddedDEF_CLASS_MAPfor DebugCanvasBUILD.gn— Added debugger sources underskia_build_for_debuggerflagsrc/xamarin/SkiaKeeper.c— Added debugger symbol references to prevent dead-strippingAPI Surface
sk_debug_canvas_new/destroysk_debug_canvas_load_skpsk_debug_canvas_get_command_countsk_debug_canvas_draw/draw_tosk_debug_canvas_get_command_list_jsonsk_debug_canvas_get_command_info_jsonsk_debug_canvas_set_command_visibilitysk_debug_canvas_delete_commandsk_debug_canvas_set_overdraw_vissk_debug_canvas_set_clip_viz_colorsk_debug_canvas_set_origin_visiblesk_debug_canvas_get_boundsBuild
Gated behind the existing
skia_build_for_debuggerGN flag — no impact on normal builds.