From 23209fec39baad25c1d60cbf5f9812be105188cc Mon Sep 17 00:00:00 2001 From: osy <50960678+osy@users.noreply.github.com> Date: Tue, 2 Aug 2022 21:53:16 -0700 Subject: [PATCH] display(iOS): make renderer a property --- .../Display/VMDisplayMetalViewController.m | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/Platform/iOS/Display/VMDisplayMetalViewController.m b/Platform/iOS/Display/VMDisplayMetalViewController.m index 627adca01..e472c5a4e 100644 --- a/Platform/iOS/Display/VMDisplayMetalViewController.m +++ b/Platform/iOS/Display/VMDisplayMetalViewController.m @@ -28,9 +28,13 @@ #import "UTM-Swift.h" @import CocoaSpiceRenderer; -@implementation VMDisplayMetalViewController { - CSRenderer *_renderer; -} +@interface VMDisplayMetalViewController () + +@property (nonatomic, nullable) CSRenderer *renderer; + +@end + +@implementation VMDisplayMetalViewController - (instancetype)initWithDisplay:(CSDisplay *)display input:(CSInput *)input { if (self = [super initWithNibName:nil bundle:nil]) { @@ -74,8 +78,8 @@ - (void)viewDidLoad { return; } - _renderer = [[CSRenderer alloc] initWithMetalKitView:self.mtkView]; - if (!_renderer) { + self.renderer = [[CSRenderer alloc] initWithMetalKitView:self.mtkView]; + if (!self.renderer) { UTMLog(@"Renderer failed initialization"); return; } @@ -83,12 +87,12 @@ - (void)viewDidLoad { // Initialize our renderer with the view size CGSize drawableSize = self.view.bounds.size; self.mtkView.drawableSize = drawableSize; - [_renderer mtkView:self.mtkView drawableSizeWillChange:drawableSize]; + [self.renderer mtkView:self.mtkView drawableSizeWillChange:drawableSize]; - [_renderer changeUpscaler:self.delegate.qemuDisplayUpscaler - downscaler:self.delegate.qemuDisplayDownscaler]; + [self.renderer changeUpscaler:self.delegate.qemuDisplayUpscaler + downscaler:self.delegate.qemuDisplayDownscaler]; - self.mtkView.delegate = _renderer; + self.mtkView.delegate = self.renderer; self.vmDisplay = self.vmDisplay; // reset renderer [self initTouch]; @@ -186,7 +190,7 @@ - (void)displayResize:(CGSize)size { - (void)setVmDisplay:(CSDisplay *)display { _vmDisplay = display; - _renderer.source = display; + self.renderer.source = display; } - (void)setDisplayScaling:(CGFloat)scaling origin:(CGPoint)origin {