Fix dispatch group and not all columns loading
This commit is contained in:
parent
861d478d89
commit
bf0aa43b76
1 changed files with 2 additions and 6 deletions
|
@ -158,8 +158,6 @@ class Document: NSDocument {
|
|||
let queue = DispatchQueue(label: "imageWork")
|
||||
|
||||
DispatchQueue.concurrentPerform(iterations: chunkPaths.count) { (i: Int) in
|
||||
dispatchGroup.enter()
|
||||
|
||||
guard let threadArchive = Archive(data: self.data!, accessMode: Archive.AccessMode.read) else {
|
||||
return
|
||||
}
|
||||
|
@ -212,12 +210,10 @@ class Document: NSDocument {
|
|||
|
||||
let image = NSImage(cgImage: cgimage, size: NSZeroSize)
|
||||
|
||||
queue.async(flags: .barrier) {
|
||||
queue.async(group: dispatchGroup) {
|
||||
layer.data.chunks[i].image = image
|
||||
layer.data.chunks[i].x = x
|
||||
layer.data.chunks[i].y = y
|
||||
|
||||
dispatchGroup.leave()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -251,7 +247,7 @@ class Document: NSDocument {
|
|||
info.height = height!
|
||||
|
||||
columns = Int(ceil(Float(info.width) / Float(info.tileSize)))
|
||||
rows = Int(ceil(Float(info.height) / Float(info.tileSize)))
|
||||
rows = Int(ceil(Float(info.height) / Float(info.tileSize))) + 1 // TODO: lol why
|
||||
|
||||
if info.width % info.tileSize != 0 {
|
||||
remainderWidth = (columns * info.tileSize) - info.width
|
||||
|
|
Reference in a new issue