Skip to content

fix: use pixel dimensions for wallpaper images#45

Open
Grumpicus wants to merge 3 commits into
spreadpaper:mainfrom
Grumpicus:fix-image-pixel-dimensions
Open

fix: use pixel dimensions for wallpaper images#45
Grumpicus wants to merge 3 commits into
spreadpaper:mainfrom
Grumpicus:fix-image-pixel-dimensions

Conversation

@Grumpicus

@Grumpicus Grumpicus commented Jul 6, 2026

Copy link
Copy Markdown

Fixes image sizing for files whose DPI metadata causes NSImage.size to report point dimensions instead of actual pixels.

Example: a 7680x1440 JPEG with 1 DPI metadata was shown as 552960x103680+ in the editor.

Changes:

  • Add an NSImage.pixelSize helper using NSBitmapImageRep.pixelsWide/pixelsHigh, falling back to CGImage.width/height
  • Use pixel dimensions for editor labels, fit-to-canvas math, canvas preview sizing, thumbnails, and render sizing

Validation:

xcodebuild -scheme SpreadPaper -configuration Debug -derivedDataPath /tmp/SpreadPaperForkDerivedData build

@Grumpicus
Grumpicus force-pushed the fix-image-pixel-dimensions branch from 4f5fe67 to 13cd426 Compare July 6, 2026 20:15
@Grumpicus

Copy link
Copy Markdown
Author

Small note on the nonisolated changes:

This project has SWIFT_DEFAULT_ACTOR_ISOLATION = MainActor, so file-level functions/properties are inferred as main-actor isolated unless marked otherwise.

pixelSize is used from WallpaperManager.renderForScreen, which is already nonisolated, so the property also needs to be explicitly nonisolated.

renderThumbnails(jobs:) is called from a Task.detached thumbnail-rendering path, so it also needs to be callable outside the main actor. The previous @Sendable annotation conflicts with the inferred main-actor isolation and triggers a Swift 6 diagnostic. Making the function nonisolated is the relevant fix here; the detached task closure remains the concurrency boundary, and ThumbnailJob / ThumbnailResult already cover the sendability requirements for the values crossing that boundary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant