mac/common: add support for transparent rendering
this adds support for possible transparent rendering by setting the window and layer background to transparent. NOTE: atm only possible with libplacebo master.
This commit is contained in:
1 parent
9aebe4cb01
commit
ce694c1eba
2 files changed
+5
No files matched your search
@@ -84,6 +84,7 @@ class MetalLayer: CAMetalLayer {
|
|||||||
let isForced = newValue == wantsAlpha
|
let isForced = newValue == wantsAlpha
|
||||||
if isOpaque == wantsAlpha || isForced {
|
if isOpaque == wantsAlpha || isForced {
|
||||||
super.isOpaque = !wantsAlpha
|
super.isOpaque = !wantsAlpha
|
||||||
|
backgroundColor = (wantsAlpha ? NSColor.clear : NSColor.black).cgColor
|
||||||
log.verbose("Metal layer is opaque (direct-to-display possible): \(isOpaque)" + (isForced ? " (forced)" : ""))
|
log.verbose("Metal layer is opaque (direct-to-display possible): \(isOpaque)" + (isForced ? " (forced)" : ""))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,6 +117,10 @@ class MacCommon: Common {
|
|||||||
|
|
||||||
@objc func update(alpha: Bool) {
|
@objc func update(alpha: Bool) {
|
||||||
layer?.wantsAlpha = alpha
|
layer?.wantsAlpha = alpha
|
||||||
|
DispatchQueue.main.sync {
|
||||||
|
window?.isOpaque = !alpha
|
||||||
|
window?.backgroundColor = alpha ? NSColor.clear : nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override func displayLinkCallback(_ displayLink: CVDisplayLink,
|
override func displayLinkCallback(_ displayLink: CVDisplayLink,
|
||||||
|
|||||||
Reference in new issue
Block a user