Skip to content

Commit

Permalink
Fix flipping image on preview for simulator (FluidGroup#205)
Browse files Browse the repository at this point in the history
as iOS 17 fixed geometry issue on simulator. we don't need to use the
workaround
  • Loading branch information
muukii authored Nov 24, 2023
1 parent 1e203bb commit dcce61e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,15 @@
"version" : "1.3.1"
}
},
{
"identity" : "swift-syntax",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-syntax.git",
"state" : {
"revision" : "6ad4ea24b01559dde0773e3d091f1b9e36175036",
"version" : "509.0.2"
}
},
{
"identity" : "texture",
"kind" : "remoteSourceControl",
Expand Down Expand Up @@ -104,8 +113,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/VergeGroup/Verge.git",
"state" : {
"revision" : "23b6e92fbf88e72ce0546144fbc1dc455cb5d53d",
"version" : "11.5.4"
"revision" : "a338c22b82c9a686a7131b54fa84ddad773f5c2a",
"version" : "12.0.0-beta.4"
}
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,16 +189,26 @@ open class MetalImageView: MTKView, CIImageDisplaying, MTKViewDelegate {
let resolvedImage: CIImage

#if targetEnvironment(simulator)

if #available(iOS 17, *) {
// Fixes geometry in Metal
resolvedImage =
image
resolvedImage = image
.transformed(by: CGAffineTransform(scaleX: scale, y: scale))
.transformed(by: CGAffineTransform(translationX: targetRect.origin.x, y: targetRect.origin.y))

} else {
// Fixes geometry in Metal
resolvedImage = image
.transformed(
by: CGAffineTransform(scaleX: 1, y: -1)
.concatenating(.init(translationX: 0, y: image.extent.height))
.concatenating(.init(scaleX: scale, y: scale))
.concatenating(.init(translationX: targetRect.origin.x, y: targetRect.origin.y))
)

}


#else
resolvedImage =
image
Expand Down

0 comments on commit dcce61e

Please sign in to comment.