Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions flow/layers/child_scene_layer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ void ChildSceneLayer::Paint(PaintContext& context) const {
FML_NOTREACHED();
}

void ChildSceneLayer::UpdateScene(std::shared_ptr<SceneUpdateContext> context) {
void ChildSceneLayer::UpdateScene(SceneUpdateContext& context) {
TRACE_EVENT0("flutter", "ChildSceneLayer::UpdateScene");
FML_DCHECK(needs_system_composite());
context->UpdateView(layer_id_, offset_, size_, hit_testable_);
context.UpdateView(layer_id_, offset_, size_, hit_testable_);
}

} // namespace flutter
2 changes: 1 addition & 1 deletion flow/layers/child_scene_layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class ChildSceneLayer : public Layer {

void Paint(PaintContext& context) const override;

void UpdateScene(std::shared_ptr<SceneUpdateContext> context) override;
void UpdateScene(SceneUpdateContext& context) override;

private:
zx_koid_t layer_id_ = ZX_KOID_INVALID;
Expand Down
2 changes: 1 addition & 1 deletion flow/layers/clip_path_layer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ void ClipPathLayer::Preroll(PrerollContext* context, const SkMatrix& matrix) {

#if defined(LEGACY_FUCHSIA_EMBEDDER)

void ClipPathLayer::UpdateScene(std::shared_ptr<SceneUpdateContext> context) {
void ClipPathLayer::UpdateScene(SceneUpdateContext& context) {
TRACE_EVENT0("flutter", "ClipPathLayer::UpdateScene");
FML_DCHECK(needs_system_composite());

Expand Down
2 changes: 1 addition & 1 deletion flow/layers/clip_path_layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ClipPathLayer : public ContainerLayer {
}

#if defined(LEGACY_FUCHSIA_EMBEDDER)
void UpdateScene(std::shared_ptr<SceneUpdateContext> context) override;
void UpdateScene(SceneUpdateContext& context) override;
#endif

private:
Expand Down
2 changes: 1 addition & 1 deletion flow/layers/clip_rect_layer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ void ClipRectLayer::Preroll(PrerollContext* context, const SkMatrix& matrix) {

#if defined(LEGACY_FUCHSIA_EMBEDDER)

void ClipRectLayer::UpdateScene(std::shared_ptr<SceneUpdateContext> context) {
void ClipRectLayer::UpdateScene(SceneUpdateContext& context) {
TRACE_EVENT0("flutter", "ClipRectLayer::UpdateScene");
FML_DCHECK(needs_system_composite());

Expand Down
2 changes: 1 addition & 1 deletion flow/layers/clip_rect_layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class ClipRectLayer : public ContainerLayer {
}

#if defined(LEGACY_FUCHSIA_EMBEDDER)
void UpdateScene(std::shared_ptr<SceneUpdateContext> context) override;
void UpdateScene(SceneUpdateContext& context) override;
#endif

private:
Expand Down
2 changes: 1 addition & 1 deletion flow/layers/clip_rrect_layer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ void ClipRRectLayer::Preroll(PrerollContext* context, const SkMatrix& matrix) {

#if defined(LEGACY_FUCHSIA_EMBEDDER)

void ClipRRectLayer::UpdateScene(std::shared_ptr<SceneUpdateContext> context) {
void ClipRRectLayer::UpdateScene(SceneUpdateContext& context) {
TRACE_EVENT0("flutter", "ClipRRectLayer::UpdateScene");
FML_DCHECK(needs_system_composite());

Expand Down
2 changes: 1 addition & 1 deletion flow/layers/clip_rrect_layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ClipRRectLayer : public ContainerLayer {
}

#if defined(LEGACY_FUCHSIA_EMBEDDER)
void UpdateScene(std::shared_ptr<SceneUpdateContext> context) override;
void UpdateScene(SceneUpdateContext& context) override;
#endif

private:
Expand Down
7 changes: 3 additions & 4 deletions flow/layers/container_layer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,19 +98,18 @@ void ContainerLayer::CheckForChildLayerBelow(PrerollContext* context) {
// All ContainerLayers make the check in PrerollChildren.
}

void ContainerLayer::UpdateScene(std::shared_ptr<SceneUpdateContext> context) {
void ContainerLayer::UpdateScene(SceneUpdateContext& context) {
UpdateSceneChildren(context);
}

void ContainerLayer::UpdateSceneChildren(
std::shared_ptr<SceneUpdateContext> context) {
void ContainerLayer::UpdateSceneChildren(SceneUpdateContext& context) {
FML_DCHECK(needs_system_composite());

std::optional<SceneUpdateContext::Frame> frame;
if (child_layer_exists_below_) {
frame.emplace(
context, SkRRect::MakeRect(paint_bounds()), SK_ColorTRANSPARENT,
SkScalarRoundToInt(context->alphaf() * 255), "flutter::ContainerLayer");
SkScalarRoundToInt(context.alphaf() * 255), "flutter::ContainerLayer");
frame->AddPaintLayer(this);
}

Expand Down
4 changes: 2 additions & 2 deletions flow/layers/container_layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class ContainerLayer : public Layer {
void Paint(PaintContext& context) const override;
#if defined(LEGACY_FUCHSIA_EMBEDDER)
void CheckForChildLayerBelow(PrerollContext* context) override;
void UpdateScene(std::shared_ptr<SceneUpdateContext> context) override;
void UpdateScene(SceneUpdateContext& context) override;
#endif

const std::vector<std::shared_ptr<Layer>>& layers() const { return layers_; }
Expand All @@ -33,7 +33,7 @@ class ContainerLayer : public Layer {
void PaintChildren(PaintContext& context) const;

#if defined(LEGACY_FUCHSIA_EMBEDDER)
void UpdateSceneChildren(std::shared_ptr<SceneUpdateContext> context);
void UpdateSceneChildren(SceneUpdateContext& context);
#endif

// Try to prepare the raster cache for a given layer.
Expand Down
12 changes: 6 additions & 6 deletions flow/layers/fuchsia_layer_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ struct TestContext {
std::unique_ptr<MockSessionWrapper> mock_session_wrapper;

// SceneUpdateContext.
std::shared_ptr<SceneUpdateContext> scene_update_context;
std::unique_ptr<SceneUpdateContext> scene_update_context;

// PrerollContext.
MutatorsStack unused_stack;
Expand All @@ -286,7 +286,7 @@ std::unique_ptr<TestContext> InitTest() {
std::make_unique<MockSessionWrapper>(std::move(session_ptr));

// Init SceneUpdateContext.
context->scene_update_context = std::make_shared<SceneUpdateContext>(
context->scene_update_context = std::make_unique<SceneUpdateContext>(
"fuchsia_layer_unittest", fuchsia::ui::views::ViewToken(),
scenic::ViewRefPair::New(), *(context->mock_session_wrapper));

Expand Down Expand Up @@ -410,7 +410,7 @@ TEST_F(FuchsiaLayerTest, DISABLED_PhysicalShapeLayersAndChildSceneLayers) {

// Create another frame to be the "real" root. Required because
// UpdateScene() traversal expects there to already be a top node.
SceneUpdateContext::Frame frame(test_context->scene_update_context,
SceneUpdateContext::Frame frame(*(test_context->scene_update_context),
SkRRect::MakeRect(SkRect::MakeWH(100, 100)),
SK_ColorTRANSPARENT, SK_AlphaOPAQUE,
"fuchsia test root");
Expand Down Expand Up @@ -555,7 +555,7 @@ TEST_F(FuchsiaLayerTest, DISABLED_PhysicalShapeLayersAndChildSceneLayers) {

// Finally, UpdateScene(). The MockSession will check the emitted commands
// against the list above.
root->UpdateScene(test_context->scene_update_context);
root->UpdateScene(*(test_context->scene_update_context));

test_context->mock_session_wrapper->Present();

Expand Down Expand Up @@ -626,7 +626,7 @@ TEST_F(FuchsiaLayerTest, DISABLED_OpacityAndTransformLayer) {

// Create another frame to be the "real" root. Required because
// UpdateScene() traversal expects there to already be a top node.
SceneUpdateContext::Frame frame(test_context->scene_update_context,
SceneUpdateContext::Frame frame(*(test_context->scene_update_context),
SkRRect::MakeRect(SkRect::MakeWH(100, 100)),
SK_ColorTRANSPARENT, SK_AlphaOPAQUE,
"fuchsia test root");
Expand Down Expand Up @@ -737,7 +737,7 @@ TEST_F(FuchsiaLayerTest, DISABLED_OpacityAndTransformLayer) {

// Finally, UpdateScene(). The MockSession will check the emitted
// commands against the list above.
root->UpdateScene(test_context->scene_update_context);
root->UpdateScene(*(test_context->scene_update_context));

test_context->mock_session_wrapper->Present();

Expand Down
4 changes: 2 additions & 2 deletions flow/layers/layer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ void Layer::CheckForChildLayerBelow(PrerollContext* context) {
}
}

void Layer::UpdateScene(std::shared_ptr<SceneUpdateContext> context) {
void Layer::UpdateScene(SceneUpdateContext& context) {
FML_DCHECK(needs_system_composite());
FML_DCHECK(child_layer_exists_below_);

SceneUpdateContext::Frame frame(
context, SkRRect::MakeRect(paint_bounds()), SK_ColorTRANSPARENT,
SkScalarRoundToInt(context->alphaf() * 255), "flutter::Layer");
SkScalarRoundToInt(context.alphaf() * 255), "flutter::Layer");

frame.AddPaintLayer(this);
}
Expand Down
2 changes: 1 addition & 1 deletion flow/layers/layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ class Layer {

#if defined(LEGACY_FUCHSIA_EMBEDDER)
// Updates the system composited scene.
virtual void UpdateScene(std::shared_ptr<SceneUpdateContext> context);
virtual void UpdateScene(SceneUpdateContext& context);
virtual void CheckForChildLayerBelow(PrerollContext* context);
#endif

Expand Down
6 changes: 3 additions & 3 deletions flow/layers/layer_tree.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ bool LayerTree::Preroll(CompositorContext::ScopedFrame& frame,
}

#if defined(LEGACY_FUCHSIA_EMBEDDER)
void LayerTree::UpdateScene(std::shared_ptr<SceneUpdateContext> context) {
void LayerTree::UpdateScene(SceneUpdateContext& context) {
TRACE_EVENT0("flutter", "LayerTree::UpdateScene");

// Reset for a new Scene.
context->Reset();
context.Reset();

const float inv_dpr = 1.0f / device_pixel_ratio_;
SceneUpdateContext::Transform transform(context, inv_dpr, inv_dpr, 1.0f);
Expand All @@ -82,7 +82,7 @@ void LayerTree::UpdateScene(std::shared_ptr<SceneUpdateContext> context) {
if (root_layer_->needs_painting()) {
frame.AddPaintLayer(root_layer_.get());
}
context->root_node().AddChild(transform.entity_node());
context.root_node().AddChild(transform.entity_node());
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion flow/layers/layer_tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class LayerTree {
bool ignore_raster_cache = false);

#if defined(LEGACY_FUCHSIA_EMBEDDER)
void UpdateScene(std::shared_ptr<SceneUpdateContext> context);
void UpdateScene(SceneUpdateContext& context);
#endif

void Paint(CompositorContext::ScopedFrame& frame,
Expand Down
8 changes: 4 additions & 4 deletions flow/layers/opacity_layer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ void OpacityLayer::Paint(PaintContext& context) const {

#if defined(LEGACY_FUCHSIA_EMBEDDER)

void OpacityLayer::UpdateScene(std::shared_ptr<SceneUpdateContext> context) {
float saved_alpha = context->alphaf();
context->set_alphaf(context->alphaf() * (alpha_ / 255.f));
void OpacityLayer::UpdateScene(SceneUpdateContext& context) {
float saved_alpha = context.alphaf();
context.set_alphaf(context.alphaf() * (alpha_ / 255.f));
ContainerLayer::UpdateScene(context);
context->set_alphaf(saved_alpha);
context.set_alphaf(saved_alpha);
}

#endif
Expand Down
2 changes: 1 addition & 1 deletion flow/layers/opacity_layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class OpacityLayer : public MergedContainerLayer {
void Paint(PaintContext& context) const override;

#if defined(LEGACY_FUCHSIA_EMBEDDER)
void UpdateScene(std::shared_ptr<SceneUpdateContext> context) override;
void UpdateScene(SceneUpdateContext& context) override;
#endif

private:
Expand Down
5 changes: 2 additions & 3 deletions flow/layers/platform_view_layer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,10 @@ void PlatformViewLayer::Paint(PaintContext& context) const {
}

#if defined(LEGACY_FUCHSIA_EMBEDDER)
void PlatformViewLayer::UpdateScene(
std::shared_ptr<SceneUpdateContext> context) {
void PlatformViewLayer::UpdateScene(SceneUpdateContext& context) {
TRACE_EVENT0("flutter", "PlatformViewLayer::UpdateScene");
FML_DCHECK(needs_system_composite());
context->UpdateView(view_id_, offset_, size_);
context.UpdateView(view_id_, offset_, size_);
}
#endif

Expand Down
2 changes: 1 addition & 1 deletion flow/layers/platform_view_layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class PlatformViewLayer : public Layer {
void Paint(PaintContext& context) const override;
#if defined(LEGACY_FUCHSIA_EMBEDDER)
// Updates the system composited scene.
void UpdateScene(std::shared_ptr<SceneUpdateContext> context) override;
void UpdateScene(SceneUpdateContext& context) override;
#endif

private:
Expand Down
2 changes: 1 addition & 1 deletion flow/layers/transform_layer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ void TransformLayer::Preroll(PrerollContext* context, const SkMatrix& matrix) {

#if defined(LEGACY_FUCHSIA_EMBEDDER)

void TransformLayer::UpdateScene(std::shared_ptr<SceneUpdateContext> context) {
void TransformLayer::UpdateScene(SceneUpdateContext& context) {
TRACE_EVENT0("flutter", "TransformLayer::UpdateScene");
FML_DCHECK(needs_system_composite());

Expand Down
2 changes: 1 addition & 1 deletion flow/layers/transform_layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class TransformLayer : public ContainerLayer {
void Paint(PaintContext& context) const override;

#if defined(LEGACY_FUCHSIA_EMBEDDER)
void UpdateScene(std::shared_ptr<SceneUpdateContext> context) override;
void UpdateScene(SceneUpdateContext& context) override;
#endif

private:
Expand Down
Loading