Skip to content

Commit

Permalink
Bump swift-png to current version 4.4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
valeriyvan committed Apr 13, 2024
1 parent 2a3ac77 commit 85ee4ee
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 10 deletions.
14 changes: 11 additions & 3 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/tayloraswift/jpeg.git",
"state" : {
"branch" : "master",
"revision" : "fc21d193b85ad8593b0a894b1dec9bef56254058"
}
},
Expand All @@ -27,6 +26,15 @@
"version" : "1.1.4"
}
},
{
"identity" : "swift-hash",
"kind" : "remoteSourceControl",
"location" : "https://github.com/tayloraswift/swift-hash",
"state" : {
"revision" : "c7ba0cde5eb63042c2196b02b65a770101c1ac11",
"version" : "0.5.0"
}
},
{
"identity" : "swift-numerics",
"kind" : "remoteSourceControl",
Expand All @@ -41,8 +49,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/tayloraswift/swift-png.git",
"state" : {
"revision" : "075dfb248ae327822635370e9d4f94a5d3fe93b2",
"version" : "4.0.2"
"revision" : "4553010a4d293831627c15635fecabc788b9bebc",
"version" : "4.4.1"
}
},
{
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import PackageDescription

var dependencies: [Package.Dependency] = [
.package(url: "https://github.com/tayloraswift/swift-png.git", from: "4.0.2"), // try upgrade to latest 4.4.1
.package(url: "https://github.com/tayloraswift/swift-png.git", from: "4.4.1"),
.package(url: "https://github.com/tayloraswift/jpeg.git", revision: "fc21d193b85ad8593b0a894b1dec9bef56254058"),
.package(url: "https://github.com/pointfreeco/swift-snapshot-testing.git", from: "1.13.0"),
.package(url: "https://github.com/apple/swift-algorithms.git", from: "1.0.0"),
Expand Down
2 changes: 1 addition & 1 deletion Sources/geometrize-cli/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ let width, height: Int

switch inputUrl.pathExtension.lowercased() {
case "png":
guard let image: PNG.Data.Rectangular = try .decompress(path: inputUrl.path) else {
guard let image: PNG.Image = try .decompress(path: inputUrl.path) else {
print("Cannot read or decode input file \(inputUrl.path).")
exit(1)
}
Expand Down
8 changes: 4 additions & 4 deletions Tests/geometrizeTests/Bitmap+Extension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ extension Bitmap {
$0[$0.startIndex + 3]
)
}
let image: PNG.Data.Rectangular = PNG.Data.Rectangular(packing: rgba, size: (x: width, y: height), layout: PNG.Layout(format: .rgba8(palette: [], fill: nil)))
let image: PNG.Image = PNG.Image(packing: rgba, size: (x: width, y: height), layout: PNG.Layout(format: .rgba8(palette: [], fill: nil)))
var destinationStream = DestinationStream()
try image.compress(stream: &destinationStream)
return Data(destinationStream.data)
Expand All @@ -28,7 +28,7 @@ extension Bitmap {
}
}
var stream = SourceStream(bytes)
let image: PNG.Data.Rectangular = try decodeOnline(stream: &stream, overdraw: false) { _ in }
let image: PNG.Image = try decodeOnline(stream: &stream, overdraw: false) { _ in }
let rgba: [PNG.RGBA<UInt8>] = image.unpack(as: PNG.RGBA<UInt8>.self)
let bitmapData: [UInt8] = rgba.flatMap({ [$0.r, $0.g, $0.b, $0.a] })
self.init(width: image.size.0, height: image.size.1, data: bitmapData)
Expand Down Expand Up @@ -105,8 +105,8 @@ func waitChunk(stream: inout SourceStream) throws -> (type: PNG.Chunk, data: [UI
func decodeOnline(
stream: inout SourceStream,
overdraw: Bool,
capture: (PNG.Data.Rectangular) throws -> Void
) throws -> PNG.Data.Rectangular {
capture: (PNG.Image) throws -> Void
) throws -> PNG.Image {
// lex PNG signature bytes
try waitSignature(stream: &stream)
// lex header chunk, and preceeding cgbi chunk, if present
Expand Down
2 changes: 1 addition & 1 deletion Tests/geometrizeTests/ImageRunnerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ final class ImageRunnerTests: XCTestCase {
// seedRandomGenerator(9001)

let url = Bundle.module.url(forResource: "kris", withExtension: "png")!
let image: PNG.Data.Rectangular = try .decompress(path: url.path)!
let image: PNG.Image = try .decompress(path: url.path)!
let rgba: [PNG.RGBA<UInt8>] = image.unpack(as: PNG.RGBA<UInt8>.self)
let (width, height) = image.size

Expand Down

0 comments on commit 85ee4ee

Please sign in to comment.