fix video(texture) with opacity can not play issue (flutter/engine#23793)

This commit is contained in:
zljj0818
2021-01-27 06:44:01 +08:00
committed by GitHub
parent d37e04a7c0
commit a184dbb90d
3 changed files with 10 additions and 1 deletions

View File

@@ -43,6 +43,7 @@ void ContainerLayer::PrerollChildren(PrerollContext* context,
// always be false.
FML_DCHECK(!context->has_platform_view);
bool child_has_platform_view = false;
bool child_has_texture_layer = false;
for (auto& layer : layers_) {
// Reset context->has_platform_view to false so that layers aren't treated
// as if they have a platform view based on one being previously found in a
@@ -58,9 +59,12 @@ void ContainerLayer::PrerollChildren(PrerollContext* context,
child_has_platform_view =
child_has_platform_view || context->has_platform_view;
child_has_texture_layer =
child_has_texture_layer || context->has_texture_layer;
}
context->has_platform_view = child_has_platform_view;
context->has_texture_layer = child_has_texture_layer;
#if defined(LEGACY_FUCHSIA_EMBEDDER)
if (child_layer_exists_below_) {
@@ -90,7 +94,8 @@ void ContainerLayer::PaintChildren(PaintContext& context) const {
void ContainerLayer::TryToPrepareRasterCache(PrerollContext* context,
Layer* layer,
const SkMatrix& matrix) {
if (!context->has_platform_view && context->raster_cache &&
if (!context->has_platform_view && !context->has_texture_layer &&
context->raster_cache &&
SkRect::Intersects(context->cull_rect, layer->paint_bounds())) {
context->raster_cache->Prepare(context, layer, matrix);
}

View File

@@ -64,6 +64,9 @@ struct PrerollContext {
// Informs whether a layer needs to be system composited.
bool child_scene_layer_exists_below = false;
#endif
// These allow us to track properties like elevation, opacity, and the
// prescence of a texture layer during Preroll.
bool has_texture_layer = false;
};
// Represents a single composited layer. Created on the UI thread but then

View File

@@ -28,6 +28,7 @@ void TextureLayer::Preroll(PrerollContext* context, const SkMatrix& matrix) {
set_paint_bounds(SkRect::MakeXYWH(offset_.x(), offset_.y(), size_.width(),
size_.height()));
context->has_texture_layer = true;
}
void TextureLayer::Paint(PaintContext& context) const {