2 * Copyright 2011 Google Inc.
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
8 #ifndef SkEmptyShader_DEFINED
9 #define SkEmptyShader_DEFINED
13 // TODO: move this to private, as there is a public factory on SkShader
16 * \class SkEmptyShader
17 * A Shader that always draws nothing. Its createContext always returns NULL.
19 class SK_API SkEmptyShader : public SkShader {
23 size_t contextSize() const override {
24 // Even though createContext returns NULL we have to return a value of at least
25 // sizeof(SkShader::Context) to satisfy SkSmallAllocator.
26 return sizeof(SkShader::Context);
29 SK_TO_STRING_OVERRIDE()
30 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkEmptyShader)
33 SkShader::Context* onCreateContext(const ContextRec&, void*) const override {
38 typedef SkShader INHERITED;