• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 SkSurfaceProps;
24 struct SkISize;
25 
26 namespace SkImages { enum class BitDepth; }
27 
28 class SkImage_Picture : public SkImage_Lazy {
29 public:
30     static sk_sp<SkImage> Make(sk_sp<SkPicture> picture, const SkISize& dimensions,
31                                const SkMatrix* matrix, const SkPaint* paint,
32                                SkImages::BitDepth bitDepth, sk_sp<SkColorSpace> colorSpace,
33                                SkSurfaceProps props);
34 
SkImage_Picture(Validator * validator)35     SkImage_Picture(Validator* validator) : SkImage_Lazy(validator) {}
36 
type()37     SkImage_Base::Type type() const override { return SkImage_Base::Type::kLazyPicture; }
38 
39     // This is thread safe. It is a const field set in the constructor.
40     const SkSurfaceProps* props() const;
41 
42     // Call drawPicture on the provided canvas taking care of any required mutex locking.
43     void replay(SkCanvas*) const;
44 
45     // If possible, extract key data based on the underlying drawPicture-call's parameters.
46     // Takes care of any required mutex locking.
47     bool getImageKeyValues(uint32_t keyValues[SkTiledImageUtils::kNumImageKeyValues]) const;
48 };
49 
50 #endif
51