• 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_TEXTURE_LAYER_H
9 #define FLUTTER_FLOW_OHOS_LAYERS_TEXTURE_LAYER_H
10 
11 #include "third_party/skia/include/core/SkPoint.h"
12 #include "third_party/skia/include/core/SkSize.h"
13 
14 #include "flutter/flow/ohos_layers/layer.h"
15 
16 namespace flutter::OHOS {
17 
18 constexpr int64_t INVALID_TEXTURE_ID = -1;
19 
20 class TextureLayer : public Layer {
21 public:
TextureLayer(const SkPoint & offset,SkSize textureSize,int64_t textureId,uint8_t opacity)22     TextureLayer(const SkPoint& offset, SkSize textureSize, int64_t textureId, uint8_t opacity)
23         : offset_(offset), textureSize_(textureSize), textureId_(textureId), opacity_(opacity) {}
24     ~TextureLayer() override = default;
25 
26     void Prepare(const SkMatrix& matrix) override;
27 
28     void Paint(const PaintContext& paintContext) const override;
29 
30 private:
31     SkPoint offset_;
32     SkSize textureSize_;
33     int64_t textureId_ { INVALID_TEXTURE_ID };
34     uint8_t opacity_ { UINT8_MAX };
35 
36     FML_DISALLOW_COPY_AND_ASSIGN(TextureLayer);
37 };
38 
39 }  // namespace flutter::OHOS
40 
41 #endif  // FLUTTER_FLOW_OHOS_LAYERS_TEXTURE_LAYER_H
42