scene.cc 1.3 KB
Newer Older
1 2 3 4
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

5
#include "flutter/lib/ui/compositing/scene.h"
6

7 8 9 10
#include "flutter/tonic/dart_args.h"
#include "flutter/tonic/dart_binding_macros.h"
#include "flutter/tonic/dart_converter.h"
#include "flutter/tonic/dart_library_natives.h"
11 12 13
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkPictureRecorder.h"

14
namespace blink {
15

16
IMPLEMENT_WRAPPERTYPEINFO(ui, Scene);
17

18 19 20 21
#define FOR_EACH_BINDING(V) \
  V(Scene, dispose)

DART_BIND_ALL(Scene, FOR_EACH_BINDING)
22

23
scoped_refptr<Scene> Scene::create(
A
Adam Barth 已提交
24
    std::unique_ptr<flow::Layer> rootLayer,
25
    uint32_t rasterizerTracingThreshold) {
26
  return new Scene(std::move(rootLayer), rasterizerTracingThreshold);
27 28
}

A
Adam Barth 已提交
29
Scene::Scene(std::unique_ptr<flow::Layer> rootLayer,
30
             uint32_t rasterizerTracingThreshold)
A
Adam Barth 已提交
31
    : m_layerTree(new flow::LayerTree()) {
32
  m_layerTree->set_root_layer(std::move(rootLayer));
33
  m_layerTree->set_rasterizer_tracing_threshold(rasterizerTracingThreshold);
34 35
}

36
Scene::~Scene() {}
37

38 39 40 41
void Scene::dispose() {
  ClearDartWrapper();
}

A
Adam Barth 已提交
42
std::unique_ptr<flow::LayerTree> Scene::takeLayerTree() {
43
  return std::move(m_layerTree);
44 45
}

46
}  // namespace blink