1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "flutter/flow/layers/child_scene_layer.h"
6
7 #include "flutter/flow/view_holder.h"
8
9 namespace flutter {
10
ChildSceneLayer(zx_koid_t layer_id,const SkPoint & offset,const SkSize & size,bool hit_testable)11 ChildSceneLayer::ChildSceneLayer(zx_koid_t layer_id,
12 const SkPoint& offset,
13 const SkSize& size,
14 bool hit_testable)
15 : layer_id_(layer_id),
16 offset_(offset),
17 size_(size),
18 hit_testable_(hit_testable) {}
19
Preroll(PrerollContext * context,const SkMatrix & matrix)20 void ChildSceneLayer::Preroll(PrerollContext* context, const SkMatrix& matrix) {
21 set_needs_system_composite(true);
22 }
23
Paint(PaintContext & context) const24 void ChildSceneLayer::Paint(PaintContext& context) const {
25 FML_NOTREACHED() << "This layer never needs painting.";
26 }
27
UpdateScene(SceneUpdateContext & context)28 void ChildSceneLayer::UpdateScene(SceneUpdateContext& context) {
29 FML_DCHECK(needs_system_composite());
30
31 auto* view_holder = ViewHolder::FromId(layer_id_);
32 FML_DCHECK(view_holder);
33
34 view_holder->UpdateScene(context, offset_, size_, hit_testable_);
35 }
36
37 } // namespace flutter
38