Skip to content

Commit

Permalink
Remove enum ImageTransform.
Browse files Browse the repository at this point in the history
  • Loading branch information
shogo4405 committed Jun 8, 2024
1 parent 42dd089 commit f502265
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 112 deletions.
5 changes: 0 additions & 5 deletions HaishinKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,6 @@
BC8A29942AA63DA300F6D27F /* HaishinKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2945CBBD1B4BE66000104112 /* HaishinKit.framework */; };
BC8A29952AA63DA300F6D27F /* HaishinKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 2945CBBD1B4BE66000104112 /* HaishinKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
BC93792F2ADD76BE001097DB /* AVAudioCompressedBuffer+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC93792E2ADD76BE001097DB /* AVAudioCompressedBuffer+Extension.swift */; };
BC959EEF296EE4190067BA97 /* ImageTransform.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC959EEE296EE4190067BA97 /* ImageTransform.swift */; };
BC959F0E29705B1B0067BA97 /* SCStreamPublishViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC959F0D29705B1B0067BA97 /* SCStreamPublishViewController.swift */; };
BC959F1229717EDB0067BA97 /* PreferenceViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC959F1129717EDB0067BA97 /* PreferenceViewController.swift */; };
BC9CFA9323BDE8B700917EEF /* IOStreamView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC9CFA9223BDE8B700917EEF /* IOStreamView.swift */; };
Expand Down Expand Up @@ -677,7 +676,6 @@
BC7C56D029A78D4F00C41A9B /* ADTSHeaderTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ADTSHeaderTests.swift; sourceTree = "<group>"; };
BC83A4722403D83B006BDE06 /* VTCompressionSession+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "VTCompressionSession+Extension.swift"; sourceTree = "<group>"; };
BC93792E2ADD76BE001097DB /* AVAudioCompressedBuffer+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AVAudioCompressedBuffer+Extension.swift"; sourceTree = "<group>"; };
BC959EEE296EE4190067BA97 /* ImageTransform.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageTransform.swift; sourceTree = "<group>"; };
BC959F0D29705B1B0067BA97 /* SCStreamPublishViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SCStreamPublishViewController.swift; sourceTree = "<group>"; };
BC959F1129717EDB0067BA97 /* PreferenceViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreferenceViewController.swift; sourceTree = "<group>"; };
BC9CFA9223BDE8B700917EEF /* IOStreamView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IOStreamView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -888,7 +886,6 @@
BC3E384329C216BB007CD972 /* ADTSReaderTests.swift */,
2917CB652104CA2800F6823A /* AudioSpecificConfigTests.swift */,
BC1720A82C03473200F65941 /* AVCDecoderConfigurationRecordTests.swift */,
BCCBCE9429A7C9C90095B51C /* AVCFormatStreamTests.swift */,
BC7C56C629A7701F00C41A9B /* ESSpecificDataTests.swift */,
BC1DC5112A04E46E00E928ED /* HEVCDecoderConfigurationRecordTests.swift */,
BCCBCE9429A7C9C90095B51C /* ISOTypeBufferUtilTests.swift */,
Expand Down Expand Up @@ -1296,7 +1293,6 @@
isa = PBXGroup;
children = (
BC9F9C7726F8C16600B01ED0 /* Choreographer.swift */,
BC959EEE296EE4190067BA97 /* ImageTransform.swift */,
BCDEB4F92BE442F900EEC6ED /* Screen.swift */,
BC16019B2BE0E4750061BD3E /* ScreenObject.swift */,
BCDEB4FB2BE4436D00EEC6ED /* ScreenObjectContainer.swift */,
Expand Down Expand Up @@ -1948,7 +1944,6 @@
29B876921CD70AFE00FC07DA /* IOMixer.swift in Sources */,
29DC17B321D0CC0600E26CED /* Atomic.swift in Sources */,
BCDEB4F82BE441D300EEC6ED /* ScreenRenderer.swift in Sources */,
BC959EEF296EE4190067BA97 /* ImageTransform.swift in Sources */,
2942424D1CF4C01300D65DCB /* MD5.swift in Sources */,
29EA87D31E799F360043A5F8 /* ExpressibleByIntegerLiteral+Extension.swift in Sources */,
29B876901CD70AFE00FC07DA /* IOAudioUnit.swift in Sources */,
Expand Down
65 changes: 0 additions & 65 deletions Sources/Screen/ImageTransform.swift

This file was deleted.

23 changes: 0 additions & 23 deletions Sources/Screen/Shape.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,29 +28,6 @@ class RoundedSquareShape: Shape {
return context.makeImage()
}
}

class HalfRectShape: Shape {
var rect: CGRect = .zero
var direction: ImageTransform = .east

func makeCGImage() -> CGImage? {
guard let context = CGContext(
data: nil,
width: Int(rect.width),
height: Int(rect.height),
bitsPerComponent: 8,
bytesPerRow: Int(rect.width) * 4,
space: CGColorSpaceCreateDeviceRGB(),
bitmapInfo: CGBitmapInfo(rawValue: CGImageAlphaInfo.premultipliedFirst.rawValue).rawValue
) else {
return nil
}
context.setFillColor(NSColor.white.cgColor)
context.addRect(direction.makeRect(rect))
context.fillPath()
return context.makeImage()
}
}
#else
import UIKit

Expand Down
19 changes: 0 additions & 19 deletions Sources/Screen/ShapeFactory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ class ShapeFactory {

private var imageBuffers: [String: vImage_Buffer] = [:]
private var roundedSquareShape = RoundedSquareShape()
private var halfRectShape = HalfRectShape()

func cornerRadius(_ size: CGSize, cornerRadius: CGFloat) -> vImage_Buffer {
let key = "\(size.width):\(size.height):\(cornerRadius)"
Expand All @@ -31,24 +30,6 @@ class ShapeFactory {
return imageBuffer
}

func split(_ size: CGSize, direction: ImageTransform) -> vImage_Buffer {
let key = "\(size.width):\(size.height):\(direction)"
if let buffer = imageBuffers[key] {
return buffer
}
var imageBuffer = vImage_Buffer()
halfRectShape.rect = .init(origin: .zero, size: size)
halfRectShape.direction = direction
guard
let image = halfRectShape.makeCGImage(),
var format = vImage_CGImageFormat(cgImage: image),
vImageBuffer_InitWithCGImage(&imageBuffer, &format, nil, image, vImage_Flags(kvImageNoFlags)) == kvImageNoError else {
return imageBuffer
}
imageBuffers[key] = imageBuffer
return imageBuffer
}

func removeAll() {
for buffer in imageBuffers.values {
buffer.free()
Expand Down

0 comments on commit f502265

Please sign in to comment.