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

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

Issue 866773002: Use an image generator to back SkPictureShader tiles. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: review comments Created 5 years, 10 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 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkPictureShader_DEFINED 8 #ifndef SkPictureShader_DEFINED
9 #define SkPictureShader_DEFINED 9 #define SkPictureShader_DEFINED
10 10
11 #include "SkShader.h" 11 #include "SkShader.h"
12 12
13 class SkBitmap; 13 class SkBitmap;
14 class SkPicture; 14 class SkPicture;
15 15
16 /* 16 /*
17 * An SkPictureShader can be used to draw SkPicture-based patterns. 17 * An SkPictureShader can be used to draw SkPicture-based patterns.
18 * 18 *
19 * The SkPicture is first rendered into a tile, which is then used to shade the area according 19 * The SkPicture is first rendered into a tile, which is then used to shade the area according
20 * to specified tiling rules. 20 * to specified tiling rules.
21 */ 21 */
22 class SkPictureShader : public SkShader { 22 class SkPictureShader : public SkShader {
23 public: 23 public:
24 static SkPictureShader* Create(const SkPicture*, TileMode, TileMode, const S kMatrix*, 24 static SkPictureShader* Create(const SkPicture*, TileMode, TileMode, const S kMatrix*,
25 const SkRect*); 25 const SkRect*);
26 virtual ~SkPictureShader();
27 26
28 size_t contextSize() const SK_OVERRIDE; 27 size_t contextSize() const SK_OVERRIDE;
29 28
30 SK_TO_STRING_OVERRIDE() 29 SK_TO_STRING_OVERRIDE()
31 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPictureShader) 30 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPictureShader)
32 31
33 bool asFragmentProcessor(GrContext*, const SkPaint&, const SkMatrix& viewM, const SkMatrix*, 32 bool asFragmentProcessor(GrContext*, const SkPaint&, const SkMatrix& viewM, const SkMatrix*,
34 GrColor*, GrFragmentProcessor**) const SK_OVERRIDE; 33 GrColor*, GrFragmentProcessor**) const SK_OVERRIDE;
35 34
36 protected: 35 protected:
37 SkPictureShader(SkReadBuffer&); 36 SkPictureShader(SkReadBuffer&);
38 void flatten(SkWriteBuffer&) const SK_OVERRIDE; 37 void flatten(SkWriteBuffer&) const SK_OVERRIDE;
39 Context* onCreateContext(const ContextRec&, void* storage) const SK_OVERRIDE ; 38 Context* onCreateContext(const ContextRec&, void* storage) const SK_OVERRIDE ;
40 39
41 private: 40 private:
42 SkPictureShader(const SkPicture*, TileMode, TileMode, const SkMatrix*, const SkRect*); 41 SkPictureShader(const SkPicture*, TileMode, TileMode, const SkMatrix*, const SkRect*);
43 42
44 SkShader* refBitmapShader(const SkMatrix&, const SkMatrix* localMatrix) cons t; 43 SkShader* refBitmapShader(const SkMatrix&, const SkMatrix* localMatrix) cons t;
45 44
46 const SkPicture* fPicture; 45 SkAutoTUnref<const SkPicture> fPicture;
47 SkRect fTile; 46 SkRect fTile;
48 TileMode fTmx, fTmy; 47 TileMode fTmx, fTmy;
49 48
50 class PictureShaderContext : public SkShader::Context { 49 class PictureShaderContext : public SkShader::Context {
51 public: 50 public:
52 static Context* Create(void* storage, const SkPictureShader&, const Cont extRec&, 51 static Context* Create(void* storage, const SkPictureShader&, const Cont extRec&,
53 SkShader* bitmapShader); 52 SkShader* bitmapShader);
54 53
55 virtual ~PictureShaderContext(); 54 virtual ~PictureShaderContext();
56 55
57 uint32_t getFlags() const SK_OVERRIDE; 56 uint32_t getFlags() const SK_OVERRIDE;
58 57
59 ShadeProc asAShadeProc(void** ctx) SK_OVERRIDE; 58 ShadeProc asAShadeProc(void** ctx) SK_OVERRIDE;
60 void shadeSpan(int x, int y, SkPMColor dstC[], int count) SK_OVERRIDE; 59 void shadeSpan(int x, int y, SkPMColor dstC[], int count) SK_OVERRIDE;
61 void shadeSpan16(int x, int y, uint16_t dstC[], int count) SK_OVERRIDE; 60 void shadeSpan16(int x, int y, uint16_t dstC[], int count) SK_OVERRIDE;
62 61
63 private: 62 private:
64 PictureShaderContext(const SkPictureShader&, const ContextRec&, SkShader * bitmapShader); 63 PictureShaderContext(const SkPictureShader&, const ContextRec&, SkShader * bitmapShader);
65 64
66 SkAutoTUnref<SkShader> fBitmapShader; 65 SkAutoTUnref<SkShader> fBitmapShader;
67 SkShader::Context* fBitmapShaderContext; 66 SkShader::Context* fBitmapShaderContext;
68 void* fBitmapShaderContextStorage; 67 void* fBitmapShaderContextStorage;
69 68
70 typedef SkShader::Context INHERITED; 69 typedef SkShader::Context INHERITED;
71 }; 70 };
72 71
73 typedef SkShader INHERITED; 72 typedef SkShader INHERITED;
74 }; 73 };
75 74
76 #endif // SkPictureShader_DEFINED 75 #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