Skip to content

Commit df10ced

Browse files
committed
Rename internal ios class: EARenderView => RenderHostView
1 parent abbf5b9 commit df10ced

12 files changed

Lines changed: 62 additions & 71 deletions

core/platform/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ elseif(APPLE)
8282
${_AX_PLATFORM_SPECIFIC_HEADER}
8383
platform/ios/Application-ios.h
8484
platform/ios/DirectorCaller-ios.h
85-
platform/ios/EARenderView-ios.h
85+
platform/ios/RenderHostView-ios.h
8686
platform/ios/RenderViewImpl-ios.h
8787
platform/ios/StdC-ios.h
8888
platform/ios/InputView-ios.h
@@ -95,7 +95,7 @@ elseif(APPLE)
9595
platform/ios/Common-ios.mm
9696
platform/ios/Device-ios.mm
9797
platform/ios/DirectorCaller-ios.mm
98-
platform/ios/EARenderView-ios.mm
98+
platform/ios/RenderHostView-ios.mm
9999
platform/ios/RenderViewImpl-ios.mm
100100
platform/ios/Image-ios.mm
101101
platform/ios/InputView-ios.mm

core/platform/ios/AxmolViewController.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ of this software and associated documentation files (the "Software"), to deal
2323
****************************************************************************/
2424

2525
#import "AxmolViewController.h"
26-
#import "platform/ios/EARenderView-ios.h"
26+
#import "platform/ios/RenderHostView-ios.h"
2727
#include "platform/Device.h"
2828
#include "platform/Application.h"
2929
#include "base/Director.h"

core/platform/ios/Device-ios.mm

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -904,24 +904,13 @@ static bool _initWithString(std::string_view text,
904904
return Device::Orientation::Portrait; // fallback
905905
}
906906

