mirror of
https://github.com/exyte/Macaw.git
synced 2024-09-11 05:05:23 +03:00
Merge pull request #680 from amarunko/rendering-respects-screen-scale
Respects scale on rendering
This commit is contained in:
commit
af19c93db0
@ -84,10 +84,10 @@ open class Shape: Node {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fileprivate func createContext() -> CGContext? {
|
fileprivate func createContext() -> CGContext? {
|
||||||
|
let screenScale: CGFloat = MMainScreen()?.mScale ?? 1.0
|
||||||
let smallSize = CGSize(width: 1.0, height: 1.0)
|
let smallSize = CGSize(width: 1.0, height: 1.0)
|
||||||
|
|
||||||
MGraphicsBeginImageContextWithOptions(smallSize, false, 1.0)
|
MGraphicsBeginImageContextWithOptions(smallSize, false, screenScale)
|
||||||
|
|
||||||
return MGraphicsGetCurrentContext()
|
return MGraphicsGetCurrentContext()
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ class GroupRenderer: NodeRenderer {
|
|||||||
renderers.removeAll()
|
renderers.removeAll()
|
||||||
|
|
||||||
renderers = group.contents.compactMap { child -> NodeRenderer? in
|
renderers = group.contents.compactMap { child -> NodeRenderer? in
|
||||||
return RenderUtils.createNodeRenderer(child, view: view, parentRenderer: self)
|
RenderUtils.createNodeRenderer(child, view: view, parentRenderer: self)
|
||||||
}
|
}
|
||||||
|
|
||||||
var parent: NodeRenderer = self
|
var parent: NodeRenderer = self
|
||||||
|
@ -254,7 +254,8 @@ class NodeRenderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func renderToImage(bounds: Rect, inset: Double = 0, coloringMode: ColoringMode = .rgb) -> MImage {
|
func renderToImage(bounds: Rect, inset: Double = 0, coloringMode: ColoringMode = .rgb) -> MImage {
|
||||||
MGraphicsBeginImageContextWithOptions(CGSize(width: bounds.w + inset, height: bounds.h + inset), false, 1)
|
let screenScale: CGFloat = MMainScreen()?.mScale ?? 1.0
|
||||||
|
MGraphicsBeginImageContextWithOptions(CGSize(width: bounds.w + inset, height: bounds.h + inset), false, screenScale)
|
||||||
let tempContext = MGraphicsGetCurrentContext()!
|
let tempContext = MGraphicsGetCurrentContext()!
|
||||||
|
|
||||||
// flip y-axis and leave space for the blur
|
// flip y-axis and leave space for the blur
|
||||||
|
Loading…
Reference in New Issue
Block a user