| 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 |
|
| 18 |
#include <cstddef> |
| 19 |
|
| 20 |
struct SkImageInfo; |
| 21 |
|
| 22 |
class SkPictureImageGenerator : public SkImageGenerator { |
| 23 |
public: |
| 24 |
SkPictureImageGenerator(const SkImageInfo&, sk_sp<SkPicture>, const SkMatrix*, |
| 25 |
const SkPaint*, const SkSurfaceProps&); |
| 26 |
|
| 27 |
protected: |
| 28 |
bool onGetPixels(const SkImageInfo&, void* pixels, size_t rowBytes, const Options&) override; |
| 29 |
|
| 30 |
private: |
| 31 |
sk_sp<SkPicture> fPicture; |
| 32 |
SkMatrix fMatrix; |
| 33 |
std::optional<SkPaint> fPaint; |
| 34 |
const SkSurfaceProps fProps; |
| 35 |
|
| 36 |
friend class SkImage_Picture; |
| 37 |
}; |
| 38 |
|
| 39 |
#endif |