Skip to content

Commit

Permalink
Merge pull request #903 from MarcFerry/master
Browse files Browse the repository at this point in the history
fix: render view x origin when using isMirrored option with MTHKView
  • Loading branch information
shogo4405 authored Sep 8, 2021
2 parents a770393 + cf2951f commit 6e7ae46
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Sources/Media/MTHKView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,6 @@ extension MTHKView: MTKViewDelegate {
}
let bounds = CGRect(origin: .zero, size: drawableSize)
var scaledImage: CIImage = displayImage
.transformed(by: CGAffineTransform(translationX: translationX, y: translationY))
.transformed(by: CGAffineTransform(scaleX: scaleX, y: scaleY))

if isMirrored {
if #available(iOS 11.0, tvOS 11.0, macOS 10.13, *) {
Expand All @@ -125,6 +123,10 @@ extension MTHKView: MTKViewDelegate {
}
}

scaledImage = scaledImage
.transformed(by: CGAffineTransform(translationX: translationX, y: translationY))
.transformed(by: CGAffineTransform(scaleX: scaleX, y: scaleY))

context.render(scaledImage, to: currentDrawable.texture, commandBuffer: commandBuffer, bounds: bounds, colorSpace: colorSpace)
commandBuffer.present(currentDrawable)
commandBuffer.commit()
Expand Down

0 comments on commit 6e7ae46

Please sign in to comment.