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 ~PictureLayer() override; 23 picture()24 SkPicture* picture() const { return picture_.get().get(); } 25 26 void Preroll(PrerollContext* frame, const SkMatrix& matrix) override; 27 28 void Paint(PaintContext& context) const override; 29 30 private: 31 SkPoint offset_; 32 // Even though pictures themselves are not GPU resources, they may reference 33 // images that have a reference to a GPU resource. 34 SkiaGPUObject<SkPicture> picture_; 35 bool is_complex_ = false; 36 bool will_change_ = false; 37 38 FML_DISALLOW_COPY_AND_ASSIGN(PictureLayer); 39 }; 40 41 } // namespace flutter 42 43 #endif // FLUTTER_FLOW_LAYERS_PICTURE_LAYER_H_ 44