Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sxychenjing
engine
提交
40eb74c5
E
engine
项目概览
sxychenjing
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
engine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
40eb74c5
编写于
4月 01, 2019
作者:
D
Dan Field
提交者:
GitHub
4月 01, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make the resource context primary on iOS (#8387)
* Make resource context primary on iOS
上级
d8d9855d
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
28 addition
and
20 deletion
+28
-20
shell/platform/darwin/ios/framework/Source/FlutterView.h
shell/platform/darwin/ios/framework/Source/FlutterView.h
+1
-1
shell/platform/darwin/ios/framework/Source/FlutterView.mm
shell/platform/darwin/ios/framework/Source/FlutterView.mm
+2
-2
shell/platform/darwin/ios/ios_gl_context.mm
shell/platform/darwin/ios/ios_gl_context.mm
+7
-7
shell/platform/darwin/ios/ios_surface_gl.h
shell/platform/darwin/ios/ios_surface_gl.h
+2
-1
shell/platform/darwin/ios/ios_surface_gl.mm
shell/platform/darwin/ios/ios_surface_gl.mm
+4
-4
shell/platform/darwin/ios/platform_view_ios.h
shell/platform/darwin/ios/platform_view_ios.h
+2
-0
shell/platform/darwin/ios/platform_view_ios.mm
shell/platform/darwin/ios/platform_view_ios.mm
+10
-5
未找到文件。
shell/platform/darwin/ios/framework/Source/FlutterView.h
浏览文件 @
40eb74c5
...
...
@@ -33,7 +33,7 @@
-
(
instancetype
)
initWithDelegate
:(
id
<
FlutterViewEngineDelegate
>
)
delegate
opaque
:(
BOOL
)
opaque
NS_DESIGNATED_INITIALIZER
;
-
(
std
::
unique_ptr
<
shell
::
IOSSurface
>
)
createSurface
;
-
(
std
::
unique_ptr
<
shell
::
IOSSurface
>
)
createSurface
:(
std
::
shared_ptr
<
shell
::
IOSGLContext
>
)
context
;
@end
...
...
shell/platform/darwin/ios/framework/Source/FlutterView.mm
浏览文件 @
40eb74c5
...
...
@@ -75,7 +75,7 @@ id<FlutterViewEngineDelegate> _delegate;
#endif // TARGET_IPHONE_SIMULATOR
}
-
(
std
::
unique_ptr
<
shell
::
IOSSurface
>
)
createSurface
{
-
(
std
::
unique_ptr
<
shell
::
IOSSurface
>
)
createSurface
:(
std
::
shared_ptr
<
shell
::
IOSGLContext
>
)
context
{
if
([
self
.
layer
isKindOfClass
:[
CAEAGLLayer
class
]])
{
fml
::
scoped_nsobject
<
CAEAGLLayer
>
eagl_layer
(
reinterpret_cast
<
CAEAGLLayer
*>
([
self
.
layer
retain
]));
...
...
@@ -88,7 +88,7 @@ id<FlutterViewEngineDelegate> _delegate;
eagl_layer
.
get
().
presentsWithTransaction
=
YES
;
}
}
return
std
::
make_unique
<
shell
::
IOSSurfaceGL
>
(
std
::
move
(
eagl_layer
),
return
std
::
make_unique
<
shell
::
IOSSurfaceGL
>
(
context
,
std
::
move
(
eagl_layer
),
[
_delegate
platformViewsController
]);
}
else
{
fml
::
scoped_nsobject
<
CALayer
>
layer
(
reinterpret_cast
<
CALayer
*>
([
self
.
layer
retain
]));
...
...
shell/platform/darwin/ios/ios_gl_context.mm
浏览文件 @
40eb74c5
...
...
@@ -13,14 +13,14 @@
namespace
shell
{
IOSGLContext
::
IOSGLContext
()
{
context_
.
reset
([[
EAGLContext
alloc
]
initWithAPI
:
kEAGLRenderingAPIOpenGLES3
]);
if
(
context_
!=
nullptr
)
{
resource_
context_
.
reset
([[
EAGLContext
alloc
]
initWithAPI
:
kEAGLRenderingAPIOpenGLES3
sharegroup:
context_
.
get
().
sharegroup
]);
resource_
context_
.
reset
([[
EAGLContext
alloc
]
initWithAPI
:
kEAGLRenderingAPIOpenGLES3
]);
if
(
resource_
context_
!=
nullptr
)
{
context_
.
reset
([[
EAGLContext
alloc
]
initWithAPI
:
kEAGLRenderingAPIOpenGLES3
sharegroup:
resource_
context_
.
get
().
sharegroup
]);
}
else
{
context_
.
reset
([[
EAGLContext
alloc
]
initWithAPI
:
kEAGLRenderingAPIOpenGLES2
]);
resource_
context_
.
reset
([[
EAGLContext
alloc
]
initWithAPI
:
kEAGLRenderingAPIOpenGLES2
sharegroup:
context_
.
get
().
sharegroup
]);
resource_
context_
.
reset
([[
EAGLContext
alloc
]
initWithAPI
:
kEAGLRenderingAPIOpenGLES2
]);
context_
.
reset
([[
EAGLContext
alloc
]
initWithAPI
:
kEAGLRenderingAPIOpenGLES2
sharegroup:
resource_
context_
.
get
().
sharegroup
]);
}
// TODO:
...
...
shell/platform/darwin/ios/ios_surface_gl.h
浏览文件 @
40eb74c5
...
...
@@ -20,7 +20,8 @@ class IOSSurfaceGL : public IOSSurface,
public
GPUSurfaceGLDelegate
,
public
flow
::
ExternalViewEmbedder
{
public:
IOSSurfaceGL
(
fml
::
scoped_nsobject
<
CAEAGLLayer
>
layer
,
IOSSurfaceGL
(
std
::
shared_ptr
<
IOSGLContext
>
context
,
fml
::
scoped_nsobject
<
CAEAGLLayer
>
layer
,
FlutterPlatformViewsController
*
platform_views_controller
);
IOSSurfaceGL
(
fml
::
scoped_nsobject
<
CAEAGLLayer
>
layer
,
std
::
shared_ptr
<
IOSGLContext
>
context
);
...
...
shell/platform/darwin/ios/ios_surface_gl.mm
浏览文件 @
40eb74c5
...
...
@@ -9,10 +9,10 @@
namespace
shell
{
IOSSurfaceGL
::
IOSSurfaceGL
(
fml
::
scoped_nsobject
<
CAEAGLLayer
>
layer
,
IOSSurfaceGL
::
IOSSurfaceGL
(
std
::
shared_ptr
<
IOSGLContext
>
context
,
fml
::
scoped_nsobject
<
CAEAGLLayer
>
layer
,
FlutterPlatformViewsController
*
platform_views_controller
)
:
IOSSurface
(
platform_views_controller
)
{
context_
=
std
::
make_shared
<
IOSGLContext
>
();
:
IOSSurface
(
platform_views_controller
),
context_
(
context
)
{
render_target_
=
context_
->
CreateRenderTarget
(
std
::
move
(
layer
));
}
...
...
@@ -29,7 +29,7 @@ bool IOSSurfaceGL::IsValid() const {
}
bool
IOSSurfaceGL
::
ResourceContextMakeCurrent
()
{
return
render_target_
->
IsValid
()
?
context_
->
ResourceMakeCurrent
()
:
false
;
return
context_
->
ResourceMakeCurrent
()
;
}
void
IOSSurfaceGL
::
UpdateStorageSizeIfNecessary
()
{
...
...
shell/platform/darwin/ios/platform_view_ios.h
浏览文件 @
40eb74c5
...
...
@@ -17,6 +17,7 @@
#include "flutter/shell/platform/darwin/ios/framework/Source/FlutterView.h"
#include "flutter/shell/platform/darwin/ios/framework/Source/accessibility_bridge.h"
#include "flutter/shell/platform/darwin/ios/framework/Source/platform_message_router.h"
#include "flutter/shell/platform/darwin/ios/ios_gl_context.h"
#include "flutter/shell/platform/darwin/ios/ios_surface.h"
@
class
FlutterViewController
;
...
...
@@ -46,6 +47,7 @@ class PlatformViewIOS final : public PlatformView {
private:
fml
::
WeakPtr
<
FlutterViewController
>
owner_controller_
;
std
::
unique_ptr
<
IOSSurface
>
ios_surface_
;
std
::
shared_ptr
<
IOSGLContext
>
gl_context_
;
PlatformMessageRouter
platform_message_router_
;
std
::
unique_ptr
<
AccessibilityBridge
>
accessibility_bridge_
;
fml
::
scoped_nsprotocol
<
FlutterTextInputPlugin
*>
text_input_plugin_
;
...
...
shell/platform/darwin/ios/platform_view_ios.mm
浏览文件 @
40eb74c5
...
...
@@ -20,7 +20,11 @@
namespace
shell
{
PlatformViewIOS
::
PlatformViewIOS
(
PlatformView
::
Delegate
&
delegate
,
blink
::
TaskRunners
task_runners
)
:
PlatformView
(
delegate
,
std
::
move
(
task_runners
))
{}
:
PlatformView
(
delegate
,
std
::
move
(
task_runners
))
{
#if !TARGET_IPHONE_SIMULATOR
gl_context_
=
std
::
make_shared
<
IOSGLContext
>
();
#endif // !TARGET_IPHONE_SIMULATOR
}
PlatformViewIOS
::~
PlatformViewIOS
()
=
default
;
...
...
@@ -45,7 +49,8 @@ void PlatformViewIOS::SetOwnerViewController(fml::WeakPtr<FlutterViewController>
}
owner_controller_
=
owner_controller
;
if
(
owner_controller_
)
{
ios_surface_
=
static_cast
<
FlutterView
*>
(
owner_controller
.
get
().
view
).
createSurface
;
ios_surface_
=
[
static_cast
<
FlutterView
*>
(
owner_controller
.
get
().
view
)
createSurface
:
gl_context_
];
FML_DCHECK
(
ios_surface_
!=
nullptr
);
if
(
accessibility_bridge_
)
{
...
...
@@ -77,10 +82,10 @@ std::unique_ptr<Surface> PlatformViewIOS::CreateRenderingSurface() {
// |shell::PlatformView|
sk_sp
<
GrContext
>
PlatformViewIOS
::
CreateResourceContext
()
const
{
if
(
!
ios_surface_
||
!
ios_surface_
->
ResourceContext
MakeCurrent
())
{
if
(
!
gl_context_
||
!
gl_context_
->
Resource
MakeCurrent
())
{
FML_DLOG
(
INFO
)
<<
"Could not make resource context current on IO thread. "
"Async texture uploads "
"
will be disabl
ed."
;
"Async texture uploads
will be disabled. On Simulators,
"
"
this is expect
ed."
;
return
nullptr
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录