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

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

Issue 198193005: Work (in progress) to make SkShader immutable. (Closed) Base URL: https://skia.googlesource.com/skia.git@shaderGenerator
Patch Set: Created 6 years, 9 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
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 setContext always returns false, 18 * A Shader that always draws nothing. Its validContext always returns false,
19 * so it never expects that its shadeSpan() methods will get called. 19 * and it never creates a ShaderImpl.
20 */ 20 */
21 class SK_API SkEmptyShader : public SkShader { 21 class SK_API SkEmptyShader : public SkShaderGenerator {
22 public: 22 public:
23 SkEmptyShader() {} 23 SkEmptyShader() {}
24 24
25 virtual uint32_t getFlags() SK_OVERRIDE; 25 virtual size_t shaderImplSize() const SK_OVERRIDE { return 0; }
26 virtual uint8_t getSpan16Alpha() const SK_OVERRIDE; 26
27 virtual bool setContext(const SkBitmap&, const SkPaint&, 27 virtual bool validContext(const SkBitmap&, const SkPaint&,
28 const SkMatrix&) SK_OVERRIDE; 28 const SkMatrix&) SK_OVERRIDE { return false; }
29 virtual void shadeSpan(int x, int y, SkPMColor span[], int count) SK_OVERRID E; 29 virtual ShaderImpl* createShaderImpl(const SkBitmap&, const SkPaint&,
30 virtual void shadeSpan16(int x, int y, uint16_t span[], int count) SK_OVERRI DE; 30 const SkMatrix&, void*) const SK_OVERRID E {
31 virtual void shadeSpanAlpha(int x, int y, uint8_t alpha[], int count) SK_OVE RRIDE; 31 // Should never be called, since validContext returns false.
32 SkASSERT(false);
33 return NULL;
34 }
32 35
33 SK_DEVELOPER_TO_STRING() 36 SK_DEVELOPER_TO_STRING()
34 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkEmptyShader) 37 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkEmptyShader)
35 38
36 protected: 39 protected:
37 SkEmptyShader(SkReadBuffer& buffer) : INHERITED(buffer) {} 40 SkEmptyShader(SkReadBuffer& buffer) : INHERITED(buffer) {}
38 41
39 private: 42 private:
40 typedef SkShader INHERITED; 43 typedef SkShaderGenerator INHERITED;
41 }; 44 };
42 45
43 #endif 46 #endif
OLDNEW
« no previous file with comments | « include/core/SkComposeShader.h ('k') | include/core/SkShader.h » ('j') | src/core/SkShader.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698