| 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 |
#ifndef SkImage_Picture_DEFINED |
| 8 |
#define SkImage_Picture_DEFINED |
| 9 |
|
| 10 |
#include "include/core/SkRefCnt.h" |
| 11 |
#include "include/core/SkTiledImageUtils.h" |
| 12 |
#include "src/image/SkImage_Base.h" |
| 13 |
#include "src/image/SkImage_Lazy.h" |
| 14 |
|
| 15 |
#include <cstdint> |
| 16 |
|
| 17 |
class SkCanvas; |
| 18 |
class SkColorSpace; |
| 19 |
class SkImage; |
| 20 |
class SkMatrix; |
| 21 |
class SkPaint; |
| 22 |
class SkPicture; |
| 23 |
class SkRecorder; |
| 24 |
class SkSurfaceProps; |
| 25 |
struct SkIRect; |
| 26 |
struct SkISize; |
| 27 |
|
| 28 |
namespace SkImages { enum class BitDepth; } |
| 29 |
|
| 30 |
class SkImage_Picture : public SkImage_Lazy { |
| 31 |
public: |
| 32 |
static sk_sp<SkImage> Make(sk_sp<SkPicture> picture, const SkISize& dimensions, |
| 33 |
const SkMatrix* matrix, const SkPaint* paint, |
| 34 |
SkImages::BitDepth bitDepth, sk_sp<SkColorSpace> colorSpace, |
| 35 |
SkSurfaceProps props); |
| 36 |
|
| 37 |
explicit SkImage_Picture(Validator* validator) : SkImage_Lazy(validator) {} |
| 38 |
|
| 39 |
SkImage_Base::Type type() const override { return SkImage_Base::Type::kLazyPicture; } |
| 40 |
|
| 41 |
// This is thread safe. It is a const field set in the constructor. |
| 42 |
const SkSurfaceProps* props() const; |
| 43 |
|
| 44 |
// Call drawPicture on the provided canvas taking care of any required mutex locking. |
| 45 |
void replay(SkCanvas*) const; |
| 46 |
|
| 47 |
sk_sp<SkImage> onMakeSubset(SkRecorder*, const SkIRect&, RequiredProperties) const override; |
| 48 |
|
| 49 |
// If possible, extract key data based on the underlying drawPicture-call's parameters. |
| 50 |
// Takes care of any required mutex locking. |
| 51 |
bool getImageKeyValues(uint32_t keyValues[SkTiledImageUtils::kNumImageKeyValues]) const; |
| 52 |
}; |
| 53 |
|
| 54 |
#endif |