performance updates
This commit is contained in:
@@ -180,7 +180,7 @@ final class DJNativeSpectrumView: DJWaveMouseView {
|
||||
private var hoverX: Double?
|
||||
private var tracking: NSTrackingArea?
|
||||
override init(frame: NSRect) {
|
||||
super.init(frame:frame)
|
||||
super.init(frame:frame);clipsToBounds = true
|
||||
freeze = { [weak self] start in self?.frozenViewport = start;self?.needsDisplay = true }
|
||||
}
|
||||
required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") }
|
||||
@@ -223,6 +223,12 @@ final class DJNativeSpectrumView: DJWaveMouseView {
|
||||
super.mouseDown(with:event)
|
||||
}
|
||||
override func draw(_ dirtyRect: NSRect) {
|
||||
guard let context = NSGraphicsContext.current?.cgContext else { return }
|
||||
context.saveGState()
|
||||
defer { context.restoreGState() }
|
||||
// Cached sections extend beyond the viewport while scrolling. Neither
|
||||
// those sections nor their markers may paint into adjacent deck controls.
|
||||
context.clip(to:bounds)
|
||||
NSColor.black.setFill();bounds.fill()
|
||||
guard let player,player.duration > 0,span > 0,!player.waveform.isEmpty else { return }
|
||||
let time = player.displayTime,start = frozenViewport ?? (time-span/2),width = bounds.width,height = bounds.height
|
||||
|
||||
Reference in New Issue
Block a user