Fix Mozart child views (flutter/engine#3232)
When we pipelined the drawing commands we caused UpdateScene to be called before Preroll, which isn't allowed. Now we call Preroll, UpdateScene, and Paint separately.
This commit is contained in:
@@ -19,23 +19,20 @@ LayerTree::~LayerTree() {}
|
||||
|
||||
void LayerTree::Raster(CompositorContext::ScopedFrame& frame,
|
||||
bool ignore_raster_cache) {
|
||||
{
|
||||
TRACE_EVENT0("flutter", "LayerTree::Preroll");
|
||||
frame.context().raster_cache().SetCheckboardCacheImages(
|
||||
checkerboard_raster_cache_images_);
|
||||
Layer::PrerollContext context = {
|
||||
ignore_raster_cache ? nullptr : &frame.context().raster_cache(),
|
||||
frame.gr_context(), SkRect::MakeEmpty(),
|
||||
};
|
||||
root_layer_->Preroll(&context, SkMatrix());
|
||||
}
|
||||
Preroll(frame, ignore_raster_cache);
|
||||
Paint(frame);
|
||||
}
|
||||
|
||||
{
|
||||
Layer::PaintContext context = {frame.canvas(), frame.context().frame_time(),
|
||||
frame.context().engine_time()};
|
||||
TRACE_EVENT0("flutter", "LayerTree::Paint");
|
||||
root_layer_->Paint(context);
|
||||
}
|
||||
void LayerTree::Preroll(CompositorContext::ScopedFrame& frame,
|
||||
bool ignore_raster_cache) {
|
||||
TRACE_EVENT0("flutter", "LayerTree::Preroll");
|
||||
frame.context().raster_cache().SetCheckboardCacheImages(
|
||||
checkerboard_raster_cache_images_);
|
||||
Layer::PrerollContext context = {
|
||||
ignore_raster_cache ? nullptr : &frame.context().raster_cache(),
|
||||
frame.gr_context(), SkRect::MakeEmpty(),
|
||||
};
|
||||
root_layer_->Preroll(&context, SkMatrix());
|
||||
}
|
||||
|
||||
#if defined(OS_FUCHSIA)
|
||||
@@ -46,4 +43,11 @@ void LayerTree::UpdateScene(mozart::SceneUpdate* update,
|
||||
}
|
||||
#endif
|
||||
|
||||
void LayerTree::Paint(CompositorContext::ScopedFrame& frame) {
|
||||
Layer::PaintContext context = {frame.canvas(), frame.context().frame_time(),
|
||||
frame.context().engine_time()};
|
||||
TRACE_EVENT0("flutter", "LayerTree::Paint");
|
||||
root_layer_->Paint(context);
|
||||
}
|
||||
|
||||
} // namespace flow
|
||||
|
||||
@@ -23,9 +23,13 @@ class LayerTree {
|
||||
|
||||
~LayerTree();
|
||||
|
||||
// Raster includes both Preroll and Paint.
|
||||
void Raster(CompositorContext::ScopedFrame& frame,
|
||||
bool ignore_raster_cache = false);
|
||||
|
||||
void Preroll(CompositorContext::ScopedFrame& frame,
|
||||
bool ignore_raster_cache = false);
|
||||
|
||||
#if defined(OS_FUCHSIA)
|
||||
// TODO(abarth): Integrate scene updates with the rasterization pass so that
|
||||
// we can draw on top of child scenes (and so that we can apply clips and
|
||||
@@ -33,6 +37,8 @@ class LayerTree {
|
||||
void UpdateScene(mozart::SceneUpdate* update, mozart::Node* container);
|
||||
#endif
|
||||
|
||||
void Paint(CompositorContext::ScopedFrame& frame);
|
||||
|
||||
Layer* root_layer() const { return root_layer_.get(); }
|
||||
|
||||
void set_root_layer(std::unique_ptr<Layer> root_layer) {
|
||||
|
||||
Reference in New Issue
Block a user