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 | #ifndef FLUTTER_FLOW_LAYERS_PICTURE_LAYER_H_ |
6 | #define FLUTTER_FLOW_LAYERS_PICTURE_LAYER_H_ |
7 | |
8 | #include <memory> |
9 | |
10 | #include "flutter/flow/layers/layer.h" |
11 | #include "flutter/flow/raster_cache.h" |
12 | #include "flutter/flow/skia_gpu_object.h" |
13 | |
14 | namespace flutter { |
15 | |
16 | class PictureLayer : public Layer { |
17 | public: |
18 | PictureLayer(const SkPoint& offset, |
19 | SkiaGPUObject<SkPicture> picture, |
20 | bool is_complex, |
21 | bool will_change); |
22 | |
23 | SkPicture* picture() const { return picture_.get().get(); } |
24 | |
25 | void Preroll(PrerollContext* frame, const SkMatrix& matrix) override; |
26 | |
27 | void Paint(PaintContext& context) const override; |
28 | |
29 | private: |
30 | SkPoint offset_; |
31 | // Even though pictures themselves are not GPU resources, they may reference |
32 | // images that have a reference to a GPU resource. |
33 | SkiaGPUObject<SkPicture> picture_; |
34 | bool is_complex_ = false; |
35 | bool will_change_ = false; |
36 | |
37 | FML_DISALLOW_COPY_AND_ASSIGN(PictureLayer); |
38 | }; |
39 | |
40 | } // namespace flutter |
41 | |
42 | #endif // FLUTTER_FLOW_LAYERS_PICTURE_LAYER_H_ |
43 |