OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "SkTwoPointConicalGradient.h" | 8 #include "SkTwoPointConicalGradient.h" |
9 | 9 |
10 struct TwoPtRadialContext { | 10 struct TwoPtRadialContext { |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 // TODO(junov): Compute whether the cone fills the plane crbug.com/222380 | 209 // TODO(junov): Compute whether the cone fills the plane crbug.com/222380 |
210 return false; | 210 return false; |
211 } | 211 } |
212 | 212 |
213 size_t SkTwoPointConicalGradient::onContextSize(const ContextRec&) const { | 213 size_t SkTwoPointConicalGradient::onContextSize(const ContextRec&) const { |
214 return sizeof(TwoPointConicalGradientContext); | 214 return sizeof(TwoPointConicalGradientContext); |
215 } | 215 } |
216 | 216 |
217 SkShader::Context* SkTwoPointConicalGradient::onCreateContext(const ContextRec&
rec, | 217 SkShader::Context* SkTwoPointConicalGradient::onCreateContext(const ContextRec&
rec, |
218 void* storage) con
st { | 218 void* storage) con
st { |
219 return new (storage) TwoPointConicalGradientContext(*this, rec); | 219 return CheckedCreateContext<TwoPointConicalGradientContext>(storage, *this,
rec); |
220 } | 220 } |
221 | 221 |
222 SkTwoPointConicalGradient::TwoPointConicalGradientContext::TwoPointConicalGradie
ntContext( | 222 SkTwoPointConicalGradient::TwoPointConicalGradientContext::TwoPointConicalGradie
ntContext( |
223 const SkTwoPointConicalGradient& shader, const ContextRec& rec) | 223 const SkTwoPointConicalGradient& shader, const ContextRec& rec) |
224 : INHERITED(shader, rec) | 224 : INHERITED(shader, rec) |
225 { | 225 { |
226 // in general, we might discard based on computed-radius, so clear | 226 // in general, we might discard based on computed-radius, so clear |
227 // this flag (todo: sometimes we can detect that we never discard...) | 227 // this flag (todo: sometimes we can detect that we never discard...) |
228 fFlags &= ~kOpaqueAlpha_Flag; | 228 fFlags &= ~kOpaqueAlpha_Flag; |
229 } | 229 } |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 str->appendScalar(fCenter2.fY); | 389 str->appendScalar(fCenter2.fY); |
390 str->append(") radius2: "); | 390 str->append(") radius2: "); |
391 str->appendScalar(fRadius2); | 391 str->appendScalar(fRadius2); |
392 str->append(" "); | 392 str->append(" "); |
393 | 393 |
394 this->INHERITED::toString(str); | 394 this->INHERITED::toString(str); |
395 | 395 |
396 str->append(")"); | 396 str->append(")"); |
397 } | 397 } |
398 #endif | 398 #endif |
OLD | NEW |