Skip to content

Commit

Permalink
Fix ImageRenderer - recorver error from creating copy image (#166)
Browse files Browse the repository at this point in the history
  • Loading branch information
muukii authored Apr 1, 2022
1 parent b823bb1 commit a84f0fe
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions Sources/BrightroomEngine/Engine/ImageRenderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,18 @@ public final class ImageRenderer {
*/
EngineLog.debug(
.renderer,
"Fixing colorspace \(sourceCGImage.colorSpace?.name as NSString? ?? "") -> \(options.workingColorSpace.name as NSString? ?? "")"
"Fixing colorspace \(sourceCGImage.colorSpace as Any) -> \(options.workingColorSpace)"
)

let fixedColorspace: CGImage = try sourceCGImage.copy(colorSpace: options.workingColorSpace)
.unwrap(orThrow: "Failed to copy with fixing colorspace.")
let fixedColorspace: CGImage
do {
fixedColorspace = try sourceCGImage.copy(colorSpace: options.workingColorSpace)
.unwrap(orThrow: "Failed to copy with fixing colorspace. \(sourceCGImage.colorSpace as Any), \(options.workingColorSpace)")
} catch {
EngineLog.error(.renderer, "Failed to create fixed colorspace image, \(error)")
fixedColorspace = sourceCGImage
}

assert(fixedColorspace.colorSpace == options.workingColorSpace)
/*
===
===
Expand Down

0 comments on commit a84f0fe

Please sign in to comment.