OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 #include "SkColorFilterShader.h" | 8 #include "SkColorFilterShader.h" |
9 #include "SkReadBuffer.h" | 9 #include "SkReadBuffer.h" |
10 #include "SkWriteBuffer.h" | 10 #include "SkWriteBuffer.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 void* storage) const { | 56 void* storage) const { |
57 char* shaderContextStorage = (char*)storage + sizeof(FilterShaderContext); | 57 char* shaderContextStorage = (char*)storage + sizeof(FilterShaderContext); |
58 SkShader::Context* shaderContext = fShader->createContext(rec, shaderContext
Storage); | 58 SkShader::Context* shaderContext = fShader->createContext(rec, shaderContext
Storage); |
59 if (nullptr == shaderContext) { | 59 if (nullptr == shaderContext) { |
60 return nullptr; | 60 return nullptr; |
61 } | 61 } |
62 return new (storage) FilterShaderContext(*this, shaderContext, rec); | 62 return new (storage) FilterShaderContext(*this, shaderContext, rec); |
63 } | 63 } |
64 | 64 |
65 size_t SkColorFilterShader::onContextSize(const ContextRec& rec) const { | 65 size_t SkColorFilterShader::onContextSize(const ContextRec& rec) const { |
66 return SkAlign16(sizeof(FilterShaderContext)) + fShader->contextSize(rec); | 66 return sizeof(FilterShaderContext) + fShader->contextSize(rec); |
67 } | 67 } |
68 | 68 |
69 SkColorFilterShader::FilterShaderContext::FilterShaderContext( | 69 SkColorFilterShader::FilterShaderContext::FilterShaderContext( |
70 const SkColorFilterShad
er& filterShader, | 70 const SkColorFilterShad
er& filterShader, |
71 SkShader::Context* shad
erContext, | 71 SkShader::Context* shad
erContext, |
72 const ContextRec& rec) | 72 const ContextRec& rec) |
73 : INHERITED(filterShader, rec) | 73 : INHERITED(filterShader, rec) |
74 , fShaderContext(shaderContext) | 74 , fShaderContext(shaderContext) |
75 {} | 75 {} |
76 | 76 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 | 137 |
138 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 138 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
139 | 139 |
140 SkShader* SkShader::newWithColorFilter(SkColorFilter* filter) const { | 140 SkShader* SkShader::newWithColorFilter(SkColorFilter* filter) const { |
141 SkShader* base = const_cast<SkShader*>(this); | 141 SkShader* base = const_cast<SkShader*>(this); |
142 if (!filter) { | 142 if (!filter) { |
143 return SkRef(base); | 143 return SkRef(base); |
144 } | 144 } |
145 return new SkColorFilterShader(base, filter); | 145 return new SkColorFilterShader(base, filter); |
146 } | 146 } |
OLD | NEW |