1 /* 2 * Copyright 2023 Google LLC 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #ifndef SkPictureImageGenerator_DEFINED 9 #define SkPictureImageGenerator_DEFINED 10 11 #include "include/core/SkImageGenerator.h" 12 #include "include/core/SkMatrix.h" 13 #include "include/core/SkPaint.h" 14 #include "include/core/SkPicture.h" 15 #include "include/core/SkRefCnt.h" 16 #include "include/core/SkSurfaceProps.h" 17 #include "src/base/SkTLazy.h" 18 19 #include <cstddef> 20 21 struct SkImageInfo; 22 23 class SkPictureImageGenerator : public SkImageGenerator { 24 public: 25 SkPictureImageGenerator(const SkImageInfo&, sk_sp<SkPicture>, const SkMatrix*, 26 const SkPaint*, const SkSurfaceProps&); 27 28 protected: 29 bool onGetPixels(const SkImageInfo&, void* pixels, size_t rowBytes, const Options&) override; 30 31 private: 32 sk_sp<SkPicture> fPicture; 33 SkMatrix fMatrix; 34 SkTLazy<SkPaint> fPaint; 35 const SkSurfaceProps fProps; 36 37 friend class SkImage_Picture; 38 }; 39 40 #endif 41