907-
static bool isPhone()
908-
{
909-
#if !defined(AX_TARGET_OS_TVOS)
910-
return [[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone;
911-
#else
912-
return false;
913-
#endif
914-
}
915907
Device::Orientation Device::resolveOrientation()
916908
{
917909
auto supported = getSupportedOrientations();
918910
auto preferred = getPreferredOrientation();
919911
auto physical = getPhysicalOrientation();
920912

921913
auto tryUse = [&](Orientation o) -> Orientation {
922-
if (isPhone() && o == Orientation::ReversePortrait)
923-
return Orientation::Portrait; // iPhone treats ReversePortrait as Portrait
924-
925914
return ((supported & toMask(o)) == toMask(o)) ? o : Orientation::Unknown;
926915
};
927916

core/platform/ios/DirectorCaller-ios.mm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ of this software and associated documentation files (the "Software"), to deal
3131
#import <OpenGLES/EAGL.h>
3232

3333
#import "base/Director.h"
34-
#import "platform/ios/EARenderView-ios.h"
34+
#import "platform/ios/RenderHostView-ios.h"
3535

3636
static id s_sharedDirectorCaller;
3737

@@ -139,7 +139,7 @@ - (void)doCaller:(id)sender
139139
{
140140
ax::Director* director = ax::Director::getInstance();
141141
#if AX_GLES_PROFILE
142-
EAGLContext* context = [(__bridge EARenderView*)director->getRenderView()->getEARenderView() context];
142+
EAGLContext* context = [(__bridge RenderHostView*)director->getRenderView()->getEARenderView() context];
143143
if (context != [EAGLContext currentContext])
144144
glFlush();
145145

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ seeds.
1515
1616
=====================
1717
18-
File: EARenderView.h
18+
File: RenderHostView.h
1919
Abstract: Convenience class that wraps the CAEAGLLayer from CoreAnimation into a
2020
UIView subclass.
2121
@@ -77,12 +77,12 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved.
7777

7878
// CLASS INTERFACE:
7979

80-
/** EARenderView Class.
80+
/** RenderHostView Class.
8181
* This class wraps the CAEAGLLayer from CoreAnimation into a convenient UIView subclass.
8282
* The view content is basically an EAGL surface you render your OpenGL scene into.
8383
* Note that setting the view non-opaque will only work if the EAGL surface has an alpha channel.
8484
*/
85-
@interface EARenderView : UIView {
85+
@interface RenderHostView : UIView {
8686
#if AX_GLES_PROFILE
8787
id<ESRenderer> renderer_;
8888
#endif
@@ -94,13 +94,13 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved.
9494
unsigned int requestedSamples_;
9595
}
9696

97-
/** creates an initializes an EARenderView with a frame and 0-bit depth buffer, and a RGB565 color buffer */
97+
/** creates an initializes an RenderHostView with a frame and 0-bit depth buffer, and a RGB565 color buffer */
9898
+ (id)viewWithFrame:(CGRect)frame;
99-
/** creates an initializes an EARenderView with a frame, a color buffer format, and 0-bit depth buffer */
99+
/** creates an initializes an RenderHostView with a frame, a color buffer format, and 0-bit depth buffer */
100100
+ (id)viewWithFrame:(CGRect)frame pixelFormat:(int)format;
101-
/** creates an initializes an EARenderView with a frame, a color buffer format, and a depth buffer format */
101+
/** creates an initializes an RenderHostView with a frame, a color buffer format, and a depth buffer format */
102102
+ (id)viewWithFrame:(CGRect)frame pixelFormat:(int)format depthFormat:(int)depth;
103-
/** creates an initializes an EARenderView with a frame, a color buffer format, a depth buffer format, a sharegroup, and
103+
/** creates an initializes an RenderHostView with a frame, a color buffer format, a depth buffer format, a sharegroup, and
104104
* multisampling */
105105
+ (id)viewWithFrame:(CGRect)frame
106106
pixelFormat:(int)format
@@ -110,11 +110,11 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved.
110110
multiSampling:(BOOL)multisampling
111111
numberOfSamples:(unsigned int)samples;
112112

113-
/** Initializes an EARenderView with a frame and 0-bit depth buffer, and a RGB565 color buffer */
113+
/** Initializes an RenderHostView with a frame and 0-bit depth buffer, and a RGB565 color buffer */
114114
- (id)initWithFrame:(CGRect)frame; // These also set the current context
115-
/** Initializes an EARenderView with a frame, a color buffer format, and 0-bit depth buffer */
115+
/** Initializes an RenderHostView with a frame, a color buffer format, and 0-bit depth buffer */
116116
- (id)initWithFrame:(CGRect)frame pixelFormat:(int)format;
117-
/** Initializes an EARenderView with a frame, a color buffer format, a depth buffer format, a sharegroup and multisampling
117+
/** Initializes an RenderHostView with a frame, a color buffer format, a depth buffer format, a sharegroup and multisampling
118118
* support */
119119
- (id)initWithFrame:(CGRect)frame
120120
pixelFormat:(int)format
@@ -140,7 +140,7 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved.
140140
@property(nonatomic, readwrite) BOOL multiSampling;
141141
@property(nonatomic, readonly) BOOL isKeyboardShown;
142142

143-
/** EARenderView uses double-buffer. This method swaps the buffers */
143+
/** RenderHostView uses double-buffer. This method swaps the buffers */
144144
- (void)swapBuffers;
145145

146146
- (CGRect)convertRectFromViewToSurface:(CGRect)rect;
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
1616
=====================
1717
18-
File: EARenderView.m
18+
File: RenderHostView.m
1919
Abstract: Convenience class that wraps the CAEAGLLayer from CoreAnimation into a
2020
UIView subclass.
2121
@@ -60,7 +60,7 @@ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
6060
Copyright (C) 2008 Apple Inc. All Rights Reserved.
6161
6262
*/
63-
#import "platform/ios/EARenderView-ios.h"
63+
#import "platform/ios/RenderHostView-ios.h"
6464

6565
#import <QuartzCore/QuartzCore.h>
6666

@@ -84,14 +84,14 @@ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
8484

8585
#define IOS_MAX_TOUCHES_COUNT 10
8686

87-
@interface EARenderView ()
87+
@interface RenderHostView ()
8888
@property(nonatomic) TextInputView* textInputView;
8989
@property(nonatomic, readwrite, assign) BOOL isKeyboardShown;
9090
@property(nonatomic, copy) NSNotification* keyboardShowNotification;
9191
@property(nonatomic, assign) CGRect originalRect;
9292
@end
9393

94-
@implementation EARenderView
94+
@implementation RenderHostView
9595

9696
@synthesize surfaceSize = size_;
9797
@synthesize pixelFormat = pixelformat_, depthFormat = depthFormat_;
@@ -432,7 +432,7 @@ - (unsigned int)convertPixelFormat:(int)pixelFormat
432432
}
433433
#endif
434434

435-
#pragma mark EARenderView - Point conversion
435+
#pragma mark RenderHostView - Point conversion
436436

437437
- (CGPoint)convertPointFromViewToSurface:(CGPoint)point
438438
{
@@ -459,7 +459,7 @@ - (CGRect)convertRectFromViewToSurface:(CGRect)rect
459459
}
460460

461461
// Pass the touches to the superview
462-
#pragma mark EARenderView - Touch Delegate
462+
#pragma mark RenderHostView - Touch Delegate
463463
- (void)touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event
464464
{
465465
if (self.isKeyboardShown)

core/platform/ios/RenderViewImpl-ios.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,10 @@ class AX_DLL RenderViewImpl : public RenderView
7777
bool isRetinaDisplay() const override { return getContentScaleFactor() == 2.0; }
7878

7979
/** @since axmol-2.8.0, returns the objective-c UIWindow instance */
80-
void* getEAWindow() const override { return _eaWindowHandle; }
80+
void* getEAWindow() const override { return _hostWindowHandle; }
8181

82-
/** @since axmol-2.8.0, returns the objective-c EARenderView instance */
83-
void* getEARenderView() const override { return _eaViewHandle; }
82+
/** @since axmol-2.8.0, returns the objective-c RenderHostView instance */
83+
void* getEARenderView() const override { return _hostViewHandle; }
8484

8585
// overrides
8686
bool isGfxContextReady() override;
@@ -102,8 +102,8 @@ class AX_DLL RenderViewImpl : public RenderView
102102
bool initWithFullScreen(std::string_view viewName);
103103

104104
// the objective-c instance handles
105-
void* _eaViewHandle;
106-
void* _eaWindowHandle;
105+
void* _hostViewHandle;
106+
void* _hostWindowHandle;
107107
};
108108

109109
#ifndef AX_CORE_PROFILE

core/platform/ios/RenderViewImpl-ios.mm

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ of this software and associated documentation files (the "Software"), to deal
2626
****************************************************************************/
2727
#import <UIKit/UIKit.h>
2828

29-
#include "platform/ios/EARenderView-ios.h"
29+
#include "platform/ios/RenderHostView-ios.h"
3030
#include "platform/ios/DirectorCaller-ios.h"
3131
#include "platform/ios/RenderViewImpl-ios.h"
3232
#include "platform/Device.h"
@@ -147,15 +147,15 @@ static CGSize computeLogicalScreenSize()
147147

148148
RenderViewImpl::~RenderViewImpl()
149149
{
150-
// auto eaView = (__bridge EARenderView*) _eaViewHandle;
150+
// auto eaView = (__bridge RenderHostView*) _hostViewHandle;
151151
//[eaView release];
152152
}
153153

154154
#ifndef AX_CORE_PROFILE
155155
bool RenderViewImpl::initWithEARenderView(void* viewHandle)
156156
{
157-
_eaViewHandle = viewHandle;
158-
EARenderView* eaView = (__bridge EARenderView*)_eaViewHandle;
157+
_hostViewHandle = viewHandle;
158+
RenderHostView* eaView = (__bridge RenderHostView*)_hostViewHandle;
159159

160160
_screenSize.width = _designResolutionSize.width = [eaView getWidth];
161161
_screenSize.height = _designResolutionSize.height = [eaView getHeight];
@@ -171,10 +171,10 @@ static CGSize computeLogicalScreenSize()
171171
choosePixelFormats();
172172

173173
// create platform window
174-
_eaWindowHandle = [[UIWindow alloc] initWithFrame:r];
174+
_hostWindowHandle = [[UIWindow alloc] initWithFrame:r];
175175

176176
// create platform render view
177-
EARenderView* eaView = [EARenderView viewWithFrame:r
177+
RenderHostView* hostView = [RenderHostView viewWithFrame:r
178178
pixelFormat:(int)_pixelFormat
179179
depthFormat:(int)_depthFormat
180180
preserveBackbuffer:NO
@@ -184,16 +184,18 @@ static CGSize computeLogicalScreenSize()
184184

185185
// Not available on tvOS
186186
#if !defined(AX_TARGET_OS_TVOS)
187-
[eaView setMultipleTouchEnabled:YES];
187+
[hostView setMultipleTouchEnabled:YES];
188188
#endif
189189

190190
auto logicalSize = computeLogicalScreenSize();
191+
192+
const auto backingScaleFactor = hostView.contentScaleFactor;
191193

192-
_screenSize.width = _designResolutionSize.width = logicalSize.width;
193-
_screenSize.height = _designResolutionSize.height = logicalSize.height;
194+
_screenSize.width = _designResolutionSize.width = logicalSize.width * backingScaleFactor;
195+
_screenSize.height = _designResolutionSize.height = logicalSize.height * backingScaleFactor;
194196
// _scaleX = _scaleY = [eaView contentScaleFactor];
195197

196-
_eaViewHandle = eaView;
198+
_hostViewHandle = hostView;
197199

198200
return true;
199201
}
@@ -213,21 +215,21 @@ static CGSize computeLogicalScreenSize()
213215
void RenderViewImpl::setMultipleTouchEnabled(bool enabled)
214216
{
215217
#if !defined(AX_TARGET_OS_TVOS)
216-
[(__bridge EARenderView*)_eaViewHandle setMultipleTouchEnabled:enabled];
218+
[(__bridge RenderHostView*)_hostViewHandle setMultipleTouchEnabled:enabled];
217219
#else
218220
AX_UNUSED_PARAM(enabled);
219221
#endif
220222
}
221223

222224
void RenderViewImpl::showWindow(void* viewController)
223225
{
224-
auto window = (__bridge UIWindow*)_eaWindowHandle;
226+
auto window = (__bridge UIWindow*)_hostWindowHandle;
225227
auto controller = (__bridge UIViewController*)viewController;
226228

227229
#if !defined(AX_TARGET_OS_TVOS)
228230
controller.extendedLayoutIncludesOpaqueBars = YES;
229231
#endif
230-
auto view = (__bridge EARenderView*)_eaViewHandle;
232+
auto view = (__bridge RenderHostView*)_hostViewHandle;
231233
controller.view = view;
232234

233235
// Set RootViewController to window
@@ -257,40 +259,40 @@ static CGSize computeLogicalScreenSize()
257259

258260
bool RenderViewImpl::isGfxContextReady()
259261
{
260-
return _eaViewHandle != nullptr;
262+
return _hostViewHandle != nullptr;
261263
}
262264

263265
bool RenderViewImpl::setContentScaleFactor(float contentScaleFactor)
264266
{
265267
AX_ASSERT(_resolutionPolicy == ResolutionPolicy::UNKNOWN); // cannot enable retina mode
266268
_scaleX = _scaleY = contentScaleFactor;
267269

268-
[(__bridge EARenderView*)_eaViewHandle setNeedsLayout];
270+
[(__bridge RenderHostView*)_hostViewHandle setNeedsLayout];
269271

270272
return true;
271273
}
272274

273275
float RenderViewImpl::getContentScaleFactor() const
274276
{
275-
return [(__bridge EARenderView*)_eaViewHandle contentScaleFactor];
277+
return [(__bridge RenderHostView*)_hostViewHandle contentScaleFactor];
276278
}
277279

278280
void RenderViewImpl::end()
279281
{
280282
[CCDirectorCaller destroy];
281283

282-
[(__bridge EARenderView*)_eaViewHandle removeFromSuperview];
284+
[(__bridge RenderHostView*)_hostViewHandle removeFromSuperview];
283285
release();
284286
}
285287

286288
void RenderViewImpl::swapBuffers()
287289
{
288-
[(__bridge EARenderView*)_eaViewHandle swapBuffers];
290+
[(__bridge RenderHostView*)_hostViewHandle swapBuffers];
289291
}
290292

291293
void RenderViewImpl::setIMEKeyboardState(bool open)
292294
{
293-
auto eaView = (__bridge EARenderView*)_eaViewHandle;
295+
auto eaView = (__bridge RenderHostView*)_hostViewHandle;
294296
if (open)
295297
{
296298
[eaView showKeyboard];
@@ -303,7 +305,7 @@ static CGSize computeLogicalScreenSize()
303305

304306
Rect RenderViewImpl::getSafeAreaRect() const
305307
{
306-
EARenderView* eaView = (__bridge EARenderView*)_eaViewHandle;
308+
RenderHostView* eaView = (__bridge RenderHostView*)_hostViewHandle;
307309

308310
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000
309311
float version = [[UIDevice currentDevice].systemVersion floatValue];

core/ui/UIEditBox/UIEditBoxImpl-ios.mm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ of this software and associated documentation files (the "Software"), to deal
3434
# include "ui/UIEditBox/UIEditBox.h"
3535
# include "base/Director.h"
3636
# include "2d/Label.h"
37-
# import "platform/ios/EARenderView-ios.h"
37+
# import "platform/ios/RenderHostView-ios.h"
3838

3939
# import <Foundation/Foundation.h>
4040
# import <UIKit/UIKit.h>
@@ -182,7 +182,7 @@ of this software and associated documentation files (the "Software"), to deal
182182
void EditBoxImplIOS::updateNativeFrame(const Rect& rect)
183183
{
184184
auto renderView = ax::Director::getInstance()->getRenderView();
185-
EARenderView* eaView = (__bridge EARenderView*)renderView->getEARenderView();
185+
RenderHostView* eaView = (__bridge RenderHostView*)renderView->getEARenderView();
186186

187187
float factor = eaView.contentScaleFactor;
188188

@@ -210,7 +210,7 @@ of this software and associated documentation files (the "Software"), to deal
210210
UIFont* EditBoxImplIOS::constructFont(const char* fontName, int fontSize)
211211
{
212212
AXASSERT(fontName != nullptr, "fontName can't be nullptr");
213-
auto eaView = static_cast<EARenderView*>(ax::Director::getInstance()->getRenderView()->getEARenderView());
213+
auto eaView = static_cast<RenderHostView*>(ax::Director::getInstance()->getRenderView()->getEARenderView());
214214
float retinaFactor = eaView.contentScaleFactor;
215215
NSString* fntName = [NSString stringWithUTF8String:fontName];
216216

core/ui/UIEditBox/UIEditBoxImpl-mac.mm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ of this software and associated documentation files (the "Software"), to deal
4848
EditBoxImplMac::EditBoxImplMac(EditBox* pEditText) : EditBoxImplCommon(pEditText), _sysEdit(nullptr)
4949
{
5050
//! TODO: Retina on Mac
51-
//! _inRetinaMode = [[EARenderView sharedERenderView] contentScaleFactor] == 2.0f ? true : false;
51+
//! _inRetinaMode = [[RenderHostView sharedERenderView] contentScaleFactor] == 2.0f ? true : false;
5252
_inRetinaMode = false;
5353
}
5454

0 commit comments

Comments
 (0)