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 #include "SkTwoPointConicalGradient_gpu.h" | 10 #include "SkTwoPointConicalGradient_gpu.h" |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 // Because areas outside the cone are left untouched, we cannot treat the | 214 // Because areas outside the cone are left untouched, we cannot treat the |
215 // shader as opaque even if the gradient itself is opaque. | 215 // shader as opaque even if the gradient itself is opaque. |
216 // TODO(junov): Compute whether the cone fills the plane crbug.com/222380 | 216 // TODO(junov): Compute whether the cone fills the plane crbug.com/222380 |
217 return false; | 217 return false; |
218 } | 218 } |
219 | 219 |
220 size_t SkTwoPointConicalGradient::contextSize() const { | 220 size_t SkTwoPointConicalGradient::contextSize() const { |
221 return sizeof(TwoPointConicalGradientContext); | 221 return sizeof(TwoPointConicalGradientContext); |
222 } | 222 } |
223 | 223 |
224 SkShader::Context* SkTwoPointConicalGradient::createContext( | 224 SkShader::Context* SkTwoPointConicalGradient::createContext(const ContextRec& re
c, |
225 const SkBitmap& device, const SkPaint& paint, | 225 void* storage) const
{ |
226 const SkMatrix& matrix, void* storage) const { | 226 if (!this->validContext(rec)) { |
227 if (!this->validContext(device, paint, matrix)) { | |
228 return NULL; | 227 return NULL; |
229 } | 228 } |
230 | 229 |
231 return SkNEW_PLACEMENT_ARGS(storage, TwoPointConicalGradientContext, | 230 return SkNEW_PLACEMENT_ARGS(storage, TwoPointConicalGradientContext, (*this,
rec)); |
232 (*this, device, paint, matrix)); | |
233 } | 231 } |
234 | 232 |
235 SkTwoPointConicalGradient::TwoPointConicalGradientContext::TwoPointConicalGradie
ntContext( | 233 SkTwoPointConicalGradient::TwoPointConicalGradientContext::TwoPointConicalGradie
ntContext( |
236 const SkTwoPointConicalGradient& shader, const SkBitmap& device, | 234 const SkTwoPointConicalGradient& shader, const ContextRec& rec) |
237 const SkPaint& paint, const SkMatrix& matrix) | 235 : INHERITED(shader, rec) |
238 : INHERITED(shader, device, paint, matrix) | |
239 { | 236 { |
240 // we don't have a span16 proc | 237 // we don't have a span16 proc |
241 fFlags &= ~kHasSpan16_Flag; | 238 fFlags &= ~kHasSpan16_Flag; |
242 | 239 |
243 // in general, we might discard based on computed-radius, so clear | 240 // in general, we might discard based on computed-radius, so clear |
244 // this flag (todo: sometimes we can detect that we never discard...) | 241 // this flag (todo: sometimes we can detect that we never discard...) |
245 fFlags &= ~kOpaqueAlpha_Flag; | 242 fFlags &= ~kOpaqueAlpha_Flag; |
246 } | 243 } |
247 | 244 |
248 void SkTwoPointConicalGradient::TwoPointConicalGradientContext::shadeSpan( | 245 void SkTwoPointConicalGradient::TwoPointConicalGradientContext::shadeSpan( |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 str->appendScalar(fCenter2.fY); | 418 str->appendScalar(fCenter2.fY); |
422 str->append(") radius2: "); | 419 str->append(") radius2: "); |
423 str->appendScalar(fRadius2); | 420 str->appendScalar(fRadius2); |
424 str->append(" "); | 421 str->append(" "); |
425 | 422 |
426 this->INHERITED::toString(str); | 423 this->INHERITED::toString(str); |
427 | 424 |
428 str->append(")"); | 425 str->append(")"); |
429 } | 426 } |
430 #endif | 427 #endif |
OLD | NEW |