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

Side by Side Diff: include/core/SkEmptyShader.h

Issue 264843006: create struct to hold all the params passed around for shader::context (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: address review comments Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « include/core/SkComposeShader.h ('k') | include/core/SkShader.h » ('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 2011 Google Inc. 3 * Copyright 2011 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 9
10 10
11 #ifndef SkEmptyShader_DEFINED 11 #ifndef SkEmptyShader_DEFINED
12 #define SkEmptyShader_DEFINED 12 #define SkEmptyShader_DEFINED
13 13
14 #include "SkShader.h" 14 #include "SkShader.h"
15 15
16 /** 16 /**
17 * \class SkEmptyShader 17 * \class SkEmptyShader
18 * A Shader that always draws nothing. Its createContext always returns NULL. 18 * A Shader that always draws nothing. Its createContext always returns NULL.
19 */ 19 */
20 class SK_API SkEmptyShader : public SkShader { 20 class SK_API SkEmptyShader : public SkShader {
21 public: 21 public:
22 SkEmptyShader() {} 22 SkEmptyShader() {}
23 23
24 virtual size_t contextSize() const SK_OVERRIDE { 24 virtual size_t contextSize() const SK_OVERRIDE {
25 // Even though createContext returns NULL we have to return a value of a t least 25 // Even though createContext returns NULL we have to return a value of a t least
26 // sizeof(SkShader::Context) to satisfy SkSmallAllocator. 26 // sizeof(SkShader::Context) to satisfy SkSmallAllocator.
27 return sizeof(SkShader::Context); 27 return sizeof(SkShader::Context);
28 } 28 }
29 29
30 virtual bool validContext(const SkBitmap&, const SkPaint&, 30 virtual bool validContext(const ContextRec&, SkMatrix* totalInverse = NULL) const SK_OVERRIDE {
31 const SkMatrix&, SkMatrix* totalInverse = NULL) co nst SK_OVERRIDE {
32 return false; 31 return false;
33 } 32 }
34 33
35 virtual SkShader::Context* createContext(const SkBitmap&, const SkPaint&, 34 virtual SkShader::Context* createContext(const ContextRec&, void*) const SK_ OVERRIDE {
36 const SkMatrix&, void*) const SK_OV ERRIDE {
37 // validContext returns false. 35 // validContext returns false.
38 return NULL; 36 return NULL;
39 } 37 }
40 38
41 SK_TO_STRING_OVERRIDE() 39 SK_TO_STRING_OVERRIDE()
42 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkEmptyShader) 40 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkEmptyShader)
43 41
44 protected: 42 protected:
45 SkEmptyShader(SkReadBuffer& buffer) : INHERITED(buffer) {} 43 SkEmptyShader(SkReadBuffer& buffer) : INHERITED(buffer) {}
46 44
47 private: 45 private:
48 typedef SkShader INHERITED; 46 typedef SkShader INHERITED;
49 }; 47 };
50 48
51 #endif 49 #endif
OLDNEW
« no previous file with comments | « include/core/SkComposeShader.h ('k') | include/core/SkShader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698