Remove dead editing-canvas API stranded by the scaffold deletion - #325
Open
muukii wants to merge 1 commit into
Open
Remove dead editing-canvas API stranded by the scaffold deletion#325muukii wants to merge 1 commit into
muukii wants to merge 1 commit into
Conversation
The standalone `_EditingCanvasView` development scaffold was deleted in 879c6c8. It was the only consumer of several EditingCanvas members, which survived as public/internal surface with no callers. Each item below was verified dead with a repo-wide grep over Sources/ and Dev/ before removal. EC-03 Dead metrics apparatus (EditingCanvasMTKView) `onMetricsChange` was never assigned and the four counters never read; the demo diagnostics overlay that subscribed died with the scaffold. Deletes `DrawMetrics`, `activeStampCount`, `committedStampCount`, `strokeCount`, `framesPerSecond`, `onMetricsChange`, `recordDrawSample`, `publishLiveMetricsIfNeeded`, and the two metrics fields of `LiveRefreshState` (now a display-link holder), plus the per-draw and per-display-link-tick work that fed them. `#if DEBUG` `PerformanceDiagnostics` is untouched — it still logs. EC-04 Dead viewport API (EditingCanvasMTKView) `Viewport.zoomScale` was never read: `updateViewport` consumes only `visibleContentRect` and `visibleCanvasFrame`. Removes the field, the now-unused `CropDisplayViewport.zoomScale` that fed it through the `editingCanvasViewport` bridge, and the 3-argument `setViewport` overload that had zero callers, leaving `setViewport(_:)` as the single entry point. EC-05 PublicTypes drift Deletes the unused `EditingCanvasMode.localEffect`/`activeLocalEffect` and the stale `.interactionMode(.view)` doc reference (that API was deleted with the scaffold). Demotes `EditingCanvasMode` and `EditingCanvasBrush` to internal — neither appears in a public signature. Strips `CaseIterable`/`Identifiable`/`title` from `EditingCanvasStrokeSmoothingAlgorithm` (scaffold debug-picker support); the enum and `EditingCanvasStrokeSmoothingConfiguration` stay public, reachable via `SwiftUICropView.strokeSmoothing`. Renames the file to EditingCanvasConfiguration.swift. EC-06 Dead displayedContentRect (EditingCanvasRenderImageFactory) No caller ever passed it, so `sanitizedRenderBounds` always took its `guard let` exit and `renderBounds` was always `canvasRect`. Drops the parameter from all three signatures, deletes the sanitizer, and uses `canvasRect` directly. Behavior-identical. EC-10 StrokeCommitPipeline surface Deletes `updateEffect(_:in:insertingBefore:)` (zero callers). Makes `replaceLocalAdjustments` and the layer lookup private — both are called only from inside the class. Renames `layerIndex` to `adoptedLayerIndex` to state the `layerID` mutation it performs behind an index-getter name. Moves `editingCanvasEffectIdentity` here from the rendering file, next to its identity-matching use. EC-11 Geometry file drift Deletes five dead diagnostics extensions (`CGSize.simdFloat2`, `CGFloat/Double.logString`, `CGRect.logDescription`, `CGPoint.simdFloat2`) left by the removed [ToolZoomDiag] logging, and renames the file to EditingCanvasImageProcessing.swift after what it actually holds: the canvas color/pixel-format contract. The contract itself is unchanged. EC-12 Copy-pasted imports Trims EditingCanvasStroke.swift, EditingCanvasDrawingGestureRecognizer .swift, and the renamed image-processing file to the imports they use. Verified: SwiftUIDemo builds clean (no new warnings in the touched files); the full BrightroomEngineTests suite passes, 153 tests in 36 suites. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
muukii
force-pushed
the
chore/editing-canvas-api-purge
branch
from
August 27, 2026 12:06
22a222d to
9578be7
Compare
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.
The standalone
_EditingCanvasViewdevelopment scaffold was deleted in 879c6c8 (-1853lines). It was the only consumer of a number of EditingCanvas members, which survived as public/internal surface with no callers. This PR removes them.Rule applied: every symbol, parameter, and conformance below was verified dead with a repo-wide grep over
Sources/andDev/before removal. Grep evidence is listed per item. Where a proposal reduced access control instead of deleting, behavior is identical. No item was skipped — all seven applied cleanly.Renames use
git mv, so history follows (both tracked as renames: 57% and 90% similarity).EC-03 — Dead metrics apparatus (
EditingCanvasMTKView.swift)onMetricsChangewas never assigned, and the four counters were never read. The demo diagnostics overlay that subscribed to them died with the scaffold; theDrawMetricsdoc comment still advertised it.Deleted:
DrawMetrics,drawMetrics,activeStampCount,committedStampCount,strokeCount,framesPerSecond,onMetricsChange,recordDrawSample,publishLiveMetricsIfNeeded, andLiveRefreshState.lastMetricsPublishTime/.metricsPublishInterval(the struct collapses to a display-link holder). TheonMetricsChange?()call sites inupdateViewport,reset,finishCommittedStrokeRendering, thedraw(in:)defer, and the display-link tick go with them, removing per-draw and per-tick work.#if DEBUG PerformanceDiagnosticsis untouched — it has real log output.EC-04 — Dead viewport API (
EditingCanvasMTKView.swift)Viewport.zoomScalewas never read —updateViewportconsumes onlyvisibleContentRectandvisibleCanvasFrame. A struct field the renderer ignores misleads: it suggests the render depends on zoom when zoom is in fact derived from the two rects.Deleted: the
zoomScalefield onViewport; theCropDisplayViewport.zoomScalethat threaded it in (the bridge atCropView.swift:3085was its only reader, so it would otherwise have become newly dead) and its two construction sites; and the unused 3-argumentsetViewport(visibleContentRect:visibleCanvasFrame:zoomScale:)overload.setViewport(_ viewport: Viewport)is now the single entry point.EC-05 —
EditingCanvasPublicTypes.swiftdrift'PublicTypes' was neither an honest name nor shape.
EditingCanvasMode.localEffectand.activeLocalEffect— zero callers.Use this mode with .interactionMode(.view)— that API no longer exists anywhere (deleted with the scaffold).EditingCanvasModeandEditingCanvasBrushto internal — neither appears in any public signature (the actual public brush API isCropViewMaskingBrush).CaseIterable,Identifiable,id, andtitle(picker copy: "Catmull"/"Avg") fromEditingCanvasStrokeSmoothingAlgorithm— they existed for the scaffold's debug picker. The enum andEditingCanvasStrokeSmoothingConfigurationstay public: they are reachable viaSwiftUICropView.strokeSmoothing(_:).EditingCanvasConfiguration.swift.EC-06 — Dead
displayedContentRect(EditingCanvasRenderImageFactory.swift)The parameter was threaded through all three
makeRenderImagessignatures but never passed by any caller, sosanitizedRenderBoundsalways took itsguard let rect else { return canvasRect }exit andrenderBoundswas alwayscanvasRect— ~25 lines sanitizing a value that could not occur, making the factory look viewport-aware when it is not.Deleted the parameter from all three signatures and deleted
sanitizedRenderBounds; the fiverenderBoundsuses now readcanvasRectdirectly. Behavior-identical. Also updated a stale comment inMaskedPreviewExportScaleConsistencyTests.swift:151that referenced the removed parameter.EC-10 —
EditingCanvasStrokeCommitPipelinesurfaceSpeculative API on the single owner of commit semantics is where drift starts: the class doc promises frozen pipelines, and an uncalled mutator of those pipelines is the loophole.
updateEffect(_:in:insertingBefore:)— zero callers; it existed on the strength of its own doc comment, which is also removed.replaceLocalAdjustmentsand the layer lookupprivate— both are called only from inside the class.layerIndex(in:matching:)→adoptedLayerIndex(in:matching:): it read as a pure lookup but mutateslayerIDon the fallback path. The doc now states the adoption.editingCanvasEffectIdentityout of the rendering file (EditingCanvasRenderImageFactory.swift) into this file, next to its identity-matching use.Behavior of the pipeline is unchanged — only its unused surface and access control.
EC-11 — Geometry file drift
Deleted five dead diagnostics extensions left behind when the
[ToolZoomDiag]/chase logging was removed:CGSize.simdFloat2,CGFloat.logString,Double.logString,CGRect.logDescription,CGPoint.simdFloat2.Renamed the file
EditingCanvasGeometry.swift→EditingCanvasImageProcessing.swift(viagit mv) after what it actually holds:EditingCanvasImageProcessing, the canvas color/pixel-format contract whose comments carry the P3-clamp postmortem. The color contract itself is unchanged. TheCGPointmath used by stroke smoothing stays.EC-12 — Copy-pasted imports
Trimmed each file to the imports it uses:
EditingCanvasStroke.swift: wasCoreImage, BrightroomEngine, BrightroomParametric, IOSurface, MetalKit, os, simd, SwiftUI, UIKit→ nowBrightroomParametric, CoreGraphics, Foundation(pureCGPointmath plus oneBrushMaskStrokebridge).EditingCanvasDrawingGestureRecognizer.swift: wasCoreImage, BrightroomEngine, IOSurface, MetalKit, os, simd, SwiftUI, UIKit→ nowUIKit(a UIKit-only gesture recognizer).CoreImage, BrightroomEngine, IOSurface, MetalKit, os, simd, SwiftUI, UIKit→ nowCoreGraphics, CoreImage, Metal(simddropped as unused once EC-11'sSIMD2extensions went).Skipped items
None. All seven proposals had zero live users and applied as written.
Verification
xcodebuild -project Brightroom.xcodeproj -scheme SwiftUIDemo -destination 'generic/platform=iOS Simulator' build→** BUILD SUCCEEDED **, with no warnings in any touched file.BrightroomEngineTestson a freshly created private simulator with-parallel-testing-enabled NO→** TEST SUCCEEDED **, 153 tests in 36 suites passed (43.5s). Simulator deleted afterwards.Diff stat
🤖 Generated with Claude Code