Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sxychenjing
engine
提交
6c2381da
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,发现更多精彩内容 >>
未验证
提交
6c2381da
编写于
10月 17, 2019
作者:
C
Chinmay Garde
提交者:
GitHub
10月 17, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Revert "Custom compositor layers must take into account the device pixel ratio. (#13193)" (#13211)
This reverts commit
e53d10c3
.
上级
ffb5d0b2
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
16 addition
and
263 deletion
+16
-263
flow/embedded_views.h
flow/embedded_views.h
+1
-3
flow/layers/layer_tree.h
flow/layers/layer_tree.h
+0
-7
shell/common/engine.cc
shell/common/engine.cc
+0
-1
shell/common/rasterizer.cc
shell/common/rasterizer.cc
+1
-2
shell/platform/embedder/embedder.cc
shell/platform/embedder/embedder.cc
+0
-6
shell/platform/embedder/embedder_external_view_embedder.cc
shell/platform/embedder/embedder_external_view_embedder.cc
+12
-30
shell/platform/embedder/embedder_external_view_embedder.h
shell/platform/embedder/embedder_external_view_embedder.h
+1
-4
shell/platform/embedder/fixtures/main.dart
shell/platform/embedder/fixtures/main.dart
+0
-13
shell/platform/embedder/tests/embedder_unittests.cc
shell/platform/embedder/tests/embedder_unittests.cc
+1
-197
未找到文件。
flow/embedded_views.h
浏览文件 @
6c2381da
...
@@ -208,9 +208,7 @@ class ExternalViewEmbedder {
...
@@ -208,9 +208,7 @@ class ExternalViewEmbedder {
// sets the stage for the next pre-roll.
// sets the stage for the next pre-roll.
virtual
void
CancelFrame
()
=
0
;
virtual
void
CancelFrame
()
=
0
;
virtual
void
BeginFrame
(
SkISize
frame_size
,
virtual
void
BeginFrame
(
SkISize
frame_size
,
GrContext
*
context
)
=
0
;
GrContext
*
context
,
double
device_pixel_ratio
)
=
0
;
virtual
void
PrerollCompositeEmbeddedView
(
virtual
void
PrerollCompositeEmbeddedView
(
int
view_id
,
int
view_id
,
...
...
flow/layers/layer_tree.h
浏览文件 @
6c2381da
...
@@ -71,15 +71,8 @@ class LayerTree {
...
@@ -71,15 +71,8 @@ class LayerTree {
checkerboard_offscreen_layers_
=
checkerboard
;
checkerboard_offscreen_layers_
=
checkerboard
;
}
}
void
set_device_pixel_ratio
(
double
device_pixel_ratio
)
{
device_pixel_ratio_
=
device_pixel_ratio
;
}
double
device_pixel_ratio
()
const
{
return
device_pixel_ratio_
;
}
private:
private:
SkISize
frame_size_
=
SkISize
::
MakeEmpty
();
// Physical pixels.
SkISize
frame_size_
=
SkISize
::
MakeEmpty
();
// Physical pixels.
double
device_pixel_ratio_
=
1.0
;
std
::
shared_ptr
<
Layer
>
root_layer_
;
std
::
shared_ptr
<
Layer
>
root_layer_
;
fml
::
TimePoint
build_start_
;
fml
::
TimePoint
build_start_
;
fml
::
TimePoint
build_finish_
;
fml
::
TimePoint
build_finish_
;
...
...
shell/common/engine.cc
浏览文件 @
6c2381da
...
@@ -438,7 +438,6 @@ void Engine::Render(std::unique_ptr<flutter::LayerTree> layer_tree) {
...
@@ -438,7 +438,6 @@ void Engine::Render(std::unique_ptr<flutter::LayerTree> layer_tree) {
return
;
return
;
layer_tree
->
set_frame_size
(
frame_size
);
layer_tree
->
set_frame_size
(
frame_size
);
layer_tree
->
set_device_pixel_ratio
(
viewport_metrics_
.
device_pixel_ratio
);
animator_
->
Render
(
std
::
move
(
layer_tree
));
animator_
->
Render
(
std
::
move
(
layer_tree
));
}
}
...
...
shell/common/rasterizer.cc
浏览文件 @
6c2381da
...
@@ -230,8 +230,7 @@ RasterStatus Rasterizer::DrawToSurface(flutter::LayerTree& layer_tree) {
...
@@ -230,8 +230,7 @@ RasterStatus Rasterizer::DrawToSurface(flutter::LayerTree& layer_tree) {
if
(
external_view_embedder
!=
nullptr
)
{
if
(
external_view_embedder
!=
nullptr
)
{
external_view_embedder
->
BeginFrame
(
layer_tree
.
frame_size
(),
external_view_embedder
->
BeginFrame
(
layer_tree
.
frame_size
(),
surface_
->
GetContext
(),
surface_
->
GetContext
());
layer_tree
.
device_pixel_ratio
());
embedder_root_surface
=
external_view_embedder
->
GetRootSurface
();
embedder_root_surface
=
external_view_embedder
->
GetRootSurface
();
}
}
...
...
shell/platform/embedder/embedder.cc
浏览文件 @
6c2381da
...
@@ -979,12 +979,6 @@ FlutterEngineResult FlutterEngineSendWindowMetricsEvent(
...
@@ -979,12 +979,6 @@ FlutterEngineResult FlutterEngineSendWindowMetricsEvent(
metrics
.
physical_height
=
SAFE_ACCESS
(
flutter_metrics
,
height
,
0.0
);
metrics
.
physical_height
=
SAFE_ACCESS
(
flutter_metrics
,
height
,
0.0
);
metrics
.
device_pixel_ratio
=
SAFE_ACCESS
(
flutter_metrics
,
pixel_ratio
,
1.0
);
metrics
.
device_pixel_ratio
=
SAFE_ACCESS
(
flutter_metrics
,
pixel_ratio
,
1.0
);
if
(
metrics
.
device_pixel_ratio
<=
0.0
)
{
FML_LOG
(
ERROR
)
<<
"Device pixel ratio invalid: "
<<
metrics
.
device_pixel_ratio
;
return
LOG_EMBEDDER_ERROR
(
kInvalidArguments
);
}
return
reinterpret_cast
<
flutter
::
EmbedderEngine
*>
(
engine
)
->
SetViewportMetrics
(
return
reinterpret_cast
<
flutter
::
EmbedderEngine
*>
(
engine
)
->
SetViewportMetrics
(
std
::
move
(
metrics
))
std
::
move
(
metrics
))
?
kSuccess
?
kSuccess
...
...
shell/platform/embedder/embedder_external_view_embedder.cc
浏览文件 @
6c2381da
...
@@ -67,12 +67,9 @@ static SkISize TransformedSurfaceSize(const SkISize& size,
...
@@ -67,12 +67,9 @@ static SkISize TransformedSurfaceSize(const SkISize& size,
// |ExternalViewEmbedder|
// |ExternalViewEmbedder|
void
EmbedderExternalViewEmbedder
::
BeginFrame
(
SkISize
frame_size
,
void
EmbedderExternalViewEmbedder
::
BeginFrame
(
SkISize
frame_size
,
GrContext
*
context
,
GrContext
*
context
)
{
double
device_pixel_ratio
)
{
Reset
();
Reset
();
pending_frame_size_
=
frame_size
;
pending_frame_size_
=
frame_size
;
pending_device_pixel_ratio_
=
device_pixel_ratio
;
pending_surface_transformation_
=
GetSurfaceTransformation
();
pending_surface_transformation_
=
GetSurfaceTransformation
();
const
auto
surface_size
=
TransformedSurfaceSize
(
const
auto
surface_size
=
TransformedSurfaceSize
(
...
@@ -158,8 +155,7 @@ SkCanvas* EmbedderExternalViewEmbedder::CompositeEmbeddedView(int view_id) {
...
@@ -158,8 +155,7 @@ SkCanvas* EmbedderExternalViewEmbedder::CompositeEmbeddedView(int view_id) {
static
FlutterLayer
MakeBackingStoreLayer
(
static
FlutterLayer
MakeBackingStoreLayer
(
const
SkISize
&
frame_size
,
const
SkISize
&
frame_size
,
const
FlutterBackingStore
*
store
,
const
FlutterBackingStore
*
store
,
const
SkMatrix
&
surface_transformation
,
const
SkMatrix
&
surface_transformation
)
{
double
device_pixel_ratio
)
{
FlutterLayer
layer
=
{};
FlutterLayer
layer
=
{};
layer
.
struct_size
=
sizeof
(
layer
);
layer
.
struct_size
=
sizeof
(
layer
);
...
@@ -170,9 +166,7 @@ static FlutterLayer MakeBackingStoreLayer(
...
@@ -170,9 +166,7 @@ static FlutterLayer MakeBackingStoreLayer(
SkRect
::
MakeWH
(
frame_size
.
width
(),
frame_size
.
height
());
SkRect
::
MakeWH
(
frame_size
.
width
(),
frame_size
.
height
());
const
auto
transformed_layer_bounds
=
const
auto
transformed_layer_bounds
=
SkMatrix
::
Concat
(
surface_transformation
,
surface_transformation
.
mapRect
(
layer_bounds
);
SkMatrix
::
MakeScale
(
device_pixel_ratio
))
.
mapRect
(
layer_bounds
);
layer
.
offset
.
x
=
transformed_layer_bounds
.
x
();
layer
.
offset
.
x
=
transformed_layer_bounds
.
x
();
layer
.
offset
.
y
=
transformed_layer_bounds
.
y
();
layer
.
offset
.
y
=
transformed_layer_bounds
.
y
();
...
@@ -196,8 +190,7 @@ static FlutterPlatformView MakePlatformView(
...
@@ -196,8 +190,7 @@ static FlutterPlatformView MakePlatformView(
static
FlutterLayer
MakePlatformViewLayer
(
static
FlutterLayer
MakePlatformViewLayer
(
const
EmbeddedViewParams
&
params
,
const
EmbeddedViewParams
&
params
,
const
FlutterPlatformView
&
platform_view
,
const
FlutterPlatformView
&
platform_view
,
const
SkMatrix
&
surface_transformation
,
const
SkMatrix
&
surface_transformation
)
{
double
device_pixel_ratio
)
{
FlutterLayer
layer
=
{};
FlutterLayer
layer
=
{};
layer
.
struct_size
=
sizeof
(
layer
);
layer
.
struct_size
=
sizeof
(
layer
);
...
@@ -211,9 +204,7 @@ static FlutterLayer MakePlatformViewLayer(
...
@@ -211,9 +204,7 @@ static FlutterLayer MakePlatformViewLayer(
);
);
const
auto
transformed_layer_bounds
=
const
auto
transformed_layer_bounds
=
SkMatrix
::
Concat
(
surface_transformation
,
surface_transformation
.
mapRect
(
layer_bounds
);
SkMatrix
::
MakeScale
(
device_pixel_ratio
))
.
mapRect
(
layer_bounds
);
layer
.
offset
.
x
=
transformed_layer_bounds
.
x
();
layer
.
offset
.
x
=
transformed_layer_bounds
.
x
();
layer
.
offset
.
y
=
transformed_layer_bounds
.
y
();
layer
.
offset
.
y
=
transformed_layer_bounds
.
y
();
...
@@ -244,11 +235,8 @@ bool EmbedderExternalViewEmbedder::SubmitFrame(GrContext* context) {
...
@@ -244,11 +235,8 @@ bool EmbedderExternalViewEmbedder::SubmitFrame(GrContext* context) {
{
{
// The root surface is expressed as a layer.
// The root surface is expressed as a layer.
presented_layers
.
push_back
(
MakeBackingStoreLayer
(
presented_layers
.
push_back
(
MakeBackingStoreLayer
(
pending_frame_size_
,
// frame size
pending_frame_size_
,
root_render_target_
->
GetBackingStore
(),
root_render_target_
->
GetBackingStore
(),
// backing store
pending_surface_transformation_
));
pending_surface_transformation_
,
// surface transformation
pending_device_pixel_ratio_
// device pixel ratio
));
}
}
const
auto
surface_size
=
TransformedSurfaceSize
(
const
auto
surface_size
=
TransformedSurfaceSize
(
...
@@ -274,12 +262,9 @@ bool EmbedderExternalViewEmbedder::SubmitFrame(GrContext* context) {
...
@@ -274,12 +262,9 @@ bool EmbedderExternalViewEmbedder::SubmitFrame(GrContext* context) {
// The layers presented to the embedder will contain a back pointer to this
// The layers presented to the embedder will contain a back pointer to this
// struct. It is safe to deallocate when the embedder callback is done.
// struct. It is safe to deallocate when the embedder callback is done.
presented_platform_views
[
view_id
]
=
MakePlatformView
(
view_id
);
presented_platform_views
[
view_id
]
=
MakePlatformView
(
view_id
);
presented_layers
.
push_back
(
MakePlatformViewLayer
(
presented_layers
.
push_back
(
params
,
// embedded view params
MakePlatformViewLayer
(
params
,
presented_platform_views
.
at
(
view_id
),
presented_platform_views
.
at
(
view_id
),
// platform view
pending_surface_transformation_
));
pending_surface_transformation_
,
// surface transformation
pending_device_pixel_ratio_
// device pixel ratio
));
if
(
!
pending_canvas_spies_
.
at
(
view_id
)
->
DidDrawIntoCanvas
())
{
if
(
!
pending_canvas_spies_
.
at
(
view_id
)
->
DidDrawIntoCanvas
())
{
// Nothing was drawn into the overlay canvas, we don't need to composite
// Nothing was drawn into the overlay canvas, we don't need to composite
...
@@ -327,11 +312,8 @@ bool EmbedderExternalViewEmbedder::SubmitFrame(GrContext* context) {
...
@@ -327,11 +312,8 @@ bool EmbedderExternalViewEmbedder::SubmitFrame(GrContext* context) {
// Indicate a layer for the backing store containing contents rendered by
// Indicate a layer for the backing store containing contents rendered by
// Flutter.
// Flutter.
presented_layers
.
push_back
(
MakeBackingStoreLayer
(
presented_layers
.
push_back
(
MakeBackingStoreLayer
(
pending_frame_size_
,
// frame size
pending_frame_size_
,
render_target
->
GetBackingStore
(),
render_target
->
GetBackingStore
(),
// backing store
pending_surface_transformation_
));
pending_surface_transformation_
,
// surface transformation
pending_device_pixel_ratio_
// device pixel ratio
));
}
}
{
{
...
...
shell/platform/embedder/embedder_external_view_embedder.h
浏览文件 @
6c2381da
...
@@ -73,9 +73,7 @@ class EmbedderExternalViewEmbedder final : public ExternalViewEmbedder {
...
@@ -73,9 +73,7 @@ class EmbedderExternalViewEmbedder final : public ExternalViewEmbedder {
void
CancelFrame
()
override
;
void
CancelFrame
()
override
;
// |ExternalViewEmbedder|
// |ExternalViewEmbedder|
void
BeginFrame
(
SkISize
frame_size
,
void
BeginFrame
(
SkISize
frame_size
,
GrContext
*
context
)
override
;
GrContext
*
context
,
double
device_pixel_ratio
)
override
;
// |ExternalViewEmbedder|
// |ExternalViewEmbedder|
void
PrerollCompositeEmbeddedView
(
void
PrerollCompositeEmbeddedView
(
...
@@ -129,7 +127,6 @@ class EmbedderExternalViewEmbedder final : public ExternalViewEmbedder {
...
@@ -129,7 +127,6 @@ class EmbedderExternalViewEmbedder final : public ExternalViewEmbedder {
RegistryKey
::
Equal
>
;
RegistryKey
::
Equal
>
;
SkISize
pending_frame_size_
=
SkISize
::
Make
(
0
,
0
);
SkISize
pending_frame_size_
=
SkISize
::
Make
(
0
,
0
);
double
pending_device_pixel_ratio_
=
1.0
;
SkMatrix
pending_surface_transformation_
;
SkMatrix
pending_surface_transformation_
;
std
::
map
<
ViewIdentifier
,
std
::
unique_ptr
<
SkPictureRecorder
>>
std
::
map
<
ViewIdentifier
,
std
::
unique_ptr
<
SkPictureRecorder
>>
pending_recorders_
;
pending_recorders_
;
...
...
shell/platform/embedder/fixtures/main.dart
浏览文件 @
6c2381da
...
@@ -430,16 +430,3 @@ void verify_b141980393() {
...
@@ -430,16 +430,3 @@ void verify_b141980393() {
};
};
window
.
scheduleFrame
();
window
.
scheduleFrame
();
}
}
@pragma
(
'vm:entry-point'
)
void
can_display_platform_view_with_pixel_ratio
(
)
{
window
.
onBeginFrame
=
(
Duration
duration
)
{
SceneBuilder
builder
=
SceneBuilder
();
builder
.
pushOffset
(
0.0
,
20.0
);
builder
.
addPlatformView
(
42
,
width:
400.0
,
height:
280.0
);
builder
.
addPicture
(
Offset
(
0.0
,
0.0
),
CreateSimplePicture
());
builder
.
pop
();
window
.
render
(
builder
.
build
());
};
window
.
scheduleFrame
();
}
shell/platform/embedder/tests/embedder_unittests.cc
浏览文件 @
6c2381da
...
@@ -652,7 +652,6 @@ TEST_F(EmbedderTest, CompositorMustBeAbleToRenderToOpenGLFramebuffer) {
...
@@ -652,7 +652,6 @@ TEST_F(EmbedderTest, CompositorMustBeAbleToRenderToOpenGLFramebuffer) {
event
.
struct_size
=
sizeof
(
event
);
event
.
struct_size
=
sizeof
(
event
);
event
.
width
=
800
;
event
.
width
=
800
;
event
.
height
=
600
;
event
.
height
=
600
;
event
.
pixel_ratio
=
1.0
;
ASSERT_EQ
(
FlutterEngineSendWindowMetricsEvent
(
engine
.
get
(),
&
event
),
ASSERT_EQ
(
FlutterEngineSendWindowMetricsEvent
(
engine
.
get
(),
&
event
),
kSuccess
);
kSuccess
);
ASSERT_TRUE
(
engine
.
is_valid
());
ASSERT_TRUE
(
engine
.
is_valid
());
...
@@ -744,7 +743,6 @@ TEST_F(EmbedderTest, CompositorMustBeAbleToRenderToOpenGLTexture) {
...
@@ -744,7 +743,6 @@ TEST_F(EmbedderTest, CompositorMustBeAbleToRenderToOpenGLTexture) {
event
.
struct_size
=
sizeof
(
event
);
event
.
struct_size
=
sizeof
(
event
);
event
.
width
=
800
;
event
.
width
=
800
;
event
.
height
=
600
;
event
.
height
=
600
;
event
.
pixel_ratio
=
1.0
;
ASSERT_EQ
(
FlutterEngineSendWindowMetricsEvent
(
engine
.
get
(),
&
event
),
ASSERT_EQ
(
FlutterEngineSendWindowMetricsEvent
(
engine
.
get
(),
&
event
),
kSuccess
);
kSuccess
);
ASSERT_TRUE
(
engine
.
is_valid
());
ASSERT_TRUE
(
engine
.
is_valid
());
...
@@ -836,7 +834,6 @@ TEST_F(EmbedderTest, CompositorMustBeAbleToRenderToSoftwareBuffer) {
...
@@ -836,7 +834,6 @@ TEST_F(EmbedderTest, CompositorMustBeAbleToRenderToSoftwareBuffer) {
event
.
struct_size
=
sizeof
(
event
);
event
.
struct_size
=
sizeof
(
event
);
event
.
width
=
800
;
event
.
width
=
800
;
event
.
height
=
600
;
event
.
height
=
600
;
event
.
pixel_ratio
=
1.0
;
ASSERT_EQ
(
FlutterEngineSendWindowMetricsEvent
(
engine
.
get
(),
&
event
),
ASSERT_EQ
(
FlutterEngineSendWindowMetricsEvent
(
engine
.
get
(),
&
event
),
kSuccess
);
kSuccess
);
ASSERT_TRUE
(
engine
.
is_valid
());
ASSERT_TRUE
(
engine
.
is_valid
());
...
@@ -1128,7 +1125,6 @@ TEST_F(EmbedderTest, CompositorMustBeAbleToRenderKnownScene) {
...
@@ -1128,7 +1125,6 @@ TEST_F(EmbedderTest, CompositorMustBeAbleToRenderKnownScene) {
event
.
struct_size
=
sizeof
(
event
);
event
.
struct_size
=
sizeof
(
event
);
event
.
width
=
800
;
event
.
width
=
800
;
event
.
height
=
600
;
event
.
height
=
600
;
event
.
pixel_ratio
=
1.0
;
ASSERT_EQ
(
FlutterEngineSendWindowMetricsEvent
(
engine
.
get
(),
&
event
),
ASSERT_EQ
(
FlutterEngineSendWindowMetricsEvent
(
engine
.
get
(),
&
event
),
kSuccess
);
kSuccess
);
ASSERT_TRUE
(
engine
.
is_valid
());
ASSERT_TRUE
(
engine
.
is_valid
());
...
@@ -1306,7 +1302,6 @@ TEST_F(EmbedderTest,
...
@@ -1306,7 +1302,6 @@ TEST_F(EmbedderTest,
event
.
struct_size
=
sizeof
(
event
);
event
.
struct_size
=
sizeof
(
event
);
event
.
width
=
800
;
event
.
width
=
800
;
event
.
height
=
600
;
event
.
height
=
600
;
event
.
pixel_ratio
=
1.0
;
ASSERT_EQ
(
FlutterEngineSendWindowMetricsEvent
(
engine
.
get
(),
&
event
),
ASSERT_EQ
(
FlutterEngineSendWindowMetricsEvent
(
engine
.
get
(),
&
event
),
kSuccess
);
kSuccess
);
ASSERT_TRUE
(
engine
.
is_valid
());
ASSERT_TRUE
(
engine
.
is_valid
());
...
@@ -1427,7 +1422,6 @@ TEST_F(EmbedderTest, CustomCompositorMustWorkWithCustomTaskRunner) {
...
@@ -1427,7 +1422,6 @@ TEST_F(EmbedderTest, CustomCompositorMustWorkWithCustomTaskRunner) {
event
.
struct_size
=
sizeof
(
event
);
event
.
struct_size
=
sizeof
(
event
);
event
.
width
=
800
;
event
.
width
=
800
;
event
.
height
=
600
;
event
.
height
=
600
;
event
.
pixel_ratio
=
1.0
;
ASSERT_EQ
(
FlutterEngineSendWindowMetricsEvent
(
engine
.
get
(),
&
event
),
ASSERT_EQ
(
FlutterEngineSendWindowMetricsEvent
(
engine
.
get
(),
&
event
),
kSuccess
);
kSuccess
);
...
@@ -1506,7 +1500,6 @@ TEST_F(EmbedderTest, CompositorMustBeAbleToRenderWithRootLayerOnly) {
...
@@ -1506,7 +1500,6 @@ TEST_F(EmbedderTest, CompositorMustBeAbleToRenderWithRootLayerOnly) {
event
.
struct_size
=
sizeof
(
event
);
event
.
struct_size
=
sizeof
(
event
);
event
.
width
=
800
;
event
.
width
=
800
;
event
.
height
=
600
;
event
.
height
=
600
;
event
.
pixel_ratio
=
1.0
;
ASSERT_EQ
(
FlutterEngineSendWindowMetricsEvent
(
engine
.
get
(),
&
event
),
ASSERT_EQ
(
FlutterEngineSendWindowMetricsEvent
(
engine
.
get
(),
&
event
),
kSuccess
);
kSuccess
);
ASSERT_TRUE
(
engine
.
is_valid
());
ASSERT_TRUE
(
engine
.
is_valid
());
...
@@ -1619,7 +1612,6 @@ TEST_F(EmbedderTest, CompositorMustBeAbleToRenderWithPlatformLayerOnBottom) {
...
@@ -1619,7 +1612,6 @@ TEST_F(EmbedderTest, CompositorMustBeAbleToRenderWithPlatformLayerOnBottom) {
event
.
struct_size
=
sizeof
(
event
);
event
.
struct_size
=
sizeof
(
event
);
event
.
width
=
800
;
event
.
width
=
800
;
event
.
height
=
600
;
event
.
height
=
600
;
event
.
pixel_ratio
=
1.0
;
ASSERT_EQ
(
FlutterEngineSendWindowMetricsEvent
(
engine
.
get
(),
&
event
),
ASSERT_EQ
(
FlutterEngineSendWindowMetricsEvent
(
engine
.
get
(),
&
event
),
kSuccess
);
kSuccess
);
ASSERT_TRUE
(
engine
.
is_valid
());
ASSERT_TRUE
(
engine
.
is_valid
());
...
@@ -1803,7 +1795,6 @@ TEST_F(EmbedderTest,
...
@@ -1803,7 +1795,6 @@ TEST_F(EmbedderTest,
// Flutter still thinks it is 800 x 600. Only the root surface is rotated.
// Flutter still thinks it is 800 x 600. Only the root surface is rotated.
event
.
width
=
800
;
event
.
width
=
800
;
event
.
height
=
600
;
event
.
height
=
600
;
event
.
pixel_ratio
=
1.0
;
ASSERT_EQ
(
FlutterEngineSendWindowMetricsEvent
(
engine
.
get
(),
&
event
),
ASSERT_EQ
(
FlutterEngineSendWindowMetricsEvent
(
engine
.
get
(),
&
event
),
kSuccess
);
kSuccess
);
ASSERT_TRUE
(
engine
.
is_valid
());
ASSERT_TRUE
(
engine
.
is_valid
());
...
@@ -1838,7 +1829,6 @@ TEST_F(EmbedderTest, CanRenderSceneWithoutCustomCompositor) {
...
@@ -1838,7 +1829,6 @@ TEST_F(EmbedderTest, CanRenderSceneWithoutCustomCompositor) {
event
.
struct_size
=
sizeof
(
event
);
event
.
struct_size
=
sizeof
(
event
);
event
.
width
=
800
;
event
.
width
=
800
;
event
.
height
=
600
;
event
.
height
=
600
;
event
.
pixel_ratio
=
1.0
;
ASSERT_EQ
(
FlutterEngineSendWindowMetricsEvent
(
engine
.
get
(),
&
event
),
ASSERT_EQ
(
FlutterEngineSendWindowMetricsEvent
(
engine
.
get
(),
&
event
),
kSuccess
);
kSuccess
);
...
@@ -1881,7 +1871,6 @@ TEST_F(EmbedderTest, CanRenderSceneWithoutCustomCompositorWithTransformation) {
...
@@ -1881,7 +1871,6 @@ TEST_F(EmbedderTest, CanRenderSceneWithoutCustomCompositorWithTransformation) {
// Flutter still thinks it is 800 x 600.
// Flutter still thinks it is 800 x 600.
event
.
width
=
800
;
event
.
width
=
800
;
event
.
height
=
600
;
event
.
height
=
600
;
event
.
pixel_ratio
=
1.0
;
ASSERT_EQ
(
FlutterEngineSendWindowMetricsEvent
(
engine
.
get
(),
&
event
),
ASSERT_EQ
(
FlutterEngineSendWindowMetricsEvent
(
engine
.
get
(),
&
event
),
kSuccess
);
kSuccess
);
...
@@ -1916,7 +1905,6 @@ TEST_F(EmbedderTest, CanRenderGradientWithoutCompositor) {
...
@@ -1916,7 +1905,6 @@ TEST_F(EmbedderTest, CanRenderGradientWithoutCompositor) {
event
.
struct_size
=
sizeof
(
event
);
event
.
struct_size
=
sizeof
(
event
);
event
.
width
=
800
;
event
.
width
=
800
;
event
.
height
=
600
;
event
.
height
=
600
;
event
.
pixel_ratio
=
1.0
;
ASSERT_EQ
(
FlutterEngineSendWindowMetricsEvent
(
engine
.
get
(),
&
event
),
ASSERT_EQ
(
FlutterEngineSendWindowMetricsEvent
(
engine
.
get
(),
&
event
),
kSuccess
);
kSuccess
);
...
@@ -1959,7 +1947,6 @@ TEST_F(EmbedderTest, CanRenderGradientWithoutCompositorWithXform) {
...
@@ -1959,7 +1947,6 @@ TEST_F(EmbedderTest, CanRenderGradientWithoutCompositorWithXform) {
// Flutter still thinks it is 800 x 600.
// Flutter still thinks it is 800 x 600.
event
.
width
=
800
;
event
.
width
=
800
;
event
.
height
=
600
;
event
.
height
=
600
;
event
.
pixel_ratio
=
1.0
;
ASSERT_EQ
(
FlutterEngineSendWindowMetricsEvent
(
engine
.
get
(),
&
event
),
ASSERT_EQ
(
FlutterEngineSendWindowMetricsEvent
(
engine
.
get
(),
&
event
),
kSuccess
);
kSuccess
);
...
@@ -1994,7 +1981,6 @@ TEST_F(EmbedderTest, CanRenderGradientWithCompositor) {
...
@@ -1994,7 +1981,6 @@ TEST_F(EmbedderTest, CanRenderGradientWithCompositor) {
event
.
struct_size
=
sizeof
(
event
);
event
.
struct_size
=
sizeof
(
event
);
event
.
width
=
800
;
event
.
width
=
800
;
event
.
height
=
600
;
event
.
height
=
600
;
event
.
pixel_ratio
=
1.0
;
ASSERT_EQ
(
FlutterEngineSendWindowMetricsEvent
(
engine
.
get
(),
&
event
),
ASSERT_EQ
(
FlutterEngineSendWindowMetricsEvent
(
engine
.
get
(),
&
event
),
kSuccess
);
kSuccess
);
...
@@ -2038,7 +2024,6 @@ TEST_F(EmbedderTest, CanRenderGradientWithCompositorWithXform) {
...
@@ -2038,7 +2024,6 @@ TEST_F(EmbedderTest, CanRenderGradientWithCompositorWithXform) {
// Flutter still thinks it is 800 x 600.
// Flutter still thinks it is 800 x 600.
event
.
width
=
800
;
event
.
width
=
800
;
event
.
height
=
600
;
event
.
height
=
600
;
event
.
pixel_ratio
=
1.0
;
ASSERT_EQ
(
FlutterEngineSendWindowMetricsEvent
(
engine
.
get
(),
&
event
),
ASSERT_EQ
(
FlutterEngineSendWindowMetricsEvent
(
engine
.
get
(),
&
event
),
kSuccess
);
kSuccess
);
...
@@ -2149,7 +2134,6 @@ TEST_F(EmbedderTest, CanRenderGradientWithCompositorOnNonRootLayer) {
...
@@ -2149,7 +2134,6 @@ TEST_F(EmbedderTest, CanRenderGradientWithCompositorOnNonRootLayer) {
event
.
struct_size
=
sizeof
(
event
);
event
.
struct_size
=
sizeof
(
event
);
event
.
width
=
800
;
event
.
width
=
800
;
event
.
height
=
600
;
event
.
height
=
600
;
event
.
pixel_ratio
=
1.0
;
ASSERT_EQ
(
FlutterEngineSendWindowMetricsEvent
(
engine
.
get
(),
&
event
),
ASSERT_EQ
(
FlutterEngineSendWindowMetricsEvent
(
engine
.
get
(),
&
event
),
kSuccess
);
kSuccess
);
...
@@ -2269,7 +2253,6 @@ TEST_F(EmbedderTest, CanRenderGradientWithCompositorOnNonRootLayerWithXform) {
...
@@ -2269,7 +2253,6 @@ TEST_F(EmbedderTest, CanRenderGradientWithCompositorOnNonRootLayerWithXform) {
// Flutter still thinks it is 800 x 600.
// Flutter still thinks it is 800 x 600.
event
.
width
=
800
;
event
.
width
=
800
;
event
.
height
=
600
;
event
.
height
=
600
;
event
.
pixel_ratio
=
1.0
;
ASSERT_EQ
(
FlutterEngineSendWindowMetricsEvent
(
engine
.
get
(),
&
event
),
ASSERT_EQ
(
FlutterEngineSendWindowMetricsEvent
(
engine
.
get
(),
&
event
),
kSuccess
);
kSuccess
);
...
@@ -2389,7 +2372,7 @@ TEST_F(EmbedderTest, VerifyB141980393) {
...
@@ -2389,7 +2372,7 @@ TEST_F(EmbedderTest, VerifyB141980393) {
// achieved via a root surface transformation.
// achieved via a root surface transformation.
event
.
width
=
flutter_application_rect
.
width
();
event
.
width
=
flutter_application_rect
.
width
();
event
.
height
=
flutter_application_rect
.
height
();
event
.
height
=
flutter_application_rect
.
height
();
event
.
pixel_ratio
=
1.0
;
ASSERT_EQ
(
FlutterEngineSendWindowMetricsEvent
(
engine
.
get
(),
&
event
),
ASSERT_EQ
(
FlutterEngineSendWindowMetricsEvent
(
engine
.
get
(),
&
event
),
kSuccess
);
kSuccess
);
ASSERT_TRUE
(
engine
.
is_valid
());
ASSERT_TRUE
(
engine
.
is_valid
());
...
@@ -2442,7 +2425,6 @@ TEST_F(EmbedderTest, CaDeinitializeAnEngine) {
...
@@ -2442,7 +2425,6 @@ TEST_F(EmbedderTest, CaDeinitializeAnEngine) {
event
.
struct_size
=
sizeof
(
event
);
event
.
struct_size
=
sizeof
(
event
);
event
.
width
=
800
;
event
.
width
=
800
;
event
.
height
=
600
;
event
.
height
=
600
;
event
.
pixel_ratio
=
1.0
;
ASSERT_EQ
(
FlutterEngineSendWindowMetricsEvent
(
engine
.
get
(),
&
event
),
ASSERT_EQ
(
FlutterEngineSendWindowMetricsEvent
(
engine
.
get
(),
&
event
),
kInvalidArguments
);
kInvalidArguments
);
engine
.
reset
();
engine
.
reset
();
...
@@ -2484,7 +2466,6 @@ TEST_F(EmbedderTest, CanCreateEmbedderWithCustomRenderTaskRunner) {
...
@@ -2484,7 +2466,6 @@ TEST_F(EmbedderTest, CanCreateEmbedderWithCustomRenderTaskRunner) {
event
.
struct_size
=
sizeof
(
event
);
event
.
struct_size
=
sizeof
(
event
);
event
.
width
=
800
;
event
.
width
=
800
;
event
.
height
=
600
;
event
.
height
=
600
;
event
.
pixel_ratio
=
1.0
;
ASSERT_EQ
(
FlutterEngineSendWindowMetricsEvent
(
engine
.
get
(),
&
event
),
ASSERT_EQ
(
FlutterEngineSendWindowMetricsEvent
(
engine
.
get
(),
&
event
),
kSuccess
);
kSuccess
);
task_latch
.
Wait
();
task_latch
.
Wait
();
...
@@ -2544,7 +2525,6 @@ TEST_F(EmbedderTest,
...
@@ -2544,7 +2525,6 @@ TEST_F(EmbedderTest,
event
.
struct_size
=
sizeof
(
event
);
event
.
struct_size
=
sizeof
(
event
);
event
.
width
=
800
;
event
.
width
=
800
;
event
.
height
=
600
;
event
.
height
=
600
;
event
.
pixel_ratio
=
1.0
;
ASSERT_EQ
(
FlutterEngineSendWindowMetricsEvent
(
engine
.
get
(),
&
event
),
ASSERT_EQ
(
FlutterEngineSendWindowMetricsEvent
(
engine
.
get
(),
&
event
),
kSuccess
);
kSuccess
);
});
});
...
@@ -2575,181 +2555,5 @@ TEST_F(EmbedderTest,
...
@@ -2575,181 +2555,5 @@ TEST_F(EmbedderTest,
}
}
}
}
TEST_F
(
EmbedderTest
,
CompositorMustBeAbleToRenderKnownScenePixelRatioOnSurface
)
{
auto
&
context
=
GetEmbedderContext
();
EmbedderConfigBuilder
builder
(
context
);
builder
.
SetOpenGLRendererConfig
(
SkISize
::
Make
(
800
,
600
));
builder
.
SetCompositor
();
builder
.
SetDartEntrypoint
(
"can_display_platform_view_with_pixel_ratio"
);
context
.
GetCompositor
().
SetRenderTargetType
(
EmbedderTestCompositor
::
RenderTargetType
::
kOpenGLTexture
);
fml
::
AutoResetWaitableEvent
latch
;
context
.
GetCompositor
().
SetNextPresentCallback
(
[
&
](
const
FlutterLayer
**
layers
,
size_t
layers_count
)
{
ASSERT_EQ
(
layers_count
,
3u
);
// Layer 0 (Root)
{
FlutterBackingStore
backing_store
=
*
layers
[
0
]
->
backing_store
;
backing_store
.
type
=
kFlutterBackingStoreTypeOpenGL
;
backing_store
.
did_update
=
true
;
backing_store
.
open_gl
.
type
=
kFlutterOpenGLTargetTypeTexture
;
FlutterLayer
layer
=
{};
layer
.
struct_size
=
sizeof
(
layer
);
layer
.
type
=
kFlutterLayerContentTypeBackingStore
;
layer
.
backing_store
=
&
backing_store
;
layer
.
size
=
FlutterSizeMake
(
800.0
,
600.0
);
layer
.
offset
=
FlutterPointMake
(
0.0
,
0.0
);
ASSERT_EQ
(
*
layers
[
0
],
layer
);
}
// Layer 1
{
FlutterPlatformView
platform_view
=
{};
platform_view
.
struct_size
=
sizeof
(
platform_view
);
platform_view
.
identifier
=
42
;
FlutterLayer
layer
=
{};
layer
.
struct_size
=
sizeof
(
layer
);
layer
.
type
=
kFlutterLayerContentTypePlatformView
;
layer
.
platform_view
=
&
platform_view
;
layer
.
size
=
FlutterSizeMake
(
800.0
,
560.0
);
layer
.
offset
=
FlutterPointMake
(
0.0
,
40.0
);
ASSERT_EQ
(
*
layers
[
1
],
layer
);
}
// Layer 2
{
FlutterBackingStore
backing_store
=
*
layers
[
2
]
->
backing_store
;
backing_store
.
type
=
kFlutterBackingStoreTypeOpenGL
;
backing_store
.
did_update
=
true
;
backing_store
.
open_gl
.
type
=
kFlutterOpenGLTargetTypeTexture
;
FlutterLayer
layer
=
{};
layer
.
struct_size
=
sizeof
(
layer
);
layer
.
type
=
kFlutterLayerContentTypeBackingStore
;
layer
.
backing_store
=
&
backing_store
;
layer
.
size
=
FlutterSizeMake
(
800.0
,
600.0
);
layer
.
offset
=
FlutterPointMake
(
0.0
,
0.0
);
ASSERT_EQ
(
*
layers
[
2
],
layer
);
}
latch
.
Signal
();
});
auto
engine
=
builder
.
LaunchEngine
();
// Send a window metrics events so frames may be scheduled.
FlutterWindowMetricsEvent
event
=
{};
event
.
struct_size
=
sizeof
(
event
);
event
.
width
=
400
;
event
.
height
=
300
;
event
.
pixel_ratio
=
2.0
;
ASSERT_EQ
(
FlutterEngineSendWindowMetricsEvent
(
engine
.
get
(),
&
event
),
kSuccess
);
ASSERT_TRUE
(
engine
.
is_valid
());
latch
.
Wait
();
}
TEST_F
(
EmbedderTest
,
CompositorMustBeAbleToRenderKnownScenePixelRatioOnSurfaceWithRootSurfaceXformation
)
{
auto
&
context
=
GetEmbedderContext
();
EmbedderConfigBuilder
builder
(
context
);
builder
.
SetOpenGLRendererConfig
(
SkISize
::
Make
(
600
,
800
));
builder
.
SetCompositor
();
builder
.
SetDartEntrypoint
(
"can_display_platform_view_with_pixel_ratio"
);
context
.
GetCompositor
().
SetRenderTargetType
(
EmbedderTestCompositor
::
RenderTargetType
::
kOpenGLTexture
);
const
auto
root_surface_transformation
=
SkMatrix
().
preTranslate
(
0
,
800
).
preRotate
(
-
90
,
0
,
0
);
context
.
SetRootSurfaceTransformation
(
root_surface_transformation
);
fml
::
AutoResetWaitableEvent
latch
;
context
.
GetCompositor
().
SetNextPresentCallback
(
[
&
](
const
FlutterLayer
**
layers
,
size_t
layers_count
)
{
ASSERT_EQ
(
layers_count
,
3u
);
// Layer 0 (Root)
{
FlutterBackingStore
backing_store
=
*
layers
[
0
]
->
backing_store
;
backing_store
.
type
=
kFlutterBackingStoreTypeOpenGL
;
backing_store
.
did_update
=
true
;
backing_store
.
open_gl
.
type
=
kFlutterOpenGLTargetTypeTexture
;
FlutterLayer
layer
=
{};
layer
.
struct_size
=
sizeof
(
layer
);
layer
.
type
=
kFlutterLayerContentTypeBackingStore
;
layer
.
backing_store
=
&
backing_store
;
layer
.
size
=
FlutterSizeMake
(
600.0
,
800.0
);
layer
.
offset
=
FlutterPointMake
(
0.0
,
0.0
);
ASSERT_EQ
(
*
layers
[
0
],
layer
);
}
// Layer 1
{
FlutterPlatformView
platform_view
=
{};
platform_view
.
struct_size
=
sizeof
(
platform_view
);
platform_view
.
identifier
=
42
;
FlutterLayer
layer
=
{};
layer
.
struct_size
=
sizeof
(
layer
);
layer
.
type
=
kFlutterLayerContentTypePlatformView
;
layer
.
platform_view
=
&
platform_view
;
layer
.
size
=
FlutterSizeMake
(
560.0
,
800.0
);
layer
.
offset
=
FlutterPointMake
(
40.0
,
0.0
);
ASSERT_EQ
(
*
layers
[
1
],
layer
);
}
// Layer 2
{
FlutterBackingStore
backing_store
=
*
layers
[
2
]
->
backing_store
;
backing_store
.
type
=
kFlutterBackingStoreTypeOpenGL
;
backing_store
.
did_update
=
true
;
backing_store
.
open_gl
.
type
=
kFlutterOpenGLTargetTypeTexture
;
FlutterLayer
layer
=
{};
layer
.
struct_size
=
sizeof
(
layer
);
layer
.
type
=
kFlutterLayerContentTypeBackingStore
;
layer
.
backing_store
=
&
backing_store
;
layer
.
size
=
FlutterSizeMake
(
600.0
,
800.0
);
layer
.
offset
=
FlutterPointMake
(
0.0
,
0.0
);
ASSERT_EQ
(
*
layers
[
2
],
layer
);
}
latch
.
Signal
();
});
auto
engine
=
builder
.
LaunchEngine
();
// Send a window metrics events so frames may be scheduled.
FlutterWindowMetricsEvent
event
=
{};
event
.
struct_size
=
sizeof
(
event
);
event
.
width
=
400
;
event
.
height
=
300
;
event
.
pixel_ratio
=
2.0
;
ASSERT_EQ
(
FlutterEngineSendWindowMetricsEvent
(
engine
.
get
(),
&
event
),
kSuccess
);
ASSERT_TRUE
(
engine
.
is_valid
());
latch
.
Wait
();
}
}
// namespace testing
}
// namespace testing
}
// namespace flutter
}
// namespace flutter
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录