Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sxychenjing
engine
提交
dfe016e0
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,发现更多精彩内容 >>
提交
dfe016e0
编写于
10月 27, 2016
作者:
C
Chinmay Garde
提交者:
GitHub
10月 27, 2016
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Explicitly tell the platform view to update its backing store. (#3181)
上级
9eaedb06
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
51 addition
and
34 deletion
+51
-34
shell/platform/darwin/ios/framework/Source/FlutterViewController.mm
...form/darwin/ios/framework/Source/FlutterViewController.mm
+7
-4
shell/platform/darwin/ios/platform_view_ios.h
shell/platform/darwin/ios/platform_view_ios.h
+5
-0
shell/platform/darwin/ios/platform_view_ios.mm
shell/platform/darwin/ios/platform_view_ios.mm
+39
-30
未找到文件。
shell/platform/darwin/ios/framework/Source/FlutterViewController.mm
浏览文件 @
dfe016e0
...
...
@@ -14,11 +14,11 @@
#include "flutter/shell/gpu/gpu_surface_gl.h"
#include "flutter/shell/platform/darwin/common/platform_mac.h"
#include "flutter/shell/platform/darwin/common/string_conversions.h"
#include "flutter/shell/platform/darwin/ios/framework/Source/flutter_touch_mapper.h"
#include "flutter/shell/platform/darwin/ios/framework/Source/FlutterDartProject_Internal.h"
#include "flutter/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.h"
#include "flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputDelegate.h"
#include "flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.h"
#include "flutter/shell/platform/darwin/ios/framework/Source/flutter_touch_mapper.h"
#include "flutter/shell/platform/darwin/ios/platform_view_ios.h"
#include "lib/ftl/functional/make_copyable.h"
#include "lib/ftl/time/time_delta.h"
...
...
@@ -330,10 +330,13 @@ static inline PointerChangeMapperPhase PointerChangePhaseFromUITouchPhase(
-
(
void
)
updateViewportMetrics
{
blink
::
Threads
::
UI
()
->
PostTask
([
engine
=
_platformView
->
engine
().
GetWeakPtr
(),
metrics
=
_viewportMetrics
weak_platform_view
=
_platformView
->
GetWeakPtr
(),
metrics
=
_viewportMetrics
]
{
if
(
engine
.
get
())
engine
->
SetViewportMetrics
(
metrics
);
if
(
!
weak_platform_view
)
{
return
;
}
weak_platform_view
->
UpdateSurfaceSize
();
weak_platform_view
->
engine
().
SetViewportMetrics
(
metrics
);
});
}
...
...
shell/platform/darwin/ios/platform_view_ios.h
浏览文件 @
dfe016e0
...
...
@@ -38,6 +38,10 @@ class PlatformViewIOS : public PlatformView, public GPUSurfaceGLDelegate {
return
platform_message_router_
;
}
ftl
::
WeakPtr
<
PlatformViewIOS
>
GetWeakPtr
();
void
UpdateSurfaceSize
();
VsyncWaiter
*
GetVsyncWaiter
()
override
;
bool
ResourceContextMakeCurrent
()
override
;
...
...
@@ -64,6 +68,7 @@ class PlatformViewIOS : public PlatformView, public GPUSurfaceGLDelegate {
sky
::
SkyEnginePtr
engine_
;
PlatformMessageRouter
platform_message_router_
;
std
::
unique_ptr
<
AccessibilityBridge
>
accessibility_bridge_
;
ftl
::
WeakPtrFactory
<
PlatformViewIOS
>
weak_factory_
;
void
SetupAndLoadFromSource
(
const
std
::
string
&
main
,
const
std
::
string
&
packages
,
...
...
shell/platform/darwin/ios/platform_view_ios.mm
浏览文件 @
dfe016e0
...
...
@@ -3,16 +3,14 @@
// found in the LICENSE file.
#include "flutter/shell/platform/darwin/ios/platform_view_ios.h"
#import <OpenGLES/EAGL.h>
#import <OpenGLES/ES2/gl.h>
#import <OpenGLES/ES2/glext.h>
#import <QuartzCore/CAEAGLLayer.h>
#include <utility>
#include "base/mac/scoped_nsautorelease_pool.h"
#include "base/trace_event/trace_event.h"
#include "flutter/common/threads.h"
#include "flutter/shell/gpu/gpu_rasterizer.h"
#include "flutter/shell/platform/darwin/ios/framework/Source/vsync_waiter_ios.h"
#include "lib/ftl/synchronization/waitable_event.h"
...
...
@@ -170,32 +168,6 @@ class IOSGLContext {
GLuint
framebuffer
()
const
{
return
framebuffer_
;
}
bool
MakeCurrent
()
{
base
::
mac
::
ScopedNSAutoreleasePool
pool
;
return
UpdateStorageSizeIfNecessary
()
&&
[
EAGLContext
setCurrentContext
:
context_
.
get
()];
}
bool
ResourceMakeCurrent
()
{
base
::
mac
::
ScopedNSAutoreleasePool
pool
;
return
[
EAGLContext
setCurrentContext
:
resource_context_
.
get
()];
}
private:
base
::
scoped_nsobject
<
CAEAGLLayer
>
layer_
;
base
::
scoped_nsobject
<
EAGLContext
>
context_
;
base
::
scoped_nsobject
<
EAGLContext
>
resource_context_
;
GLuint
framebuffer_
;
GLuint
colorbuffer_
;
GLuint
depthbuffer_
;
GLuint
stencilbuffer_
;
GLuint
depth_stencil_packed_buffer_
;
GLintSize
storage_size_
;
bool
UpdateStorageSizeIfNecessary
()
{
GLintSize
size
([
layer_
.
get
()
bounds
].
size
);
...
...
@@ -270,12 +242,37 @@ class IOSGLContext {
return
true
;
}
bool
MakeCurrent
()
{
base
::
mac
::
ScopedNSAutoreleasePool
pool
;
return
UpdateStorageSizeIfNecessary
()
&&
[
EAGLContext
setCurrentContext
:
context_
.
get
()];
}
bool
ResourceMakeCurrent
()
{
base
::
mac
::
ScopedNSAutoreleasePool
pool
;
return
[
EAGLContext
setCurrentContext
:
resource_context_
.
get
()];
}
private:
base
::
scoped_nsobject
<
CAEAGLLayer
>
layer_
;
base
::
scoped_nsobject
<
EAGLContext
>
context_
;
base
::
scoped_nsobject
<
EAGLContext
>
resource_context_
;
GLuint
framebuffer_
;
GLuint
colorbuffer_
;
GLuint
depthbuffer_
;
GLuint
stencilbuffer_
;
GLuint
depth_stencil_packed_buffer_
;
GLintSize
storage_size_
;
FTL_DISALLOW_COPY_AND_ASSIGN
(
IOSGLContext
);
};
PlatformViewIOS
::
PlatformViewIOS
(
CAEAGLLayer
*
layer
)
:
PlatformView
(
std
::
make_unique
<
GPURasterizer
>
()),
context_
(
std
::
make_unique
<
IOSGLContext
>
(
surface_config_
,
layer
))
{
context_
(
std
::
make_unique
<
IOSGLContext
>
(
surface_config_
,
layer
)),
weak_factory_
(
this
)
{
CreateEngine
();
NSArray
*
paths
=
NSSearchPathForDirectoriesInDomains
(
NSDocumentDirectory
,
...
...
@@ -313,6 +310,18 @@ void PlatformViewIOS::SetupAndLoadFromSource(
engine_
->
RunFromFile
(
main
,
packages
,
assets_directory
);
}
ftl
::
WeakPtr
<
PlatformViewIOS
>
PlatformViewIOS
::
GetWeakPtr
()
{
return
weak_factory_
.
GetWeakPtr
();
}
void
PlatformViewIOS
::
UpdateSurfaceSize
()
{
blink
::
Threads
::
Gpu
()
->
PostTask
([
self
=
GetWeakPtr
()]()
{
if
(
self
&&
self
->
context_
!=
nullptr
)
{
self
->
context_
->
UpdateStorageSizeIfNecessary
();
}
});
}
VsyncWaiter
*
PlatformViewIOS
::
GetVsyncWaiter
()
{
if
(
!
vsync_waiter_
)
vsync_waiter_
=
std
::
make_unique
<
VsyncWaiterIOS
>
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录