Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Side by Side Diff: src/core/SkPictureShader.h

Issue 1323863002: Image generator-backed SkPictureShader (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/core/SkPictureShader.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2014 Google Inc. 3 * Copyright 2014 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #ifndef SkPictureShader_DEFINED 9 #ifndef SkPictureShader_DEFINED
10 #define SkPictureShader_DEFINED 10 #define SkPictureShader_DEFINED
11 11
12 #include "SkShader.h" 12 #include "SkShader.h"
13 13
14 class SkBitmap; 14 class SkBitmap;
15 class SkPicture; 15 class SkPicture;
16 16
17 /* 17 /*
18 * An SkPictureShader can be used to draw SkPicture-based patterns. 18 * An SkPictureShader can be used to draw SkPicture-based patterns.
19 * 19 *
20 * The SkPicture is first rendered into a tile, which is then used to shade the area according 20 * The SkPicture is first rendered into a tile, which is then used to shade the area according
21 * to specified tiling rules. 21 * to specified tiling rules.
22 */ 22 */
23 class SkPictureShader : public SkShader { 23 class SkPictureShader : public SkShader {
24 public: 24 public:
25 static SkShader* Create(const SkPicture*, TileMode, TileMode, const SkMatrix *, 25 static SkShader* Create(const SkPicture*, TileMode, TileMode, const SkMatrix *,
26 const SkRect*); 26 const SkRect*);
27 virtual ~SkPictureShader();
28 27
29 size_t contextSize() const override; 28 size_t contextSize() const override;
30 29
31 SK_TO_STRING_OVERRIDE() 30 SK_TO_STRING_OVERRIDE()
32 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPictureShader) 31 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPictureShader)
33 32
34 #if SK_SUPPORT_GPU 33 #if SK_SUPPORT_GPU
35 const GrFragmentProcessor* asFragmentProcessor(GrContext*, 34 const GrFragmentProcessor* asFragmentProcessor(GrContext*,
36 const SkMatrix& viewM, 35 const SkMatrix& viewM,
37 const SkMatrix*, 36 const SkMatrix*,
38 SkFilterQuality, 37 SkFilterQuality,
39 GrProcessorDataManager*) cons t override; 38 GrProcessorDataManager*) cons t override;
40 #endif 39 #endif
41 40
42 protected: 41 protected:
43 SkPictureShader(SkReadBuffer&); 42 SkPictureShader(SkReadBuffer&);
44 void flatten(SkWriteBuffer&) const override; 43 void flatten(SkWriteBuffer&) const override;
45 Context* onCreateContext(const ContextRec&, void* storage) const override; 44 Context* onCreateContext(const ContextRec&, void* storage) const override;
46 45
47 private: 46 private:
48 SkPictureShader(const SkPicture*, TileMode, TileMode, const SkMatrix*, const SkRect*); 47 SkPictureShader(const SkPicture*, TileMode, TileMode, const SkMatrix*, const SkRect*);
49 48
50 SkShader* refBitmapShader(const SkMatrix&, const SkMatrix* localMatrix, cons t int maxTextureSize = 0) const; 49 SkShader* refBitmapShader(const SkMatrix&, const SkMatrix* localMatrix, cons t int maxTextureSize = 0) const;
51 50
52 const SkPicture* fPicture; 51 SkAutoTUnref<const SkPicture> fPicture;
53 SkRect fTile; 52 SkRect fTile;
54 TileMode fTmx, fTmy; 53 TileMode fTmx, fTmy;
55 54
56 class PictureShaderContext : public SkShader::Context { 55 class PictureShaderContext : public SkShader::Context {
57 public: 56 public:
58 static Context* Create(void* storage, const SkPictureShader&, const Cont extRec&, 57 static Context* Create(void* storage, const SkPictureShader&, const Cont extRec&,
59 SkShader* bitmapShader); 58 SkShader* bitmapShader);
60 59
61 virtual ~PictureShaderContext(); 60 virtual ~PictureShaderContext();
62 61
63 uint32_t getFlags() const override; 62 uint32_t getFlags() const override;
64 63
65 ShadeProc asAShadeProc(void** ctx) override; 64 ShadeProc asAShadeProc(void** ctx) override;
66 void shadeSpan(int x, int y, SkPMColor dstC[], int count) override; 65 void shadeSpan(int x, int y, SkPMColor dstC[], int count) override;
67 void shadeSpan16(int x, int y, uint16_t dstC[], int count) override; 66 void shadeSpan16(int x, int y, uint16_t dstC[], int count) override;
68 67
69 private: 68 private:
70 PictureShaderContext(const SkPictureShader&, const ContextRec&, SkShader * bitmapShader); 69 PictureShaderContext(const SkPictureShader&, const ContextRec&, SkShader * bitmapShader);
71 70
72 SkAutoTUnref<SkShader> fBitmapShader; 71 SkAutoTUnref<SkShader> fBitmapShader;
73 SkShader::Context* fBitmapShaderContext; 72 SkShader::Context* fBitmapShaderContext;
74 void* fBitmapShaderContextStorage; 73 void* fBitmapShaderContextStorage;
75 74
76 typedef SkShader::Context INHERITED; 75 typedef SkShader::Context INHERITED;
77 }; 76 };
78 77
79 typedef SkShader INHERITED; 78 typedef SkShader INHERITED;
80 }; 79 };
81 80
82 #endif // SkPictureShader_DEFINED 81 #endif // SkPictureShader_DEFINED
OLDNEW
« no previous file with comments | « no previous file | src/core/SkPictureShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698