Remove rasterizerTracingThreshold, checkerboardRasterCacheImages, and checkerboardOffscreenLayers, etc (flutter/engine#52446)

This commit is contained in:
Ian Hickson
2024-05-01 21:35:04 -07:00
committed by GitHub
parent 51b0f37818
commit 8966c48831
28 changed files with 215 additions and 767 deletions

View File

@@ -54,7 +54,6 @@
../../../flutter/flow/frame_timings_recorder_unittests.cc
../../../flutter/flow/gl_context_switch_unittests.cc
../../../flutter/flow/layers/backdrop_filter_layer_unittests.cc
../../../flutter/flow/layers/checkerboard_layertree_unittests.cc
../../../flutter/flow/layers/clip_path_layer_unittests.cc
../../../flutter/flow/layers/clip_rect_layer_unittests.cc
../../../flutter/flow/layers/clip_rrect_layer_unittests.cc

View File

@@ -158,7 +158,6 @@ if (enable_unittests) {
"frame_timings_recorder_unittests.cc",
"gl_context_switch_unittests.cc",
"layers/backdrop_filter_layer_unittests.cc",
"layers/checkerboard_layertree_unittests.cc",
"layers/clip_path_layer_unittests.cc",
"layers/clip_rect_layer_unittests.cc",
"layers/clip_rrect_layer_unittests.cc",

View File

@@ -1,252 +0,0 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "flutter/flow/layers/clip_path_layer.h"
#include "flutter/flow/layers/clip_rect_layer.h"
#include "flutter/flow/layers/clip_rrect_layer.h"
#include "flutter/flow/testing/layer_test.h"
#include "flutter/flow/testing/mock_layer.h"
#include "flutter/fml/macros.h"
#include "flutter/testing/mock_canvas.h"
namespace flutter {
namespace testing {
using CheckerBoardLayerTest = LayerTest;
using ClipOp = DlCanvas::ClipOp;
#ifndef NDEBUG
TEST_F(CheckerBoardLayerTest, ClipRectSaveLayerCheckBoard) {
const SkMatrix initial_matrix = SkMatrix::Translate(0.5f, 1.0f);
const SkRect child_bounds = SkRect::MakeXYWH(1.0, 2.0, 2.0, 2.0);
const SkRect layer_bounds = SkRect::MakeXYWH(0.5, 1.0, 5.0, 6.0);
const SkPath child_path = SkPath().addRect(child_bounds);
const DlPaint child_paint = DlPaint(DlColor::kYellow());
auto mock_layer = std::make_shared<MockLayer>(child_path, child_paint);
auto layer = std::make_shared<ClipRectLayer>(layer_bounds,
Clip::kAntiAliasWithSaveLayer);
layer->Add(mock_layer);
preroll_context()->state_stack.set_preroll_delegate(initial_matrix);
layer->Preroll(preroll_context());
// Untouched
EXPECT_EQ(preroll_context()->state_stack.device_cull_rect(), kGiantRect);
EXPECT_TRUE(preroll_context()->state_stack.is_empty());
EXPECT_EQ(mock_layer->paint_bounds(), child_bounds);
EXPECT_EQ(layer->paint_bounds(), mock_layer->paint_bounds());
EXPECT_EQ(layer->child_paint_bounds(), child_bounds);
EXPECT_TRUE(mock_layer->needs_painting(paint_context()));
EXPECT_TRUE(layer->needs_painting(paint_context()));
EXPECT_EQ(mock_layer->parent_cull_rect(), layer_bounds);
EXPECT_EQ(mock_layer->parent_matrix(), initial_matrix);
EXPECT_EQ(mock_layer->parent_mutators(),
std::vector({Mutator(layer_bounds)}));
layer->Paint(display_list_paint_context());
{
DisplayListBuilder expected_builder;
/* (ClipRect)layer::Paint */ {
expected_builder.Save();
{
expected_builder.ClipRect(layer_bounds, DlCanvas::ClipOp::kIntersect,
true);
expected_builder.SaveLayer(&child_bounds);
{
/* mock_layer::Paint */ {
expected_builder.DrawPath(child_path, child_paint);
}
}
expected_builder.Restore();
}
expected_builder.Restore();
}
EXPECT_TRUE(
DisplayListsEQ_Verbose(display_list(), expected_builder.Build()));
}
reset_display_list();
layer->Paint(checkerboard_context());
{
DisplayListBuilder expected_builder;
/* (ClipRect)layer::Paint */ {
expected_builder.Save();
{
expected_builder.ClipRect(layer_bounds, DlCanvas::ClipOp::kIntersect,
true);
expected_builder.SaveLayer(&child_bounds);
{
/* mock_layer::Paint */ {
expected_builder.DrawPath(child_path, child_paint);
}
expected_builder.DrawRect(child_path.getBounds(),
checkerboard_paint());
}
expected_builder.Restore();
}
expected_builder.Restore();
}
EXPECT_TRUE(
DisplayListsEQ_Verbose(display_list(), expected_builder.Build()));
}
}
TEST_F(CheckerBoardLayerTest, ClipPathSaveLayerCheckBoard) {
const SkMatrix initial_matrix = SkMatrix::Translate(0.5f, 1.0f);
const SkRect child_bounds = SkRect::MakeXYWH(1.0, 2.0, 2.0, 2.0);
const SkRect layer_bounds = SkRect::MakeXYWH(0.5, 1.0, 5.0, 6.0);
const SkPath child_path = SkPath().addRect(child_bounds);
const SkPath layer_path =
SkPath().addRect(layer_bounds).addRect(layer_bounds);
const DlPaint child_paint = DlPaint(DlColor::kYellow());
const DlPaint clip_paint;
auto mock_layer = std::make_shared<MockLayer>(child_path, child_paint);
auto layer = std::make_shared<ClipPathLayer>(layer_path,
Clip::kAntiAliasWithSaveLayer);
layer->Add(mock_layer);
preroll_context()->state_stack.set_preroll_delegate(initial_matrix);
layer->Preroll(preroll_context());
// Untouched
EXPECT_EQ(preroll_context()->state_stack.device_cull_rect(), kGiantRect);
EXPECT_TRUE(preroll_context()->state_stack.is_empty());
EXPECT_EQ(mock_layer->paint_bounds(), child_bounds);
EXPECT_EQ(layer->paint_bounds(), mock_layer->paint_bounds());
EXPECT_TRUE(mock_layer->needs_painting(paint_context()));
EXPECT_TRUE(layer->needs_painting(paint_context()));
EXPECT_EQ(mock_layer->parent_cull_rect(), layer_bounds);
EXPECT_EQ(mock_layer->parent_matrix(), initial_matrix);
EXPECT_EQ(mock_layer->parent_mutators(), std::vector({Mutator(layer_path)}));
layer->Paint(display_list_paint_context());
{
DisplayListBuilder expected_builder;
/* (ClipRect)layer::Paint */ {
expected_builder.Save();
{
expected_builder.ClipPath(layer_path, DlCanvas::ClipOp::kIntersect,
true);
expected_builder.SaveLayer(&child_bounds);
{
/* mock_layer::Paint */ {
expected_builder.DrawPath(child_path, child_paint);
}
}
expected_builder.Restore();
}
expected_builder.Restore();
}
EXPECT_TRUE(
DisplayListsEQ_Verbose(display_list(), expected_builder.Build()));
}
reset_display_list();
layer->Paint(checkerboard_context());
{
DisplayListBuilder expected_builder;
/* (ClipRect)layer::Paint */ {
expected_builder.Save();
{
expected_builder.ClipPath(layer_path, DlCanvas::ClipOp::kIntersect,
true);
expected_builder.SaveLayer(&child_bounds);
{
/* mock_layer::Paint */ {
expected_builder.DrawPath(child_path, child_paint);
}
expected_builder.DrawRect(child_path.getBounds(),
checkerboard_paint());
}
expected_builder.Restore();
}
expected_builder.Restore();
}
EXPECT_TRUE(
DisplayListsEQ_Verbose(display_list(), expected_builder.Build()));
}
}
TEST_F(CheckerBoardLayerTest, ClipRRectSaveLayerCheckBoard) {
const SkMatrix initial_matrix = SkMatrix::Translate(0.5f, 1.0f);
const SkRect child_bounds = SkRect::MakeXYWH(1.0, 2.0, 2.0, 2.0);
const SkRect layer_bounds = SkRect::MakeXYWH(0.5, 1.0, 5.0, 6.0);
const SkPath child_path = SkPath().addRect(child_bounds);
const SkRRect layer_rrect = SkRRect::MakeRectXY(layer_bounds, .1, .1);
const DlPaint child_paint = DlPaint(DlColor::kYellow());
const DlPaint clip_paint;
auto mock_layer = std::make_shared<MockLayer>(child_path, child_paint);
auto layer = std::make_shared<ClipRRectLayer>(layer_rrect,
Clip::kAntiAliasWithSaveLayer);
layer->Add(mock_layer);
preroll_context()->state_stack.set_preroll_delegate(initial_matrix);
layer->Preroll(preroll_context());
// Untouched
EXPECT_EQ(preroll_context()->state_stack.device_cull_rect(), kGiantRect);
EXPECT_TRUE(preroll_context()->state_stack.is_empty());
EXPECT_EQ(mock_layer->paint_bounds(), child_bounds);
EXPECT_EQ(layer->paint_bounds(), mock_layer->paint_bounds());
EXPECT_TRUE(mock_layer->needs_painting(paint_context()));
EXPECT_TRUE(layer->needs_painting(paint_context()));
EXPECT_EQ(mock_layer->parent_cull_rect(), layer_bounds);
EXPECT_EQ(mock_layer->parent_matrix(), initial_matrix);
EXPECT_EQ(mock_layer->parent_mutators(), std::vector({Mutator(layer_rrect)}));
layer->Paint(display_list_paint_context());
{
DisplayListBuilder expected_builder;
/* (ClipRect)layer::Paint */ {
expected_builder.Save();
{
expected_builder.ClipRRect(layer_rrect, DlCanvas::ClipOp::kIntersect,
true);
expected_builder.SaveLayer(&child_bounds);
{
/* mock_layer::Paint */ {
expected_builder.DrawPath(child_path, child_paint);
}
}
expected_builder.Restore();
}
expected_builder.Restore();
}
EXPECT_TRUE(
DisplayListsEQ_Verbose(display_list(), expected_builder.Build()));
}
reset_display_list();
layer->Paint(checkerboard_context());
{
DisplayListBuilder expected_builder;
/* (ClipRect)layer::Paint */ {
expected_builder.Save();
{
expected_builder.ClipRRect(layer_rrect, DlCanvas::ClipOp::kIntersect,
true);
expected_builder.SaveLayer(&child_bounds);
{
/* mock_layer::Paint */ {
expected_builder.DrawPath(child_path, child_paint);
}
expected_builder.DrawRect(child_path.getBounds(),
checkerboard_paint());
}
expected_builder.Restore();
}
expected_builder.Restore();
}
EXPECT_TRUE(
DisplayListsEQ_Verbose(display_list(), expected_builder.Build()));
}
}
#endif
} // namespace testing
} // namespace flutter

View File

@@ -106,8 +106,6 @@ bool Rasterize(RasterCacheItem::CacheState cache_state,
FML_DCHECK(cache_state != RasterCacheItem::CacheState::kNone);
LayerStateStack state_stack;
state_stack.set_delegate(canvas);
state_stack.set_checkerboard_func(
paint_context.state_stack.checkerboard_func());
PaintContext context = {
// clang-format off
.state_stack = state_stack,

View File

@@ -229,12 +229,6 @@ class SaveLayerEntry : public LayerStateStack::StateEntry {
stack->outstanding_ = {};
}
void restore(LayerStateStack* stack) const override {
if (stack->checkerboard_func_) {
DlCanvas* canvas = stack->canvas_delegate();
if (canvas != nullptr) {
(*stack->checkerboard_func_)(canvas, bounds_);
}
}
stack->delegate_->restore();
stack->outstanding_ = old_attributes_;
}

View File

@@ -131,13 +131,6 @@ class LayerStateStack {
// by this LayerStateStack in the order encountered.
void fill(MutatorsStack* mutators);
// Sets up a checkerboard function that will be used to checkerboard the
// contents of any saveLayer executed by the state stack.
CheckerboardFunc checkerboard_func() const { return checkerboard_func_; }
void set_checkerboard_func(CheckerboardFunc checkerboard_func) {
checkerboard_func_ = checkerboard_func;
}
class AutoRestore {
public:
~AutoRestore() {
@@ -475,7 +468,6 @@ class LayerStateStack {
std::shared_ptr<Delegate> delegate_;
RenderingAttributes outstanding_;
CheckerboardFunc checkerboard_func_ = nullptr;
friend class SaveLayerEntry;
};

View File

@@ -41,7 +41,6 @@ TEST(LayerStateStack, Defaults) {
LayerStateStack state_stack;
ASSERT_EQ(state_stack.canvas_delegate(), nullptr);
ASSERT_EQ(state_stack.checkerboard_func(), nullptr);
ASSERT_EQ(state_stack.outstanding_opacity(), SK_Scalar1);
ASSERT_EQ(state_stack.outstanding_color_filter(), nullptr);
ASSERT_EQ(state_stack.outstanding_image_filter(), nullptr);

View File

@@ -18,13 +18,9 @@
namespace flutter {
LayerTree::LayerTree(const Config& config, const SkISize& frame_size)
: root_layer_(config.root_layer),
frame_size_(frame_size),
rasterizer_tracing_threshold_(config.rasterizer_tracing_threshold),
checkerboard_raster_cache_images_(
config.checkerboard_raster_cache_images),
checkerboard_offscreen_layers_(config.checkerboard_offscreen_layers) {}
LayerTree::LayerTree(const std::shared_ptr<Layer>& root_layer,
const SkISize& frame_size)
: root_layer_(root_layer), frame_size_(frame_size) {}
inline SkColorSpace* GetColorSpace(DlCanvas* canvas) {
return canvas ? canvas->GetImageInfo().colorSpace() : nullptr;
@@ -41,8 +37,6 @@ bool LayerTree::Preroll(CompositorContext::ScopedFrame& frame,
}
SkColorSpace* color_space = GetColorSpace(frame.canvas());
frame.context().raster_cache().SetCheckboardCacheImages(
checkerboard_raster_cache_images_);
LayerStateStack state_stack;
state_stack.set_preroll_delegate(cull_rect,
frame.root_surface_transformation());
@@ -109,11 +103,6 @@ void LayerTree::Paint(CompositorContext::ScopedFrame& frame,
LayerStateStack state_stack;
// DrawCheckerboard is not supported on Impeller.
if (checkerboard_offscreen_layers_ && !frame.aiks_context()) {
state_stack.set_checkerboard_func(DrawCheckerboard);
}
DlCanvas* canvas = frame.canvas();
state_stack.set_delegate(canvas);

View File

@@ -21,14 +21,8 @@ namespace flutter {
class LayerTree {
public:
struct Config {
std::shared_ptr<Layer> root_layer;
uint32_t rasterizer_tracing_threshold = 0;
bool checkerboard_raster_cache_images = false;
bool checkerboard_offscreen_layers = false;
};
LayerTree(const Config& config, const SkISize& frame_size);
LayerTree(const std::shared_ptr<Layer>& root_layer,
const SkISize& frame_size);
// Perform a preroll pass on the tree and return information about
// the tree that affects rendering this frame.
@@ -60,15 +54,8 @@ class LayerTree {
const PaintRegionMap& paint_region_map() const { return paint_region_map_; }
PaintRegionMap& paint_region_map() { return paint_region_map_; }
// The number of frame intervals missed after which the compositor must
// trace the rasterized picture to a trace file. 0 stands for disabling all
// tracing.
uint32_t rasterizer_tracing_threshold() const {
return rasterizer_tracing_threshold_;
}
/// When `Paint` is called, if leaf layer tracing is enabled, additional
/// metadata around raterization of leaf layers is collected.
/// metadata around rasterization of leaf layers is collected.
///
/// This is not supported in the Impeller backend.
///
@@ -84,9 +71,6 @@ class LayerTree {
private:
std::shared_ptr<Layer> root_layer_;
SkISize frame_size_ = SkISize::MakeEmpty(); // Physical pixels.
uint32_t rasterizer_tracing_threshold_;
bool checkerboard_raster_cache_images_;
bool checkerboard_offscreen_layers_;
bool enable_leaf_layer_tracing_ = false;
PaintRegionMap paint_region_map_;

View File

@@ -32,8 +32,9 @@ class LayerTreeTest : public CanvasTest {
CompositorContext::ScopedFrame& frame() { return *scoped_frame_.get(); }
const SkMatrix& root_transform() { return root_transform_; }
std::unique_ptr<LayerTree> BuildLayerTree(const LayerTree::Config& config) {
return std::make_unique<LayerTree>(config, SkISize::Make(64, 64));
std::unique_ptr<LayerTree> BuildLayerTree(
const std::shared_ptr<Layer>& root_layer) {
return std::make_unique<LayerTree>(root_layer, SkISize::Make(64, 64));
}
private:
@@ -44,10 +45,7 @@ class LayerTreeTest : public CanvasTest {
TEST_F(LayerTreeTest, PaintingEmptyLayerDies) {
auto layer = std::make_shared<ContainerLayer>();
auto layer_tree = BuildLayerTree(LayerTree::Config{
.root_layer = layer,
});
auto layer_tree = BuildLayerTree(layer);
layer_tree->Preroll(frame());
EXPECT_EQ(layer->paint_bounds(), SkRect::MakeEmpty());
EXPECT_TRUE(layer->is_empty());
@@ -63,9 +61,7 @@ TEST_F(LayerTreeTest, PaintBeforePrerollDies) {
auto layer = std::make_shared<ContainerLayer>();
layer->Add(mock_layer);
auto layer_tree = BuildLayerTree(LayerTree::Config{
.root_layer = layer,
});
auto layer_tree = BuildLayerTree(layer);
EXPECT_EQ(mock_layer->paint_bounds(), kEmptyRect);
EXPECT_EQ(layer->paint_bounds(), kEmptyRect);
EXPECT_TRUE(mock_layer->is_empty());
@@ -83,9 +79,7 @@ TEST_F(LayerTreeTest, Simple) {
auto layer = std::make_shared<ContainerLayer>();
layer->Add(mock_layer);
auto layer_tree = BuildLayerTree(LayerTree::Config{
.root_layer = layer,
});
auto layer_tree = BuildLayerTree(layer);
layer_tree->Preroll(frame());
EXPECT_EQ(mock_layer->paint_bounds(), child_bounds);
EXPECT_EQ(layer->paint_bounds(), mock_layer->paint_bounds());
@@ -113,9 +107,7 @@ TEST_F(LayerTreeTest, Multiple) {
SkRect expected_total_bounds = child_path1.getBounds();
expected_total_bounds.join(child_path2.getBounds());
auto layer_tree = BuildLayerTree(LayerTree::Config{
.root_layer = layer,
});
auto layer_tree = BuildLayerTree(layer);
layer_tree->Preroll(frame());
EXPECT_EQ(mock_layer1->paint_bounds(), child_path1.getBounds());
EXPECT_EQ(mock_layer2->paint_bounds(), child_path2.getBounds());
@@ -148,9 +140,7 @@ TEST_F(LayerTreeTest, MultipleWithEmpty) {
layer->Add(mock_layer1);
layer->Add(mock_layer2);
auto layer_tree = BuildLayerTree(LayerTree::Config{
.root_layer = layer,
});
auto layer_tree = BuildLayerTree(layer);
layer_tree->Preroll(frame());
EXPECT_EQ(mock_layer1->paint_bounds(), child_path1.getBounds());
EXPECT_EQ(mock_layer2->paint_bounds(), SkPath().getBounds());
@@ -182,9 +172,7 @@ TEST_F(LayerTreeTest, NeedsSystemComposite) {
SkRect expected_total_bounds = child_path1.getBounds();
expected_total_bounds.join(child_path2.getBounds());
auto layer_tree = BuildLayerTree(LayerTree::Config{
.root_layer = layer,
});
auto layer_tree = BuildLayerTree(layer);
layer_tree->Preroll(frame());
EXPECT_EQ(mock_layer1->paint_bounds(), child_path1.getBounds());
EXPECT_EQ(mock_layer2->paint_bounds(), child_path2.getBounds());
@@ -262,7 +250,6 @@ TEST_F(LayerTreeTest, PaintContextInitialization) {
EXPECT_EQ(&context.ui_time, &mock_ui_time);
EXPECT_EQ(context.texture_registry.get(), mock_registry.get());
EXPECT_EQ(context.raster_cache, nullptr);
EXPECT_EQ(context.state_stack.checkerboard_func(), nullptr);
EXPECT_EQ(context.enable_leaf_layer_tracing, false);
EXPECT_EQ(context.layer_snapshot_store, nullptr);

View File

@@ -12,8 +12,6 @@
namespace flutter {
typedef void (*CheckerboardFunc)(DlCanvas*, const SkRect&);
void DrawCheckerboard(DlCanvas* canvas, const SkRect& rect);
} // namespace flutter

View File

@@ -264,18 +264,6 @@ size_t RasterCache::GetPictureCachedEntriesCount() const {
return display_list_cached_entries_count;
}
void RasterCache::SetCheckboardCacheImages(bool checkerboard) {
if (checkerboard_images_ == checkerboard) {
return;
}
checkerboard_images_ = checkerboard;
// Clear all existing entries so previously rasterized items (with or without
// a checkerboard) will be refreshed in subsequent passes.
Clear();
}
void RasterCache::TraceStatsToTimeline() const {
#if !FLUTTER_RELEASE
FML_TRACE_COUNTER(

View File

@@ -166,8 +166,6 @@ class RasterCache {
void Clear();
void SetCheckboardCacheImages(bool checkerboard);
const RasterCacheMetrics& picture_metrics() const { return picture_metrics_; }
const RasterCacheMetrics& layer_metrics() const { return layer_metrics_; }

View File

@@ -143,45 +143,6 @@ TEST(RasterCache, ThresholdIsRespectedForDisplayList) {
ASSERT_TRUE(display_list_item.Draw(paint_context, &dummy_canvas, &paint));
}
TEST(RasterCache, SetCheckboardCacheImages) {
size_t threshold = 1;
flutter::RasterCache cache(threshold);
SkMatrix matrix = SkMatrix::I();
auto display_list = GetSampleDisplayList();
LayerStateStack preroll_state_stack;
preroll_state_stack.set_preroll_delegate(kGiantRect, matrix);
FixedRefreshRateStopwatch raster_time;
FixedRefreshRateStopwatch ui_time;
PaintContextHolder paint_context_holder = GetSamplePaintContextHolder(
preroll_state_stack, &cache, &raster_time, &ui_time);
auto& paint_context = paint_context_holder.paint_context;
auto dummy_draw_function = [](DlCanvas* canvas) {};
bool did_draw_checkerboard = false;
auto draw_checkerboard = [&](DlCanvas* canvas, const SkRect&) {
did_draw_checkerboard = true;
};
RasterCache::Context r_context = {
// clang-format off
.gr_context = paint_context.gr_context,
.dst_color_space = paint_context.dst_color_space,
.matrix = matrix,
.logical_rect = display_list->bounds(),
.flow_type = "RasterCacheFlow::DisplayList",
// clang-format on
};
cache.SetCheckboardCacheImages(false);
cache.Rasterize(r_context, nullptr, dummy_draw_function, draw_checkerboard);
ASSERT_FALSE(did_draw_checkerboard);
cache.SetCheckboardCacheImages(true);
cache.Rasterize(r_context, nullptr, dummy_draw_function, draw_checkerboard);
ASSERT_TRUE(did_draw_checkerboard);
}
TEST(RasterCache, AccessThresholdOfZeroDisablesCachingForDisplayList) {
size_t threshold = 0;
flutter::RasterCache cache(threshold);

View File

@@ -86,26 +86,11 @@ class LayerTestBase : public CanvasTestBase<BaseT> {
.texture_registry = texture_registry_,
.raster_cache = nullptr,
// clang-format on
},
checkerboard_context_{
// clang-format off
.state_stack = checkerboard_state_stack_,
.canvas = &display_list_builder_,
.gr_context = nullptr,
.view_embedder = nullptr,
.raster_time = raster_time_,
.ui_time = ui_time_,
.texture_registry = texture_registry_,
.raster_cache = nullptr,
// clang-format on
} {
use_null_raster_cache();
preroll_state_stack_.set_preroll_delegate(kGiantRect, SkMatrix::I());
paint_state_stack_.set_delegate(&TestT::mock_canvas());
display_list_state_stack_.set_delegate(&display_list_builder_);
checkerboard_state_stack_.set_delegate(&display_list_builder_);
checkerboard_state_stack_.set_checkerboard_func(draw_checkerboard);
checkerboard_paint_.setColor(kCheckerboardColor);
}
/**
@@ -168,8 +153,6 @@ class LayerTestBase : public CanvasTestBase<BaseT> {
PaintContext& display_list_paint_context() {
return display_list_paint_context_;
}
const DlPaint& checkerboard_paint() { return checkerboard_paint_; }
PaintContext& checkerboard_context() { return checkerboard_context_; }
LayerSnapshotStore& layer_snapshot_store() { return snapshot_store_; }
sk_sp<DisplayList> display_list() {
@@ -205,19 +188,8 @@ class LayerTestBase : public CanvasTestBase<BaseT> {
display_list_paint_context_.raster_cache = raster_cache_.get();
}
static constexpr DlColor kCheckerboardColor = DlColor(0x42424242);
static void draw_checkerboard(DlCanvas* canvas, const SkRect& rect) {
if (canvas) {
DlPaint paint;
paint.setColor(kCheckerboardColor);
canvas->DrawRect(rect, paint);
}
}
LayerStateStack preroll_state_stack_;
LayerStateStack paint_state_stack_;
LayerStateStack checkerboard_state_stack_;
FixedRefreshRateStopwatch raster_time_;
FixedRefreshRateStopwatch ui_time_;
std::shared_ptr<TextureRegistry> texture_registry_;
@@ -229,8 +201,6 @@ class LayerTestBase : public CanvasTestBase<BaseT> {
LayerStateStack display_list_state_stack_;
sk_sp<DisplayList> display_list_;
PaintContext display_list_paint_context_;
DlPaint checkerboard_paint_;
PaintContext checkerboard_context_;
LayerSnapshotStore snapshot_store_;
std::vector<RasterCacheItem*> cacheable_items_;

View File

@@ -545,37 +545,6 @@ abstract class SceneBuilder {
double height = 0.0,
});
/// Sets a threshold after which additional debugging information should be recorded.
///
/// Currently this interface is difficult to use by end-developers. If you're
/// interested in using this feature, please contact [flutter-dev](https://groups.google.com/forum/#!forum/flutter-dev).
/// We'll hopefully be able to figure out how to make this feature more useful
/// to you.
void setRasterizerTracingThreshold(int frameInterval);
/// Sets whether the raster cache should checkerboard cached entries. This is
/// only useful for debugging purposes.
///
/// The compositor can sometimes decide to cache certain portions of the
/// widget hierarchy. Such portions typically don't change often from frame to
/// frame and are expensive to render. This can speed up overall rendering. However,
/// there is certain upfront cost to constructing these cache entries. And, if
/// the cache entries are not used very often, this cost may not be worth the
/// speedup in rendering of subsequent frames. If the developer wants to be certain
/// that populating the raster cache is not causing stutters, this option can be
/// set. Depending on the observations made, hints can be provided to the compositor
/// that aid it in making better decisions about caching.
///
/// Currently this interface is difficult to use by end-developers. If you're
/// interested in using this feature, please contact [flutter-dev](https://groups.google.com/forum/#!forum/flutter-dev).
void setCheckerboardRasterCacheImages(bool checkerboard);
/// Sets whether the compositor should checkerboard layers that are rendered
/// to offscreen bitmaps.
///
/// This is only useful for debugging purposes.
void setCheckerboardOffscreenLayers(bool checkerboard);
/// Finishes building the scene.
///
/// Returns a [Scene] containing the objects that have been added to
@@ -945,18 +914,6 @@ base class _NativeSceneBuilder extends NativeFieldWrapperClass1 implements Scene
@Native<Void Function(Pointer<Void>, Double, Double, Double, Double, Int64)>(symbol: 'SceneBuilder::addPlatformView', isLeaf: true)
external void _addPlatformView(double dx, double dy, double width, double height, int viewId);
@override
@Native<Void Function(Pointer<Void>, Uint32)>(symbol: 'SceneBuilder::setRasterizerTracingThreshold', isLeaf: true)
external void setRasterizerTracingThreshold(int frameInterval);
@override
@Native<Void Function(Pointer<Void>, Bool)>(symbol: 'SceneBuilder::setCheckerboardRasterCacheImages', isLeaf: true)
external void setCheckerboardRasterCacheImages(bool checkerboard);
@override
@Native<Void Function(Pointer<Void>, Bool)>(symbol: 'SceneBuilder::setCheckerboardOffscreenLayers', isLeaf: true)
external void setCheckerboardOffscreenLayers(bool checkerboard);
@override
Scene build() {
final Scene scene = _NativeScene._();

View File

@@ -25,36 +25,23 @@ namespace flutter {
IMPLEMENT_WRAPPERTYPEINFO(ui, Scene);
void Scene::create(Dart_Handle scene_handle,
std::shared_ptr<flutter::Layer> rootLayer,
uint32_t rasterizerTracingThreshold,
bool checkerboardRasterCacheImages,
bool checkerboardOffscreenLayers) {
auto scene = fml::MakeRefCounted<Scene>(
std::move(rootLayer), rasterizerTracingThreshold,
checkerboardRasterCacheImages, checkerboardOffscreenLayers);
std::shared_ptr<flutter::Layer> rootLayer) {
auto scene = fml::MakeRefCounted<Scene>(std::move(rootLayer));
scene->AssociateWithDartWrapper(scene_handle);
}
Scene::Scene(std::shared_ptr<flutter::Layer> rootLayer,
uint32_t rasterizerTracingThreshold,
bool checkerboardRasterCacheImages,
bool checkerboardOffscreenLayers) {
layer_tree_config_.root_layer = std::move(rootLayer);
layer_tree_config_.rasterizer_tracing_threshold = rasterizerTracingThreshold;
layer_tree_config_.checkerboard_raster_cache_images =
checkerboardRasterCacheImages;
layer_tree_config_.checkerboard_offscreen_layers =
checkerboardOffscreenLayers;
Scene::Scene(std::shared_ptr<flutter::Layer> rootLayer) {
layer_tree_root_layer_ = std::move(rootLayer);
}
Scene::~Scene() {}
bool Scene::valid() {
return layer_tree_config_.root_layer != nullptr;
return layer_tree_root_layer_ != nullptr;
}
void Scene::dispose() {
layer_tree_config_.root_layer.reset();
layer_tree_root_layer_.reset();
ClearDartWrapper();
}
@@ -137,7 +124,7 @@ std::unique_ptr<LayerTree> Scene::BuildLayerTree(uint32_t width,
if (!valid()) {
return nullptr;
}
return std::make_unique<LayerTree>(layer_tree_config_,
return std::make_unique<LayerTree>(layer_tree_root_layer_,
SkISize::Make(width, height));
}

View File

@@ -20,10 +20,7 @@ class Scene : public RefCountedDartWrappable<Scene> {
public:
~Scene() override;
static void create(Dart_Handle scene_handle,
std::shared_ptr<flutter::Layer> rootLayer,
uint32_t rasterizerTracingThreshold,
bool checkerboardRasterCacheImages,
bool checkerboardOffscreenLayers);
std::shared_ptr<flutter::Layer> rootLayer);
std::unique_ptr<flutter::LayerTree> takeLayerTree(uint64_t width,
uint64_t height);
@@ -39,10 +36,7 @@ class Scene : public RefCountedDartWrappable<Scene> {
void dispose();
private:
Scene(std::shared_ptr<flutter::Layer> rootLayer,
uint32_t rasterizerTracingThreshold,
bool checkerboardRasterCacheImages,
bool checkerboardOffscreenLayers);
explicit Scene(std::shared_ptr<flutter::Layer> rootLayer);
// Returns true if `dispose()` has not been called.
bool valid();
@@ -53,7 +47,7 @@ class Scene : public RefCountedDartWrappable<Scene> {
std::unique_ptr<LayerTree> BuildLayerTree(uint32_t width, uint32_t height);
flutter::LayerTree::Config layer_tree_config_;
std::shared_ptr<Layer> layer_tree_root_layer_;
};
} // namespace flutter

View File

@@ -268,24 +268,10 @@ void SceneBuilder::addPerformanceOverlay(uint64_t enabledOptions,
AddLayer(std::move(layer));
}
void SceneBuilder::setRasterizerTracingThreshold(uint32_t frameInterval) {
rasterizer_tracing_threshold_ = frameInterval;
}
void SceneBuilder::setCheckerboardRasterCacheImages(bool checkerboard) {
checkerboard_raster_cache_images_ = checkerboard;
}
void SceneBuilder::setCheckerboardOffscreenLayers(bool checkerboard) {
checkerboard_offscreen_layers_ = checkerboard;
}
void SceneBuilder::build(Dart_Handle scene_handle) {
FML_DCHECK(layer_stack_.size() >= 1);
Scene::create(
scene_handle, std::move(layer_stack_[0]), rasterizer_tracing_threshold_,
checkerboard_raster_cache_images_, checkerboard_offscreen_layers_);
Scene::create(scene_handle, std::move(layer_stack_[0]));
layer_stack_.clear();
ClearDartWrapper(); // may delete this object.
}

View File

@@ -117,10 +117,6 @@ class SceneBuilder : public RefCountedDartWrappable<SceneBuilder> {
double height,
int64_t viewId);
void setRasterizerTracingThreshold(uint32_t frameInterval);
void setCheckerboardRasterCacheImages(bool checkerboard);
void setCheckerboardOffscreenLayers(bool checkerboard);
void build(Dart_Handle scene_handle);
const std::vector<std::shared_ptr<ContainerLayer>>& layer_stack() {
@@ -135,9 +131,6 @@ class SceneBuilder : public RefCountedDartWrappable<SceneBuilder> {
void PopLayer();
std::vector<std::shared_ptr<ContainerLayer>> layer_stack_;
int rasterizer_tracing_threshold_ = 0;
bool checkerboard_raster_cache_images_ = false;
bool checkerboard_offscreen_layers_ = false;
FML_DISALLOW_COPY_AND_ASSIGN(SceneBuilder);
};

View File

@@ -139,176 +139,173 @@ typedef CanvasPath Path;
// - Resolve the native function pointer associated with an @Native function.
// If there is a mismatch between names or parameter count an @Native is
// trying to resolve, an exception will be thrown.
#define FFI_METHOD_LIST(V) \
V(Canvas, clipPath) \
V(Canvas, clipRect) \
V(Canvas, clipRRect) \
V(Canvas, drawArc) \
V(Canvas, drawAtlas) \
V(Canvas, drawCircle) \
V(Canvas, drawColor) \
V(Canvas, drawDRRect) \
V(Canvas, drawImage) \
V(Canvas, drawImageNine) \
V(Canvas, drawImageRect) \
V(Canvas, drawLine) \
V(Canvas, drawOval) \
V(Canvas, drawPaint) \
V(Canvas, drawPath) \
V(Canvas, drawPicture) \
V(Canvas, drawPoints) \
V(Canvas, drawRRect) \
V(Canvas, drawRect) \
V(Canvas, drawShadow) \
V(Canvas, drawVertices) \
V(Canvas, getDestinationClipBounds) \
V(Canvas, getLocalClipBounds) \
V(Canvas, getSaveCount) \
V(Canvas, getTransform) \
V(Canvas, restore) \
V(Canvas, restoreToCount) \
V(Canvas, rotate) \
V(Canvas, save) \
V(Canvas, saveLayer) \
V(Canvas, saveLayerWithoutBounds) \
V(Canvas, scale) \
V(Canvas, skew) \
V(Canvas, transform) \
V(Canvas, translate) \
V(Codec, dispose) \
V(Codec, frameCount) \
V(Codec, getNextFrame) \
V(Codec, repetitionCount) \
V(ColorFilter, initLinearToSrgbGamma) \
V(ColorFilter, initMatrix) \
V(ColorFilter, initMode) \
V(ColorFilter, initSrgbToLinearGamma) \
V(EngineLayer, dispose) \
V(FragmentProgram, initFromAsset) \
V(ReusableFragmentShader, Dispose) \
V(ReusableFragmentShader, SetImageSampler) \
V(ReusableFragmentShader, ValidateSamplers) \
V(Gradient, initLinear) \
V(Gradient, initRadial) \
V(Gradient, initSweep) \
V(Gradient, initTwoPointConical) \
V(Image, dispose) \
V(Image, width) \
V(Image, height) \
V(Image, toByteData) \
V(Image, colorSpace) \
V(ImageDescriptor, bytesPerPixel) \
V(ImageDescriptor, dispose) \
V(ImageDescriptor, height) \
V(ImageDescriptor, instantiateCodec) \
V(ImageDescriptor, width) \
V(ImageFilter, initBlur) \
V(ImageFilter, initDilate) \
V(ImageFilter, initErode) \
V(ImageFilter, initColorFilter) \
V(ImageFilter, initComposeFilter) \
V(ImageFilter, initMatrix) \
V(ImageShader, dispose) \
V(ImageShader, initWithImage) \
V(ImmutableBuffer, dispose) \
V(ImmutableBuffer, length) \
V(ParagraphBuilder, addPlaceholder) \
V(ParagraphBuilder, addText) \
V(ParagraphBuilder, build) \
V(ParagraphBuilder, pop) \
V(ParagraphBuilder, pushStyle) \
V(Paragraph, alphabeticBaseline) \
V(Paragraph, computeLineMetrics) \
V(Paragraph, didExceedMaxLines) \
V(Paragraph, dispose) \
V(Paragraph, getClosestGlyphInfo) \
V(Paragraph, getGlyphInfoAt) \
V(Paragraph, getLineBoundary) \
V(Paragraph, getLineMetricsAt) \
V(Paragraph, getLineNumberAt) \
V(Paragraph, getNumberOfLines) \
V(Paragraph, getPositionForOffset) \
V(Paragraph, getRectsForPlaceholders) \
V(Paragraph, getRectsForRange) \
V(Paragraph, getWordBoundary) \
V(Paragraph, height) \
V(Paragraph, ideographicBaseline) \
V(Paragraph, layout) \
V(Paragraph, longestLine) \
V(Paragraph, maxIntrinsicWidth) \
V(Paragraph, minIntrinsicWidth) \
V(Paragraph, paint) \
V(Paragraph, width) \
V(PathMeasure, setPath) \
V(PathMeasure, getLength) \
V(PathMeasure, getPosTan) \
V(PathMeasure, getSegment) \
V(PathMeasure, isClosed) \
V(PathMeasure, nextContour) \
V(Path, addArc) \
V(Path, addOval) \
V(Path, addPath) \
V(Path, addPathWithMatrix) \
V(Path, addPolygon) \
V(Path, addRRect) \
V(Path, addRect) \
V(Path, arcTo) \
V(Path, arcToPoint) \
V(Path, clone) \
V(Path, close) \
V(Path, conicTo) \
V(Path, contains) \
V(Path, cubicTo) \
V(Path, extendWithPath) \
V(Path, extendWithPathAndMatrix) \
V(Path, getBounds) \
V(Path, getFillType) \
V(Path, lineTo) \
V(Path, moveTo) \
V(Path, op) \
V(Path, quadraticBezierTo) \
V(Path, relativeArcToPoint) \
V(Path, relativeConicTo) \
V(Path, relativeCubicTo) \
V(Path, relativeLineTo) \
V(Path, relativeMoveTo) \
V(Path, relativeQuadraticBezierTo) \
V(Path, reset) \
V(Path, setFillType) \
V(Path, shift) \
V(Path, transform) \
V(PictureRecorder, endRecording) \
V(Picture, GetAllocationSize) \
V(Picture, dispose) \
V(Picture, toImage) \
V(Picture, toImageSync) \
V(SceneBuilder, addPerformanceOverlay) \
V(SceneBuilder, addPicture) \
V(SceneBuilder, addPlatformView) \
V(SceneBuilder, addRetained) \
V(SceneBuilder, addTexture) \
V(SceneBuilder, build) \
V(SceneBuilder, pop) \
V(SceneBuilder, pushBackdropFilter) \
V(SceneBuilder, pushClipPath) \
V(SceneBuilder, pushClipRRect) \
V(SceneBuilder, pushClipRect) \
V(SceneBuilder, pushColorFilter) \
V(SceneBuilder, pushImageFilter) \
V(SceneBuilder, pushOffset) \
V(SceneBuilder, pushOpacity) \
V(SceneBuilder, pushShaderMask) \
V(SceneBuilder, pushTransformHandle) \
V(SceneBuilder, setCheckerboardOffscreenLayers) \
V(SceneBuilder, setCheckerboardRasterCacheImages) \
V(SceneBuilder, setRasterizerTracingThreshold) \
V(Scene, dispose) \
V(Scene, toImage) \
V(Scene, toImageSync) \
V(SemanticsUpdateBuilder, build) \
V(SemanticsUpdateBuilder, updateCustomAction) \
V(SemanticsUpdateBuilder, updateNode) \
V(SemanticsUpdate, dispose) \
#define FFI_METHOD_LIST(V) \
V(Canvas, clipPath) \
V(Canvas, clipRect) \
V(Canvas, clipRRect) \
V(Canvas, drawArc) \
V(Canvas, drawAtlas) \
V(Canvas, drawCircle) \
V(Canvas, drawColor) \
V(Canvas, drawDRRect) \
V(Canvas, drawImage) \
V(Canvas, drawImageNine) \
V(Canvas, drawImageRect) \
V(Canvas, drawLine) \
V(Canvas, drawOval) \
V(Canvas, drawPaint) \
V(Canvas, drawPath) \
V(Canvas, drawPicture) \
V(Canvas, drawPoints) \
V(Canvas, drawRRect) \
V(Canvas, drawRect) \
V(Canvas, drawShadow) \
V(Canvas, drawVertices) \
V(Canvas, getDestinationClipBounds) \
V(Canvas, getLocalClipBounds) \
V(Canvas, getSaveCount) \
V(Canvas, getTransform) \
V(Canvas, restore) \
V(Canvas, restoreToCount) \
V(Canvas, rotate) \
V(Canvas, save) \
V(Canvas, saveLayer) \
V(Canvas, saveLayerWithoutBounds) \
V(Canvas, scale) \
V(Canvas, skew) \
V(Canvas, transform) \
V(Canvas, translate) \
V(Codec, dispose) \
V(Codec, frameCount) \
V(Codec, getNextFrame) \
V(Codec, repetitionCount) \
V(ColorFilter, initLinearToSrgbGamma) \
V(ColorFilter, initMatrix) \
V(ColorFilter, initMode) \
V(ColorFilter, initSrgbToLinearGamma) \
V(EngineLayer, dispose) \
V(FragmentProgram, initFromAsset) \
V(ReusableFragmentShader, Dispose) \
V(ReusableFragmentShader, SetImageSampler) \
V(ReusableFragmentShader, ValidateSamplers) \
V(Gradient, initLinear) \
V(Gradient, initRadial) \
V(Gradient, initSweep) \
V(Gradient, initTwoPointConical) \
V(Image, dispose) \
V(Image, width) \
V(Image, height) \
V(Image, toByteData) \
V(Image, colorSpace) \
V(ImageDescriptor, bytesPerPixel) \
V(ImageDescriptor, dispose) \
V(ImageDescriptor, height) \
V(ImageDescriptor, instantiateCodec) \
V(ImageDescriptor, width) \
V(ImageFilter, initBlur) \
V(ImageFilter, initDilate) \
V(ImageFilter, initErode) \
V(ImageFilter, initColorFilter) \
V(ImageFilter, initComposeFilter) \
V(ImageFilter, initMatrix) \
V(ImageShader, dispose) \
V(ImageShader, initWithImage) \
V(ImmutableBuffer, dispose) \
V(ImmutableBuffer, length) \
V(ParagraphBuilder, addPlaceholder) \
V(ParagraphBuilder, addText) \
V(ParagraphBuilder, build) \
V(ParagraphBuilder, pop) \
V(ParagraphBuilder, pushStyle) \
V(Paragraph, alphabeticBaseline) \
V(Paragraph, computeLineMetrics) \
V(Paragraph, didExceedMaxLines) \
V(Paragraph, dispose) \
V(Paragraph, getClosestGlyphInfo) \
V(Paragraph, getGlyphInfoAt) \
V(Paragraph, getLineBoundary) \
V(Paragraph, getLineMetricsAt) \
V(Paragraph, getLineNumberAt) \
V(Paragraph, getNumberOfLines) \
V(Paragraph, getPositionForOffset) \
V(Paragraph, getRectsForPlaceholders) \
V(Paragraph, getRectsForRange) \
V(Paragraph, getWordBoundary) \
V(Paragraph, height) \
V(Paragraph, ideographicBaseline) \
V(Paragraph, layout) \
V(Paragraph, longestLine) \
V(Paragraph, maxIntrinsicWidth) \
V(Paragraph, minIntrinsicWidth) \
V(Paragraph, paint) \
V(Paragraph, width) \
V(PathMeasure, setPath) \
V(PathMeasure, getLength) \
V(PathMeasure, getPosTan) \
V(PathMeasure, getSegment) \
V(PathMeasure, isClosed) \
V(PathMeasure, nextContour) \
V(Path, addArc) \
V(Path, addOval) \
V(Path, addPath) \
V(Path, addPathWithMatrix) \
V(Path, addPolygon) \
V(Path, addRRect) \
V(Path, addRect) \
V(Path, arcTo) \
V(Path, arcToPoint) \
V(Path, clone) \
V(Path, close) \
V(Path, conicTo) \
V(Path, contains) \
V(Path, cubicTo) \
V(Path, extendWithPath) \
V(Path, extendWithPathAndMatrix) \
V(Path, getBounds) \
V(Path, getFillType) \
V(Path, lineTo) \
V(Path, moveTo) \
V(Path, op) \
V(Path, quadraticBezierTo) \
V(Path, relativeArcToPoint) \
V(Path, relativeConicTo) \
V(Path, relativeCubicTo) \
V(Path, relativeLineTo) \
V(Path, relativeMoveTo) \
V(Path, relativeQuadraticBezierTo) \
V(Path, reset) \
V(Path, setFillType) \
V(Path, shift) \
V(Path, transform) \
V(PictureRecorder, endRecording) \
V(Picture, GetAllocationSize) \
V(Picture, dispose) \
V(Picture, toImage) \
V(Picture, toImageSync) \
V(SceneBuilder, addPerformanceOverlay) \
V(SceneBuilder, addPicture) \
V(SceneBuilder, addPlatformView) \
V(SceneBuilder, addRetained) \
V(SceneBuilder, addTexture) \
V(SceneBuilder, build) \
V(SceneBuilder, pop) \
V(SceneBuilder, pushBackdropFilter) \
V(SceneBuilder, pushClipPath) \
V(SceneBuilder, pushClipRRect) \
V(SceneBuilder, pushClipRect) \
V(SceneBuilder, pushColorFilter) \
V(SceneBuilder, pushImageFilter) \
V(SceneBuilder, pushOffset) \
V(SceneBuilder, pushOpacity) \
V(SceneBuilder, pushShaderMask) \
V(SceneBuilder, pushTransformHandle) \
V(Scene, dispose) \
V(Scene, toImage) \
V(Scene, toImageSync) \
V(SemanticsUpdateBuilder, build) \
V(SemanticsUpdateBuilder, updateCustomAction) \
V(SemanticsUpdateBuilder, updateNode) \
V(SemanticsUpdate, dispose) \
V(Vertices, dispose)
#ifdef IMPELLER_ENABLE_3D

View File

@@ -107,9 +107,6 @@ abstract class SceneBuilder {
double width = 0.0,
double height = 0.0,
});
void setRasterizerTracingThreshold(int frameInterval);
void setCheckerboardRasterCacheImages(bool checkerboard);
void setCheckerboardOffscreenLayers(bool checkerboard);
Scene build();
void setProperties(
double width,

View File

@@ -203,21 +203,6 @@ class LayerSceneBuilder implements ui.SceneBuilder {
return pushLayer<TransformEngineLayer>(TransformEngineLayer(matrix));
}
@override
void setCheckerboardOffscreenLayers(bool checkerboard) {
// TODO(hterkelsen): implement setCheckerboardOffscreenLayers
}
@override
void setCheckerboardRasterCacheImages(bool checkerboard) {
// TODO(hterkelsen): implement setCheckerboardRasterCacheImages
}
@override
void setRasterizerTracingThreshold(int frameInterval) {
// TODO(hterkelsen): implement setRasterizerTracingThreshold
}
T pushLayer<T extends ContainerLayer>(T layer) {
currentLayer.add(layer);
currentLayer = layer;

View File

@@ -425,42 +425,6 @@ class SurfaceSceneBuilder implements ui.SceneBuilder {
_addSurface(PersistedPlatformView(viewId, dx, dy, width, height));
}
/// Sets a threshold after which additional debugging information should be
/// recorded.
///
/// Currently this interface is difficult to use by end-developers. If you're
/// interested in using this feature, please contact [flutter-dev](https://groups.google.com/forum/#!forum/flutter-dev).
/// We'll hopefully be able to figure out how to make this feature more useful
/// to you.
@override
void setRasterizerTracingThreshold(int frameInterval) {}
/// Sets whether the raster cache should checkerboard cached entries. This is
/// only useful for debugging purposes.
///
/// The compositor can sometimes decide to cache certain portions of the
/// widget hierarchy. Such portions typically don't change often from frame to
/// frame and are expensive to render. This can speed up overall rendering.
/// However, there is certain upfront cost to constructing these cache
/// entries. And, if the cache entries are not used very often, this cost may
/// not be worth the speedup in rendering of subsequent frames. If the
/// developer wants to be certain that populating the raster cache is not
/// causing stutters, this option can be set. Depending on the observations
/// made, hints can be provided to the compositor that aid it in making better
/// decisions about caching.
///
/// Currently this interface is difficult to use by end-developers. If you're
/// interested in using this feature, please contact [flutter-dev](https://groups.google.com/forum/#!forum/flutter-dev).
@override
void setCheckerboardRasterCacheImages(bool checkerboard) {}
/// Sets whether the compositor should checkerboard layers that are rendered
/// to offscreen bitmaps.
///
/// This is only useful for debugging purposes.
@override
void setCheckerboardOffscreenLayers(bool checkerboard) {}
/// The scene recorded in the last frame.
///
/// This is a surface tree that holds onto the DOM elements that can be reused

View File

@@ -227,16 +227,6 @@ class EngineSceneBuilder implements ui.SceneBuilder {
TransformOperation(matrix4),
);
@override
void setCheckerboardOffscreenLayers(bool checkerboard) {
// Not implemented on web
}
@override
void setCheckerboardRasterCacheImages(bool checkerboard) {
// Not implemented on web
}
@override
void setProperties(
double width,
@@ -250,11 +240,6 @@ class EngineSceneBuilder implements ui.SceneBuilder {
// Not implemented on web
}
@override
void setRasterizerTracingThreshold(int frameInterval) {
// Not implemented on web
}
@override
ui.Scene build() {
while (currentBuilder.parent != null) {

View File

@@ -166,8 +166,8 @@ TEST_F(ShellTest, AnimatorDoesNotNotifyIdleBeforeRender) {
[&] {
ASSERT_FALSE(delegate.notify_idle_called_);
EXPECT_CALL(delegate, OnAnimatorBeginFrame).WillOnce([&] {
auto layer_tree = std::make_unique<LayerTree>(
LayerTree::Config(), SkISize::Make(600, 800));
auto layer_tree =
std::make_unique<LayerTree>(nullptr, SkISize::Make(600, 800));
animator->Render(kImplicitViewId, std::move(layer_tree), 1.0);
render_latch.Signal();
});
@@ -247,8 +247,8 @@ TEST_F(ShellTest, AnimatorDoesNotNotifyDelegateIfPipelineIsNotEmpty) {
for (int i = 0; i < 2; i++) {
task_runners.GetUITaskRunner()->PostTask([&] {
EXPECT_CALL(delegate, OnAnimatorBeginFrame).WillOnce([&] {
auto layer_tree = std::make_unique<LayerTree>(LayerTree::Config(),
SkISize::Make(600, 800));
auto layer_tree =
std::make_unique<LayerTree>(nullptr, SkISize::Make(600, 800));
animator->Render(kImplicitViewId, std::move(layer_tree), 1.0);
begin_frame_latch.Signal();
});

View File

@@ -240,9 +240,8 @@ TEST(RasterizerTest,
fml::AutoResetWaitableEvent latch;
thread_host.raster_thread->GetTaskRunner()->PostTask([&] {
auto pipeline = std::make_shared<FramePipeline>(/*depth=*/10);
auto layer_tree =
std::make_unique<LayerTree>(/*config=*/LayerTree::Config(),
/*frame_size=*/SkISize());
auto layer_tree = std::make_unique<LayerTree>(/*root_layer=*/nullptr,
/*frame_size=*/SkISize());
auto layer_tree_item = std::make_unique<FrameItem>(
SingleLayerTreeList(kImplicitViewId, std::move(layer_tree),
kDevicePixelRatio),
@@ -315,7 +314,7 @@ TEST(
thread_host.raster_thread->GetTaskRunner()->PostTask([&] {
auto pipeline = std::make_shared<FramePipeline>(/*depth=*/10);
auto layer_tree = std::make_unique<LayerTree>(
/*config=*/LayerTree::Config(), /*frame_size=*/SkISize());
/*root_layer=*/nullptr, /*frame_size=*/SkISize());
auto layer_tree_item = std::make_unique<FrameItem>(
SingleLayerTreeList(kImplicitViewId, std::move(layer_tree),
kDevicePixelRatio),
@@ -393,7 +392,7 @@ TEST(
rasterizer->Setup(std::move(surface));
auto pipeline = std::make_shared<FramePipeline>(/*depth=*/10);
auto layer_tree = std::make_unique<LayerTree>(/*config=*/LayerTree::Config(),
auto layer_tree = std::make_unique<LayerTree>(/*root_layer=*/nullptr,
/*frame_size=*/SkISize());
auto layer_tree_item = std::make_unique<FrameItem>(
SingleLayerTreeList(kImplicitViewId, std::move(layer_tree),
@@ -476,7 +475,7 @@ TEST(RasterizerTest,
rasterizer->Setup(std::move(surface));
auto pipeline = std::make_shared<FramePipeline>(/*depth=*/10);
auto layer_tree = std::make_unique<LayerTree>(/*config=*/LayerTree::Config(),
auto layer_tree = std::make_unique<LayerTree>(/*root_layer=*/nullptr,
/*frame_size=*/SkISize());
auto layer_tree_item = std::make_unique<FrameItem>(
SingleLayerTreeList(kImplicitViewId, std::move(layer_tree),
@@ -529,7 +528,7 @@ TEST(RasterizerTest, externalViewEmbedderDoesntEndFrameWhenNoSurfaceIsSet) {
thread_host.raster_thread->GetTaskRunner()->PostTask([&] {
auto pipeline = std::make_shared<FramePipeline>(/*depth=*/10);
auto layer_tree = std::make_unique<LayerTree>(
/*config=*/LayerTree::Config(), /*frame_size=*/SkISize());
/*root_layer=*/nullptr, /*frame_size=*/SkISize());
auto layer_tree_item = std::make_unique<FrameItem>(
SingleLayerTreeList(kImplicitViewId, std::move(layer_tree),
kDevicePixelRatio),
@@ -593,7 +592,7 @@ TEST(RasterizerTest, externalViewEmbedderDoesntEndFrameWhenNotUsedThisFrame) {
thread_host.raster_thread->GetTaskRunner()->PostTask([&] {
auto pipeline = std::make_shared<FramePipeline>(/*depth=*/10);
auto layer_tree = std::make_unique<LayerTree>(
/*config=*/LayerTree::Config(), /*frame_size=*/SkISize());
/*root_layer=*/nullptr, /*frame_size=*/SkISize());
auto layer_tree_item = std::make_unique<FrameItem>(
SingleLayerTreeList(kImplicitViewId, std::move(layer_tree),
kDevicePixelRatio),
@@ -722,9 +721,9 @@ TEST(RasterizerTest, drawMultipleViewsWithExternalViewEmbedder) {
auto pipeline = std::make_shared<FramePipeline>(/*depth=*/10);
std::vector<std::unique_ptr<LayerTreeTask>> tasks;
tasks.push_back(std::make_unique<LayerTreeTask>(
0, std::make_unique<LayerTree>(LayerTree::Config(), SkISize()), 1.5));
0, std::make_unique<LayerTree>(nullptr, SkISize()), 1.5));
tasks.push_back(std::make_unique<LayerTreeTask>(
1, std::make_unique<LayerTree>(LayerTree::Config(), SkISize()), 2.0));
1, std::make_unique<LayerTree>(nullptr, SkISize()), 2.0));
auto layer_tree_item = std::make_unique<FrameItem>(
std::move(tasks), CreateFinishedBuildRecorder());
PipelineProduceResult result =
@@ -782,7 +781,7 @@ TEST(RasterizerTest,
thread_host.raster_thread->GetTaskRunner()->PostTask([&] {
auto pipeline = std::make_shared<FramePipeline>(/*depth=*/10);
auto layer_tree = std::make_unique<LayerTree>(
/*config=*/LayerTree::Config(), /*frame_size=*/SkISize());
/*root_layer=*/nullptr, /*frame_size=*/SkISize());
auto layer_tree_item = std::make_unique<FrameItem>(
SingleLayerTreeList(kImplicitViewId, std::move(layer_tree),
kDevicePixelRatio),
@@ -843,7 +842,7 @@ TEST(
thread_host.raster_thread->GetTaskRunner()->PostTask([&] {
auto pipeline = std::make_shared<FramePipeline>(/*depth=*/10);
auto layer_tree = std::make_unique<LayerTree>(
/*config=*/LayerTree::Config(), /*frame_size=*/SkISize());
/*root_layer=*/nullptr, /*frame_size=*/SkISize());
auto layer_tree_item = std::make_unique<FrameItem>(
SingleLayerTreeList(kImplicitViewId, std::move(layer_tree),
kDevicePixelRatio),
@@ -904,7 +903,7 @@ TEST(
thread_host.raster_thread->GetTaskRunner()->PostTask([&] {
auto pipeline = std::make_shared<FramePipeline>(/*depth=*/10);
auto layer_tree = std::make_unique<LayerTree>(
/*config=*/LayerTree::Config(), /*frame_size=*/SkISize());
/*root_layer=*/nullptr, /*frame_size=*/SkISize());
auto layer_tree_item = std::make_unique<FrameItem>(
SingleLayerTreeList(kImplicitViewId, std::move(layer_tree),
kDevicePixelRatio),
@@ -964,7 +963,7 @@ TEST(
thread_host.raster_thread->GetTaskRunner()->PostTask([&] {
auto pipeline = std::make_shared<FramePipeline>(/*depth=*/10);
auto layer_tree = std::make_unique<LayerTree>(
/*config=*/LayerTree::Config(), /*frame_size=*/SkISize());
/*root_layer=*/nullptr, /*frame_size=*/SkISize());
auto layer_tree_item = std::make_unique<FrameItem>(
SingleLayerTreeList(kImplicitViewId, std::move(layer_tree),
kDevicePixelRatio),
@@ -1022,7 +1021,7 @@ TEST(
thread_host.raster_thread->GetTaskRunner()->PostTask([&] {
auto pipeline = std::make_shared<FramePipeline>(/*depth=*/10);
auto layer_tree = std::make_unique<LayerTree>(
/*config=*/LayerTree::Config(), /*frame_size=*/SkISize());
/*root_layer=*/nullptr, /*frame_size=*/SkISize());
auto layer_tree_item = std::make_unique<FrameItem>(
SingleLayerTreeList(kImplicitViewId, std::move(layer_tree),
kDevicePixelRatio),
@@ -1106,7 +1105,7 @@ TEST(RasterizerTest,
auto pipeline = std::make_shared<FramePipeline>(/*depth=*/10);
for (int i = 0; i < 2; i++) {
auto layer_tree = std::make_unique<LayerTree>(
/*config=*/LayerTree::Config(), /*frame_size=*/SkISize());
/*root_layer=*/nullptr, /*frame_size=*/SkISize());
auto layer_tree_item = std::make_unique<FrameItem>(
SingleLayerTreeList(kImplicitViewId, std::move(layer_tree),
kDevicePixelRatio),
@@ -1280,7 +1279,7 @@ TEST(RasterizerTest, presentationTimeSetWhenVsyncTargetInFuture) {
auto pipeline = std::make_shared<FramePipeline>(/*depth=*/10);
for (int i = 0; i < 2; i++) {
auto layer_tree = std::make_unique<LayerTree>(
/*config=*/LayerTree::Config(), /*frame_size=*/SkISize());
/*root_layer=*/nullptr, /*frame_size=*/SkISize());
auto layer_tree_item = std::make_unique<FrameItem>(
SingleLayerTreeList(kImplicitViewId, std::move(layer_tree),
kDevicePixelRatio),
@@ -1363,7 +1362,7 @@ TEST(RasterizerTest, presentationTimeNotSetWhenVsyncTargetInPast) {
rasterizer->Setup(std::move(surface));
auto pipeline = std::make_shared<FramePipeline>(/*depth=*/10);
auto layer_tree = std::make_unique<LayerTree>(
/*config=*/LayerTree::Config(), /*frame_size=*/SkISize());
/*root_layer=*/nullptr, /*frame_size=*/SkISize());
auto layer_tree_item = std::make_unique<FrameItem>(
SingleLayerTreeList(kImplicitViewId, std::move(layer_tree),
kDevicePixelRatio),

View File

@@ -241,7 +241,7 @@ void ShellTest::PumpOneFrame(Shell* shell, FrameContent frame_content) {
identity.setIdentity();
auto root_layer = std::make_shared<TransformLayer>(identity);
auto layer_tree = std::make_unique<LayerTree>(
LayerTree::Config{.root_layer = root_layer},
root_layer,
SkISize::Make(view_content.viewport_metrics.physical_width,
view_content.viewport_metrics.physical_height));
float device_pixel_ratio = static_cast<float>(