• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2015 Google Inc.
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 SkPictureImageGenerator_DEFINED
8 #define SkPictureImageGenerator_DEFINED
9 
10 #include "SkImageGenerator.h"
11 #include "SkTLazy.h"
12 
13 class SkPictureImageGenerator : public SkImageGenerator {
14 public:
15     static std::unique_ptr<SkImageGenerator> Make(const SkISize&, sk_sp<SkPicture>, const SkMatrix*,
16                                                   const SkPaint*, SkImage::BitDepth,
17                                                   sk_sp<SkColorSpace>);
18 
19 protected:
20     bool onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBytes, SkPMColor ctable[],
21                      int* ctableCount) override;
22 
23 #if SK_SUPPORT_GPU
24     sk_sp<GrTextureProxy> onGenerateTexture(GrContext*, const SkImageInfo&,
25                                             const SkIPoint&) override;
26 #endif
27 
28 private:
29     SkPictureImageGenerator(const SkImageInfo& info, sk_sp<SkPicture>, const SkMatrix*,
30                             const SkPaint*);
31 
32     sk_sp<SkPicture>    fPicture;
33     SkMatrix            fMatrix;
34     SkTLazy<SkPaint>    fPaint;
35 
36     typedef SkImageGenerator INHERITED;
37 };
38 #endif  // SkPictureImageGenerator_DEFINED
39