Skip to content

Commit

Permalink
clean
Browse files Browse the repository at this point in the history
  • Loading branch information
SusanDoggie committed Sep 30, 2017
1 parent a819a00 commit f5dff9b
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions Sources/Doggie/ImageContext/ImageContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,23 @@ public class ImageContext<Pixel: ColorPixelProtocol> {

public private(set) var image: Image<Pixel>

private var clip: [Double]
private var depth: [Double]
private var clip: MappedBuffer<Double>
private var depth: MappedBuffer<Double>

private var styles: ImageContextStyles = ImageContextStyles()

private var next: ImageContext?

public init(image: Image<Pixel>) {
self.image = image
self.clip = [Double](repeating: 1, count: image.width * image.height)
self.depth = [Double](repeating: 1, count: image.width * image.height)
self.clip = MappedBuffer(repeating: 1, count: image.width * image.height, option: image.option)
self.depth = MappedBuffer(repeating: 1, count: image.width * image.height, option: image.option)
}

public init(width: Int, height: Int, resolution: Resolution = Resolution(resolution: 1, unit: .point), colorSpace: ColorSpace<Pixel.Model>, option: MappedBufferOption = .default) {
self.image = Image(width: width, height: height, resolution: resolution, colorSpace: colorSpace, option: option)
self.clip = [Double](repeating: 1, count: width * height)
self.depth = [Double](repeating: 1, count: width * height)
self.clip = MappedBuffer(repeating: 1, count: width * height, option: option)
self.depth = MappedBuffer(repeating: 1, count: width * height, option: option)
}
}

Expand Down Expand Up @@ -417,6 +417,6 @@ extension ImageContext {

try body(_clip)

self.clip = _clip.image.pixels.map { $0.color.white * $0.opacity }
self.clip = MappedBuffer(_clip.image.pixels.lazy.map { $0.color.white * $0.opacity }, option: image.option)
}
}

0 comments on commit f5dff9b

Please sign in to comment.