Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions Sources/GPUImage/PictureInput.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ public class PictureInput: ImageSource {
var internalTexture: Texture?
var hasProcessedImage: Bool = false
var internalImage: CGImage?
let orientation: ImageOrientation

public init(
image: CGImage, smoothlyScaleOutput: Bool = false, orientation: ImageOrientation = .portrait
) {
internalImage = image
self.orientation = orientation
}

#if canImport(UIKit)
Expand Down Expand Up @@ -80,7 +82,7 @@ public class PictureInput: ImageSource {
let imageTexture = try textureLoader.newTexture(
cgImage: internalImage!, options: [MTKTextureLoader.Option.SRGB: false])
internalImage = nil
self.internalTexture = Texture(orientation: .portrait, texture: imageTexture)
self.internalTexture = Texture(orientation: self.orientation, texture: imageTexture)
self.updateTargetsWithTexture(self.internalTexture!)
self.hasProcessedImage = true
} catch {
Expand All @@ -97,7 +99,7 @@ public class PictureInput: ImageSource {
fatalError("Nil texture received")
}
self.internalImage = nil
self.internalTexture = Texture(orientation: .portrait, texture: texture)
self.internalTexture = Texture(orientation: self.orientation, texture: texture)
DispatchQueue.global().async {
self.updateTargetsWithTexture(self.internalTexture!)
self.hasProcessedImage = true
Expand Down