From 0594bbf287371f38a77a8b6882ea2b6ea3dcd3f8 Mon Sep 17 00:00:00 2001 From: Kyle Date: Wed, 11 Mar 2026 02:00:28 +0800 Subject: [PATCH] [NFC] Use RB for properties and function and ORB for type --- .../DisplayList/AppKitDisplayList.swift | 4 +-- .../DisplayList/DisplayListViewDrawing.swift | 4 +-- .../Render/DisplayList/RenderBoxView.swift | 6 ++-- .../Render/DisplayList/UIKitDisplayList.swift | 4 +-- .../CAHostingLayerPlatformDefinition.swift | 2 +- .../Render/DisplayList/DisplayList.swift | 2 +- .../Render/PlatformDrawable.swift | 8 ++--- .../Render/RasterizationOptions.swift | 14 ++++---- .../Render/RendererConfiguration.swift | 2 +- Sources/OpenSwiftUICore/Shape/Path.swift | 34 +++++++++---------- Sources/OpenSwiftUICore/Shape/PathData.swift | 8 ++--- .../Shape/ShapeStyle/ShapeStyleResolver.swift | 2 +- .../View/Image/GraphicsImage.swift | 14 ++++---- .../View/Image/SymbolRenderingMode.swift | 4 +-- .../Overlay/CoreGraphics/CGPath+OpenSwiftUI.m | 6 ++-- Sources/OpenSwiftUI_SPI/Util/PathData.h | 4 +-- 16 files changed, 59 insertions(+), 59 deletions(-) diff --git a/Sources/OpenSwiftUI/Render/DisplayList/AppKitDisplayList.swift b/Sources/OpenSwiftUI/Render/DisplayList/AppKitDisplayList.swift index 9d10bd352..0699156b7 100644 --- a/Sources/OpenSwiftUI/Render/DisplayList/AppKitDisplayList.swift +++ b/Sources/OpenSwiftUI/Render/DisplayList/AppKitDisplayList.swift @@ -90,8 +90,8 @@ final class NSViewPlatformViewDefinition: PlatformViewDefinition, @unchecked Sen } override static func getRBLayer(drawingView: AnyObject) -> AnyObject? { - guard let orbView = drawingView as? ORBDrawingView else { return nil } - return orbView.layer + guard let rbView = drawingView as? ORBDrawingView else { return nil } + return rbView.layer } override static func setIgnoresEvents(_ state: Bool, of view: AnyObject) { diff --git a/Sources/OpenSwiftUI/Render/DisplayList/DisplayListViewDrawing.swift b/Sources/OpenSwiftUI/Render/DisplayList/DisplayListViewDrawing.swift index 60dd5193b..ea745d3e8 100644 --- a/Sources/OpenSwiftUI/Render/DisplayList/DisplayListViewDrawing.swift +++ b/Sources/OpenSwiftUI/Render/DisplayList/DisplayListViewDrawing.swift @@ -152,9 +152,9 @@ final class ORBDrawingView: OpenRenderBoxView, PlatformDrawable { private func updateOptions() { isOpaque = options.isOpaque #if os(iOS) || os(visionOS) - options.update(orbLayer: layer) + options.update(rbLayer: layer) #elseif os(macOS) - options.update(orbLayer: layer!) + options.update(rbLayer: layer!) #endif rendersFirstFrameAsynchronously = options.rendersFirstFrameAsynchronously } diff --git a/Sources/OpenSwiftUI/Render/DisplayList/RenderBoxView.swift b/Sources/OpenSwiftUI/Render/DisplayList/RenderBoxView.swift index e14e410b3..ec5f63eb4 100644 --- a/Sources/OpenSwiftUI/Render/DisplayList/RenderBoxView.swift +++ b/Sources/OpenSwiftUI/Render/DisplayList/RenderBoxView.swift @@ -25,7 +25,7 @@ class OpenRenderBoxView: PlatformGraphicsView { } #endif - private func orbInit() { + private func rbInit() { #if os(iOS) || os(visionOS) let layer = layer layer.delegate = self @@ -43,13 +43,13 @@ class OpenRenderBoxView: PlatformGraphicsView { override init(frame: CGRect) { rendersFirstFrameAsynchronously = false super.init(frame: frame) - orbInit() + rbInit() } required init?(coder: NSCoder) { rendersFirstFrameAsynchronously = false super.init(coder: coder) - orbInit() + rbInit() } deinit { diff --git a/Sources/OpenSwiftUI/Render/DisplayList/UIKitDisplayList.swift b/Sources/OpenSwiftUI/Render/DisplayList/UIKitDisplayList.swift index 738903113..c022482c9 100644 --- a/Sources/OpenSwiftUI/Render/DisplayList/UIKitDisplayList.swift +++ b/Sources/OpenSwiftUI/Render/DisplayList/UIKitDisplayList.swift @@ -75,8 +75,8 @@ final class UIViewPlatformViewDefinition: PlatformViewDefinition, @unchecked Sen } override static func getRBLayer(drawingView: AnyObject) -> AnyObject? { - guard let orbView = drawingView as? ORBDrawingView else { return nil } - return orbView.layer + guard let rbView = drawingView as? ORBDrawingView else { return nil } + return rbView.layer } override static func setIgnoresEvents(_ state: Bool, of view: AnyObject) { diff --git a/Sources/OpenSwiftUICore/Render/DisplayList/CAHostingLayerPlatformDefinition.swift b/Sources/OpenSwiftUICore/Render/DisplayList/CAHostingLayerPlatformDefinition.swift index 0b3cb71b7..6e03c809e 100644 --- a/Sources/OpenSwiftUICore/Render/DisplayList/CAHostingLayerPlatformDefinition.swift +++ b/Sources/OpenSwiftUICore/Render/DisplayList/CAHostingLayerPlatformDefinition.swift @@ -191,7 +191,7 @@ private final class ORBDrawingLayer: ORBLayer, PlatformDrawable { private func updateOptions() { isOpaque = options.isOpaque - options.update(orbLayer: self) + options.update(rbLayer: self) } static var allowsContentsMultiplyColor: Bool { false } diff --git a/Sources/OpenSwiftUICore/Render/DisplayList/DisplayList.swift b/Sources/OpenSwiftUICore/Render/DisplayList/DisplayList.swift index f9d7f34ea..c6eb2c883 100644 --- a/Sources/OpenSwiftUICore/Render/DisplayList/DisplayList.swift +++ b/Sources/OpenSwiftUICore/Render/DisplayList/DisplayList.swift @@ -497,7 +497,7 @@ extension DisplayList { private struct Contents { var list: DisplayList var origin: CGPoint - var orbList: ORBDisplayListContents + var rbList: ORBDisplayListContents var nextTime: Time var numericValue: Float? } diff --git a/Sources/OpenSwiftUICore/Render/PlatformDrawable.swift b/Sources/OpenSwiftUICore/Render/PlatformDrawable.swift index 8bfad6b1f..47c5c0dd1 100644 --- a/Sources/OpenSwiftUICore/Render/PlatformDrawable.swift +++ b/Sources/OpenSwiftUICore/Render/PlatformDrawable.swift @@ -45,8 +45,8 @@ public struct PlatformDrawableContent: @unchecked Sendable { case graphicsCallback((inout GraphicsContext, CGSize) -> ()) case platformCallback((CGSize) -> ()) case displayList(DisplayList, CGPoint, Time) - case orbDisplayList(any ORBDisplayListContents, CGPoint) - case orbInterpolator(ORBDisplayListInterpolator, Float, CGPoint) + case rbDisplayList(any ORBDisplayListContents, CGPoint) + case rbInterpolator(ORBDisplayListInterpolator, Float, CGPoint) case empty } @@ -141,9 +141,9 @@ public struct PlatformDrawableOptions: Equatable, Sendable { } #endif - public func update(orbLayer: AnyObject) { + public func update(rbLayer: AnyObject) { #if canImport(Darwin) - let layer = orbLayer as! ORBLayer + let layer = rbLayer as! ORBLayer layer.colorMode = base.resolvedColorMode layer.rendersAsynchronously = rendersAsynchronously layer.maxDrawableCount = Int(base.maxDrawableCount) diff --git a/Sources/OpenSwiftUICore/Render/RasterizationOptions.swift b/Sources/OpenSwiftUICore/Render/RasterizationOptions.swift index 34d0cbaae..cc24e7d1b 100644 --- a/Sources/OpenSwiftUICore/Render/RasterizationOptions.swift +++ b/Sources/OpenSwiftUICore/Render/RasterizationOptions.swift @@ -88,7 +88,7 @@ package struct RasterizationOptions: Equatable { package var colorMode: ColorRenderingMode - package var orbColorMode: Int32? + package var rbColorMode: Int32? package var flags: RasterizationOptions.Flags @@ -96,12 +96,12 @@ package struct RasterizationOptions: Equatable { package init( colorMode: ColorRenderingMode = .nonLinear, - orbColorMode: Int32? = nil, + rbColorMode: Int32? = nil, flags: RasterizationOptions.Flags = .defaultFlags, maxDrawableCount: Int8 = 3 ) { self.colorMode = colorMode - self.orbColorMode = orbColorMode + self.rbColorMode = rbColorMode self.flags = flags self.maxDrawableCount = maxDrawableCount } @@ -138,7 +138,7 @@ package struct RasterizationOptions: Equatable { #if !OPENSWIFTUI_ANY_ATTRIBUTE_FIX package var resolvedColorMode: ORBColor.Mode { - if let mode = orbColorMode { + if let mode = rbColorMode { return ORBColor.Mode(rawValue: mode) } else { let alphaOnly = alphaOnly @@ -176,8 +176,8 @@ package struct RasterizationOptions: Equatable { extension RasterizationOptions: ProtobufMessage { package func encode(to encoder: inout ProtobufEncoder) { encoder.enumField(1, colorMode, defaultValue: .nonLinear) - if let orbColorMode { - encoder.intField(2, Int(orbColorMode)) + if let rbColorMode { + encoder.intField(2, Int(rbColorMode)) } encoder.intField(3, Int(flags.rawValue)) encoder.intField(4, Int(maxDrawableCount)) @@ -188,7 +188,7 @@ extension RasterizationOptions: ProtobufMessage { while let field = try decoder.nextField() { switch field.tag { case 1: options.colorMode = try decoder.enumField(field) ?? .nonLinear - case 2: options.orbColorMode = Int32(try decoder.intField(field)) + case 2: options.rbColorMode = Int32(try decoder.intField(field)) case 3: options.flags = Flags(rawValue: UInt32(try decoder.intField(field))) case 4: options.maxDrawableCount = Int8(try decoder.intField(field)) default: try decoder.skipField(field) diff --git a/Sources/OpenSwiftUICore/Render/RendererConfiguration.swift b/Sources/OpenSwiftUICore/Render/RendererConfiguration.swift index 4547ff897..c837130ff 100644 --- a/Sources/OpenSwiftUICore/Render/RendererConfiguration.swift +++ b/Sources/OpenSwiftUICore/Render/RendererConfiguration.swift @@ -45,7 +45,7 @@ public struct _RendererConfiguration { /// When non-nil overrides colorMode with a member of the /// `RBColorMode` enum, specified as its raw integer value. - public var orbColorMode: Int32? + public var rbColorMode: Int32? /// When true the view will build and submit its command buffer /// asynchronously. diff --git a/Sources/OpenSwiftUICore/Shape/Path.swift b/Sources/OpenSwiftUICore/Shape/Path.swift index 166912d6b..790e37720 100644 --- a/Sources/OpenSwiftUICore/Shape/Path.swift +++ b/Sources/OpenSwiftUICore/Shape/Path.swift @@ -27,7 +27,7 @@ public struct Path: Equatable, LosslessStringConvertible, @unchecked Sendable { #if canImport(CoreGraphics) || !OPENSWIFTUI_CF_CGTYPES case cgPath #endif - case orbPath + case rbPath case buffer } @@ -43,8 +43,8 @@ public struct Path: Equatable, LosslessStringConvertible, @unchecked Sendable { #endif package init(takingPath path: ORBPath) { - kind = .orbPath - data = PathData(orbPath: path) + kind = .rbPath + data = PathData(rbPath: path) } private func prepareBuffer() { @@ -54,8 +54,8 @@ public struct Path: Equatable, LosslessStringConvertible, @unchecked Sendable { case .cgPath: path = ORBPath(cgPath: data.cgPath.takeRetainedValue()) #endif - case .orbPath: - path = data.orbPath + case .rbPath: + path = data.rbPath case .buffer: return } @@ -135,27 +135,27 @@ public struct Path: Equatable, LosslessStringConvertible, @unchecked Sendable { #if canImport(CoreGraphics) || !OPENSWIFTUI_CF_CGTYPES @inline(__always) fileprivate var cgPath: CGPath { - let orbPath: ORBPath + let rbPath: ORBPath switch kind { case .cgPath: return data.cgPath.takeUnretainedValue() - case .orbPath: - orbPath = data.orbPath + case .rbPath: + rbPath = data.rbPath case .buffer: let storage = unsafeBitCast(self, to: ORBPath.Storage.self) - orbPath = ORBPath(storage: storage, callbacks: Self.bufferCallbacks) + rbPath = ORBPath(storage: storage, callbacks: Self.bufferCallbacks) } - return orbPath.cgPath + return rbPath.cgPath } #endif @inline(__always) - fileprivate var orbPath: ORBPath { + fileprivate var rbPath: ORBPath { switch kind { case .cgPath: return ORBPath(cgPath: data.cgPath.takeUnretainedValue()) - case .orbPath: - return data.orbPath + case .rbPath: + return data.rbPath case .buffer: let storage = unsafeBitCast(self, to: ORBPath.Storage.self) return ORBPath(storage: storage, callbacks: Self.bufferCallbacks) @@ -164,14 +164,14 @@ public struct Path: Equatable, LosslessStringConvertible, @unchecked Sendable { @inline(__always) fileprivate func retainRBPath() -> ORBPath { - let orbPath = orbPath - orbPath.retain() - return orbPath + let rbPath = rbPath + rbPath.retain() + return rbPath } @usableFromInline package static func == (lhs: PathBox, rhs: PathBox) -> Bool { - return lhs.orbPath.isEqual(to: rhs.orbPath) + return lhs.rbPath.isEqual(to: rhs.rbPath) } } diff --git a/Sources/OpenSwiftUICore/Shape/PathData.swift b/Sources/OpenSwiftUICore/Shape/PathData.swift index cab50cd91..69d0de6aa 100644 --- a/Sources/OpenSwiftUICore/Shape/PathData.swift +++ b/Sources/OpenSwiftUICore/Shape/PathData.swift @@ -16,7 +16,7 @@ package import OpenRenderBoxShims /// /// typedef union PathData { /// CGPathRef cgPath; // 8 bytes (pointer) -/// ORBPath orbPath; // 16 bytes (2 pointers) +/// ORBPath rbPath; // 16 bytes (2 pointers) /// uint8_t buffer[0x60]; // 96 bytes /// } PathData; package struct PathData { @@ -74,11 +74,11 @@ package struct PathData { // MARK: - ORBPath access - package init(orbPath: ORBPath) { - self.orbPath = orbPath + package init(rbPath: ORBPath) { + self.rbPath = rbPath } - package var orbPath: ORBPath { + package var rbPath: ORBPath { get { withUnsafeBytes(of: storage) { buffer in buffer.load(as: ORBPath.self) diff --git a/Sources/OpenSwiftUICore/Shape/ShapeStyle/ShapeStyleResolver.swift b/Sources/OpenSwiftUICore/Shape/ShapeStyle/ShapeStyleResolver.swift index 12ff8319f..fa29dccb8 100644 --- a/Sources/OpenSwiftUICore/Shape/ShapeStyle/ShapeStyleResolver.swift +++ b/Sources/OpenSwiftUICore/Shape/ShapeStyle/ShapeStyleResolver.swift @@ -34,7 +34,7 @@ package struct _ShapeStyle_ResolverMode: Equatable { self.options = options } - package init(orbSymbolStyleMask mask: UInt32, location: Image.Location) { + package init(rbSymbolStyleMask mask: UInt32, location: Image.Location) { let bundle: Bundle? var options: Options if mask & (1 << 9) != 0 { diff --git a/Sources/OpenSwiftUICore/View/Image/GraphicsImage.swift b/Sources/OpenSwiftUICore/View/Image/GraphicsImage.swift index 9febccc38..3a2973efa 100644 --- a/Sources/OpenSwiftUICore/View/Image/GraphicsImage.swift +++ b/Sources/OpenSwiftUICore/View/Image/GraphicsImage.swift @@ -97,7 +97,7 @@ package struct GraphicsImage: Equatable, Sendable { switch contents { case let .vectorGlyph(resolvedVectorGlyph): return .init( - orbSymbolStyleMask: resolvedVectorGlyph.animator.styleMask, + rbSymbolStyleMask: resolvedVectorGlyph.animator.styleMask, location: resolvedVectorGlyph.location ) case .none: @@ -199,7 +199,7 @@ package struct ResolvedVectorGlyph: Equatable { animator.glyph = glyph animator.variableValue = variableValue animator.flipsRightToLeft = flipsRightToLeft - animator.renderingMode = context.effectiveSymbolRenderingMode?.orbRenderingMode ?? 255 + animator.renderingMode = context.effectiveSymbolRenderingMode?.rbRenderingMode ?? 255 let direction = context.environment.layoutDirection let version = animator.version let options = context.options @@ -231,14 +231,14 @@ package struct ResolvedVectorGlyph: Equatable { } package var renderingMode: SymbolRenderingMode.Storage? { - SymbolRenderingMode(orbRenderingMode: animator.renderingMode)?.storage + SymbolRenderingMode(rbRenderingMode: animator.renderingMode)?.storage } package var resolvedRenderingMode: SymbolRenderingMode.Storage? { #if OPENSWIFTUI_LINK_COREUI && OPENSWIFTUI_RENDERBOX - let orbMode = animator.renderingMode - guard orbMode == 0 else { - return SymbolRenderingMode(orbRenderingMode: orbMode)?.storage + let rbMode = animator.renderingMode + guard rbMode == 0 else { + return SymbolRenderingMode(rbRenderingMode: rbMode)?.storage } guard let glyph = animator.glyph else { return .preferred @@ -258,7 +258,7 @@ package struct ResolvedVectorGlyph: Equatable { } package var styleResolverMode: ShapeStyle.ResolverMode { - .init(orbSymbolStyleMask: animator.styleMask, location: location) + .init(rbSymbolStyleMask: animator.styleMask, location: location) } // MARK: - Methods diff --git a/Sources/OpenSwiftUICore/View/Image/SymbolRenderingMode.swift b/Sources/OpenSwiftUICore/View/Image/SymbolRenderingMode.swift index e94e0779d..6b97e0029 100644 --- a/Sources/OpenSwiftUICore/View/Image/SymbolRenderingMode.swift +++ b/Sources/OpenSwiftUICore/View/Image/SymbolRenderingMode.swift @@ -101,7 +101,7 @@ public struct SymbolRenderingMode: Sendable { // MARK: - SymbolRenderingMode + RB Rendering Mode extension SymbolRenderingMode { - package var orbRenderingMode: UInt32 { + package var rbRenderingMode: UInt32 { switch storage { case .monochrome: 1 case .multicolor: 2 @@ -114,7 +114,7 @@ extension SymbolRenderingMode { } } - package init?(orbRenderingMode mode: UInt32) { + package init?(rbRenderingMode mode: UInt32) { switch mode { case 0: self = .preferred case 1: self = .monochrome diff --git a/Sources/OpenSwiftUI_SPI/Overlay/CoreGraphics/CGPath+OpenSwiftUI.m b/Sources/OpenSwiftUI_SPI/Overlay/CoreGraphics/CGPath+OpenSwiftUI.m index b53577f30..62cdfa2d2 100644 --- a/Sources/OpenSwiftUI_SPI/Overlay/CoreGraphics/CGPath+OpenSwiftUI.m +++ b/Sources/OpenSwiftUI_SPI/Overlay/CoreGraphics/CGPath+OpenSwiftUI.m @@ -234,9 +234,9 @@ CGPathRef _CGPathCreateRoundedRect(CGRect rect, CGFloat cornerWidth, CGFloat cor RBPathRelease(rbPath); return cgPath; #else - ORBPath orbPath = ORBPathMakeRoundedRect(rect, cornerWidth, cornerHeight, ORBPathRoundedCornerStyleContinuous, NULL); - CGPathRef cgPath = ORBPathCopyCGPath(orbPath); - ORBPathRelease(orbPath); + ORBPath rbPath = ORBPathMakeRoundedRect(rect, cornerWidth, cornerHeight, ORBPathRoundedCornerStyleContinuous, NULL); + CGPathRef cgPath = ORBPathCopyCGPath(rbPath); + ORBPathRelease(rbPath); return cgPath; #endif } diff --git a/Sources/OpenSwiftUI_SPI/Util/PathData.h b/Sources/OpenSwiftUI_SPI/Util/PathData.h index b07c2c411..615544ec6 100644 --- a/Sources/OpenSwiftUI_SPI/Util/PathData.h +++ b/Sources/OpenSwiftUI_SPI/Util/PathData.h @@ -28,9 +28,9 @@ typedef union PathData { CGPathRef cgPath; #endif #if OPENSWIFTUI_RENDERBOX - RBPath orbPath; + RBPath rbPath; #else - ORBPath orbPath; + ORBPath rbPath; #endif uint8_t buffer[0x60]; } PathData;