• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Copyright (c) Huawei Technologies Co., Ltd. 2021. All rights reserved.
3 // Use of this source code is governed by a BSD-style license that can be
4 // found in the LICENSE file.
5 // 2021.2.10 Increase the process used in native_view mode.
6 //           Copyright (c) 2021 Huawei Device Co., Ltd. All rights reserved.
7 
8 #ifndef FLUTTER_FLOW_OHOS_LAYERS_PICTURE_LAYER_H
9 #define FLUTTER_FLOW_OHOS_LAYERS_PICTURE_LAYER_H
10 
11 #include <memory>
12 
13 #include "third_party/skia/include/core/SkPicture.h"
14 
15 #include "flutter/flow/ohos_layers/layer.h"
16 
17 namespace flutter::OHOS {
18 
19 class PictureLayer : public Layer {
20 public:
PictureLayer(const SkPoint & offset,sk_sp<SkPicture> picture)21     PictureLayer(const SkPoint& offset, sk_sp<SkPicture> picture)
22         : offset_(offset), picture_(std::move(picture)) {}
23     ~PictureLayer() override = default;
24 
GetPicture()25     SkPicture* GetPicture() const
26     {
27         return picture_.get();
28     }
29 
30     void Prepare(const SkMatrix& matrix) override;
31 
32     void Paint(const PaintContext& paintContext) const override;
33 
34 private:
35     SkPoint offset_;
36     sk_sp<SkPicture> picture_;
37 
38     FML_DISALLOW_COPY_AND_ASSIGN(PictureLayer);
39 };
40 
41 }  // namespace flutter::OHOS
42 
43 #endif  // FLUTTER_FLOW_OHOS_LAYERS_PICTURE_LAYER_H