Skip to content

Commit

Permalink
remove dpr on preroll, paint, and diff context
Browse files Browse the repository at this point in the history
  • Loading branch information
jonahwilliams committed May 3, 2023
1 parent d190333 commit 13a7519
Show file tree
Hide file tree
Showing 17 changed files with 2 additions and 53 deletions.
4 changes: 1 addition & 3 deletions flow/compositor_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ std::optional<SkRect> FrameDamage::ComputeClipRect(
bool has_raster_cache) {
if (layer_tree.root_layer()) {
PaintRegionMap empty_paint_region_map;
DiffContext context(layer_tree.frame_size(),
layer_tree.device_pixel_ratio(),
layer_tree.paint_region_map(),
DiffContext context(layer_tree.frame_size(), layer_tree.paint_region_map(),
prev_layer_tree_ ? prev_layer_tree_->paint_region_map()
: empty_paint_region_map,
has_raster_cache);
Expand Down
2 changes: 0 additions & 2 deletions flow/diff_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@
namespace flutter {

DiffContext::DiffContext(SkISize frame_size,
double frame_device_pixel_ratio,
PaintRegionMap& this_frame_paint_region_map,
const PaintRegionMap& last_frame_paint_region_map,
bool has_raster_cache)
: clip_tracker_(DisplayListMatrixClipTracker(kGiantRect, SkMatrix::I())),
rects_(std::make_shared<std::vector<SkRect>>()),
frame_size_(frame_size),
frame_device_pixel_ratio_(frame_device_pixel_ratio),
this_frame_paint_region_map_(this_frame_paint_region_map),
last_frame_paint_region_map_(last_frame_paint_region_map),
has_raster_cache_(has_raster_cache) {}
Expand Down
4 changes: 0 additions & 4 deletions flow/diff_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ using PaintRegionMap = std::map<uint64_t, PaintRegion>;
class DiffContext {
public:
explicit DiffContext(SkISize frame_size,
double device_pixel_aspect_ratio,
PaintRegionMap& this_frame_paint_region_map,
const PaintRegionMap& last_frame_paint_region_map,
bool has_raster_cache);
Expand Down Expand Up @@ -141,8 +140,6 @@ class DiffContext {
int horizontal_clip_alignment = 0,
int vertical_clip_alignment = 0) const;

double frame_device_pixel_ratio() const { return frame_device_pixel_ratio_; };

// Adds the region to current damage. Used for removed layers, where instead
// of diffing the layer its paint region is direcly added to damage.
void AddDamage(const PaintRegion& damage);
Expand Down Expand Up @@ -234,7 +231,6 @@ class DiffContext {
std::shared_ptr<std::vector<SkRect>> rects_;
State state_;
SkISize frame_size_;
double frame_device_pixel_ratio_;
std::vector<State> state_stack_;
std::vector<FilterBoundsAdjustment> filter_bounds_adjustment_stack_;

Expand Down
2 changes: 0 additions & 2 deletions flow/layers/layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ struct PrerollContext {
const Stopwatch& raster_time;
const Stopwatch& ui_time;
std::shared_ptr<TextureRegistry> texture_registry;
const float frame_device_pixel_ratio = 1.0f;

// These allow us to track properties like elevation, opacity, and the
// presence of a platform view during Preroll.
Expand Down Expand Up @@ -114,7 +113,6 @@ struct PaintContext {
const Stopwatch& ui_time;
std::shared_ptr<TextureRegistry> texture_registry;
const RasterCache* raster_cache;
const float frame_device_pixel_ratio = 1.0f;

// Snapshot store to collect leaf layer snapshots. The store is non-null
// only when leaf layer tracing is enabled.
Expand Down
1 change: 0 additions & 1 deletion flow/layers/layer_raster_cache_item.cc
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ bool Rasterize(RasterCacheItem::CacheState cache_state,
.ui_time = paint_context.ui_time,
.texture_registry = paint_context.texture_registry,
.raster_cache = paint_context.raster_cache,
.frame_device_pixel_ratio = paint_context.frame_device_pixel_ratio,
// clang-format on
};

Expand Down
4 changes: 0 additions & 4 deletions flow/layers/layer_tree.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ bool LayerTree::Preroll(CompositorContext::ScopedFrame& frame,
.raster_time = frame.context().raster_time(),
.ui_time = frame.context().ui_time(),
.texture_registry = frame.context().texture_registry(),
.frame_device_pixel_ratio = device_pixel_ratio_,
.raster_cached_entries = &raster_cache_items_,
.display_list_enabled = frame.display_list_builder() != nullptr,
// clang-format on
Expand Down Expand Up @@ -141,7 +140,6 @@ void LayerTree::Paint(CompositorContext::ScopedFrame& frame,
.ui_time = frame.context().ui_time(),
.texture_registry = frame.context().texture_registry(),
.raster_cache = cache,
.frame_device_pixel_ratio = device_pixel_ratio_,
.layer_snapshot_store = snapshot_store,
.enable_leaf_layer_tracing = enable_leaf_layer_tracing_,
.aiks_context = frame.aiks_context(),
Expand Down Expand Up @@ -182,7 +180,6 @@ sk_sp<DisplayList> LayerTree::Flatten(
.raster_time = unused_stopwatch,
.ui_time = unused_stopwatch,
.texture_registry = texture_registry,
.frame_device_pixel_ratio = device_pixel_ratio_
// clang-format on
};

Expand All @@ -199,7 +196,6 @@ sk_sp<DisplayList> LayerTree::Flatten(
.ui_time = unused_stopwatch,
.texture_registry = texture_registry,
.raster_cache = nullptr,
.frame_device_pixel_ratio = device_pixel_ratio_,
.layer_snapshot_store = nullptr,
.enable_leaf_layer_tracing = false,
// clang-format on
Expand Down
2 changes: 0 additions & 2 deletions flow/layers/layer_tree_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ TEST_F(LayerTreeTest, PrerollContextInitialization) {
EXPECT_EQ(&context.raster_time, &mock_raster_time);
EXPECT_EQ(&context.ui_time, &mock_ui_time);
EXPECT_EQ(context.texture_registry.get(), mock_registry.get());
EXPECT_EQ(context.frame_device_pixel_ratio, 1.0f);

EXPECT_EQ(context.has_platform_view, false);
EXPECT_EQ(context.has_texture_layer, false);
Expand Down Expand Up @@ -252,7 +251,6 @@ TEST_F(LayerTreeTest, PaintContextInitialization) {
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.frame_device_pixel_ratio, 1.0f);

EXPECT_EQ(context.enable_leaf_layer_tracing, false);
EXPECT_EQ(context.layer_snapshot_store, nullptr);
Expand Down
1 change: 0 additions & 1 deletion flow/layers/performance_overlay_layer_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ static void TestPerformanceOverlayLayerGold(int refresh_rate) {
.ui_time = mock_stopwatch,
.texture_registry = nullptr,
.raster_cache = nullptr,
.frame_device_pixel_ratio = 1.0f,
// clang-format on
};

Expand Down
2 changes: 1 addition & 1 deletion flow/testing/diff_context_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Damage DiffContextTest::DiffLayerTree(MockLayerTree& layer_tree,
bool use_raster_cache) {
FML_CHECK(layer_tree.size() == old_layer_tree.size());

DiffContext dc(layer_tree.size(), 1, layer_tree.paint_region_map(),
DiffContext dc(layer_tree.size(), layer_tree.paint_region_map(),
old_layer_tree.paint_region_map(), use_raster_cache);
dc.PushCullRect(
SkRect::MakeIWH(layer_tree.size().width(), layer_tree.size().height()));
Expand Down
4 changes: 0 additions & 4 deletions flow/testing/layer_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ class LayerTestBase : public CanvasTestBase<BaseT> {
.raster_time = raster_time_,
.ui_time = ui_time_,
.texture_registry = texture_registry_,
.frame_device_pixel_ratio = 1.0f,
.has_platform_view = false,
.raster_cached_entries = &cacheable_items_,
// clang-format on
Expand All @@ -71,7 +70,6 @@ class LayerTestBase : public CanvasTestBase<BaseT> {
.ui_time = ui_time_,
.texture_registry = texture_registry_,
.raster_cache = nullptr,
.frame_device_pixel_ratio = 1.0f,
// clang-format on
},
display_list_builder_(kDlBounds),
Expand All @@ -85,7 +83,6 @@ class LayerTestBase : public CanvasTestBase<BaseT> {
.ui_time = ui_time_,
.texture_registry = texture_registry_,
.raster_cache = nullptr,
.frame_device_pixel_ratio = 1.0f,
// clang-format on
},
checkerboard_context_{
Expand All @@ -98,7 +95,6 @@ class LayerTestBase : public CanvasTestBase<BaseT> {
.ui_time = ui_time_,
.texture_registry = texture_registry_,
.raster_cache = nullptr,
.frame_device_pixel_ratio = 1.0f,
// clang-format on
} {
use_null_raster_cache();
Expand Down
2 changes: 0 additions & 2 deletions flow/testing/mock_raster_cache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ PrerollContextHolder GetSamplePrerollContextHolder(
.raster_time = *raster_time,
.ui_time = *ui_time,
.texture_registry = nullptr,
.frame_device_pixel_ratio = 1.0f,
.has_platform_view = false,
.has_texture_layer = false,
.raster_cached_entries = &raster_cache_items_,
Expand Down Expand Up @@ -128,7 +127,6 @@ PaintContextHolder GetSamplePaintContextHolder(
.ui_time = *ui_time,
.texture_registry = nullptr,
.raster_cache = raster_cache,
.frame_device_pixel_ratio = 1.0f,
},
// clang-format on
srgb};
Expand Down
2 changes: 0 additions & 2 deletions flow/testing/mock_raster_cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ class MockRasterCache : public RasterCache {
.raster_time = raster_time_,
.ui_time = ui_time_,
.texture_registry = texture_registry_,
.frame_device_pixel_ratio = 1.0f,
.has_platform_view = false,
.has_texture_layer = false,
.raster_cached_entries = &raster_cache_items_
Expand All @@ -103,7 +102,6 @@ class MockRasterCache : public RasterCache {
.ui_time = ui_time_,
.texture_registry = texture_registry_,
.raster_cache = nullptr,
.frame_device_pixel_ratio = 1.0f,
// clang-format on
};
};
Expand Down
1 change: 0 additions & 1 deletion lib/web_ui/lib/src/engine/canvaskit/layer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import 'painting.dart';
import 'path.dart';
import 'picture.dart';
import 'raster_cache.dart';
import 'util.dart';

/// A layer to be composed into a scene.
///
Expand Down
4 changes: 0 additions & 4 deletions lib/web_ui/lib/src/engine/html/clip.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,8 @@
import 'package:ui/ui.dart' as ui;

import '../dom.dart';
import '../shadow.dart';
import '../svg.dart';
import '../util.dart';
import 'dom_canvas.dart';
import 'painting.dart';
import 'path/path.dart';
import 'path_to_svg_clip.dart';
import 'surface.dart';
import 'surface_stats.dart';
Expand Down
1 change: 0 additions & 1 deletion lib/web_ui/lib/src/engine/html/scene_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import 'color_filter.dart';
import 'image_filter.dart';
import 'offset.dart';
import 'opacity.dart';
import 'path/path.dart';
import 'path_to_svg_clip.dart';
import 'picture.dart';
import 'platform_view.dart';
Expand Down
17 changes: 0 additions & 17 deletions lib/web_ui/test/html/compositing/color_filter_golden_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -113,23 +113,6 @@ Picture _drawTestPictureWithCircles(double offsetX, double offsetY) {
return recorder.endRecording();
}

Picture _drawTestPictureWithImage(ColorFilter filter) {
final EnginePictureRecorder recorder =
PictureRecorder() as EnginePictureRecorder;
final RecordingCanvas canvas =
recorder.beginRecording(const Rect.fromLTRB(0, 0, 400, 400));
final Image testImage = createTestImage();
canvas.drawImageRect(
testImage,
const Rect.fromLTWH(0, 0, 200, 150),
const Rect.fromLTWH(0, 0, 300, 300),
(Paint()
..style = PaintingStyle.fill
..colorFilter = filter
..color = const Color.fromRGBO(0, 0, 255, 1)) as SurfacePaint);
return recorder.endRecording();
}

Picture _drawBackground() {
final EnginePictureRecorder recorder =
PictureRecorder() as EnginePictureRecorder;
Expand Down
2 changes: 0 additions & 2 deletions shell/common/shell_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2418,7 +2418,6 @@ TEST_F(ShellTest, OnServiceProtocolEstimateRasterCacheMemoryWorks) {
.ui_time = ui_time,
.texture_registry = nullptr,
.raster_cache = &raster_cache,
.frame_device_pixel_ratio = 1.0f,
// clang-format on
};

Expand All @@ -2433,7 +2432,6 @@ TEST_F(ShellTest, OnServiceProtocolEstimateRasterCacheMemoryWorks) {
.raster_time = raster_time,
.ui_time = ui_time,
.texture_registry = nullptr,
.frame_device_pixel_ratio = 1.0f,
.has_platform_view = false,
.has_texture_layer = false,
.raster_cached_entries = &raster_cache_items,
Expand Down

0 comments on commit 13a7519

Please sign in to comment.